Repository navigation
feat(issue-tracker): api-mode workers speak as their run — self-location from the seat record (board ticket 35) - #110
Merged
Merged
Conversation
… root A run context now resolves from the seat record $CLAUDE_CODE_SESSION_ID names, and every suite here runs inside a Claude session — so an ambient id would let a fixture verb find the operator's own record. $SMINOS_HOME goes with it, and goes away rather than to a scratch value: it outranks $DAEMON_HOME, which is what the per-invocation prefixes in these suites pin their registries with.
The dispatchers hand a worker its run on a spawn env prefix. `claude --bg` drops it: a backgrounded session's Bash shells are forked from a supervisor, not from the launch, so the bearer, run id and fence never reach the process that needs them. Measured again today (harness v2.1.261): of BOARD_RUN_TOKEN, BOARD_RUN_ID, BOARD_RUN_FENCE, BOARD_API_URL and BOARD_REPO, none survives — while CLAUDE_CODE_SESSION_ID does. That is the key the dispatcher already indexed the run by, so the run context is now resolved rather than handed over: env first, else this session's own seat record (confirmed bind, live bearer, this board), else nothing at all, exactly as before. token(), the claim gate, board-show's degrade and board-transition's fence all read that one resolution, so a worker's writes carry its fence instead of silently going out as the human. The three sites that declare THE TICK IS AUTOMATION, FULL STOP export BOARD_NO_SELF_LOCATE=1 beside their `unset BOARD_RUN_TOKEN`: self-location is a second route into the same hazard, and a tick launched from a worker's own session would otherwise act as that worker.
…record A worker checks out the head it was dispatched for, and a head predating dp#33's `repo` key carries a two-key board.json — so the file cannot name the repo, and the prefix that was meant to pin it is dropped with everything else. board-bind stamped `board_repo` on this session's record; that is the fallback, under the same board-equality guard, between the env override and the fatal. The url is never read from a record: the checkout's board.json names the board. _lib.sh's registry-root rule and its one-shot migrate move ahead of the _binding.sh source, because that fallback is now the process's first registry read — and the env-prefix rule comment says what is true today: the prefix is the declared channel, the seat record is the delivered one.
Spec Revision Notes v1.4 records the measured `claude --bg` drop, the resolution order that replaces the handoff, and what the env prefix now means. The issue-tracker skill gains a paragraph on how a worker's principal is resolved, and both worker bootstraps stop telling a worker its credentials are already in its environment — they never were, on the route every api-mode worker actually takes.
The reconciler's `stranded` arm retires a bound reviewer whose startup barrier never opened and ends its run — but `sminos retire` stops a turn, it does not make the seat forget. The record kept run_id, fence, run_bearer and bind_confirmed for a run that no longer exists, and a session now resolves its own run context out of exactly those fields: resumed by hand, that seat would authenticate with a revoked bearer on every verb instead of falling back to the operator's credentials. _retire_run_locally moves from _sweep_api.sh to _claim_journal.sh, which both dispatchers already source, so the end-of-run strip is one implementation rather than two. The sweep's own call site is unchanged.
BOARD_NO_SELF_LOCATE was checked in run_context() alone, so a tick that had declared itself not-the-run would still take its session's seat record for the repo key when its checkout's board.json predates one. A tick has its own binding to read a repo from, and a neighbouring worker's record is not it. The check moves into own_seat(), which is rule 2 for both facts.
The acceptance dp#35 turns on, and the one claim no stub and no hermetic suite
can carry: the env drop is a property of the real harness. A real ticket on the
real service, a real claim, a real haiku session spawned through the real
sminos CLI into a checkout whose board.json predates the `repo` key — and it
moves its ticket with nothing board-shaped in its environment.
The worker's session gets one setting, {"env": {"SMINOS_HOME": …}}, so its
registry reads land in the drill's scratch root rather than the operator's real
one; in production that root is the default and no redirection exists. It also
measures the open question this design left: a subagent's shell carries the
PARENT's CLAUDE_CODE_SESSION_ID, so a delegated board write self-locates to the
same run.
…not rendering Whether a planted record keeps its compact spelling depends on whether the sminos migrate preflight ran on this machine (it is gated on a legacy root still existing), so the earlier spelling-based assertion passed or failed by host state. Read the fields back through json instead.
…ding BOARD_NO_SELF_LOCATE was exported inside the api branch, well after each script sources _binding.sh — and _binding.sh reads this session's seat record at SOURCE time when the checkout's board.json predates the `repo` key. So the declaration arrived after the one read it was meant to close: a tick launched from a bound worker's session, in such a checkout, would take that worker's board_repo and then claim, sweep and end runs against the wrong repo. The export moves ahead of the source in all three entrypoints; the doctrine block beside each `unset BOARD_RUN_TOKEN` stays and now points at it.
The runner drives a fixed array, so a suite it does not name never runs in CI or in a full local pass. test-run-self-location.sh joins the hermetic list and test-bg-worker-actor.sh the integration one, where the existing exit-77 gate already covers its extra prerequisite.
A root overridden only inside a dispatcher's process never reaches the worker it spawns. That is sminos's standing assumption rather than anything self-location introduces — the spawn preamble already has every worker call `sminos topology`/`post`/`status` from its own shell, resolved by the same rule — so an override must be machine-wide for the fleet to work at all. Recorded on _registry_root() and in the skill's principal-resolution paragraph.
Two holes in own_seat(), both closed in the one place that answers the
question.
SPAWN BEFORE BIND. execute-dispatch.sh spawns a worker and binds it
afterwards, and the executor lane has no startup barrier to hold the worker in
between — so its first board command can land while board-bind.sh has not
written yet. board-bind stamps board, repo, run, bearer and the confirmation in
ONE write, so mid-handover the record names no board at all and resolved as no
run: token('auto') died, and on a repo-less head the binding died fatally. A
record for this session whose bind has not landed is now WAITED for, up to
$BOARD_SEAT_BIND_WAIT (30s, 0.5s poll, once per process); no record at all is
still answered at once.
The budget runs from the RECORD's last write, not the caller's clock. An
operator's own joined seat is byte-indistinguishable from a pre-bind one —
sminos writes no board key for either — so the only thing separating them is
how long ago somebody wrote it, and a record older than the budget is never
waited on.
ONE SERVICE, SEVERAL REPOS. The url names the service, and one instance serves
several repos out of one ticket namespace, so a session bound for a neighbour
repo passed the url guard. When the caller knows its own repo the record's
board_repo must equal it. Compared only where both exist: the repo-less-head
fallback asks this precisely because it has no repo yet, and a bind predating
dp#33 stamped none while still being this session's own.
… the run _spawn_reviewer's post-bind failures — the startup barrier could not be published, or the worker never acknowledged it — retire the worker and hand back a failure, and the caller then ends the run. The bind had already landed, so the record kept a confirmed bind and a live bearer for a run that no longer exists; a session resolves its own run context out of exactly those fields, so resuming that seat by hand would 401 on every verb instead of falling back to the operator's credentials. Same end-and-strip the reconciler's stranded arm performs, through the same _retire_run_locally. The end goes through _claim_end_run rather than _api_end_run's swallow because here the answer is what decides whether the strip is owed. The pre-bind failure paths reach the line too and cost nothing: their record names no run for the strip's guard to match.
The two wait assertions read $SECONDS across a whole python3 invocation, so interpreter start-up straddling a second boundary reported a microsecond scan as a second of waiting — and the pair that had to WAIT re-probed the same planted record, whose budget the first probe had already spent. Both verdicts now come from inside the resolver call, and each probe that expects a wait gets a freshly written record.
The wait keyed on "no confirmation yet", which a record whose run has ENDED also satisfies: _retire_run_locally pops the run, the bearer, the fence and the confirmation and leaves `board` standing. So a finished worker sat out the whole budget before falling back — and the two hermetic cases covering that shape took thirty seconds each. Under an api binding board-bind writes the board key and the confirmation in one write, so the board key IS the clock: absent, the bind has not landed and is worth waiting for; present without a confirmation, the bind has been undone and the fall-back is already the right answer. The suite is back to seven seconds.
… bind That is execute-dispatch's order — spawn, parse the uuid, bind — with no startup barrier on the executor lane, so the worker's first board verb meets a seat record whose bind is still in flight. The drill now proves the wait window end to end, not only the confirmed path.
execute-dispatch spawns and binds afterwards with no startup barrier between, so a dispatcher that dies in the gap leaves the worker live, the claim outstanding, and the record pre-bind forever. After the wait the resolver returned that record, run_context() found no bearer, and the worker's human-defaulted verbs then wrote as the OPERATOR — unfenced, on a ticket its own claimed run still owns. A wrong-principal write cannot be taken back. Both dispatchers now pass `--role` to `sminos spawn`, so the record carries the dispatch role from BIRTH, before any bind — the only thing a pre-bind record says about whose seat it is. A pending record on such a seat now dies with one line instead of falling back, ahead of any socket. An operator's own joined session has no role of ours and keeps the ordinary fall-back. The role literal is the same one the post-bind stamps already write, so the field never changes value and the two writes cannot disagree. _repo_from_own_seat stops swallowing stderr: that refusal is the diagnosis, and the `no repo` fatal after it is only the symptom.
…he operator The `orphaned` arm left a spawned-but-unbound worker live, reasoning that it was 'alive with its bearer in its environment'. That premise is the one this ticket disproved: `claude --bg` drops the spawn prefix, the bind is what would have put a bearer at rest, and so the worker can never speak for its run — every verb it runs goes out as the operator on a ticket its own claimed run still owns. It is now retired and the run released, the `stranded` shape. Two guards ride along. THE WRITER MUST BE DEAD, for the reason that arm already states: this one now retires a session, and a peer between its own spawn and its own bind has exactly this journal — a live writer falls to `inflight` and is left alone. And nothing is sealed any more: a release that fails must leave the journal open, or the only retry handle is gone. The stub spawns parse and persist --role, so a fixture record is dispatched the way a real one is.
…an falls back One clause in the principal-resolution paragraph, for the exception the fall-back rule now carries.
_seat_verdict demanded bind_confirmed, and the sweep's successor path writes the new run, fence and bearer onto the existing record with it set FALSE, binding only after the resumed turn returns. That record already carries `board` from the predecessor's bind, so for the whole successor turn the verdict was `no` and every verb went out as the operator — unfenced, on a ticket the successor run owned. Once a board is named, what makes a record a run is a bearer and a run id ON it: the server minted that bearer for this seat, and the end-of-run strip is what takes both away again, so their absence is the run being over. bind_confirmed keeps its own meaning for the sweep and is no longer consulted here. run_context()'s guard drops it in step. The wait budget goes to 90s, sized to the gap it covers: `sminos spawn` polls the harness for the session uuid before it returns at all (30 iterations at 2s) and the bind is the caller's next step, so a 30s budget expired while the dispatcher was still learning who it had spawned.
Wave 3 read `role` as proof that a dispatcher launched a seat. It is not: `sminos join` takes whatever role a human types and a re-fill preserves it, so a manually operated seat carrying IMPLEMENT was refused every verb it ran — while the sweep's fresh-successor spawn, which passes no role at all, left a real dispatched worker falling back to operator credentials. All three dispatch spawns now stamp `board_dispatch` (the claim nonce) onto the record between the spawn and the bind, which is exactly the window nothing else identifies the seat in, and _is_dispatch_seat reads that field alone. `--role` stays as the honest fleet metadata it always was. The stamp is non-fatal and loud: the bind normally supersedes it, but losing it silently would lose the refusal. The dispatch stubs gain a `meta` verb that records the call AND applies it, so a fixture record is dispatched the way a real one is.
Provenance a caller needs on the record from its FIRST write, not a moment later. The board dispatchers marked a seat with a `meta set` after the spawn, and that call never runs when `sminos spawn` times out polling the session uuid (up to 60s) or the caller dies inside that poll — leaving a live worker with no marker, which the client then reads as an operator's own seat. A marker that can go missing is a marker that fails open. `--stamp field=value` is repeatable, merges into the launch dict both branches write, and refuses a credential field the way `meta set` does — a launch record is written before anything narrows its mode. A re-fill drops `board_dispatch` with the run binding beside it: a seat a dispatcher once launched, re-filled by hand, would otherwise still read as dispatched. meta_set removes AFTER it merges, so the drop skips whatever this launch stamps and a dispatched re-fill keeps its own marker.
All three dispatch sites replace their post-spawn `sminos meta set` with `--stamp board_dispatch=<nonce>` on the spawn itself, so the record carries provenance from its first write and cannot be left unmarked by a uuid poll that timed out or a dispatcher that died inside it. The stubs apply --stamp the way they applied meta set, and their now-dead `meta` arm goes: a stub arm no test exercises hides the next surprise rather than surfacing it.
The orphan arm retired the worker and then ended its run, and both _claim_retire_worker implementations swallowed the CLI's status — so a refused retire read as success and the run was released anyway. The release is what frees the ticket, so that hands it to a successor beside a predecessor still running, which is the divergence the retire exists to prevent. Both implementations now report the CLI's status, the orphan arm gates the release on it, and a refused retire keeps the journal and says so — the same shape as a refused release, and for the same reason: the journal is the only handle a later tick has to retry the pair. The stranded arm keeps its tolerant call; this wave does not change what it ends or why.
SSFSKIM
added a commit
that referenced
this pull request
Oct 21, 2026
SSFSKIM
added a commit
that referenced
this pull request
Oct 21, 2026
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.
Summary
Board ticket 35 (P1). An api-mode worker now speaks as its run principal. Until this change, no real spawned worker ever did:
claude --bgdrops the dispatcher's entire spawn env prefix (BOARD_RUN_TOKEN,BOARD_RUN_ID,BOARD_RUN_FENCE,BOARD_API_URL,BOARD_REPO) before the worker's Bash shells run, so run-context verbs died and human-defaulted verbs fell back to the human token — no fence, no own-ticket scoping, silently the wrong principal.Design:
.doperpowers/direct/run-self-location/brief.md(approved 2026-09-05, direct track).The mechanism: self-location from the seat record
Measured (harness v2.1.261): a background worker's shell sees none of the spawner's variables but does see
CLAUDE_CODE_SESSION_ID. That is the key the dispatcher already indexes the run by —sminos spawnwrites the seat record with the session'sshort/currentuuid, andboard-bind.shstampsrun_id,fence,run_bearer(0600),bind_confirmed,board,board_repoonto it. Everything the prefix was meant to deliver is already on disk under a name the worker can read off its own environment._board_api.run_context()resolves once per process: explicit env prefix first (dispatchers, the sweep, foreground harnesses), else the session's own seat record — only if the bind confirmed, a bearer is present, and the record'sboardequals this checkout's — else today's behaviour._binding.shtakesrepofrom the same record when the checkout'sboard.jsonpredates the key. One stderr line names the run and seat; the bearer never prints. Nothing goes in the prompt or transcript; the worker never learns the mechanism.The dispatchers and the sweep export
BOARD_NO_SELF_LOCATE=1before sourcing the binding, so a tick launched from a worker's own session cannot act as that worker (the tick is automation, full stop). The reconciler's stranded arm now strips the bearer with the run, so a retired session cannot self-locate to a dead bearer.Review
Five codex review rounds (
gpt-5.6-sol), a fix wave after each:BOARD_NO_SELF_LOCATEexport moved before the binding source in all three automation entrypoints, one test per entrypoint); runner registration; a non-default registry root not reaching the worker (dismissed as bounded: that is sminos's own standing assumption, documented in the resolver and the skill).BOARD_SEAT_BIND_WAIT, anchored on the record's own write time so an operator's joined seat never pays it); cross-repo seat on one service (board_repomust match when the caller knows its repo); a failed review handover kept the bearer on the record (stripped on that path too).--roleat spawn so the record is recognisable as dispatched from birth; such a seat fails closed with one line instead of acting as anyone else, and the reconciler'sorphanedarm retires the worker and releases the run rather than leaving it live (with a writer-liveness guard so a peer dispatcher mid-handover is not retired).bind_confirmed=falseand binds only after the turn, so the whole successor turn had fallen back to human credentials. The bearer at rest is now the run (the end-of-run strip removes it; the confirmation flag keeps its sweep meaning). Dispatch provenance became its own field instead of the seat'srole(general sminos metadata). The bind wait rose to cover sminos's full uuid poll window.sminos spawn --stamp field=valuemerges into the launch record's first write, and the three dispatch spawns carryboard_dispatchthat way instead of ameta setafter the spawn (which a uuid-poll timeout or a dying dispatcher could skip). A re-fill drops the marker unless the new launch stamps it. The reconciler'sorphanedarm releases the run only after the retire succeeded. Review loop closed here.Tests
tests/claude-code/board-api/— 15/15 suites PASS, 1037 assertions, including the newtest-run-self-location.sh(39). sminos's own suite 533/533.helpers.shnow unsets ambientCLAUDE_CODE_SESSION_IDand the registry root so a suite can never self-locate to a real record.test-bg-worker-actor.shlaunches a realclaude --bghaiku worker through the real sminos CLI into a checkout whoseboard.jsonhas norepokey, with the env prefix dropped by the harness. The worker moved its own ticket; the board's server-derived actor on that event isrun:<id>, the fence was accepted, and the bearer never appeared in the worker's output. The drill releases the worker BEFORE the bind, the dispatcher's real order, so the worker's first verb meets a bind still in flight and waits it out. Ran on every wave's head, 12/12 each.CLAUDE_CODE_SESSION_ID, so delegated board writes self-locate to the same run.test-edge-verbs.shon the final head reached all 47 assertions with 0 failures but was killed by memory pressure before printing its verdict (its temp-spool probe diffs a ~160k-file/var/folderslisting on this machine); it printed PASS on the previous wave's head, and neither the suite nor the verb it drills is touched by the last wave.Follow-ups
board-claims/,board-suppress/,surface-locks/under the registry root are still machine-global. Its exposure begins with this PR: until now no api-mode worker could act as its run at all.sminos retireon a still-live run deliberately leaves the bearer (retire is a fleet verb; clearing it would take away the sweep's ability to resume the seat). Recorded in the report, not acted on.