Skip to content

Fix switch.hosted.boxes_by_image always reading unknown - #2531

Merged
amaudruz merged 2 commits into
mainfrom
fix/hosted-boxes-image-tag
Dec 4, 2026
Merged

amaudruz merged 2 commits into
mainfrom
fix/hosted-boxes-image-tag

Conversation

@amaudruz

@amaudruz amaudruz commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

Why

On dev, switch.hosted.boxes_by_image puts every owned box under unknown, including boxes that are running, so it can't show a box image rollout moving boxes. There are two causes in the box operator:

  1. Wrong container name (the main bug): box_image only looks for a container named box. Split-template boxes run controller and agents, so it never finds an image, and Core never gets one. start_steps has the same check, so split boxes also lose their initialized_to_started timing.
  2. Sleeping boxes: the image was read only from a live pod, so a sleeping box sent none.

What

  • box_image, template_image and the start-step timing now look for the agents container first, then box for boxes still on the older single-container template. controller runs the same image as agents.
  • When a box has no live pod, the scaler reports the image from the StatefulSet's pod template instead. The update pass patches that template while the box sleeps, so it's the image the box wakes on. A live pod's image still wins. It's read from the StatefulSet scale() already fetches each pass (KubeApi.last_template_image), so there's no new Kubernetes call and no RBAC change, and the committed contract run is unchanged.
  • Core: only the comment on Observation.image and the switch.hosted.boxes_by_image catalogue description change.

Tests

  • Controller: new tests for the split box (image from agents, start step timed from agents), the template image, a sleeping box reporting its template image, a live pod winning over the template, and KubeApi keeping the image scale read. Full controller suite passes (1648 passed).
  • Core: tests/switch_core/observability passes.

Rollout

Takes effect once a new switch-box-workers image with this change is promoted to an environment. Dev's operator runs box-workers@sha256:9bd90528…, which predates this.

🤖 Generated with Claude Code

The box scaler reported a box's image only from its live pod, so a
sleeping box sent none and stayed `unknown` in the gauge. With every owned
box asleep, the gauge couldn't show the update pass moving them.

When there is no live pod, the scaler now reports the box container's
image from the StatefulSet's pod template, which the update pass patches
while the box sleeps: the image it wakes on. It is read from the
StatefulSet `scale` already fetches each pass, so no new Kubernetes call
and no RBAC change. A live pod's image still wins.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Split-template boxes run `controller` and `agents`, with no container named
`box`, so `box_image` never found an image and every box was `unknown` in
switch.hosted.boxes_by_image, awake or asleep. The start-step timing had the
same check and lost its `initialized_to_started` step on those boxes.

Both now look for `agents` first, then `box` for boxes still on the older
single-container template.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@amaudruz amaudruz changed the title Count sleeping boxes in switch.hosted.boxes_by_image Fix switch.hosted.boxes_by_image always reading unknown Dec 4, 2026
@amaudruz
amaudruz merged commit e9965c1 into main Dec 4, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant