Skip to content

fix(bin): detect Grok 4.5 busy workers correctly - #5

Merged
sparkus merged 1 commit into
mainfrom
fm/fix-grok45-busy-detection
Aug 3, 2026
Merged

fix(bin): detect Grok 4.5 busy workers correctly#5
sparkus merged 1 commit into
mainfrom
fm/fix-grok45-busy-detection

Conversation

@sparkus

@sparkus sparkus commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Intent

Fix firstmate's stall detection for Grok 4.5 workers so firstmate can tell a stuck Grok 4.5 worker from a healthy one (both false negatives and false positives).

Confirmed live bug: harness-adapters and busy detection recorded busy as ASCII Ctrl+c:cancel in the keybind footer, but Grok 4.5 / Build 0.2.118 renders Esc:cancel instead (e.g. Shift+Tab:mode | Esc:cancel | Ctrl+x:shortcuts mid-turn; idle has no :cancel token). That made busy/idle classification wrong for every Grok 4.5 worker. Also recorded that interrupt is only Ctrl+C and that Esc only moves focus to scrollback and does NOT interrupt - false on 4.5; Escape DOES cancel the running turn (also verified Ctrl+C still cancels mid-turn).

Requirements:

  • Verify both facts against running Grok Build before changing (done: live pane captures on 0.2.118).
  • Make busy detection correct for BOTH the older Ctrl+c:cancel footer and 4.5's Esc:cancel, so a mixed fleet keeps working; do not simply swap one literal for another.
  • Correct the interrupt fact in harness-adapters, including removing the explicit false Escape claim rather than softening it.
  • Check bin/fm-tmux-lib.sh and anything else that consumes that signature (including fm-busy-lib.sh grok-regex fallback).
  • Detection driven by matched patterns (ERE alternation of verified forms) rather than a single hard-coded literal, so the next rename is a data change.
  • Stay inside detection and documentation fix; do not redesign supervision, the watcher, or the adapter contract.

Acceptance (executable tests where code allows):

  • Running Grok 4.5 turn classified BUSY; idle classified IDLE (both directions).
  • Older footer form still classifies correctly with its own test coverage.
  • Interrupt documented in harness-adapters is the one that actually cancels on 4.5; false Escape claim removed.

What Changed

  • Match both older Ctrl+c:cancel and Grok 4.5 Esc:cancel footers across tmux and Grok-specific busy detection while keeping idle footers classified correctly.
  • Correct the Grok adapter documentation for current busy-footer and interrupt behavior, including Escape cancellation.
  • Add regression coverage for older busy, Grok 4.5 busy, and Grok 4.5 idle captures across all affected consumers.

Risk Assessment

✅ Low: Captain, the change is narrowly scoped and consistently updates both Grok detection paths, preserves the older footer, correctly documents interruption, and adds busy/idle coverage without a source-verifiable regression.

Testing

No baseline test output was supplied. After correcting an evidence-command shell mismatch by rerunning under Bash, all targeted regression tests, direct captured-footer classification checks, documentation audit, scope audit, and final cleanliness check passed. This is CLI detection and documentation behavior, so screenshot evidence was not applicable.

Evidence: Grok busy/idle classification transcript

Older footer: busy grok-regex Grok 4.5 footer: busy grok-regex Grok 4.5 idle footer: idle grok-regex Obsolete interrupt claims: 0

Grok rendered-footer classification evidence
Target SHA: 6a68056408920adb8b11d324d3e7089a0177fea6
Configured Grok ERE: (Ctrl\+c|Esc):cancel

Older mid-turn footer
  rendered: Shift+Tab:mode  │  Ctrl+c:cancel  │  Ctrl+.:shortcuts
  stall classifier: busy grok-regex
  tmux delivery guard: busy
Grok 4.5 mid-turn footer
  rendered: Shift+Tab:mode  │  Esc:cancel  │  Ctrl+x:shortcuts
  stall classifier: busy grok-regex
  tmux delivery guard: busy
Grok 4.5 idle footer
  rendered: Shift+Tab:mode  │  Ctrl+x:shortcuts
  stall classifier: idle grok-regex
  tmux delivery guard: idle

Documented Grok interrupt fact
| Interrupt | single Escape cancels the running turn on Grok 4.5 (footer shows `Esc:cancel` mid-turn; verified 2026-08-02 on Build 0.2.118). A single `Ctrl+C` also cancels a running turn on 4.5. Prefer Escape when the live footer shows `Esc:cancel`. Escape is the cancel key mid-turn, not a scrollback-only focus move. |
Obsolete Escape-does-not-interrupt claims: 0

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.

  • bash tests/fm-busy-state.test.sh
  • bash tests/fm-busy-adapter-wiring.test.sh
  • bash tests/fm-crew-state.test.sh
  • bash tests/fm-tmux-submit-busy.test.sh
  • Under /bin/bash, sourced bin/fm-busy-lib.sh and bin/fm-tmux-lib.sh and classified older busy, Grok 4.5 busy, and Grok 4.5 idle captures through both consumers
  • rg -n 'FM_TMUX_GROK_BUSY_REGEX_DEFAULT|fm_busy_grok_tail_busy|fm_pane_is_busy' bin/fm-tmux-lib.sh bin/fm-busy-lib.sh
  • Searched tracked source for Esc.*only moves focus|does NOT interrupt and found no matches
  • git status --short --untracked-files=all
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Grok Build 0.2.118 / Grok 4.5 shows Esc:cancel mid-turn instead of
Ctrl+c:cancel, so busy detection missed every live turn and idle alarms
could fire on healthy workers. Match both verified cancel-footer forms as
an alternation, correct the Escape interrupt fact, and cover busy/idle for
each form in the existing busy-state tests.
@sparkus
sparkus merged commit a5dd005 into main Aug 3, 2026
10 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