Repository navigation
feat(mecatui): merge queued follow-ups, edit-back, and auto-resume on transient errors (#228) - #229
Conversation
…onsecutive_failures pause Three follow-up nits from PR #229 review: - docs/tui.md: clarify that transient auto-resume fires only when follow-ups are staged — a transient death with an empty queue does not auto-retry the original prompt. - ui/view.go: show the "· ↑ edit" queue hint only when the input is empty (EditBack is gated on empty input); a draft present made the hint misleading. - ui/queue_merge_editback_test.go: add TestMaxConsecutiveFailuresStillPausesEvenIfTransientFlag — max_consecutive_failures pauses regardless of a spurious transient flag (the auto-resume gate requires stop==stopError).
|
Follow-up to the review nits — landed in 1. docs/tui.md — auto-resume scope clarification 2. cmd/mecatui/ui/view.go — gate the 3. cmd/mecatui/ui/queue_merge_editback_test.go — pin The other two review notes were left as-is by design:
|
… transient errors (#228) The follow-up-prompt queue had three UX gaps that surfaced when a run died on a transient upstream idle timeout. This addresses all three: 1. Merge always — multiple queued follow-ups now combine into ONE prompt (joined by a blank line, queueMergeSep) and drain in a single step, matching Claude Code, instead of N sequential FIFO turns. 2. Edit-back — up on an empty input line with a non-empty queue pulls the merged queued text back into the textarea (non-destructive) so it can be revised and re-sent/re-queued. Esc stays clear-all. EditBack is a rebindable keyMap action wired into both the running and idle key paths. 3. Auto-resume transient errors — transient/retryable failures (idle/stalled stream, unavailable/overloaded backend, 429, transient 5xx) auto-fire the merged queue, since a plain retry is likely to succeed; hard errors, a user cancel, max_consecutive_failures, and a clean stream close still pause. Classification (Transient bool + TransientStreamErr/ TransientResultError over a shared vocabulary) lives in the client package; the ui reads only the boolean, preserving the proto-free ui boundary. Auto-resume fires exactly once (the merged queue empties before submit, so the reopened run's own terminal finds an empty queue). Docs (docs/tui.md keys table + queue-behaviour section) updated in lockstep. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01UeMPVTcNMwm134V3L4AAsL
…onsecutive_failures pause Three follow-up nits from PR #229 review: - docs/tui.md: clarify that transient auto-resume fires only when follow-ups are staged — a transient death with an empty queue does not auto-retry the original prompt. - ui/view.go: show the "· ↑ edit" queue hint only when the input is empty (EditBack is gated on empty input); a draft present made the hint misleading. - ui/queue_merge_editback_test.go: add TestMaxConsecutiveFailuresStillPausesEvenIfTransientFlag — max_consecutive_failures pauses regardless of a spurious transient flag (the auto-resume gate requires stop==stopError).
…del-id false-positives
The numeric entries in transientVocab (429/502/503/504) matched as bare
substrings, so an error string carrying those digits in a port number or
model id ("port 50378", "model 1230503", "listening on 42900") was
misclassified as a transient HTTP status and would auto-resume the queue
against a non-retryable failure.
Split the numeric codes into transientCodes and match them with digit-
boundary checks (containsBoundedCode): "503" still matches "HTTP 503"
and "got a 503." but not a code embedded in a longer digit run. The
alphabetic word entries stay substring-matched (they land word-bounded in
real error text). The change is strictly a true→false tightening — no
existing true-positive regresses (all prior test cases have the codes as
standalone tokens), pinned by new boundary cases in both classifier table
tests.
This was the one deferred review nit worth taking (bounded blast radius,
per the PR comment); the ↑/scroll-overload tradeoff stays by design.
7923c79 to
8e65c54
Compare
|
Rebased on latest Addressed the one deferred review nitSubstring false-positives in Split the numeric codes into a The other deferred nit — Verification on the rebased branch
|
Closes #228.
The follow-up-prompt queue in the mecatui Bubble Tea client had three UX gaps that surfaced together when a run died on a transient upstream idle timeout (the queue paused, offering only send-verbatim or drop-everything). This addresses all three, per the decisions locked in the issue.
What changed
1. Merge always
Multiple queued follow-ups now combine into one prompt (staged lines joined by a blank line,
queueMergeSep = "\n\n") and drain in a single step — matching Claude Code — instead of N sequential FIFO turns.popAndSubmitmerges the whole slice; the re-entrantResultMsg → drainQueuenow no-ops on the emptied queue. ThependingModepause is preserved verbatim (merged text lands in the textarea,queuePaused="mode", no submit).2. Edit-back
↑on an empty input line with a non-empty queue pulls the merged queued text back into the textarea (non-destructive) so it can be revised and re-sent/re-queued.escstays clear-all.EditBackis a rebindablekeyMapaction (struct field +defaultKeys()+applyKeyOverridessetter +keymapvalidator allow-list +--keymaphelp), wired into both the running and idle key paths.3. Auto-resume transient errors
Transient/retryable failures (idle/stalled stream,
Unavailable/DeadlineExceeded/ResourceExhausted, 429, transient 5xx, the shared message vocabulary) auto-fire the merged queue, since a plain retry is likely to succeed. Hard errors, a user cancel,max_consecutive_failures, and a clean stream close still pause. Auto-resume fires exactly once (the merged queue empties before submit, so the reopened run's own terminal finds an empty queue → no loop).Classification lives entirely in the
clientpackage (Transient boolonResultMsg/StreamErrMsg, set byTransientStreamErr/TransientResultErrorover a shared vocabulary); theuireads only the boolean, preserving the proto-freeuiboundary. Bareserver_erroris deliberately excluded (OpenRouter reuses it for non-transient faults).Docs
docs/tui.mdkeys table + "queued follow-ups" section updated in lockstep.llms.txtregenerated (unchanged — the prose edits don't alter the generated index).Testing
server_errorcarve-out at both the classifier and theEventToMsgmapper boundary), auto-resume (result + stream error), hard-error/cancel/StreamClosedpause, and the no-loop two-transient-in-a-row guarantee.task build,task test(full,-race, engine-standalone),task lint(both modules),task test:golden(no golden shifts),docs:check(0 broken links), andgo run ./cmd/mecademoall green.No engine/internal/proto API changes — the transient flag stays in the mecatui client package.
Review
Ran through the dev-pipeline (architect plan → implement → panel review). Spec/Standards/Architecture axes came back clean; the QA test-adequacy axis surfaced coverage gaps (StreamClosed queue-pause, the no-loop guarantee, the
server_errormapper-boundary carve-out, edit-back focus) which are now covered.🤖 Generated with Claude Code