Skip to content

fix/no-ticket(bin): keep ship and scout relaunches on their recorded worker account - #5498

Open
max-metaplanet wants to merge 12 commits into
kunchenguid:mainfrom
max-metaplanet:fm/up-relaunch-pin-issue
Open

max-metaplanet wants to merge 12 commits into
kunchenguid:mainfrom
max-metaplanet:fm/up-relaunch-pin-issue

Conversation

@max-metaplanet

@max-metaplanet max-metaplanet commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Intent

Fix the three review gaps the upstream maintainer raised on #5498 (relaunch refuses or keeps the recorded worker account when the account pin changed), with a test that relaunches twice, and re-raise the existing PR through the no-mistakes pipeline as one push. Never merge upstream.
The maintainer's review (head 998f9c7, contract-class new-default) names three gaps in the guarantee the PR adds:

  1. Protection is dropped after an unpinned same-account relaunch (bin/fm-worker-account-lib.sh around line 271): the task records account=A, the pin is removed while the ambient account is still A, so the guard passes, but fm_worker_account_select returns nothing and the rewritten record loses account=; a pin for B added later then skips the guard and moves the task. Carry the recorded account forward on that path, and add a test that relaunches twice.
  2. Pi checks the caller's account, not the pane's (around line 262): with config/pi-account absent the guard reads the caller's PI_CODING_AGENT_DIR, but an unpinned Pi replacement inherits the destination pane's environment. Check the account that will actually launch.
  3. The guard and the launch read the pin separately (bin/fm-spawn.sh around line 3150): the guard resolves the pin, then fm_worker_account_select reads it again. Have the guard check the same resolved selection the launch uses.

What Changed

  • Added fm_worker_account_relaunch_guard to bin/fm-worker-account-lib.sh. When a ship or scout recorded an account= at launch, it refuses the relaunch if the current Claude or Pi pin, or its removal, now selects a different account directory. Paths are compared physically. The refusal names the recorded account, the account now selected, and both ways forward. Secondmates, tasks with no recorded account, and relaunches onto a harness that reads the other pin file go through unchanged.
  • fm_worker_account_select now takes the relaunch id plus the recorded harness, account and provider, and runs the guard on the same resolved selection it launches with. With no pin, it carries the recorded account forward after existence and sign-in checks, using the recorded account_provider when the Pi model doesn't name one. That way a second relaunch is still guarded. An unpinned Pi replacement now launches on its recorded root rather than the caller's or destination pane's PI_CODING_AGENT_DIR. bin/fm-control.sh (before the old agent stops) and bin/fm-spawn.sh --relaunch both pass the task record into this single selection.
  • Updated docs/configuration.md, docs/agent-control.md, the operational-home-layout skill and the script headers to describe the new relaunch rule. Added relaunch tests: pin moved, pin removed, never pinned, two relaunches after unpinning, a missing recorded root refused before stop, a Pi pane-environment case, and spawn using the same selection it checks. Also added guard unit tests in tests/fm-worker-account.test.sh.

🤖 Generated with Claude Code

Risk Assessment

✅ Low: The change makes the three narrow fixes the maintainer asked for. (1) An unpinned relaunch on the same account now carries the recorded account forward, and the carried account gets the existence and sign-in checks the user approved. (2) An unpinned Pi relaunch now names the recorded root explicitly, so neither the caller's environment nor the destination pane's can change the account. (3) The guard now runs inside fm_worker_account_select on the exact pin value the launch then uses. I traced the Claude, Pi, pi-signed, ordinary, secondmate and harness-switch paths through fm-control (before the old agent stops) and fm-spawn --relaunch and found no wrong result. New tests cover each path end to end, including the two-relaunch case and a pin rewritten right after it is read. The merge commits from upstream follow the recorded rebase decisions.

Testing

