Skip to content

fix(fm-spawn): prevent crewmate git-editor deadlocks with GIT_EDITOR=true - #49

Merged
trillium merged 2 commits into
mainfrom
robots-1xw8/noninteractive-git-editor
Aug 5, 2026
Merged

trillium merged 2 commits into
mainfrom
robots-1xw8/noninteractive-git-editor

Conversation

@trillium

@trillium trillium commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Intent

Fix robots-1xw8: crewmate git commands hang forever because they inherit the machine git editor code --wait, which blocks until a human closes a VS Code tab. Crewmates have no human at a terminal, so git rebase --continue/-i, git commit without -m, non-fast-forward git merge, git revert, git tag -a, and git cherry-pick --continue all wedge silently with no output and no error. Observed live on task parlay-45-rebase: three stacked orphaned editor waiters on the same COMMIT_EDITMSG, ~15 minutes lost; killing the waiters let the rebase complete and push cleanly, so it was purely an editor deadlock and no work was ever at risk. A wedged pane is indistinguishable from a thinking pane, and the agents natural response (retry) stacks more waiters, making it worse.

The ticket prescribes two layers and asks for both. Layer 1 (the real fix): bin/fm-spawn.sh exports GIT_EDITOR=true and GIT_SEQUENCE_EDITOR=true into every crewmates pane shell, so the whole class becomes impossible instead of each worker having to remember. It is deliberately placed next to the existing GOTMPDIR pane export and before the harness launch, because that is the established point where pane environment must be set for the agent and all its children to inherit it. true exits 0 without touching the file, so git proceeds with the commit message or rebase todo as written rather than waiting. Layer 2 (belt and braces): bin/fm-brief.sh gains a Rules entry in BOTH the scout and ship scaffolds telling the worker never to let git open an editor and to treat a git command silent for over a minute as a blocked editor rather than a slow operation.

Deliberate decisions a reviewer would not see in the diff:

  • The new rules are APPENDED as 8 (and ship-only 9) rather than inserted, specifically so the existing "escalate to firstmate (rule 6)" cross-reference already in the ship brief stays correct. Renumbering would silently break it.
  • Ship rule 9 also lands the fix requested by the separate open ticket violation-0gh (a crewmate removed a sibling git worktree to resolve a branch-checked-out conflict, against its brief). robots-1xw8 explicitly says "Worth landing both in one change" because both are the same one-line fm-brief.sh Rules addition. This is intentional scope, not scope creep.
  • Rule 9 is ship-only: scout briefs already run detached and forbid pushing, so the branch-checked-out-elsewhere conflict cannot arise there.
  • Rule 9 says "where rule 1 permits pushing at all" because RULE1 varies by delivery mode and local-only mode forbids pushing entirely.
  • Test coverage was added to tests/fm-kimi-harness.test.sh rather than a new script, because that suite already owns fm-spawns pane-environment contract (it is where the GOTMPDIR pane export is asserted) and the repo style rule says extend an existing script rather than invent a runner. It asserts the observable behavior (what fm-spawn actually sends to the pane, captured in tmux-calls.log), not source bytes.
  • EDITOR/VISUAL and GH_EDITOR were deliberately NOT set: the tickets blast-radius analysis is git-specific, and GIT_EDITOR already takes precedence over core.editor and EDITOR for git.

Validation already run locally: bin/fm-lint.sh clean, bin/fm-doc-audience-check.sh clean, and bin/fm-test-run.sh --changed --base origin/main over 36 scripts. Three failures there were each reproduced on clean origin/main with the change stashed, so they are pre-existing and unrelated: fm-arm-pretool-check "A13 via codex must allow", fm-calm-pi-extension "loaded_off case rendered a duplicate captain answer" (live-pi E2E), and fm-test-run "scheduler waited for oldest worker" (timing-sensitive 0.5s vs 0.05s fixtures; passes when run alone, flakes under a 36-script load).

An earlier attempt raised this as PR #48 directly with gh pr create; the Require no-mistakes gate correctly rejected it and it was closed, which is why this is coming through the pipeline instead.

What Changed

  • bin/fm-spawn.sh now exports GIT_EDITOR=true and GIT_SEQUENCE_EDITOR=true into every crewmate pane shell before the agent starts, preventing code --wait-style editor hangs on rebase --continue, commit without -m, non-fast-forward merges, revert, tag -a, and cherry-pick --continue.
  • bin/fm-brief.sh gains a rule 8 in both scout and ship scaffolds instructing crewmates never to let git open an editor (with fallback diagnostics), and a ship-only rule 9 forbidding removal of sibling worktrees when a branch-checked-out conflict occurs.
  • tests/fm-kimi-harness.test.sh extends the existing pane-environment contract test to assert that the new GIT_EDITOR export appears in the tmux-calls log.

