Repository navigation
pool: root's by-id read serves a root-adopted claim's placeholder token, and the claim answers it - #682
Merged
Conversation
…en, and the claim answers it
A root adoption from the archive keeps the claim token's hash and a random
placeholder. The by-id read hid the placeholder and authed refused it, so root's
GET /v1/sandboxes/{id} answered without a token until someone presented the
original. A control plane that keeps no copy of the token, and reads it back
from that route, could then not reach the claim on the agent or port relay.
The placeholder is now a token: root's by-id read serves it, and the claim
answers it as well as the original. The first call with the original still
replaces the placeholder. A claim adopted before this change kept its placeholder
in claims.json, so it is served after the upgrade with no migration. The archive
row still carries only the original token's hash, so the placeholder cannot adopt
the claim on another node, and a drain hand-off still asks as the root.
…te what the minted token is good for authed returns on a token match and refuses before the hash learn, so the switch needs no comment; same answer on every input. The older-node test is renamed and compares with the placeholder: the placeholder is now a token root reads, so it pins that token, not an unknown one. cluster.md: root's /owner adopts a released row with no owner, so a holder that reads the token back no longer loses the claim; sandboxd-api.md: the minted token survives a live move and a resize, adopts on no other node, and each root adoption mints a new one.
…one; tests pin the other-node refusal and drop the pre-v0.1.26 reader The by-id read says a replaced minted token answers 404 like a released claim and that any hand-off mints a new one; two touched lines are rewrapped. cluster.md says a wake hand-off or an evacuation of a root-adopted claim moves it as the root, so a minted-token holder reads the token again. The /owner section says root's by-id read returns the minted token until the claim's own token arrives. The row-rewrite test checks that the placeholder is refused when another node adopts the claim. The older-node test is deleted: it modelled a node without token_sha256 (before v0.1.26, outside the supported mix); the placeholder's shape and its claims.json persistence are pinned by the root-adoption tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When the root adopts an archived claim, it keeps the hash of the claim's token and a random placeholder (e17eee8). The by-id read hides the placeholder, and
authedrefuses it. So root'sGET /v1/sandboxes/{id}returns notokenuntil someone presents the original token.A control plane that keeps no copy of the token reads it back from that route, as
docs/sandboxd-api.mddescribes. Once such a claim moves to another node through a root adoption, nothing the control plane holds works. The agent relay and the port relay refuse every call until the claim is released.Change
Manager.Sandboxno longer blanks the token while the hash is set. Root's and the operator's by-id reads return the placeholder (the minted token), and the operator read is audited as before.authedaccepts the claim's current token first, the minted one included. Otherwise, while the hash is set, it accepts the original token and makes it the claim's token, as before. From then on the minted token is refused.claims.json. It is served after the upgrade with no migration.What a holder of the minted token sees
Authority
No caller gains authority. The minted token goes only to root's and the operator's by-id read; both already act on every claim, and the operator already reads every ordinary claim's token there, audited. A tenant token gets 403 on that read; the listing, checkpoints, usage events and audit records carry no token.
Mixed versions and rollback
Hot path
authedcosts one constant-time compare for an ordinary claim and for a minted-token caller, as before. A claim's own token on a root-adopted claim costs one compare and one SHA-256 once, then it is an ordinary claim.Manager.Sandboxlost a branch.Docs
docs/sandboxd-api.md: the by-id read (what the minted token is, how long it lasts, the 404 and the re-read), the evacuation paragraph, the/ownersection.docs/cluster.md: a wake hand-off and an evacuation of a root-adopted claim mint a new token; a released row no node lists is adopted by root's/ownertoo, so a holder that reads the token back no longer loses the claim.Tests
TestFailoverTheRootAdoptsWithoutTheToken: the placeholder now opens the agent socket.TestFailoverARootAdoptedClaimAnswersOnlyItsOwnTokenis renamed...AnswersItsOwnTokenAndThePlaceholderRootReads:TestFailoverARowRewriteOfARootAdoptedClaimKeepsTheTokenHash: another node refuses to adopt the claim for the placeholder.TestFailoverARootAdoptedClaimReadsAsAnUnknownTokenToAnOlderNodeis deleted. It modelled a node withouttoken_sha256(before v0.1.26); the placeholder's shape and its place inclaims.jsonare pinned by the two tests above.operator.go, the first two tests fail where the placeholder is presented.golangci-lint0 issues in all five modules on linux and darwin,aslclean,go test -race ./...green on darwin and in a linux container.