Skip to content

fix: replace WAITING_USER_ANSWER regex to prevent stale scrollback false positives#142

Merged
haofeif merged 3 commits intoawslabs:mainfrom
patricka3125:fix/wait-user-answer-regex
Apr 2, 2026
Merged

fix: replace WAITING_USER_ANSWER regex to prevent stale scrollback false positives#142
haofeif merged 3 commits intoawslabs:mainfrom
patricka3125:fix/wait-user-answer-regex

Conversation

@patricka3125
Copy link
Copy Markdown
Contributor

@patricka3125 patricka3125 commented Apr 2, 2026

Summary

  • Fix WAITING_USER_ANSWER detection in the Claude Code provider being permanently triggered by stale scrollback history after a user answers a selection prompt
  • Replace content-based pattern (❯.*\d+\.) with the Ink TUI footer (↑/↓ to navigate) that is only present while a selection widget is actively mounted
  • Add regression test verifying stale scrollback without the active footer does not falsely report WAITING_USER_ANSWER

Problem

The old regex ❯.*\d+\. matched numbered selection options (e.g., ❯ 1. Allow once) against the entire tmux capture buffer. After a user answered a prompt, the text persisted in scrollback, causing get_status() to permanently return WAITING_USER_ANSWER. This blocked inbox message delivery in send_message/assign flows — the input queuing bypass treats WAITING_USER_ANSWER as a delivery block, so messages stayed PENDING forever.

On Claude Code 2.1.90, below is a screenshot showing symptoms of this issue occurring.

Terminal status as seen on the Web UI
awaiting_input

supervisor_terminal_output

Here are screenshots of what the Claude Code Ask user widget actually looks
await_user_input_claude
await_user_input2

Solution

The Claude Code Ink TUI renders a navigation footer (Enter to select · ↑/↓ to navigate · Esc to cancel) only while a selection widget is mounted. The footer disappears the instant the user makes a selection. Matching on ↑/↓ to navigate eliminates the stale-scrollback false positive while correctly detecting active prompts.

Handoff mode is unaffected — it bypasses the inbox system entirely.

Test plan

  • Updated 3 existing tests to include the Ink footer in mock output
  • Added test_get_status_stale_scrollback_not_waiting_user_answer — verifies stale numbered scrollback returns COMPLETED, not WAITING_USER_ANSWER
  • Run full unit suite: uv run pytest test/ --ignore=test/e2e -v
  • Manual verification: launch a Claude Code terminal via CAO, trigger a selection prompt, answer it, confirm status transitions correctly

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@61a327a). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #142   +/-   ##
=======================================
  Coverage        ?   90.61%           
=======================================
  Files           ?       44           
  Lines           ?     3708           
  Branches        ?        0           
=======================================
  Hits            ?     3360           
  Misses          ?      348           
  Partials        ?        0           
Flag Coverage Δ
unittests 90.61% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@haofeif haofeif added the bug Something isn't working label Apr 2, 2026
Copy link
Copy Markdown
Contributor

@haofeif haofeif left a comment

Choose a reason for hiding this comment

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

Thanks @patricka3125 LGTM

@haofeif haofeif merged commit 2baf341 into awslabs:main Apr 2, 2026
17 checks passed
erikmackinnon pushed a commit to erikmackinnon/cli-agent-orchestrator that referenced this pull request Apr 3, 2026
…lse positives (awslabs#142)

* fix WAITING_USER_ANSWER regex

* formatting

---------

Co-authored-by: haofeif <56006724+haofeif@users.noreply.github.com>
patricka3125 added a commit to patricka3125/cli-agent-orchestrator that referenced this pull request Apr 3, 2026
…lse positives (awslabs#142)

* fix WAITING_USER_ANSWER regex

* formatting

---------

Co-authored-by: haofeif <56006724+haofeif@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants