Repository navigation
feat: add opt-in Claude Code Mode launches - #76
Merged
Merged
Conversation
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
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
--claude-code-modefor Firstmate-built Claude ships and scouts, settingCLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1for the worker and restoring the choice on Claude relaunches until the harness changes.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.
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
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. Runningbin/fm-control.sh <id> relaunch --harness codex --note ...first stops the live agent with do_exit (bin/fm-control.sh:1275) and then callsfm-spawn.sh <id> --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 clearsclaude_code_mode=from the meta. If the re-enable exited 0 but did not writeclaude_code_mode=1, the meta would already lack the key and that check would pass without testing anything. Fix: right after the re-enable, assertexport_count "$HOME_DIR/state/$id.meta" 'claude_code_mode=1'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.