Risk Assessment

✅ Low: Both fix layers are minimal and well-bounded: a two-variable unconditional export before agent launch in fm-spawn.sh, and two appended rules that cannot break existing numbered cross-references in fm-brief.sh.

Testing

Ran the fm-kimi-harness suite (17 tests, 28s). The new assertion in test_kimi_launch_then_send_is_verified confirms fm-spawn.sh actually emits the git-editor export to the pane — the core behavioral contract for Layer 1. All 17 tests passed; no failures.

Evidence: fm-kimi-harness test output

FM_TEST_BEGIN 2026-08-05T10:34:55Z tests/fm-kimi-harness.test.sh family=pure-contract-unit ok - fm-spawn: kimi launches, delivers its brief, and registers a guarded turn-end token [16 other tests] FM_TEST_END exit=0 duration_ms=27898 FM_TEST_SUMMARY total=1 failed=0

FM_TEST_BEGIN 2026-08-05T10:34:55Z tests/fm-kimi-harness.test.sh family=pure-contract-unit expected_gate_skip=none
ok - Kimi hook install is idempotent and removal restores every foreign config byte
ok - Kimi hook removal preserves owned newline boundaries and pristine bytes
ok - Kimi hook install refuses missing, malformed, and surprising config without writing
ok - Kimi hook install refuses without jq before any config write
ok - fm-spawn: kimi launches, delivers its brief, and registers a guarded turn-end token
ok - Kimi hook stays silent and inert without a Firstmate registry token
ok - fm-spawn: unsafe Kimi global config refuses before pane creation
ok - fm-teardown: Kimi task pointer and registry token are removed
ok - fm-spawn: Kimi fallback expands the active HOME
ok - fm-spawn: missing Kimi executable refuses before pane creation
ok - fm-spawn: kimi treats a silent pointer drop as a failed spawn
ok - fm-spawn: kimi never sends the brief pointer before an observable ready signal
ok - fm-harness: markerless kimi is detected by ancestry after env-marker precedence
ok - fm-lock recognizes Kimi ancestry and live lock holders
ok - busy detection: real Kimi moon-plus-middot captures require its harness while idle labels stay idle
ok - fm-watch classifies Kimi as unknown rather than from its spinner, and Grok's fallback stays isolated
ok - composer classifier: kimi's existing bordered > shape is already safe without an override
FM_TEST_END 2026-08-05T10:35:23Z tests/fm-kimi-harness.test.sh exit=0 duration_ms=27898 gate_skip=false
FM_TEST_SUMMARY total=1 failed=0 skipped_gate=0 duration_ms=27985

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.

  • bin/fm-test-run.sh tests/fm-kimi-harness.test.sh — 17 tests passed including test_kimi_launch_then_send_is_verified, which asserts export GIT_EDITOR=true GIT_SEQUENCE_EDITOR=true appears in tmux-calls.log (the observable pane-environment contract)
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

A crewmate has no terminal a human can type into, but it inherits the
machine's configured git editor. On this machine that is `code --wait`,
which blocks until a human closes the tab. Any git command that opens an
editor - `rebase --continue`/`-i`, `commit` without `-m`, non-ff `merge`,
`revert`, `tag -a`, `cherry-pick --continue` - therefore hangs forever
with no output and no error. The pane looks identical to a thinking pane,
so nothing surfaces it until the staleness window expires, and the agent's
natural response (retry) stacks more orphaned waiters on the same file.
Observed live on task parlay-45-rebase: three wedged attempts, ~15 min lost,
resolved only by killing the editor waiters by hand.

Two layers, both here:

- fm-spawn now exports GIT_EDITOR=true and GIT_SEQUENCE_EDITOR=true into
  the crewmate's pane shell alongside GOTMPDIR, before the harness launch,
  so the whole class is impossible rather than each worker remembering.
  `true` exits 0 without touching the file, so git proceeds with the commit
  message or rebase todo as written.
- fm-brief adds rule 8 to both the scout and ship Rules sections: never let
  git open an editor, and treat a git command that is silent for over a
  minute as a blocked editor rather than a slow operation.

Also lands the fix violation-0gh asks for, since it is the same one-line
brief addition: ship rule 9 tells a worker whose branch is already checked
out elsewhere to use a detached HEAD, never to remove or modify another
worktree.

