Repository navigation
fix(bin): deliver seated Codex credential home to the agent, not the hooks export - #50
Merged
Merged
Conversation
The seat step prefixed the credential shed and CODEX_HOME onto a launch that already began with the AI-trailer hooks export statement, so the assignment bound that export and a seated worker ran on the default Codex account. Express the shed and home as their own statements, add a behavioural regression that executes the seated launch, and run it in house CI.
jazz127
force-pushed
the
fm/firstmate-codex-seat-home-order-r1
branch
from
September 26, 2026 02:03
da7ba63 to
55fb1e2
Compare
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.
Intent
do both #42 followup and codex account seat bug items
Context for reading that ask. The Codex account-seat bug on the fork's
housebranch: fork PR 43 bound Codex dispatch seats to dock-local credential homes, so a worker launched on a seat runs withCODEX_HOMEpointing at that seat's credential home and never spends the default account. Inbin/fm-spawn.shon currenthouse, the seat step prefixes$(fm_worker_account_codex_shed) CODEX_HOME=<seat home>ontoLAUNCHafter an earlier step has already turnedLAUNCHintoexport GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=core.hooksPath GIT_CONFIG_VALUE_0=...; <rest>(the AI-trailer commit-msg strip). A shell command-prefix assignment applies only to the first simple command, soCODEX_HOMEand the shed attach to thatexportstatement instead of the agent, and a seat worker silently runs on the default Codex account.tests/fm-spawn-dispatch-profile.test.shfails on it, butci-house.ymldoes not run that test, so house CI stayed green. No Codex work is being launched right now because both Codex accounts are out of quota; the fix must land before they reset.What Changed
bin/fm-spawn.sh, a seated Codex launch now sets its credential home as a statement (export CODEX_HOME=<seat home>) instead of a command-prefix assignment. Before, the prefix attached only to the earlierGIT_CONFIG_*hooks export, so the agent ran on the default Codex account.fm_worker_account_codex_shedinbin/fm-worker-account-lib.shnow printsunset <ambient vars>instead of anenv -u …prefix, so the ambient OpenAI/Codex credential overrides are removed for every later step of the compound launch.tests/fm-spawn-codex-seat-launch.test.sh. It runs a real seated spawn and executes the launch command the pane receives, in a pane environment that contains ambient credentials. It checks that the probecodexbinary sees the seat'sCODEX_HOMEand none of the ambient credentials. It covers both the absent and the enabled launch-env allowlist.tests/fm-spawn-dispatch-profile.test.shnow expects theunsetform..github/workflows/ci-house.yml) now lintsbin/fm-spawn.sh,bin/fm-worker-account-lib.shand the new test, and runs the new test.tests/fm-ci-workflow.test.shrequires that the new test is included, andbin/fm-test-run.shplaces it in thebackend-dispatchfamily.🤖 Generated with Claude Code
Risk Assessment
✅ Low: This is a small, focused fix. The shed and CODEX_HOME are now shell statements, so they reach the agent after the hooks export, and they work both under the env -i allowlist wrapper and without it. Only one caller uses the changed helper. The new test runs the real generated launch, and it would fail at base because
env -u … exportfails and the agent keeps the ambient account.Testing
All validation here is synthetic/offline built-CLI validation; 0 of 4 scenarios were driven live against a real Codex account, because both Codex accounts are out of quota.
tests/fm-spawn-codex-seat-launch.test.shpasses on this PR head (55fb1e2) and fails at base 61fb548 (and at the original base 854257f) with "the seated agent did not start on its seat's credential home". It runs the realbin/fm-spawn.shthrough a dock seat, then executes the emitted launch with a probecodexbinary under fake ambientCODEX_HOMEand OpenAI/Codex credential variables, for both the absent and the enabled launch-env allowlist.CODEX_HOMEand none of the fake credentials, including when the allowlist forwarded them; with the base-commit scripts the pane showedenv: export: No such file or directoryand Codex started on the ambientCODEX_HOME. Transcripts are below.tests/fm-ci-workflow.test.sh(house CI must run the new test) andbin/fm-test-run.sh --check-coveragepass; house CI on this PR is green and runs the new test.tests/fm-spawn-dispatch-profile.test.sh: on the original base 854257f the full file stopped early at the chore: update pull request #42 scratch-hookGIT_CONFIG_*launch prefix (unrelated to the seat fix; its seat cases passed when run in isolation). The separate chore: update pull request #42 follow-up (fix(bin): simplify scratch guards and keep scratch out of published changes #48) has since removed that prefix, and on this rebased head the full file passes.evidence-artifact: /tmp/fm-firstmate-codex-seat-home-order-r1/seat-evidence.txt
evidence-command: bash tests/fm-spawn-codex-seat-launch.test.sh (PR head and a git-archive copy of base 61fb548) and bash tests/fm-spawn-dispatch-profile.test.sh
evidence-captured: 2026-09-26T02:12:19Z
Evidence: Fixed: live seated codex worker env (default launch environment)
Source: Fixed: live seated codex worker env (default launch environment)
Evidence: Fixed: pane has ambient creds, codex process has seat CODEX_HOME and none of them (allowlist grants them)
Source: Fixed: pane has ambient creds, codex process has seat CODEX_HOME and none of them (allowlist grants them)
Evidence: Fixed: worker pane transcript reaching Codex trust prompt
Source: Fixed: worker pane transcript reaching Codex trust prompt
Evidence: Base 61fb548: pane shows 'env: export: No such file' and Codex using /ambient/default-account
Source: Base 61fb548c: pane shows 'env: export: No such file' and Codex using /ambient/default-account
Evidence: Base 61fb548: worker process env (no codex process on seat home)
Source: Base 61fb548c: worker process env (no codex process on seat home)
Evidence: Base-commit pane excerpt
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
ℹ️
bin/fm-spawn.sh:5091- The intent asks for both the chore: update pull request #42 followup and the Codex seat bug. This branch contains only the seat fix: the prefix is replaced withunset …; export CODEX_HOME=…statements, a behavioural regression test is added, and house CI now runs that test. The chore: update pull request #42 followup (Pi composer / secondmate restart) looks like it is being delivered separately in open fork PR fix(bin): let secondmate restart read Pi's empty composer and gate on a done persist reply #46, so I did not flag its absence here as a contradiction.ℹ️
bin/fm-spawn.sh:5059- The intent asks for both the chore: update pull request #42 followup and the Codex seat bug, but this branch has only the seat fix. That fix turns the shed and CODEX_HOME intounset …; export CODEX_HOME=…statements, adds a behavioural regression test, and wires it into house CI. The chore: update pull request #42 followup (Pi composer and secondmate restart) is being delivered separately in open fork PR fix(bin): let secondmate restart read Pi's empty composer and gate on a done persist reply #46, so it is not flagged here as a contradiction.🔧 **Test** - 2 issues found ✅
tests/fm-spawn-dispatch-profile.test.sh:187- The full fm-spawn-dispatch-profile.test.sh file still fails early on 'no-profile claude launch did not use the canonical launch kind': the launch gains a leading scratch-hooks GIT_CONFIG prefix. This also happens at base 854257f and is unrelated to this change. The file is not in house CI. Because the file-level run aborts, its seat cases only run when invoked in isolation; all six pass that way after the fix. (Superseded after the rebase onto 61fb548: fix(bin): simplify scratch guards and keep scratch out of published changes #48 removed that prefix and the full file now passes.)bash tests/fm-spawn-codex-seat-launch.test.shat da7ba639 (pass)bash tests/fm-spawn-codex-seat-launch.test.shagainst a base 854257f0 tree to reproduce the bug (fails: agent sees CODEX_HOME=/ambient/default-account and all ambient OPENAI_/CODEX_ values)Seat-related functions oftests/fm-spawn-dispatch-profile.test.sh(luna seat, Herdr backend, refusal, allowlisted-ambient override, secondmate recovery, scout/batch), run in isolation at base and at the fixbash tests/fm-spawn-dispatch-profile.test.shfull file at base and at the fix (fails early at both on an unrelated claude no-profile case)bash tests/fm-ci-workflow.test.sh(house workflow must include the new test)bin/fm-test-run.sh --check-coverage✅ No issues found.
Round 2 (after rebase): synthetic lab runs with the real codex-cli binary and fake credentials; not driven against a real account.
Lab setup:bin/fm-lab-home.sh create $LAB, a private tmux sockettmux -L fm-lab, a disposable git project,config/dock.jsonwith seat luna pointing at a lab seat home holding a fake API-key auth.json, and scout briefs frombin/fm-brief.shThe lab tmux session was seeded with fake default-account credentials: CODEX_HOME=/ambient/default-account, OPENAI_API_KEY, CODEX_API_KEY and OPENAI_BASE_URLbin/fm-spawn.sh seatprobe $LAB/projects/demo --scout --harness codex --seat luna(fixed code, default launch environment), then read the live codex process environment withps -Ebin/fm-spawn.sh seatprobe2 ... --seat lunawithconfig/launch-env-allowlistexplicitly allowing CODEX_HOME and every OpenAI/Codex credential (adversarial), then read the environment of the pane, the wrapper, and the codex processBase-commit spawn:git archive 61fb548cextracted into the lab, thenbin/fm-spawn.sh seatprobe3 ... --seat lunawith the same allowlist and ambient credentials, then read the codex environment and captured the panebash tests/fm-spawn-codex-seat-launch.test.shbash tests/fm-ci-workflow.test.shTeardown:tmux -L fm-lab kill-server,treehouse destroy <lab pool> --all --yes, then deleted the lab home and the /tmp/fm-seatprobe* task temp dirs✅ **Document** - passed
✅ No issues found.
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
✅ No issues found.