Skip to content

fix(screentracker): prevent Send() from blocking when ReadyForInitialPrompt stays false#215

Draft
johnstcn wants to merge 3 commits intofix/write-stabilize-non-fatal-phase1from
fix/send-blocks-initial-prompt-not-ready
Draft

fix(screentracker): prevent Send() from blocking when ReadyForInitialPrompt stays false#215
johnstcn wants to merge 3 commits intofix/write-stabilize-non-fatal-phase1from
fix/send-blocks-initial-prompt-not-ready

Conversation

@johnstcn
Copy link
Copy Markdown
Member

@johnstcn johnstcn commented Apr 8, 2026

Fixes #209. Stacked on #208.

Changes

  • Make statusLocked() return "changing" when initialPromptReady is false, so Send() rejects with ErrMessageValidationChanging instead of blocking forever
  • Add (U+254C) as alternative to (U+2500) in findGreaterThanMessageBox / findGenericSlimMessageBox for Claude Code v2.1.87 onboarding screens
  • Add testdata fixture for the dashed-line Claude screen
  • Add TestSendRejectsWhenInitialPromptNotReady regression test
  • Update four existing tests that asserted stable when initialPromptReady was false
Implementation plan and decision log

Root cause

statusLocked() didn't check initialPromptReady. It returned "stable" when the screen was calm, but the stableSignal (which the send loop waits on) required initialPromptReady == true. If readiness never arrived, Send() blocked forever.

Key decisions

Decision Rationale
Return "changing" (not "initializing") Snapshot buffer is full (past initializing). "changing" matches ErrMessageValidationChanging.
Unconditional guard (not only when InitialPrompt configured) stableSignal gates ALL outbound messages on initialPromptReady, not just initial prompts. Status must reflect actual send capability.
U+254C only (not broader char set) This is the specific character seen in the wild. The statusLocked guard is the safety net for future unknown characters.
Update existing test assertions Four tests documented the buggy behavior (stable when not ready). Updated to expect changing.

🤖 Written by a Coder Agent. Will be reviewed by a human.

johnstcn added 3 commits April 8, 2026 16:45
…hed line

Claude Code v2.1.87 decided to get fancy with its onboarding screen,
using ╌ (BOX DRAWINGS LIGHT DOUBLE DASH HORIZONTAL) instead of the
classic ─ (BOX DRAWINGS LIGHT HORIZONTAL). Our detector stared at
this new character like a cat seeing a cucumber.

Add ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ as an alternative pattern in both
findGreaterThanMessageBox and findGenericSlimMessageBox.

Refs: #209
statusLocked() used to report 'stable' when the screen was calm,
blissfully unaware that initialPromptReady was false. Send() would
trust this optimistic status, enqueue a message, and then wait
forever for a stableSignal that would never arrive — like waiting
for a bus that got cancelled.

Return 'changing' when initialPromptReady is false so Send() rejects
immediately with ErrMessageValidationChanging instead of ghosting the
caller.

Fixes: #209
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

✅ Preview binaries are ready!

To test with modules: agentapi_version = "agentapi_215" or download from: https://github.com/coder/agentapi/releases/tag/agentapi_215

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