Checked that the published commit 998f9c7 is an ancestor of the candidate. Ran the worker-account suite (all passed) and the 11 relaunch account tests on HEAD (all passed). The full relaunch suite stops early at a concurrency race test that fails identically on the base commit, so it is an existing environment issue, not this change. Then I stood up a disposable lab home with a real signed-in claude agent on a private tmux socket and drove real fm-control/fm-spawn relaunches. An unpinned same-account relaunch kept account= and launched the replacement with CLAUDE_CONFIG_DIR set to the recorded account root. A later pin to a different account refused before stop with the agent PID and record unchanged. A no-pin relaunch under a different ambient account refused with the reworded message. A pin moved immediately after the launch owner's single read still launched on the guarded account. Pi could not run live because no pi binary is installed; its hermetic stubbed test passed. The lab was torn down. The result is go.

  • Live validation: ✅ go - 4 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Published ancestry: 998f9c7 is an ancestor of the candidate head ⏸️ untested no The prior payload recorded only a repository history check (git merge-base), which is not a live product run. It did not establish a live result, and this scenario has no runtime surface to drive.
Gap 1: relaunch with the pin removed while the ambient Claude account still matches; the replacement keeps the recorded account= and launches with CLAUDE_CONFIG_DIR set to it ✅ pass live live-r1-unpinned-same-account.txt; replacement claude /proc environ showed CLAUDE_CONFIG_DIR set to the recorded root
Gap 1 relaunched twice: after the unpinned relaunch, pinning a different account refuses the second relaunch before the agent stops and leaves the record unchanged ✅ pass live live-r2-pin-moved-refuses.txt (exit=1, same agent pid before and after, record byte-identical); also test_worker_account_survives_two_relaunches_after_unpinning
Adversarial: no pin and firstmate running on a different ambient Claude account; the relaunch refuses with the reworded no-pin message naming both accounts ✅ pass live live-r3-unpinned-ambient-differs-refuses.txt
Gap 3: the pin is rewritten immediately after fm-spawn reads it; the launch uses the single guarded selection and the record keeps the guarded account ✅ pass live live-r4-pin-rewritten-after-resolution.txt (2 pin reads total: fm-control pre-stop and fm-spawn once; pin file now acct-b; record and replacement env on the recorded root)
Gap 2: an unpinned Pi or pi-signed relaunch launches on the recorded root regardless of the caller's or destination pane's PI_CODING_AGENT_DIR ⏸️ untested no No pi binary is on PATH and there is no repository-local copy, so a real Pi replacement could not be launched. Only the hermetic suite with a stub executable ran (test_unpinned_pi_relaunch_keeps_the…
Unpinned relaunch whose recorded root is missing or signed out refuses before stop ⏸️ untested no The prior payload established only a hermetic test result (test_unpinned_relaunch_refuses_a_missing_recorded_root_before_stop passed), not a live result. Driving it live would need a retired or signed…
Evidence: Live relaunch 1: unpinned same-account relaunch carries account= forward

Source: Live relaunch 1: unpinned same-account relaunch carries account= forward

fm-gate-refuse: gate agent lifecycle permitted only against lab home /tmp/fm-lab.l8jnl5
fm-gate-refuse: gate agent lifecycle permitted only against lab home /tmp/fm-lab.l8jnl5
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  1 task(s) in flight, but no watcher has a fresh beacon (last beat: never, grace 300s).
●  Trust the emitted supervision protocol for this harness; do not use shell & for watcher repair.
●  This is a supervision warning only; the guarded operation WILL still run.
●  watcher supervision needs Stop-owned automatic recovery; inspect the hook registration and startup status before ending the turn.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
warning: /tmp/fm-lab.l8jnl5/data/acct1/launch-brief.md records no ship branch; defaulting to legacy branch fm/acct1
warning: /tmp/fm-lab.l8jnl5/data/acct1/launch-brief.md records no delivery contract line (scaffolded before ship briefs recorded one); launching on the explicit --mode no-mistakes - confirm its definition of done matches
relaunched acct1 harness=claude from=claude model=default effort=default backend=tmux endpoint=fmses:fm-acct1 worktree=/tmp/fm-lab.l8jnl5/wt
exit=0
window=fmses:fm-acct1
endpoint_task_id=acct1
worktree=/tmp/fm-lab.l8jnl5/wt
project=/tmp/fm-lab.l8jnl5/proj
harness=claude
approval_mode=bypass
kind=ship
mode=no-mistakes
yolo=off
branch=fm/acct1
tasktmp=/tmp/fm-acct1
model=default
effort=default
account=~/.claude-seats/seat-max
busy_gen=g1793293446.1217337.4509
spawn_gen=s1793293448.1214905.9551
control_relaunch_tx=1209493.20261029T170358Z.7544
Evidence: Live relaunch 2: later pin to a different account refuses before stop

Source: Live relaunch 2: later pin to a different account refuses before stop

error: task acct1 was launched on account <seat>, but config/claude-account now selects account <lab>/acct-b; relaunching would move the task ... exit=1 agent pid before=1220467 after=1220467 task record unchanged

# config/claude-account -> /tmp/fm-lab.l8jnl5/acct-b
fm-gate-refuse: gate agent lifecycle permitted only against lab home /tmp/fm-lab.l8jnl5
error: task acct1 was launched on account ~/.claude-seats/seat-max, but config/claude-account now selects account /tmp/fm-lab.l8jnl5/acct-b; relaunching would move the task to a different account directory, and the replacement would start without the outgoing worker's session state, which stays under the recorded account. Set config/claude-account back to '~/.claude-seats/seat-max' to relaunch this task, or leave it and start a fresh task on the new account
exit=1
agent pid before=1220467 after=1220467
task record unchanged (account=~/.claude-seats/seat-max)
Evidence: Live: no pin with a different ambient account refuses with the reworded message

Source: Live: no pin with a different ambient account refuses with the reworded message

# config/claude-account removed; firstmate ambient CLAUDE_CONFIG_DIR=/tmp/fm-lab.l8jnl5/acct-b
fm-gate-refuse: gate agent lifecycle permitted only against lab home /tmp/fm-lab.l8jnl5
error: task acct1 was launched on account ~/.claude-seats/seat-max, but config/claude-account is now absent, so no pin selects an account, and the recorded account differs from the account firstmate is currently running with, account /tmp/fm-lab.l8jnl5/acct-b; the relaunch is refused because no pin selects an account and firstmate is running with a different account than the task recorded. Set config/claude-account to '~/.claude-seats/seat-max' or run firstmate with that account to relaunch this task, or start a fresh task on the current account
exit=1
agent pid before=1220467 after=1220467
task record unchanged
Evidence: Live: pin rewritten after the single read still launches on the guarded selection

Source: Live: pin rewritten after the single read still launches on the guarded selection

# config/claude-account -> recorded account; shim moves it to /tmp/fm-lab.l8jnl5/acct-b right after the launch owner's read
fm-gate-refuse: gate agent lifecycle permitted only against lab home /tmp/fm-lab.l8jnl5
fm-gate-refuse: gate agent lifecycle permitted only against lab home /tmp/fm-lab.l8jnl5
WARNING: watcher still down (same stale episode; last beat: never, grace 300s) - full banner already printed this episode.
warning: /tmp/fm-lab.l8jnl5/data/acct1/launch-brief.md records no ship branch; defaulting to legacy branch fm/acct1
warning: /tmp/fm-lab.l8jnl5/data/acct1/launch-brief.md records no delivery contract line (scaffolded before ship briefs recorded one); launching on the explicit --mode no-mistakes - confirm its definition of done matches
relaunched acct1 harness=claude from=claude model=default effort=default backend=tmux endpoint=fmses:fm-acct1 worktree=/tmp/fm-lab.l8jnl5/wt
exit=0
--- pin reads:
read by bash ~/.no-mistakes/worktrees/8bd563a85c16/01M647JHD6VEERHQ8M5GX70
read by bash ~/.no-mistakes/worktrees/8bd563a85c16/01M647JHD6VEERHQ8M5GX70
--- pin file now: /tmp/fm-lab.l8jnl5/acct-b
--- record account: account=~/.claude-seats/seat-max
--- replacement agent pid=1251548 env:
CLAUDE_CONFIG_DIR=~/.claude-seats/seat-max
Evidence: Replacement claude pane after relaunch 4

Source: Replacement claude pane after relaunch 4

✽ Unfurling…
                                                                                                     tmux detected · scroll with PgUp/PgDn · or add 'set -g mouse on' to ~/.tmux.conf for wheel scroll
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ 
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  -- INSERT -- ⏵⏵ bypass permissions on (shift+tab to cycle)
Evidence: Relaunch account subset on HEAD (11/11 ok)

Source: Relaunch account subset on HEAD (11/11 ok)

ok - fm-control relaunch: a signed-out worker account pin refuses before the old agent stops
ok - fm-control relaunch: a pin that has moved off the task's recorded account refuses and changes nothing
ok - fm-control relaunch: a pin still on the task's recorded account relaunches it
ok - fm-control relaunch: a removed pin that would move the task off its recorded account refuses and changes nothing
ok - fm-control relaunch: a home that never pinned the runner relaunches unchanged
ok - two relaunches: an unpinned same-account replacement preserves protection against a later pin change
ok - fm-control relaunch: an unpinned relaunch refuses a missing or signed-out recorded account before stop
ok - unpinned Pi replacements explicitly keep their recorded account across different caller and pane environments
ok - fm-spawn relaunch guards and launches the same pin snapshot even if the file changes after the read
ok - fm-control relaunch: mate pins are re-read for Claude and Pi, and unusable pins refuse before stopping the agent
ok - fm-control relaunch: a same-harness relaunch replaces the agent in the same endpoint and worktree
exit=0
Evidence: Worker-account suite

Source: Worker-account suite

ok - Claude, Pi, and pi-signed secondmates use their own pins without changing other launches
warning: re-init: ignored --initial-branch=main
warning: re-init: ignored --initial-branch=main
warning: re-init: ignored --initial-branch=main
warning: re-init: ignored --initial-branch=main
warning: re-init: ignored --initial-branch=main
warning: re-init: ignored --initial-branch=main
warning: re-init: ignored --initial-branch=main
warning: re-init: ignored --initial-branch=main
warning: re-init: ignored --initial-branch=main
warning: re-init: ignored --initial-branch=main
ok - unusable per-mate pins name the setting and refuse rather than use the primary's usable account
ok - a remote route refuses a primary-side account override instead of silently ignoring it
ok - an absent pin leaves Claude and Pi launches exactly as they were
ok - a Claude pin selects its root and sheds the credentials that would outrank it
ok - a Claude pin refuses a signed-out root even when the invoking process has a usable login and API key
ok - an ordinary Claude pin selects the default login and drops an ambient root
ok - malformed, relative, CR-terminated, empty, extra-line, missing-root, and non-file pins refuse before launch
ok - a Pi pin selects its root and passes the declared provider
ok - a Pi pin refuses unqualified, missing, undeclared, signed-out, and raw launches
ok - extension providers and a Pi without auth check fall back to an exact model-listing match
ok - a Claude pin leaves codex and Pi launches unchanged
ok - a raw Claude launch command receives the home's pin
ok - a pinned home refuses a raw Claude command that overrides the account
ok - an unpinned home keeps a raw Claude account override
ok - a local secondmate reads the launching home's pin and its own home's file is never inherited over
ok - the relaunch guard refuses only an ordinary task's pin, present or removed, that has moved off its recorded account
# all fm-worker-account tests passed
exit=0
Evidence: Race test also fails on base c9da552

Source: Race test also fails on base c9da5523

not ok - relaunch did not reach trace delivery
exit=1
  • Evidence: Lab setup and relaunch driver scripts (local file: ~/.no-mistakes/evidence/01M647JHD6VEERHQ8M5GX70900/scripts)
  • Outcome: ⚠️ 1 info across 1 run (42m22s)

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

🔧 **Rebase** - 7 issues found → auto-fixed ✅
  • ⚠️ bin/fm-control.sh - merge conflict rebasing onto origin/main
  • ⚠️ bin/fm-spawn.sh - merge conflict rebasing onto origin/main
  • ⚠️ bin/fm-worker-account-lib.sh - merge conflict rebasing onto origin/main
  • ⚠️ docs/agent-control.md - merge conflict rebasing onto origin/main
  • ⚠️ docs/configuration.md - merge conflict rebasing onto origin/main
  • ⚠️ tests/fm-control-relaunch.test.sh - merge conflict rebasing onto origin/main
  • ⚠️ tests/fm-worker-account.test.sh - merge conflict rebasing onto origin/main

🔧 Fix applied.
✅ Re-checked - no issues remain.

✅ **Review** - passed

✅ No issues found.

⚠️ **Test** - 1 info
  • ℹ️ tests/fm-control-relaunch.test.sh:493 - test_relaunch_serializes_concurrent_durable_metadata_publication fails with 'relaunch did not reach trace delivery' on this host, so the full relaunch suite stops after 3 tests. It fails the same way on base c9da552 (race-test.base.log), so this change did not cause it. The host load average was around 40, and that test waits only 5s, which is a likely cause. CI owns the full-suite result.
  • Live validation: ✅ go - 4 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Published ancestry: 998f9c7 is an ancestor of the candidate head ⏸️ untested no The prior payload recorded only a repository history check (git merge-base), which is not a live product run. It did not establish a live result, and this scenario has no runtime surface to drive.
Gap 1: relaunch with the pin removed while the ambient Claude account still matches; the replacement keeps the recorded account= and launches with CLAUDE_CONFIG_DIR set to it ✅ pass live live-r1-unpinned-same-account.txt; replacement claude /proc environ showed CLAUDE_CONFIG_DIR set to the recorded root
Gap 1 relaunched twice: after the unpinned relaunch, pinning a different account refuses the second relaunch before the agent stops and leaves the record unchanged ✅ pass live live-r2-pin-moved-refuses.txt (exit=1, same agent pid before and after, record byte-identical); also test_worker_account_survives_two_relaunches_after_unpinning
Adversarial: no pin and firstmate running on a different ambient Claude account; the relaunch refuses with the reworded no-pin message naming both accounts ✅ pass live live-r3-unpinned-ambient-differs-refuses.txt
Gap 3: the pin is rewritten immediately after fm-spawn reads it; the launch uses the single guarded selection and the record keeps the guarded account ✅ pass live live-r4-pin-rewritten-after-resolution.txt (2 pin reads total: fm-control pre-stop and fm-spawn once; pin file now acct-b; record and replacement env on the recorded root)
Gap 2: an unpinned Pi or pi-signed relaunch launches on the recorded root regardless of the caller's or destination pane's PI_CODING_AGENT_DIR ⏸️ untested no No pi binary is on PATH and there is no repository-local copy, so a real Pi replacement could not be launched. Only the hermetic suite with a stub executable ran (test_unpinned_pi_relaunch_keeps_the…
Unpinned relaunch whose recorded root is missing or signed out refuses before stop ⏸️ untested no The prior payload established only a hermetic test result (test_unpinned_relaunch_refuses_a_missing_recorded_root_before_stop passed), not a live result. Driving it live would need a retired or signed…
  • git merge-base --is-ancestor 998f9c7d55a221175f1bf4f76043548719717838 HEAD (ANCESTOR_OK)
  • bash tests/fm-worker-account.test.sh (all passed, exit 0)
  • bash tests/fm-control-relaunch.test.sh (stopped at test_relaunch_serializes_concurrent_durable_metadata_publication; run twice)
  • Same race test alone on a clone of base c9da5523 (fails the same way)
  • Targeted relaunch account subset on HEAD: test_signed_out_worker_account_pin_refuses_before_stop, test_worker_account_pin_moved_since_the_launch_refuses, test_worker_account_pin_on_the_recorded_account_relaunches, test_worker_account_pin_removed_refuses, test_worker_account_never_pinned_relaunches_unchanged, test_worker_account_survives_two_relaunches_after_unpinning, test_unpinned_relaunch_refuses_a_missing_recorded_root_before_stop, test_unpinned_pi_relaunch_keeps_the_recorded_root_in_a_different_pane_environment, test_spawn_relaunch_checks_the_same_pin_selection_it_launches, test_secondmate_account_pin_follows_relaunch_and_refuses_before_stop, test_same_harness_relaunch_keeps_identity_and_reuses_the_endpoint (11/11 ok)
  • Live lab (bin/fm-lab-home.sh home, tmux -L fm-lab, real claude): bin/fm-control.sh acct1 relaunch unpinned with the same ambient account, then with config/claude-account set to a different root
  • Live lab: relaunch with no pin and a different ambient CLAUDE_CONFIG_DIR
  • Live lab: relaunch with a PATH perl shim that rewrites config/claude-account right after the launch owner's read; checked the pin read count, record, and the replacement process's /proc environ
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

A home's worker account pin selects the directory a Claude or Pi worker's
whole session lives in. It was resolved at spawn and recorded on the task
as account=, then resolved again at relaunch from the home's current file,
with no notion of the account the task already ran on. A pin changed
between spawn and relaunch - for any reason, including one unrelated to
that task - silently moved the task to the new account and rewrote its
record, leaving the outgoing worker's session state unreachable under the
previous root.

A task now stays on the account it was launched on. One shared check,
fm_worker_account_relaunch_guard, refuses a relaunch whose current pin
selects a different account directory, naming the recorded account, the
account the pin now selects, and both ways forward. It serves both
relaunch paths and every pinnable runner, and runs before the sign-in
check so the move is reported as itself. The same account, no recorded
account, a relaunch onto a harness reading the other pin file, and a home
with no pin all relaunch as before; the same directory named another way
is compared physically, not textually.

This changes documented default behaviour: docs/configuration.md and the
test that pinned the follow-the-current-file relaunch are updated.

Closes kunchenguid#5479
Resolve the branch against upstream main, which has since landed
per-secondmate account pins (kunchenguid#7452): fm_worker_account_resolve now takes
a setting label and fm_worker_account_select takes a secondmate id, and
the AGENTS.md home layout listing moved into the operational-home-layout
skill.

Scope the relaunch account guard to ships and scouts. A secondmate
replacement reconciles its own home's durable records at startup rather
than continuing the outgoing agent's conversation, so there is no session
state for an account move to orphan, and re-reading the pin stays how a
per-secondmate account change is applied.
@max-metaplanet max-metaplanet changed the title fix(bin): refuse a relaunch when the worker account pin has moved off the task's recorded account fix(bin): keep a relaunch on the task's recorded worker account Oct 26, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @max-metaplanet, and sorry it took this long to get a proper look. Merging main back in today and re-raising through no-mistakes was really helpful.

What I checked at head 998f9c7d against main 003b695b: fm_worker_account_relaunch_guard runs before account selection in both resolve_relaunch_profile and fm-spawn.sh --relaunch, so a refusal happens before the old agent stops. It only acts when the task recorded an account=, which only a pinned spawn writes. Unpinned homes and unpinned tasks behave exactly as on main. Roots are compared physically. A removed pin falls back to the ambient or ordinary account, and the refusal names both accounts and both ways forward. The docs that described the old live-pin relaunch are updated. tests/fm-worker-account.test.sh passes locally at this head. tests/fm-control-relaunch.test.sh passes every case except a Herdr Pi relaunch case that needs pi on PATH. That case fails the same way on main on my host, so it's my environment, not your change.

Contract-class: new-default. Today, homes that pin config/claude-account / config/pi-account get a relaunch that follows the current pin file. This PR changes that, so those homes now get a refusal without opting into anything new. That matches how #5479 was triaged, and you said so plainly in the body, which I appreciate. It's a fail-closed change I'd expect the captain to like, but it's still the captain's call.

VISION:

  • One captain aligns: no silent account move, and the refusal is plain.
  • Authority aligns: the PR refuses instead of assuming consent to move spend.
  • Scripts aligns.
  • Restart aligns: session state stays reachable.
  • Spine aligns: live go 6/7. The Pi pin was untested live, but it goes through the same guard.
  • Vendor aligns.
  • Scope aligns.

One product point for the captain: secondmates are exempt and still re-read the pin (no-mistakes raised this too). Your reasoning is documented, and I'll include it when I present this.

CI: this head's run (20:18Z) ran on the old ubuntu-26.04 image before main's runner pin. Serials 1, 3–7 and 9 failed and serials 2 and 8 were cancelled, all in the same watcher, timeout and remote-lifecycle tests main fails on 26.04. None of them are in the files you touched. Main's own CI is still red on our side, so this is waiting on our CI, not on you. Once main is green and this head has a green run, I'll put it to the captain as a merge-or-leave decision.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: a short update, @max-metaplanet. Nothing here needs anything from you.

Main's CI is green again (green at 46df1608; tip is now 7da4c362). This head (998f9c7d) still has only its 20:18Z run, which ran on the old ubuntu-26.04 image before main's runner fix, so those reds are main's and not yours. Getting a fresh run on the fixed runners is on our side. Once this head has a green run, I'll put it to the captain as a merge-or-leave decision. Contract-class is unchanged: new-default. The secondmate-exemption question will go along with it.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: a short update, @max-metaplanet. Nothing here needs anything from you.

I closed and reopened this PR only to get a fresh CI run on current main (46b8fa9e), since re-running the old Oct 26 run would reuse its old merge ref. Runs 40828588860 (CI) and 40828588987 (no-mistakes) are queued. Head 998f9c7d is unchanged, so the no-mistakes attestation still binds. Contract-class is still new-default. If the fresh run comes back green, this goes to the captain for the merge decision. It won't be waiting on you.

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; all three previous findings are addressed.

Reviews (2) · Last reviewed commit: "fix/no-ticket(accounts): merge upstream ..." · Reviewed by Greptile

Comment thread bin/fm-worker-account-lib.sh Resolved
Comment thread bin/fm-worker-account-lib.sh Resolved
Comment thread bin/fm-spawn.sh Resolved
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @max-metaplanet. The fresh run on current main is in. CI 40828588860 is green and the no-mistakes attestation still binds 998f9c7d.

Greptile re-reviewed on the reopen (2/5) and left three P1s on the relaunch guard. I read them against the diff. They're gaps in the guarantee this PR adds, so this is waiting on you:

  1. Protection is dropped after an unpinned same-account relaunch (bin/fm-worker-account-lib.sh ~271). The task records account=A. The pin is removed and the ambient account is still A, so the guard passes. But fm_worker_account_select returns nothing, and the rewritten record loses account=. A pin for B added later then skips the guard and moves the task. Please carry the recorded account forward on that path, and add a test that relaunches twice.
  2. Pi checks the caller's account, not the pane's (~262). With config/pi-account absent, the guard reads the caller's PI_CODING_AGENT_DIR, but an unpinned Pi replacement inherits the destination pane's environment. Please check the account that will actually launch.
  3. The guard and the launch read the pin separately (bin/fm-spawn.sh ~3150). The guard resolves the pin, then fm_worker_account_select reads it again. Please have the guard check the same resolved selection the launch uses.

After that, please re-raise with git push no-mistakes. Contract-class stays new-default (relaunch now refuses or keeps the recorded account where it used to follow the current pin). Once it's green with the attestation on the new head, it goes to the captain for the merge call.

@max-metaplanet max-metaplanet changed the title fix(bin): keep a relaunch on the task's recorded worker account fix(bin): keep ship and scout relaunches on their recorded worker account Oct 29, 2026
@max-metaplanet max-metaplanet changed the title fix(bin): keep ship and scout relaunches on their recorded worker account fix/no-ticket(bin): keep ship and scout relaunches on their recorded worker account Oct 29, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @max-metaplanet, this round answers all three points from my last note.

What I checked (head 3bf17d4c vs main c9da5523): I read the diff myself.

  1. Unpinned same-account relaunch. With the pin absent and the guard passing, fm_worker_account_select now carries the recorded account into the launch and the next record. It still has to exist and pass the same sign-in check a pin gets, so a later pin for another account is still guarded.
  2. Pi uses the recorded root. An unpinned Pi relaunch now launches on the recorded root, not on the caller's or the pane's PI_CODING_AGENT_DIR.
  3. One resolution. The guard now checks the selection that fm_worker_account_select resolved for the launch. The pin is no longer read twice.

Greptile re-reviewed at 5/5 and no review threads are open. No-mistakes binds this head. Live validation is go (4 of 7). The open live gap is the real Pi replacement, since there's no pi binary on your host; the hermetic Pi test covers it. I'll note that for the captain. Nothing touches workflows, credentials or the network.

Contract-class (my own read): new-default, unchanged. Homes that pin an account used to follow the current pin file on relaunch. Now they get a refusal, or keep the recorded account. VISION: One captain aligns (the refusal names both accounts and both ways forward). Authority aligns: a task isn't silently moved to another account, which strengthens a refusal path. Scripts aligns (deterministic guard). Restart aligns (the recorded account in the durable task record is carried forward). Delegation aligns (the outgoing worker's session state isn't stranded). Vendor aligns (Claude and Pi handled the same way; account choice stays with the captain). Scope aligns.

Next step is ours, not yours. The "Full suite" check fails here only because outside PRs now need a maintainer full-ci label before the full suite runs. That isn't a problem with your change. Once we run it and it passes on this head, this goes to the captain as a merge-or-leave decision.

@kunchenguid kunchenguid added full-ci Maintainer go-ahead: run the full CI suite on this outside pull request and removed full-ci Maintainer go-ahead: run the full CI suite on this outside pull request labels Oct 29, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @max-metaplanet. The first full-suite run on head 3bf17d4c (40930266420) went red on Behavior serial 4, 5, 8 and 9. I checked each lane, and all four failed before any test ran, at the npm install step (npm error ETARGET, @aws-sdk/... versions not yet visible on the registry around 18:45Z). That's a transient registry problem that hit other PRs too, not your code. I've re-applied the full-ci label to get a fresh run.

Nothing else has changed. The no-mistakes attestation still binds this head, and contract-class is still new-default. This is waiting on our CI, not on you. If the fresh run passes, it goes to the captain for a merge-or-leave call.

@kunchenguid kunchenguid added full-ci Maintainer go-ahead: run the full CI suite on this outside pull request and removed full-ci Maintainer go-ahead: run the full CI suite on this outside pull request labels Oct 30, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @max-metaplanet. The fresh full suite on head 3bf17d4c (40965487572) got past the npm install trouble from last time. It failed in one lane only: Behavior portable serial 6, not ok - recovery drain after forced arm interruption failed. That's a known flaky watcher-recovery test that also fails on unrelated PRs, and this change doesn't touch it. Every other lane passed.

I've removed and re-added the full-ci label, so another full suite is running (40991180418). Nothing is needed from you. If it passes, this goes to the captain for the merge decision.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @max-metaplanet. The third full-suite run on head 3bf17d4c passed (40991180418, every lane green). The no-mistakes attestation binds this head, Greptile is 5/5, and all three earlier P1 threads are resolved.

Every gate is green, so this is now with the captain for the merge decision. It is not waiting on you. The reason it needs the captain: on homes with a pinned account, a ship/scout relaunch now keeps the recorded worker account (or refuses) instead of following the current pin. That's a change to the default relaunch behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-ci Maintainer go-ahead: run the full CI suite on this outside pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants