Skip to content

Fix unreliable blocked detection for Codex tmux runs#417

Merged
proboscis merged 2 commits intomainfrom
issue/orch-437/run-20260211-024708
Feb 11, 2026
Merged

Fix unreliable blocked detection for Codex tmux runs#417
proboscis merged 2 commits intomainfrom
issue/orch-437/run-20260211-024708

Conversation

@proboscis
Copy link
Owner

Summary

  • Fix tmux-agent status ordering so prompt detection (hasPrompt) is evaluated before output-change detection.
  • Make prompt detection Codex-aware by checking only recent pane lines and treating explicit active-work markers (esc to interrupt, working (, background terminal running) as not blocked.
  • Add Codex prompt patterns observed from live tmux captures (including Use /skills to list available skills).
  • Add blocked-status debounce in daemon monitoring: prompt must be seen for 2 consecutive checks before transitioning to blocked.
  • Add daemon debug logging for pane hash + prompt/busy signals per tick.

Acceptance Criteria Evidence

1) Codex runs correctly show block when idle/waiting for input

Implemented by:

  • internal/agent/manager.go (GetStatus priority + improved IsWaitingForInput)
  • internal/daemon/monitor.go (recordPromptSignal debounce)

Live Codex pane capture (idle/blocked signal):

---POST SIGNALS---
12:  ? for shortcuts ...
35:• done
40:  ? for shortcuts ...

(Idle state shows prompt hints and no active esc to interrupt marker.)

2) No false block during active Codex execution

Live Codex pane capture while active:

---ACTIVE SIGNALS---
12:  ? for shortcuts ...
27:• Working (0s • esc to interrupt)
32:  ? for shortcuts ...

(? for shortcuts is visible while active, so the new busy-marker guard prevents false blocked classification.)

Unit test coverage:

  • TestIsWaitingForInput/codex_active_work_should_not_be_treated_as_blocked
  • TestIsWaitingForInput/codex_background_task_should_not_be_treated_as_blocked

3) Claude Code and Gemini blocked detection continue working unchanged

Prompt patterns for existing agents were preserved; existing Claude prompt tests still pass:

  • TestIsWaitingForInput/claude_prompt
  • TestIsWaitingForInput/claude_shortcuts_prompt

4) Add Codex-specific prompt patterns based on actual pane captures

Added pattern:

  • use /skills to list available skills

Pattern chosen from live tmux captures in this branch.

5) Add tests for new detection logic

Added/updated tests:

  • internal/agent/manager_test.go
    • Codex blocked vs active prompt detection cases
    • Prompt-overrides-output-change status case
  • internal/daemon/monitor_test.go
    • TestRunStateRecordPromptSignalDebounce

6) hashContent() or GetStatus() handles Codex TUI layout differences

Handled in GetStatus + prompt detection path:

  • Prompt detection now overrides output-change only when prompt is stable (debounced), preventing Codex layout churn from masking blocked states.

Verification Commands

  • go test ./internal/agent
  • go test ./internal/daemon
  • go test ./internal/agent -run 'TestIsWaitingForInput|TestMuxManagerGetStatus' -v
  • go test ./internal/daemon -run 'TestRunStateRecordPromptSignalDebounce|TestHashContentIgnoresStatusBar' -v
  • go build ./...
  • make lint

Note: go test ./... currently fails in an existing unrelated test:

  • internal/cli -> TestApplyConfigDefaultsFallbacks (invalid config schema ... EOF)

Issue

Refs: orch-437

@proboscis proboscis merged commit 82729a5 into main Feb 11, 2026
1 of 2 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