Skip to content

fix(status): prefer waiting over working matches - #203

Merged
YoanWai merged 2 commits into
wainmann:mainfrom
snowyukitty:fix/waiting-status-precedence
Aug 3, 2026
Merged

YoanWai merged 2 commits into
wainmann:mainfrom
snowyukitty:fix/waiting-status-precedence

Conversation

@snowyukitty

Copy link
Copy Markdown
Contributor

What changed

  • Prefer a matching waiting rule over an earlier working match within the current pane turn.
  • Put Claude's built-in waiting rules before working rules for newly generated configs while preserving the fix for existing configs.
  • Keep typed input outside the matching scope unless a real waiting footer is present.
  • Add regression coverage for mixed approval panes, persisted rule order, modal footers, and numbered-input false positives.

Why

An approval dialog can coexist with a stale spinner or esc to interrupt line. Returning the first working match makes the session look busy even though it is blocked on the user. The match-time precedence is required for existing config.toml files whose rule order is not migrated.

Closes #112

How it was verified

  • go test ./internal/config ./internal/status

  • go vet ./...

  • go build ./...

  • git diff --check

  • Every changed Go file passes gofmt -l.

  • Synthetic merge trees with the current heads of feat: fork sessions into named siblings #200 and feat(config): add Pi as a built-in tool #201 are conflict-free; those PRs touch adjacent config/test sections but do not implement this status precedence.

  • go test ./... was also attempted on Windows. The touched packages pass, while unrelated packages hit existing Windows-specific assertions and Application Control blocks some temporary test executables.

  • gofmt -l . prints nothing (the Windows CRLF checkout makes the repository-wide form non-actionable; all four changed files pass)

  • go vet ./... passes

  • go test -race ./... passes (not run: this Windows host has no C compiler)

  • Ran it against real sessions

@snowyukitty
snowyukitty requested a review from YoanWai as a code owner August 3, 2026 20:25
@coderabbitai

coderabbitai Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 72c45b75-99a8-4d4d-94db-76e805ffc186

📥 Commits

Reviewing files that changed from the base of the PR and between 340a26e and 60453e5.

📒 Files selected for processing (1)
  • internal/status/status_test.go

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved status detection so waiting prompts and approval dialogs take precedence over stale working states.
    • Added support for recognizing Claude confirmation prompts and numbered selection dialogs as waiting states.
    • Improved handling of mixed approval panes while preserving ordinary numbered input as an active working state.
    • Updated status detection across supported tools for more accurate waiting and working indicators.

Walkthrough

The change updates Claude’s default waiting rules and status matching. Waiting matches can override earlier working matches. Matching scopes now include approval-dialog footers when required. Tests cover Claude and Codex approval and input states.

Changes

Waiting-state detection

Layer / File(s) Summary
Default waiting rule precedence
internal/config/config.go, internal/config/config_test.go, internal/status/status_test.go
Claude approval patterns now precede working patterns. Tests verify waiting-rule ordering and Claude approval patterns.
Waiting match overrides
internal/status/status.go, internal/status/status_test.go
Match allows a later Waiting rule to override an earlier Working result. Tests preserve earlier error matches and cover legacy Claude rule ordering.
Dialog scope detection and fixtures
internal/status/status.go, internal/status/status_test.go
Matching scopes include waiting footers and marker-based dialogs. Claude and Codex tests distinguish approval dialogs from ordinary numbered input.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: yoanwai

Poem

A rabbit checks the prompt in sight,
“Waiting” wins when choices light.
Working trails stay safely known,
Drafts remain in working tone.
Claude and Codex now pause just right.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary status-matching change: waiting matches now take precedence over working matches.
Description check ✅ Passed The description covers the required changes, rationale, issue link, verification steps, and known test limitations.
Linked Issues check ✅ Passed The changes satisfy issue #112 by adding waiting precedence, updating Claude defaults, preserving existing configurations, and adding regression tests.
Out of Scope Changes check ✅ Passed All code and test changes directly support status precedence, Claude configuration ordering, matching scope, and regression coverage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

@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: 1

🤖 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 `@internal/status/status_test.go`:
- Around line 56-135: Add a dedicated test in the Claude status-test block using
defaultEngine with a pane containing “Enter to confirm” alongside a stale
working-spinner signal, and assert Match returns Waiting with matched=true. Keep
the existing numbered-dialog coverage unchanged and follow the assertions used
by TestClaudeMixedApprovalPane.
🪄 Autofix (Beta)

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: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 9eddc296-be3d-457f-b19a-c137ab5279e8

📥 Commits

Reviewing files that changed from the base of the PR and between 264872c and 340a26e.

📒 Files selected for processing (4)
  • internal/config/config.go
  • internal/config/config_test.go
  • internal/status/status.go
  • internal/status/status_test.go

Comment thread internal/status/status_test.go Resolved

@YoanWai YoanWai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for this one! Ran the full race suite here plus a live A/B against real panes: the shipped binary reads a numbered draft during an active turn as waiting, this branch reads it correctly as working, and the mixed approval pane resolves to waiting as intended. Nice work on the footer scoping.

@YoanWai
YoanWai merged commit 5f4b46a into wainmann:main Aug 3, 2026
2 checks passed
@YoanWai

YoanWai commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Shipped in v0.20.0.

@YoanWai YoanWai added type:bug Something isn't working area:status Status detection and classification labels Sep 27, 2026
@agent-manager-bot agent-manager-bot Bot added the size:s 50 to 149 changed lines label Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:status Status detection and classification size:s 50 to 149 changed lines type:bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Claude pane with an approval dialog reads as working, not waiting

2 participants