Skip to content

test: clear inherited Git config in the T3 Code backend suite - #7729

Merged
kunchenguid merged 1 commit into
kunchenguid:mainfrom
arthurcruzd:fm/t3-7518-docfix
Oct 25, 2026
Merged

kunchenguid merged 1 commit into
kunchenguid:mainfrom
arthurcruzd:fm/t3-7518-docfix

Conversation

@arthurcruzd

Copy link
Copy Markdown
Contributor

Intent

Ok pra PRs. - one-task upstream consent for the small follow-up PR to github.com/kunchenguid/firstmate: pooled-home cleanup also removes the config/t3code-token symlink and only the owned settings entries, plus the small test env cleanup. Open it only after PR 7518 merges.

Context needed to read that ask. #7518 (the T3 Code backend over Orchestrator V2 /mcp) merged on 2026-10-24. During its review the maintainer welcomed two optional follow-ups (#7518 (comment)): docs/t3code-backend.md's manual cleanup told operators to remove the whole .claude/settings.local.json and did not mention removing the config/t3code-token symlink before returning a pooled home; and tests/fm-backend-t3code.test.sh should unset GIT_CONFIG_COUNT, GIT_CONFIG_KEY_0, GIT_CONFIG_VALUE_0 and GIT_CONFIG_PARAMETERS as its sibling suites do. The merged docs already say to remove only the keys FM_T3CODE_ENV_KEYS lists and the config/t3code-token symlink for a secondmate home.

What Changed

  • tests/fm-backend-t3code.test.sh now unsets GIT_CONFIG_COUNT, GIT_CONFIG_KEY_0, GIT_CONFIG_VALUE_0 and GIT_CONFIG_PARAMETERS before it sources tests/lib.sh or runs any git command, the same way tests/fm-git-push-guard.test.sh already does.
  • This means a core.hooksPath override inherited from a fleet pane can't leak into cases that set and check their own Git config entries. No product code or docs change.

🤖 Generated with Claude Code

Risk Assessment

✅ Low: The only change is a four-line test-isolation unset at the top of tests/fm-backend-t3code.test.sh. It matches the sibling suites (fm-git-push-guard, fm-git-strip-ai-trailers). No case in the suite relies on inherited GIT_CONFIG_* values: the inherited-config cases at lines 1937 and 1948 set them per command. The pooled-home docs cleanup the intent asks for is already in docs/t3code-backend.md:254-256 from the merged PR 7518, so leaving the docs untouched is not a gap.

Testing

I built a throwaway fleet-pane environment. A scratch repo got hooks from bin/fm-git-strip-ai-trailers.sh install, plus that script's env-file export (GIT_CONFIG_COUNT=1, KEY_0=core.hooksPath, VALUE_0=<hooks dir>). I sourced the export and ran the whole fixed tests/fm-backend-t3code.test.sh. It exited 0 in 225s with 89 cases passing and none failing. The pooled secondmate teardown case was among them, and it showed the token link and only Firstmate's settings keys being removed before the slot is returned. That case uses the suite's fake T3 server and a recording treehouse stub, because no real T3 Code is installed and a real treehouse return would touch the operator's pool. These are test-suite runs, not live product runs, so the scenarios are recorded as untested. The change is test-only, so there is no runtime product surface to drive. I read the docs cleanup steps; they already match the intent and this branch doesn't change them. I prepared, but did not run, a comparison of the old and new suites under hostile inherited config (hooks that always fail, and GIT_CONFIG_PARAMETERS). The old-suite copy and the scratch directory are deleted and the worktree is clean.

  • Live validation: ⚠️ no-surface - 0 of 4 scenarios driven live against the product
