Skip to content

feat: prompt delivery verification via capture-pane#10

Merged
OneStepAt4time merged 1 commit intomainfrom
fix/prompt-delivery-verification
Mar 22, 2026
Merged

feat: prompt delivery verification via capture-pane#10
OneStepAt4time merged 1 commit intomainfrom
fix/prompt-delivery-verification

Conversation

@OneStepAt4time
Copy link
Copy Markdown
Owner

Fix for Issue #1 β€” Prompt delivery ~20% failure rate

Problem: tmux send-keys is fire-and-forget. ~20% of prompts don't arrive because of race conditions, CC not ready, or Enter key timing.

Solution: Verify β†’ Retry

verifyDelivery(windowId, sentText) in tmux.ts

After sending, captures the pane and checks for delivery evidence:

  1. CC is working (spinner/status line) β†’ confirmed
  2. CC is interactive (permission, plan, question) β†’ confirmed
  3. Sent text visible in pane (first 40 chars prefix match) β†’ confirmed
  4. CC is idle with no trace of input β†’ FAILED
  5. Unknown state β†’ benefit of the doubt (may be transitioning)

sendKeysVerified(windowId, text, maxAttempts=3) in tmux.ts

  • Sends text, waits, verifies
  • Retries with escalating delays: 500ms, 1500ms, 3000ms
  • Returns { delivered: boolean, attempts: number }

API change: POST /sessions/:id/send

Now returns:

{ "ok": true, "delivered": true, "attempts": 1 }

Backward compatible β€” ok: true still present.

Tests

  • 16 new tests in prompt-delivery.test.ts
  • Covers: state detection, text matching, retry logic, API response shape
  • All 208 tests pass

Closes #1

- tmux.ts: add verifyDelivery() β€” checks pane state + text match
- tmux.ts: add sendKeysVerified() β€” retry 3x with backoff
- session.ts: sendMessage() now returns { delivered, attempts }
- server.ts: POST /send returns delivery status in response
- Evidence: working state, interactive prompts, text match, or non-idle state

Fixes #1
@OneStepAt4time OneStepAt4time merged commit 75564a1 into main Mar 22, 2026
2 checks passed
@OneStepAt4time OneStepAt4time deleted the fix/prompt-delivery-verification branch March 22, 2026 02:51
OneStepAt4time added a commit that referenced this pull request Mar 22, 2026
README: badges, Mermaid architecture diagram, complete API reference (15 endpoints),
session states table, CLI docs, env vars, 4 use cases, comparison table,
contributing guide.

CHANGELOG: v1.1.0 with all features from PRs #10-#21.
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.

[P0] Prompt delivery verification β€” capture-pane after send-keys

1 participant