fix(bin): preserve transcripts for launched Claude workers - #8
Merged
Conversation
When a primary still carries Claude Code's intentional child-session identity (CLAUDE_CODE_CHILD_SESSION and related vars), firstmate-launched Claude workers and secondmates inherited it and disabled transcript saving. Clear that identity pack on the Claude launch template only so each direct report gets an independent, resumable session without touching non-Claude tools or the captain's shell.
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
Fix Firstmate so an inherited parent Claude CLAUDE_CODE_CHILD_SESSION marker cannot disable transcript saving for Firstmate-launched Claude workers or second mates. Ship the durable fix through no-mistakes.
Deliberate design choices from implementation:
env -u CLAUDE_CODE_CHILD_SESSION -u CLAUDE_CODE_SESSION_ID -u CLAUDE_PID -u CLAUDE_JOB_DIRplus the existing prompt-suggestion suppress, applied only in bin/fm-spawn.sh's Claude launch_template. Does not use CLAUDE_CODE_FORCE_SESSION_PERSISTENCE=1 as the primary fix because that re-enables saving while keeping child-session semantics.What Changed
Risk Assessment
✅ Low: The change is narrowly scoped to the shared Claude launch template, clears the complete specified parent identity pack for ordinary workers and secondmates across all backends, preserves existing launch semantics, and includes aligned regression coverage and verification documentation.
Testing
Baseline diff inspection, focused worker/second-mate environment tests, dispatch and non-Claude regression checks, the Orca launch path, and a manual effective-environment capture all passed; the evidence shows inherited Claude identity removed while prompt suppression, arguments, and unrelated environment remain intact.
Evidence: Claude session environment transcript
Polluted parent markers were all unset in the launched fake Claude process; prompt suggestions remained disabled and unrelated environment was preserved.Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
git status --shortandgit diff --stat 21938d694ef7ea22b93200f96eada98b17adc169..7f86ea6ffcc5886d91d2ef45025a45b2b387f5bftests/fm-claude-session-env.test.shtests/fm-spawn-dispatch-profile.test.shtests/fm-kimi-harness.test.shtests/fm-backend-orca.test.shManual polluted-parent launch through the exactenv -u CLAUDE_CODE_CHILD_SESSION -u CLAUDE_CODE_SESSION_ID -u CLAUDE_PID -u CLAUDE_JOB_DIRprefix against a fakeclaude, captured to the evidence transcript✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.