Skip to content

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

Closed
trillium wants to merge 1 commit into
mainfrom
robots-1xw8/noninteractive-git-editor
Closed

trillium wants to merge 1 commit into
mainfrom
robots-1xw8/noninteractive-git-editor

Conversation

@trillium

@trillium trillium commented Aug 5, 2026 •

Copy link
Copy Markdown
Owner

Problem

A crewmate has no terminal a human can type into, but it inherits the machine's configured git editor — here bash /usr/local/bin/code --wait, which blocks until a human closes the tab. Any git command that opens an editor hangs forever with no output and no error:

rebase --continue / rebase -i, commit without -m, non-fast-forward merge, revert, tag -a, cherry-pick --continue.

A wedged 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 COMMIT_EDITMSG.

Observed live on task parlay-45-rebase: three wedged attempts on the same file (waiters aged 7m09s and 5m07s still parked), ~15 min lost. Killing the waiters let git read COMMIT_EDITMSG as-is; the rebase completed and pushed cleanly, so it was purely an editor deadlock — no work was ever at risk.

Fix — two layers

  1. Environment (the real fix). bin/fm-spawn.sh now exports GIT_EDITOR=true GIT_SEQUENCE_EDITOR=true into the crewmate's pane shell alongside GOTMPDIR, before the harness launch. true exits 0 without touching the file, so git proceeds with the commit message / rebase todo as written instead of waiting. This makes the whole class impossible rather than asking each worker to remember.
  2. Brief (belt and braces). bin/fm-brief.sh gains rule 8 in 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 in another worktree to use a detached HEAD, never to remove or modify that worktree.

New rules are appended, not inserted, so the existing "escalate to firstmate (rule 6)" cross-reference in the ship brief stays correct.

Tests

New pane-export assertion in tests/fm-kimi-harness.test.sh, which already owns fm-spawn's pane environment contract (it is where the GOTMPDIR export is asserted).

bin/fm-test-run.sh --changed --base origin/main → 36 scripts, 3 failures, all reproduced on clean origin/main:

  • fm-arm-pretool-check — "A13 via codex must allow" — fails on baseline.
  • fm-calm-pi-extension — "loaded_off case rendered a duplicate captain answer" — fails on baseline (live-pi E2E).
  • 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.

Closes robots-1xw8. Addresses violation-0gh.

Summary by CodeRabbit

  • Bug Fixes

    • Prevented Git operations from becoming blocked by interactive editor prompts during automated workflows.
    • Added guidance for resolving stalled editor processes and handling branches used across multiple worktrees.
    • Improved Git behavior when working from detached HEAD states or pushing explicitly.
  • Tests

    • Added verification that launched workflows use non-interactive Git editor settings.

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

Review Change Stack

📝 Walkthrough

Walkthrough

The change adds Git editor-safety rules to scout and ship briefs. Spawned panes now export noninteractive Git editor variables. The Kimi harness verifies both variables.

Changes

Git editor safety

Layer / File(s) Summary
Brief editor and worktree guidance
bin/fm-brief.sh
Scout and ship briefs require noninteractive Git editors. They document stalled-editor checks and worktree recovery steps.
Spawned pane editor configuration
bin/fm-spawn.sh, tests/fm-kimi-harness.test.sh
The spawned pane exports GIT_EDITOR=true and GIT_SEQUENCE_EDITOR=true. The Kimi launch test verifies both exports.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: kunchenguid

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: configuring non-interactive Git editors for spawned crewmates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch robots-1xw8/noninteractive-git-editor

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 commented Aug 5, 2026

Copy link
Copy Markdown
Owner Author

Closing: this was raised directly with gh pr create, which the Require no-mistakes gate correctly rejects. Resubmitting the same commit through git push no-mistakes per CONTRIBUTING.md.

@trillium trillium closed this Aug 5, 2026
@trillium
trillium deleted the robots-1xw8/noninteractive-git-editor branch August 5, 2026 10:29

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@bin/fm-brief.sh`:
- Around line 466-467: Scope the editor-waiter recovery guidance at
bin/fm-brief.sh lines 466-467 to the current task by locating only verified
child processes of the current Git process, including pane identity where
available, before terminating a PID; do not use an unrestricted host-wide
search. Apply the identical guarded recovery procedure at bin/fm-brief.sh lines
649-650 for ship briefs.

In `@tests/fm-kimi-harness.test.sh`:
- Around line 212-213: Strengthen the test around the kimi spawn flow: use the
existing tmux call log to assert the export command occurs before the Kimi
launch, and update the fake kimi executable to record the inherited GIT_EDITOR
and GIT_SEQUENCE_EDITOR values, asserting both are true. Keep the regression
coverage in the relevant test case and retain the existing failure diagnostics.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b43285a1-c689-410d-9e70-4948ed93482a

📥 Commits

Reviewing files that changed from the base of the PR and between 4cf593a and 5b42e0b.

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

Comment thread bin/fm-brief.sh
Comment on lines +466 to +467
editor waiting on a human, not a slow operation: check with \`pgrep -fl 'COMMIT_EDITMSG|--wait'\`
and kill the waiter rather than retrying, since each retry stacks another orphaned waiter.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Scope blocked-editor recovery to the current task.

The recovery guidance searches the full host process list and does not require process ownership, ancestry, or pane identity before termination. A crewmate can stop another agent's editor or an unrelated --wait process.

  • bin/fm-brief.sh#L466-L467: require a verified child of the current Git process before terminating a PID.
  • bin/fm-brief.sh#L649-L650: apply the same scoped recovery procedure to ship briefs.

As per coding guidelines, operational shell scripts must use their owning procedures and guarded paths for mutation, merge, teardown, synchronization, and recovery; do not bypass those guards with lower-level commands.

📍 Affects 1 file
  • bin/fm-brief.sh#L466-L467 (this comment)
  • bin/fm-brief.sh#L649-L650
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@bin/fm-brief.sh` around lines 466 - 467, Scope the editor-waiter recovery
guidance at bin/fm-brief.sh lines 466-467 to the current task by locating only
verified child processes of the current Git process, including pane identity
where available, before terminating a PID; do not use an unrestricted host-wide
search. Apply the identical guarded recovery procedure at bin/fm-brief.sh lines
649-650 for ship briefs.

Source: Coding guidelines

Comment on lines +212 to +213
assert_grep "export GIT_EDITOR=true GIT_SEQUENCE_EDITOR=true" "$CASE_DIR/tmux-calls.log" \
"kimi spawn did not export non-interactive git editors into the pane (robots-1xw8)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Assert export order and inherited environment.

assert_grep proves only that the fake tmux log contains the export text. It passes if the export is sent after the Kimi launch, and it does not prove that the launched process sees either variable. Check call order and record the environment observed by the fake kimi.

As per coding guidelines, **/*.test.* files must add behavioral regression tests when an executable contract exists, especially when correcting a reproduced bug.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/fm-kimi-harness.test.sh` around lines 212 - 213, Strengthen the test
around the kimi spawn flow: use the existing tmux call log to assert the export
command occurs before the Kimi launch, and update the fake kimi executable to
record the inherited GIT_EDITOR and GIT_SEQUENCE_EDITOR values, asserting both
are true. Keep the regression coverage in the relevant test case and retain the
existing failure diagnostics.

Source: Coding guidelines

@trillium
trillium restored the robots-1xw8/noninteractive-git-editor branch August 5, 2026 10:44
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