New rules are appended rather than inserted so the existing "rule 6"
cross-reference in the ship brief stays correct.

Covered by a new pane-export assertion in tests/fm-kimi-harness.test.sh,
which owns fm-spawn's pane environment contract.
@coderabbitai

coderabbitai Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@trillium, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 8 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ae0155e6-2854-4784-a789-f1f84a7e82ed

📥 Commits

Reviewing files that changed from the base of the PR and between 4cf593a and 79b1e8b.

📒 Files selected for processing (3)
  • bin/fm-brief.sh
  • bin/fm-spawn.sh
  • tests/fm-kimi-harness.test.sh

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@trillium
trillium merged commit b83cac3 into main Aug 5, 2026
10 checks passed
@trillium
trillium deleted the robots-1xw8/noninteractive-git-editor branch August 5, 2026 13:10
trillium added a commit that referenced this pull request Aug 6, 2026
…true (#49)

* fix(spawn): give crewmates non-interactive git editors (robots-1xw8)

A crewmate has no terminal a human can type into, but it inherits the
machine's configured git editor. On this machine that is `code --wait`,
which blocks until a human closes the tab. Any git command that opens an
editor - `rebase --continue`/`-i`, `commit` without `-m`, non-ff `merge`,
`revert`, `tag -a`, `cherry-pick --continue` - therefore hangs forever
with no output and no error. The pane looks identical to a thinking pane,
so nothing surfaces it until the staleness window expires, and the agent's
natural response (retry) stacks more orphaned waiters on the same file.
Observed live on task parlay-45-rebase: three wedged attempts, ~15 min lost,
resolved only by killing the editor waiters by hand.

Two layers, both here:

- fm-spawn now exports GIT_EDITOR=true and GIT_SEQUENCE_EDITOR=true into
  the crewmate's pane shell alongside GOTMPDIR, before the harness launch,
  so the whole class is impossible rather than each worker remembering.
  `true` exits 0 without touching the file, so git proceeds with the commit
  message or rebase todo as written.
- fm-brief adds rule 8 to both the scout and ship Rules sections: never let
  git open an editor, and treat a git command that is silent for over a
  minute as a blocked editor rather than a slow operation.

Also lands the fix violation-0gh asks for, since it is the same one-line
brief addition: ship rule 9 tells a worker whose branch is already checked
out elsewhere to use a detached HEAD, never to remove or modify another
worktree.

New rules are appended rather than inserted so the existing "rule 6"
cross-reference in the ship brief stays correct.

Covered by a new pane-export assertion in tests/fm-kimi-harness.test.sh,
which owns fm-spawn's pane environment contract.

* no-mistakes: apply CI fixes
trillium added a commit that referenced this pull request Aug 6, 2026
…true (#49)

* fix(spawn): give crewmates non-interactive git editors (robots-1xw8)

A crewmate has no terminal a human can type into, but it inherits the
machine's configured git editor. On this machine that is `code --wait`,
which blocks until a human closes the tab. Any git command that opens an
editor - `rebase --continue`/`-i`, `commit` without `-m`, non-ff `merge`,
`revert`, `tag -a`, `cherry-pick --continue` - therefore hangs forever
with no output and no error. The pane looks identical to a thinking pane,
so nothing surfaces it until the staleness window expires, and the agent's
natural response (retry) stacks more orphaned waiters on the same file.
Observed live on task parlay-45-rebase: three wedged attempts, ~15 min lost,
resolved only by killing the editor waiters by hand.

Two layers, both here:

- fm-spawn now exports GIT_EDITOR=true and GIT_SEQUENCE_EDITOR=true into
  the crewmate's pane shell alongside GOTMPDIR, before the harness launch,
  so the whole class is impossible rather than each worker remembering.
  `true` exits 0 without touching the file, so git proceeds with the commit
  message or rebase todo as written.
- fm-brief adds rule 8 to both the scout and ship Rules sections: never let
  git open an editor, and treat a git command that is silent for over a
  minute as a blocked editor rather than a slow operation.

Also lands the fix violation-0gh asks for, since it is the same one-line
brief addition: ship rule 9 tells a worker whose branch is already checked
out elsewhere to use a detached HEAD, never to remove or modify another
worktree.

New rules are appended rather than inserted so the existing "rule 6"
cross-reference in the ship brief stays correct.

Covered by a new pane-export assertion in tests/fm-kimi-harness.test.sh,
which owns fm-spawn's pane environment contract.

* no-mistakes: apply CI fixes
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