Skip to content

Drain deployments saved before sandbox specifications - #114

Merged
SaladDay merged 2 commits into
mainfrom
codex/legacy-deployment-drain
Sep 25, 2026
Merged

SaladDay merged 2 commits into
mainfrom
codex/legacy-deployment-drain

Conversation

@SaladDay

@SaladDay SaladDay commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Drain sandbox deployments that were saved before deployment specifications existed (#95), so they can be upgraded through the supported path.

Problem

Migration 000069 leaves a Web-selected Docker or microsandbox deployment with specification = '{}' and its nodes with an empty digest and generation 0. Current Core then:

  • cannot load the provider, so it can't observe or clean up the retained sandboxes;
  • rejects the retained nodes' authentication.

The existing PUT replacement requires zero retained resources, and the old release has no administrator archive. As a result, such a deployment can neither be drained nor upgraded.

Change

  • An unspecified node-backed, Web-managed deployment loads for draining only.
  • Retained nodes that never recorded a specification digest or generation reconnect. Nodes with a recorded digest or generation don't get this path.
  • These are refused in this state (fail closed): fresh hosted sandboxes (same error as maintenance), enrollment tokens, node configuration reads and enrollment.
  • The ordinary maintenance → administrative archive → PUT sequence then records a specification and retires those nodes.
  • E2B deployments from that period are out of scope.
  • Operator notes are in docs/getting-started/operations.md; the contract is in contracts/agents-api/sandbox-deployment.md.

Validation

  • Directed store test TestUnspecifiedNodeDeploymentDrainsBeforeReplacement. It fails without the fix and passes with it.
  • Full make check (server mode) passed on 0654e977, including the PostgreSQL suite, 610 client tests and 329 Web unit tests. Playwright browser cases were skipped on the server (Chrome unavailable; user-approved skip). No Web code changed.
  • Independent blind review by a fresh Claude subagent: no P0–P2 findings. Three P3s were applied in 0654e977 and verified by focused tests and the gate, not by a second review:
    • refuse enrollment tokens in the unspecified state;
    • restrict the rule to Web-managed deployments;
    • doc wording.
  • Two P3s were recorded as nonblocking:
    • pending-placement retry log noise while maintenance is off;
    • the configuration read checks the specification before the credential. This is pre-existing.
  • An isolated a7ebbe7 replica (mx1/mx2, real Docker nodes, real Kimi sessions) is prepared and backed up for the end-to-end drain rehearsal. The live demo cluster is untouched.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.

A Web-selected Docker or microsandbox deployment saved before #95 keeps the
empty specification default after migration. Current Core could neither load
its provider nor authenticate its retained nodes, so its sandboxes could not be
archived or cleaned up, and the specification could never be replaced.

Load such a deployment for draining only: retained nodes that never recorded a
specification digest or generation reconnect, fresh hosted sandboxes are
refused, and node configuration and enrollment stay closed. The existing
maintenance, archive and PUT sequence then records a specification and retires
those nodes. E2B deployments from that period remain out of scope.
Address blind-review follow-ups: an unspecified deployment cannot issue a node
enrollment token that would always fail, the drain rule applies only to
Web-managed selections, and the contract notes that GET omits the missing
specification.
@SaladDay
SaladDay merged commit f4ad34f into main Sep 25, 2026
3 checks passed
SaladDay added a commit that referenced this pull request Sep 25, 2026
* Move node transport to /api/v1 and stop forwarding machine traffic through Web

Sandbox node enrollment, configuration, identity and the node WebSocket move
from /core/v1/sandbox/{enroll,node/*} to /api/v1/sandbox-node/*, beside the
existing /api/v1/agent-daemon routes. Authentication is unchanged: an
enrollment token or the node credential. The old paths are removed.

The console no longer forwards node or daemon transport and returns 404 for
/v1 and /api/v1 whatever the credential; the TLS reverse proxy sends both
directly to Core. make openapi now writes /api/v1 routes to
contracts/agents-api/runtime.openapi.yaml; the public openapi.yaml is
unchanged. Docs describe the routing table and that older nodes cannot
connect to this Core, so upgrades follow the drain and re-enrollment workflow.

* Document the proxy upgrade step and name failures on the machine routes

Address the blind review of the /api/v1 node transport move:

- The upgrade steps now say to route /api/v1/*, including WebSocket upgrades,
  directly to Core when the release goes live; the old routing breaks every
  Runtime daemon connection, not only node enrollment.
- The pre-specification drain needs a Core built from a commit with #114 that
  still serves the old node paths (for example 7b66be2); drain there, then
  upgrade. Re-enrollment stops the old node service and moves its identity
  directory aside first.
- CONTRIBUTING notes the executor-credential routes that still go to Core.
- The node installer reports 404 as a routing problem, 409 as maintenance or a
  deployment conflict and keeps the proxy hint for connection errors; the
  self-hosted connection check reports 404 as a routing problem.
- openapi-split keeps only the security schemes each non-public document uses;
  the public openapi.yaml is unchanged.
- Console tests cover encoded and doubled separators toward /api/v1.
@SaladDay
SaladDay deleted the codex/legacy-deployment-drain branch October 7, 2026 06:38
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