Skip to content

feat: add opt-in Claude Code Mode launches - #76

Merged
peterOC26 merged 3 commits into
mainfrom
fm/fm-claude-code-mode-trial-t1
Nov 19, 2026
Merged

peterOC26 merged 3 commits into
mainfrom
fm/fm-claude-code-mode-trial-t1

Conversation

@peterOC26

Copy link
Copy Markdown
Owner

Intent

Jobs page 2026-11-19, replying to the offer "I can trial it on one Claude coding job and compare speed and tokens": "yes, pease do that".
"It" is Claude Code's experimental Code Mode (https://code.claude.com/docs/en/code-mode): with CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 in an interactive claude session (v2.1.323+, this host has 2.1.323), Claude writes JavaScript that makes several tool calls in one step. It is off by default; the first Code Mode session asks a one-time confirmation; a Code Mode session can only be resumed with Code Mode on.

What Changed

  • Add --claude-code-mode for Firstmate-built Claude ships and scouts, setting CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 for the worker and restoring the choice on Claude relaunches until the harness changes.
  • Refuse the option for secondmates, non-Claude or raw launches, and the T3 backend; document the option and add regression coverage for enablement, refusals, and relaunch behavior.

Risk Assessment

✅ Low: The fix-round change is small and minimal. It now restores the recorded Code Mode choice only when the relaunch resolves to a Firstmate-built claude launch (after ARG3 = HARNESS_ARG or the prior harness is resolved), and the meta republish writes the key only when CLAUDE_CODE_MODE=1, so switching harness drops it as the human decision required; the only remaining issue is a minor gap in the new test's setup.

Testing

The Test agent exceeded its invocation budget before live validation completed; no evidence was gathered for this head.

  • Outcome: ⏭️ skipped across 1 run (30m1s)

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 1 info
  • ⚠️ bin/fm-spawn.sh:2598 - A task's Code Mode choice is restored on every relaunch, whatever harness the relaunch uses, so a Code Mode task can no longer switch harness. The header says a harness switch is "one ordinary relaunch" (bin/fm-spawn.sh:83-87). Example: a task was spawned with --claude-code-mode, so its meta has claude_code_mode=1. Running bin/fm-control.sh &lt;id&gt; relaunch --harness codex --note ... first stops the live agent with do_exit (bin/fm-control.sh:1275) and then calls fm-spawn.sh &lt;id&gt; --relaunch --harness codex (bin/fm-control.sh:1283). fm-spawn sets CLAUDE_CODE_MODE=1 from the meta at bin/fm-spawn.sh:2598-2605, and the guard at bin/fm-spawn.sh:3304-3307 refuses with "--claude-code-mode applies only to the claude harness (this launch is codex)". The same refusal hits a raw launch command (bin/fm-spawn.sh:3300). There is no flag to turn the choice off, so the only way out is editing state/<id>.meta by hand, and the task has no agent until the operator recovers it. The stated reason for the restore (header at bin/fm-spawn.sh:521-523: "restores it on relaunch because Code Mode sessions require it to resume") also does not fit: a relaunch starts a new Claude conversation, and fm-control says the replacement "inherits the local copy but none of the conversation" (bin/fm-control.sh:1248). No worker path resumes a Code Mode session. Smallest correct fix: restore claude_code_mode only when the relaunch resolves to the Firstmate-built claude harness (RAW_LAUNCH=0 and HARNESS=claude, checked after the harness is resolved near line 3295), drop it from the republished meta otherwise, and fix the header's reasoning. The other option is to remove the restore entirely, since nothing resumes a session; that removal is the choice that needs the author's decision.

🔧 Fix applied.
1 info still open:

  • ℹ️ tests/fm-spawn-claude-lean.test.sh:446 - This is the test the round-1 fix added. Its last step, --relaunch --claude-code-mode, only checks the exit code. That step is what sets up the second loop iteration (target 'claude --raw-probe'), whose main check is that the raw switch clears claude_code_mode= from the meta. If the re-enable exited 0 but did not write claude_code_mode=1, the meta would already lack the key and that check would pass without testing anything. Fix: right after the re-enable, assert export_count &#34;$HOME_DIR/state/$id.meta&#34; &#39;claude_code_mode=1&#39; equals 1, so the raw-launch iteration starts from a recorded Code Mode choice. The codex iteration is fine because the round-1/2 relaunch loop already proves the key is recorded before it runs.
⏭️ **Test** - skipped
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@peterOC26
peterOC26 merged commit 9706deb into main Nov 19, 2026
166 of 176 checks passed
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.

1 participant