Scenario Result Live Evidence
A developer in a fleet pane (GIT_CONFIG core.hooksPath inherited from the real hook installer) runs tests/fm-backend-t3code.test.sh and the whole suite passes ⏸️ untested no The earlier payload has no live result for this scenario. Its only evidence is a test-suite run in a disposable fleet-pane shell (exit 0, 89 ok, 0 failed; see the target-fleet-pane-run.log artifact),…
Pooled T3 secondmate home teardown removes the config/t3code-token link and only the FM_T3CODE_ENV_KEYS-listed settings entries before the slot returns, keeping the home's own entries and the primary'… ⏸️ untested no The earlier payload has no live result for this scenario. The real fm-teardown.sh ran only inside the test suite, against its fake T3 server and a recording treehouse stub (the case passed in target-f…
Adversarial: hostile inherited Git config (core.hooksPath hooks that exit 1, or GIT_CONFIG_PARAMETERS commit.gpgsign=true) breaks the old suite but not the fixed one ⏸️ untested no Not run in this step; there was no technical blocker. The fixed suite already passes with real inherited fleet config, and the new line matches the sibling suites' unset line exactly, so skipping this…
The manual cleanup docs tell operators to remove only the owned settings keys and the config/t3code-token link before returning a pooled home ⏸️ untested no Docs text has no runtime surface. It was already merged in #7518, this branch doesn't change it, and I checked it by reading only.
Evidence: Fixed T3 Code suite run from a fleet-pane shell with inherited core.hooksPath (exit 0, 89 ok)

Source: Fixed T3 Code suite run from a fleet-pane shell with inherited core.hooksPath (exit 0, 89 ok)

# inherited: GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=core.hooksPath GIT_CONFIG_VALUE_0=/private/tmp/fm-t3gitcfg.*/pane-hooks ... ok - fm-teardown.sh backend=t3code pooled secondmate: the slot returns only after the provider ended, without the T3 environment the spawn wrote ... # exit=0 elapsed=225s

# run: target 87709165 tests/fm-backend-t3code.test.sh from a fleet-pane shell
# inherited: GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=core.hooksPath GIT_CONFIG_VALUE_0=/private/tmp/fm-t3gitcfg.d1zWVq/pane-hooks
# git config core.hooksPath in this shell: /private/tmp/fm-t3gitcfg.d1zWVq/pane-hooks
fm-afk-launch: away-posture record archived at /private/var/folders/hg/_55vfss90xg55gt58jfw4xqm0000gn/T/fm-backend-t3code-tests.xd6uNV/restart-unknown-completed/home/state/afk-contracts/1792852054.afk-contract
fm-afk-launch: away mode stopped; no daemon terminal was running, .afk cleared, and the posture record archived
fm-afk-launch: away-posture record archived at /private/var/folders/hg/_55vfss90xg55gt58jfw4xqm0000gn/T/fm-backend-t3code-tests.xd6uNV/restart-unknown-failed/home/state/afk-contracts/1792852057.afk-contract
fm-afk-launch: away mode stopped; no daemon terminal was running, .afk cleared, and the posture record archived
ok - native restart re-arms discarded T3 stale warnings exactly once and preserves delivered suppression
ok - away housekeeping preserves unknown stale rechecks and reports possible wedges until work resumes
ok - away daemon on T3: a stall reported while unknown is not reported again once T3 reads idle
ok - T3 stale watcher: harness=codex status=failed turn=fresh -> dead
ok - t3code: a failed thread read reports unknown busy state, submits no away-mode injection, and keeps stale rechecks uncertain
ok - T3 stale lookup honors paused and captain-held declarations
ok - T3 stale watcher: harness=codex status=running turn=fresh -> absorb
ok - T3 stale watcher: harness=claude status=running turn=fresh -> absorb
ok - T3 stale watcher: harness=codex status=waiting turn=fresh -> absorb
ok - T3 stale watcher: harness=codex status=starting turn=fresh -> surface
ok - T3 stale watcher: harness=codex status=completed turn=fresh -> surface
ok - T3 stale watcher: harness=codex status=failed turn=fresh -> dead
ok - T3 stale watcher: harness=codex status=running turn=hung -> surface
ok - fm_backend_t3code_runtime_check: a missing credential names the sign-in
ok - fm_backend_t3code_runtime_check: a 401 names the fresh sign-in
warning: T3 telemetry at http://127.0.0.1:49975 is on; run the server that hosts Firstmate workers with T3CODE_TELEMETRY_ENABLED=false (docs/t3code-backend.md)
ok - fm_backend_t3code_runtime_check: the tools/list gate and environment pin refuse control and teardown without a mutation
ok - fm_backend_t3code_project_ensure: matches by realpath, otherwise creates with the fm- title
ok - fm_backend_t3code_model_selection: T3's catalog decides driver, model, and effort; overrides keep other options; default handling, instances file
ok - fm_backend_t3code_thread_create/turn_start: verified t3_thread_launch and t3_thread_send payloads
ok - fm_backend_t3code_thread_create: a lost reply is uncertain and never retried; a mis-bound thread is archived and refused
ok - fm_backend_t3code_thread_for_home: zero, one, ambiguous, and unreachable
ok - T3 requires explicit selection and does not query the server during runtime detection
ok - fm_backend_t3code_capture: renders the activity tail and the thread's status line
ok - fm_backend_t3code_send_key: Escape and C-c interrupt, Enter no-ops, others refuse
ok - fm_backend_t3code_send_text_submit: empty on accept, send-failed on rejection
ok - t3code send: a reply lost after commit is unconfirmed through the adapter and fm-send, and the resend lands once
ok - t3code send: a held request id stays unconfirmed when the next attempt fails locally, and the retry lands once
ok - t3code send: a lost reply to a secondmate names its armed correlation instead of advising a resend
ok - t3code status table: every V2 thread status, a pending request, archived, archived-but-draining, missing, unreachable, and unreadable rows
ok - t3code push wait: a pending question wakes the supervisor once with how to answer it, approvals are named apart, and answering clears it
ok - fm-t3-answer.sh: lists a T3 worker's pending questions and answers one by request id
ok - secondmate liveness backend=t3code: a failed run is resumed on its own thread, never archived and replaced
ok - secondmate liveness backend=t3code: a missing thread re-proves its archive before replacement, and an unproved close spawns nothing
ok - away daemon on T3: an unconfirmed digest is frozen and retried verbatim; a later event goes in the next digest, each event once
ok - away daemon on T3: a delivered frozen digest leaves the items behind it with the first one's undelivered age
ok - away daemon on T3: a supervisor thread waiting on a pending request defers digests until it is answered
ok - t3code helper: runs through a symlinked Firstmate root, and a kill that cannot read the thread fails closed
ok - secondmate liveness backend=t3code: an archived thread whose run still drains is left in place, not replaced
ok - fm_backend_t3code_kill: interrupt then archive with a proven close, idempotent on archived and missing, loud on failure
ok - fm-backend dispatcher: routes every t3code primitive, validates and resolves t3_thread_id records, and joins the push wait
ok - T3 harness admission refuses every non-T3 adapter and launch-time typing refuses without a thread read
ok - fm_busy_classify: t3code native busy, idle, and unknown are trusted without a record
ok - fm-control-lib: t3code key set, state-verified, no-exit, and no-replacement membership
ok - fm-control.sh backend=t3code: exit refuses before any call (V2 has no session stop); interrupt ends the turn natively
ok - fm-control.sh relaunch backend=t3code: refused before anything is stopped, by the control plane and by the launch owner
ok - fm-spawn.sh --backend t3code: leases the slot, launches the thread on it, records metadata, sends the launch brief
ok - t3code Claude PR-tool clause: dropped only at or past the verified T3 build, kept for older or unreadable servers
ok - codex-cli 0.163.0: project config retained; shell FM_TASK_ID=t3codextrk20a5c27403
ok - fm-spawn.sh backend=t3code: compatible tracked Codex config launches, stays out of commits, and survives cleanup
ok - tracked Codex overlay: edited files survive refusal, interrupted restoration recovers, quoted and dotted policy keys refuse
ok - fm-spawn.sh --backend t3code codex: refuses to overwrite a project's tracked .codex/config.toml before any mutation
ok - fm-spawn.sh --backend t3code claude: refuses to overwrite a project's tracked CLAUDE.local.md before any mutation
ok - Claude channel refuses a symlink in the leased worktree without following it
ok - untracked Codex config is preserved unless Firstmate's marker owns it
ok - fm-t3code-codex-env.sh cleanup: without an installed overlay it needs no Python and never refuses
ok - fm-spawn.sh --backend t3code codex: an untracked Codex config in the main checkout does not refuse a worker
ok - fm-spawn.sh --backend t3code codex: writes .codex/config.toml with GOTMPDIR, FM_TASK_ID, and TRACEPARENT
ok - fm-spawn.sh --backend t3code codex: warns once, and still launches, unless the Codex configuration trusts the launch directory's main checkout
ok - fm-spawn.sh --backend t3code --secondmate: project on the home, root-strategy thread, charter message, launch prefix as settings env
ok - fm-spawn.sh --backend t3code --secondmate codex: launch prefix as .codex/config.toml shell_environment_policy
ok - fm-spawn.sh --backend t3code: refuses before mutation when the credential is rejected
ok - fm-teardown.sh backend=t3code: interrupts and archives the thread with a proven close, then returns the slot
ok - fm-teardown.sh backend=t3code secondmate: interrupts and archives, then ends the home's lingering provider process before the home is removed; an unprovable scan keeps the home
ok - fm-teardown.sh backend=t3code secondmate: interrupts and archives, then ends the home's lingering provider process before the home is removed; an unprovable scan keeps the home
ok - fm-teardown.sh backend=t3code pooled secondmate: the slot returns only after the provider ended, without the T3 environment the spawn wrote
ok - fm-teardown.sh backend=t3code: an unreachable or gate-refused server keeps the slot a live thread still points at
ok - fm-spawn.sh --backend t3code claude: refuses config/claude-permission-mode=auto it cannot honor before any mutation
ok - fm-spawn.sh --backend t3code codex: refuses config/codex-approval-mode=approve-for-me it cannot honor before any mutation
ok - fm-spawn.sh --backend t3code codex: refuses config/codex-permission-mode=restricted it cannot honor before any mutation
ok - fm-spawn.sh --backend t3code codex: config/codex-approval-mode=bypass still launches
ok - fm-spawn.sh --backend t3code claude: refuses config/launch-env-allowlist=HOME it cannot honor before any mutation
ok - fm-spawn.sh --backend t3code: refuses a raw launch command before any mutation
ok - fm-spawn.sh --backend t3code: an abort archives the thread, then returns the lease
ok - fm-spawn.sh --backend t3code: an abort that cannot archive the thread keeps the lease
ok - fm-spawn.sh --backend t3code: a launch whose response was lost keeps the lease
ok - fm-spawn.sh --backend t3code: inherited Git config values never reach the env file, which carries only Firstmate's hook entry
ok - fm-spawn.sh --backend t3code --secondmate: a symlinked .claude/settings.local.json is refused, never written through
ok - fm-spawn.sh --backend t3code: a gate failure before the launch request returns the lease
ok - fm-spawn.sh --backend t3code: a refused launch turn archives the thread, removes its environment files, then returns the lease
ok - fm-spawn.sh --backend t3code: a thread T3 bound elsewhere is archived and the lease returned
ok - fm-spawn.sh --backend t3code: a leased slot holding uncommitted work gets no thread and keeps its lease
ok - fm-spawn.sh --backend t3code: a clean leased slot whose refresh fails gets no thread and is returned
ok - fm-spawn.sh --backend t3code --secondmate: an aborted spawn archives its thread, then removes the T3 environment it wrote into the home
ok - fm-teardown.sh backend=t3code: a nested T3 secondmate's home is reaped before it is removed
ok - fm-spawn.sh --backend t3code: a launch brief whose reply is lost is reported unconfirmed and keeps its task record
ok - fm-spawn.sh --backend t3code: a lease the isolation guard rejects is neither cleaned nor returned
ok - fm-teardown.sh backend=t3code: a tracked CLAUDE.local.md stays in the slot
ok - t3code push wait: a fractional poll interval runs the event wait with its budget in milliseconds
ok - away housekeeping clears the stale marker it rechecked when two records share an endpoint
# exit=0 elapsed=225s
- Outcome: ⚠️ 1 warning across 1 run (6m35s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

⚠️ **Test** - 1 warning
  • ⚠️ this change has no live-validatable surface; proceed without live validation? (0 of 4 scenarios were driven live against the product); A developer in a fleet pane (GIT_CONFIG core.hooksPath inherited from the real hook installer) runs tests/fm-backend-t3code.test.sh and the whole suite passes: The earlier payload has no live result for this scenario. Its only evidence is a test-suite run in a disposable fleet-pane shell (exit 0, 89 ok, 0 failed; see the target-fleet-pane-run.log artifact), and it explicitly said that run was not a drive of the operator-facing product. The change touches only the test file, so there is no runtime product surface to drive live.; Pooled T3 secondmate home teardown removes the config/t3code-token link and only the FM_T3CODE_ENV_KEYS-listed settings entries before the slot returns, keeping the home's own entries and the primary's token: The earlier payload has no live result for this scenario. The real fm-teardown.sh ran only inside the test suite, against its fake T3 server and a recording treehouse stub (the case passed in target-fleet-pane-run.log). No real T3 Code server or t3 CLI is installed on this machine, and a real treehouse return would change the operator's pool. A live run needs a disposable T3 Code instance with an Orchestrator V2 /mcp credential.; Adversarial: hostile inherited Git config (core.hooksPath hooks that exit 1, or GIT_CONFIG_PARAMETERS commit.gpgsign=true) breaks the old suite but not the fixed one: Not run in this step; there was no technical blocker. The fixed suite already passes with real inherited fleet config, and the new line matches the sibling suites' unset line exactly, so skipping this doesn't cast doubt on the intent. It would only show how the old suite failed.; The manual cleanup docs tell operators to remove only the owned settings keys and the config/t3code-token link before returning a pooled home: Docs text has no runtime surface. It was already merged in feat(bin): add an explicit-only T3 Code runtime backend #7518, this branch doesn't change it, and I checked it by reading only.
  • Live validation: ⚠️ no-surface - 0 of 4 scenarios driven live against the product
Scenario Result Live Evidence
A developer in a fleet pane (GIT_CONFIG core.hooksPath inherited from the real hook installer) runs tests/fm-backend-t3code.test.sh and the whole suite passes ⏸️ untested no The earlier payload has no live result for this scenario. Its only evidence is a test-suite run in a disposable fleet-pane shell (exit 0, 89 ok, 0 failed; see the target-fleet-pane-run.log artifact),…
Pooled T3 secondmate home teardown removes the config/t3code-token link and only the FM_T3CODE_ENV_KEYS-listed settings entries before the slot returns, keeping the home's own entries and the primary'… ⏸️ untested no The earlier payload has no live result for this scenario. The real fm-teardown.sh ran only inside the test suite, against its fake T3 server and a recording treehouse stub (the case passed in target-f…
Adversarial: hostile inherited Git config (core.hooksPath hooks that exit 1, or GIT_CONFIG_PARAMETERS commit.gpgsign=true) breaks the old suite but not the fixed one ⏸️ untested no Not run in this step; there was no technical blocker. The fixed suite already passes with real inherited fleet config, and the new line matches the sibling suites' unset line exactly, so skipping this…
The manual cleanup docs tell operators to remove only the owned settings keys and the config/t3code-token link before returning a pooled home ⏸️ untested no Docs text has no runtime surface. It was already merged in #7518, this branch doesn't change it, and I checked it by reading only.
  • bin/fm-git-strip-ai-trailers.sh install &lt;scratch&gt;/pane-hooks &lt;scratch&gt;/pane-wt and env-file to make a real fleet-pane core.hooksPath export in a disposable /tmp/fm-t3gitcfg.* directory
  • . pane-env.sh &amp;&amp; bash tests/fm-backend-t3code.test.sh at commit 87709165 with GIT_CONFIG core.hooksPath inherited: exit 0, 89 ok, 0 failed, 225s
  • test_pooled_t3_secondmate_home_returned_only_after_provider_exits, observed passing in that run
  • git diff d96bff00 87709165: the only change is the unset line in tests/fm-backend-t3code.test.sh
  • Read docs/t3code-backend.md:251-258 to confirm the merged pooled-home cleanup wording
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

A fleet pane already carries GIT_CONFIG core.hooksPath, and the suite's
cases set the Git config they assert on themselves, so unset
GIT_CONFIG_COUNT, GIT_CONFIG_KEY_0, GIT_CONFIG_VALUE_0 and
GIT_CONFIG_PARAMETERS at the top as the sibling suites do.
@arthurcruzd

Copy link
Copy Markdown
Contributor Author

The only red check, Behavior portable serial 1 (https://github.com/kunchenguid/firstmate/actions/runs/40103211272/job/120899424696), failed in tests/fm-supervision-host.test.sh ("latch: the second engine error did not hand the wake back") after a ~25.6 min shard - the same slow-shard timing flake seen on #7518, unrelated to this change, which only adds an unset line to tests/fm-backend-t3code.test.sh. Could a maintainer rerun that job? Contributors can't rerun it. Thanks!

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @arthurcruzd for picking up the small follow-up from #7518 so quickly. Dropping the inherited GIT_CONFIG_* values before the suite runs any git command matches what tests/fm-git-push-guard.test.sh already does. It means a fleet pane's core.hooksPath can't leak into the cases that set their own config.

I read the diff at head 87709165 against main d96bff00. It's four lines in tests/fm-backend-t3code.test.sh and nothing else. No product code, workflow, or secret change. The no-mistakes attestation binds this head, and the PR is mergeable. Live validation is marked "no-surface," which is fine here because a test-only change has no product run to drive. Your fleet-pane suite run (89 ok, 0 failed) is good supporting evidence.

CI: every check is green except Behavior portable serial 1. That failed in tests/fm-supervision-host.test.sh ("latch: the second engine error did not hand the wake back"). That's the known timing flake tracked in #7709, in a file this PR doesn't touch. As you asked, I re-ran the failed job (run 40103211272).

Contract-class: restore. Test isolation only, and the unconfigured product path is unchanged. VISION: aligns (field incidents become regression coverage, and the change is scripted with no new surface).

Next step: if the re-run is green, this can be merged without anything more from you. This is waiting on CI, not on you.

@kunchenguid
kunchenguid merged commit 09fa1e9 into kunchenguid:main Oct 25, 2026
70 of 73 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: this is merged. Thank you @arthurcruzd — really appreciate you taking the time on this. The T3 suite now drops the inherited GIT_CONFIG_* values before any git command.

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.

2 participants