Skip to content

fix: support Grok 0.2.111 busy-state signals#985

Open
jeremiahoclark wants to merge 4 commits into
kunchenguid:mainfrom
jeremiahoclark:fm/record-grok-adapter
Open

fix: support Grok 0.2.111 busy-state signals#985
jeremiahoclark wants to merge 4 commits into
kunchenguid:mainfrom
jeremiahoclark:fm/record-grok-adapter

Conversation

@jeremiahoclark

Copy link
Copy Markdown

Intent

Add Grok CLI as a fully verified firstmate harness adapter so project tasks can be launched, supervised, resumed, validated, and stopped through the normal lifecycle. Start from the existing smoke evidence but empirically verify terminal mechanics in a disposable worktree directory, including autonomous launch and permission flags, positional prompt submission, busy and idle signatures, interrupt and clean exit, resume, dialogs, and no-mistakes skill invocation. Implement Grok anywhere the supported harness set is enumerated, including launch, detection, session locking, supervision busy signatures, turn-end handling, adapter documentation with date and CLI version, and focused tests, without changing unrelated adapters. On the current main baseline most Grok enumeration and lifecycle support already existed; live Grok 0.2.111 verification exposed a changed busy footer and interrupt key, so this branch updates the shared tmux and watcher busy signature from Ctrl+c:cancel to Esc:cancel, refreshes verified adapter facts, and adds focused regression coverage while preserving the existing launch and hook mechanics.

What Changed

  • Recognize Grok 0.2.111’s Esc:cancel busy marker while preserving support for the legacy Ctrl+c:cancel footer across tmux, watcher, crew-state, and supervision paths.
  • Centralize watcher busy detection on the shared tmux regex and update Grok adapter and configuration documentation for the verified 0.2.111 terminal behavior.
  • Add regression coverage for current and legacy Grok busy footers, idle-state rejection, and shared pane classification.

Risk Assessment

✅ Low: Captain, the change is narrowly scoped, preserves both verified Grok busy markers, centralizes runtime detection, and introduces no substantiated regression.

Testing

Startup, runtime version, target identity, focused Grok lifecycle tests, adjacent supervision/state regressions, private-tmux evidence, and a credentialed live Grok 0.2.111 busy/interrupt/idle flow all passed; an extra unchanged-path /exit setup did not reach a fresh idle composer within its bounded window and was excluded from acceptance evidence, all test-owned temporary files were removed, and the worktree finished clean.

Evidence: Live Grok 0.2.111 TUI busy/interrupt evidence
Installed runtime: grok 0.2.111 (94172f2aa4e5) [stable]
Live busy footer:   Shift+Tab:mode  │  Esc:cancel  │  Ctrl+x:shortcuts
Production classification while active: BUSY
Interrupt result: Escape cleared the cancel footer in 0.00s
Live idle footer:   Enter:send  │  Shift+Tab:mode  │  Ctrl+x:shortcuts
Production classification after interrupt: IDLE
LIVE_TUI_RESULT: Grok 0.2.111 busy detection, Escape interrupt, and idle detection verified.
Evidence: Base-versus-target classification comparison
Observed Grok 0.2.111 footer: Shift+Tab:mode  │  Esc:cancel  │  Ctrl+x:shortcuts

Base commit regex:   esc (to )?interrupt|Working\.\.\.|Ctrl\+c:cancel
Base classification: IDLE (misses the active Grok turn)

Target commit regex:   esc (to )?interrupt|Working\.\.\.|(Ctrl\+c|Esc):cancel
Target classification: BUSY (active turn remains supervised)

Idle Grok footer:      Shift+Tab:mode  │  Ctrl+x:shortcuts
Idle classification:   IDLE (no false busy state)
Evidence: Production tmux classification transcript
Installed runtime: grok 0.2.111 (94172f2aa4e5) [stable]
Production regex: esc (to )?interrupt|Working\.\.\.|(Ctrl\+c|Esc):cancel

Pane grok-new
  rendered footer: Shift+Tab:mode  │  Esc:cancel  │  Ctrl+x:shortcuts
  supervisor classification: BUSY (expected BUSY)

Pane grok-old
  rendered footer: Shift+Tab:mode  │  Ctrl+c:cancel  │  Ctrl+x:shortcuts
  supervisor classification: BUSY (expected BUSY)

Pane grok-idle
  rendered footer: Shift+Tab:mode  │  Ctrl+x:shortcuts
  supervisor classification: IDLE (expected IDLE)

RESULT: Grok 0.2.111 busy panes remain supervised; idle panes are not falsely marked busy.
Evidence: Focused Grok harness test transcript
FM_TEST_BEGIN 2026-07-24T14:59:25Z tests/fm-grok-harness.test.sh family=pure-contract-unit expected_gate_skip=none
ok - verified grok busy footers distinguish busy from idle
ok - grok global hook requires a firstmate registry token
ok - grok teardown removes pointer and token state
ok - fm-lock recognizes grok harness processes
FM_TEST_END 2026-07-24T14:59:38Z tests/fm-grok-harness.test.sh exit=0 duration_ms=12605 gate_skip=false
FM_TEST_SUMMARY total=1 failed=0 skipped_gate=0 duration_ms=13060
FM_TEST_SUMMARY_FAMILY family=pure-contract-unit count=1 duration_ms=12605 failed=0
FM_TEST_SLOWEST rank=1 script=tests/fm-grok-harness.test.sh duration_ms=12605

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 3 issues found → auto-fixed ✅
  • ⚠️ bin/fm-tmux-lib.sh:66 - Replacing the old signature drops compatibility with previously verified Grok versions, while no spawn/bootstrap path requires Grok >=0.2.111. Older installations still launch, but active turns using Ctrl+c:cancel appear idle to watcher, crew-state, and away-mode fallbacks. Decide whether to preserve both signatures or enforce a minimum Grok version.
  • ⚠️ docs/configuration.md:435 - The documented FM_BUSY_REGEX override still contains only Ctrl\+c:cancel. Because this override replaces the new default everywhere, users following the configuration reference will break busy detection on Grok 0.2.111. Update it to the selected current or dual-version pattern.
  • ℹ️ bin/fm-watch.sh:108 - Use the already-loaded shared default (FM_TMUX_BUSY_REGEX_DEFAULT) here instead of duplicating the regex literal. This non-functional simplification prevents watcher detection from drifting from crew-state and daemon consumers.

🔧 Fix: Captain, preserve Grok busy markers across versions
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • bin/fm-session-start.sh
  • grok --version
  • bin/fm-test-run.sh tests/fm-grok-harness.test.sh
  • bin/fm-test-run.sh tests/fm-tmux-submit-busy.test.sh tests/fm-crew-state.test.sh tests/fm-watch-triage.test.sh
  • bin/fm-test-run.sh tests/fm-spawn-dispatch-profile.test.sh tests/fm-supervision-instructions.test.sh
  • Private-socket tmux verification using production fm_pane_is_busy against Grok 0.2.111, legacy, and idle footers
  • Base-versus-target classification using git show 10ee7797e50c88c9865d8fb382cdfee5c2b8bcd1:bin/fm-tmux-lib.sh and target bin/fm-tmux-lib.sh
  • Credentialed, isolated Grok 0.2.111 TUI verification of positional launch, live busy footer, production classification, Escape interrupt, and post-interrupt idle classification
  • git diff --check 10ee7797e50c88c9865d8fb382cdfee5c2b8bcd1..c539c29fb553363c24f8cd81c2dd6b0b2a7acbd0
  • Final git status --short --untracked-files=all and git rev-parse HEAD cleanup/identity audit
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

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