Repository navigation
fix: 🐛 Allow sandbox worker to reconnect after stall - #841
Conversation
Signed-off-by: Evaline Ju <[email protected]>
Signed-off-by: Evaline Ju <[email protected]>
clawgenti
left a comment
There was a problem hiding this comment.
Summary
Solid fix for the stalled-reconnect bug: wrapping each attach/serve attempt in its own cancellable context correctly tears the stream down before the re-dial in both the container and microVM workers, and the two new tests demonstrate the relay-side effect (Gone()) empirically rather than just asserting a cancelled context. No blocking findings.
Author: evaline-ju (CONTRIBUTOR — returning external)
Areas reviewed: Go (remote-worker), tests, docs spec
Agent/IDE config (.claude/.vscode): none
Commits: 2 commits, all signed-off: yes
CI status: passing (check, lint, shellcheck, k8s-kind-e2e, CodeQL, Trivy)
Nit (advisory, non-blocking): both commit subjects use an emoji prefix (:bug:, :bulb:) rather than a conventional prefix (fix:, Docs:); the PR title itself is fine. Consider fix:/docs: prefixes on future commits — DCO is the only enforced check.
Verified against the diff: serveOnce/attachOnce return zero duration on attach failure, so backoff reset behavior is unchanged from the previous if err == nil structure; Serve's documented precondition (receiving the stream's own context) is preserved in both workers.
Generated by RepoMan github-pr-review@235a7f7 (https://github.com/rossoctl/agent-skills/blob/235a7f7620139ee3e4ab0872b8439591fe52e8c1/skills/github-pr-review/SKILL.md).
clawgenti
left a comment
There was a problem hiding this comment.
Follow-up to the review above (bot bookkeeping — no new findings): the fix and tests look good as reviewed.
Generated by RepoMan github-pr-review@235a7f7 (https://github.com/rossoctl/agent-skills/blob/235a7f7620139ee3e4ab0872b8439591fe52e8c1/skills/github-pr-review/SKILL.md).
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
LGTM. The per-attempt context in attachOnce / the new serveOnce makes every return from Serve close the stream before the re-dial. That covers ErrEgressWedged and also the other in-loop error returns (accept/leaseControl refusals). Serve still gets the context its stream was created from, as loop.go's precondition requires. rotateWhenIdle's inner stream context derives from the attempt context, so the cancel reaches it, and SIGTERM still flows through the parent ctx. The container-worker test against relaytest checks the server-side stream really ends, which is the property that matters.
Assisted-By: Claude Code
Takes upstream main at 1a7f41e (19 merges since 032c8f6): the sandbox idle lifetime across docs, control plane, clients and deploy (rossoctl#820, rossoctl#837, rossoctl#842, rossoctl#843), grant redemption (rossoctl#822), the lease-check log line (rossoctl#824), egress fixes (rossoctl#829, rossoctl#834), the mock wait (rossoctl#828), the deadline timer (rossoctl#835), the create rollback (rossoctl#832), multi refusals and the rossoctl#363 leftovers (rossoctl#833, rossoctl#838), the identity near-miss check (rossoctl#827), mocactl login errors (rossoctl#836), the ghostunnel probes (rossoctl#830), refusal-burst deferral (rossoctl#831), a sandbox-worker change (rossoctl#841) and the v0.11 doc truth (rossoctl#821). Conflicts (one): - deploy/sbx/README.md, the "Optional inputs" table. Upstream (rossoctl#843) rewrote the SBX_LIFETIME_DAYS row (the default idle lifetime, at most SBX_MAX_LIFETIME_DAYS) and added the SBX_MAX_LIFETIME_DAYS and SBX_LOWER_WORKSPACE_IDLE rows, which widened the table; the fork had added an SBX_GATE_RECORD_SCHEMA row at its end. Resolved by taking upstream's table whole and appending the fork's SBX_GATE_RECORD_SCHEMA row after SBX_PROFILE, then re-padding the table with prettier. The fork's env-file example line for SBX_GATE_RECORD_SCHEMA merged cleanly. Merged without markers, checked: setup.sh keeps the fork's SBX_GATE_RECORD_SCHEMA validation and its sbx-settings write (so it stays in the settings hash) beside upstream's SH_SANDBOX_MAX_LIFETIME_SECONDS; both ocp-sbx and ocp-combined patch-control-plane.yaml keep the optional SH_GATE_RECORD_SCHEMA from sbx-settings beside the new optional SH_SANDBOX_MAX_LIFETIME_SECONDS; setup.test.sh keeps the fork's cases beside upstream's. The fork's RUNBOOK, README and template-onboarding docs say nothing about sandbox lifetime, refusal bursts, login errors or the create rollback, so none needed a correction; GUIDE.md is unchanged and GUIDE.pdf is not regenerated. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Rong Chang <[email protected]>
Summary
After a stalled connection, a sandbox worker reconnected but left its old stream open. The relay refused the reconnect as a duplicate, and the sandbox stopped running commands until the worker restarted.
Each connection attempt now closes its stream before the worker reconnects, in both the container and microVM workers.
Closes: #839
Assisted-By: Claude (Anthropic AI)
Checklist
git commit -s).make lintand the tests for the touched packages pass.docs/page, with the right maturity label (seedocs/CONTRIBUTING-DOCS.md).make check-linkspasses if any Markdown changed.docs/specs/README.mdordocs/adrs/README.md. - N/A