Add provider steering and fix prompt queue behavior - #13
Conversation
foundev
left a comment
There was a problem hiding this comment.
Self-review completed. Fixed two lifecycle issues found in the PR:
- A steer waiting for initial prompt activity must be released as unconsumed if the prompt cannot be saved and therefore never reaches the adapter.
- A prompt whose RPC has already completed must use normal follow-up delivery instead of creating avoidable detached work while local delivery cleanup is still settling.
Reviewed capability gating, readiness and completion races, explicit non-delivery versus ambiguous errors, pending-history visibility, cancellation, disconnects, FIFO ordering, session isolation, queue editing/removal, and draft/attachment retention. Added a regression for a late follow-up and extended the PTY workflow to exercise Tab queuing, Alt+Up editing, and restoration of an existing draft.
The full race tests, PTY integration, vet, production build, and formatting checks pass locally. No remaining findings in this self-review; final CI must pass before merge. Protocol behavior is tested against deterministic ACP fixtures and checked against upstream adapter sources, without authenticated live-model calls.
Follow-ups previously disappeared into a count-only queue, and editing removed an entry from its original position while blocking users who already had a draft. Enter now steers an active turn when the provider advertises support, while Tab queues a separate follow-up. Providers without steering retain a local FIFO queue. Pending text is visible; Alt+Up edits the latest entry,
/queueedits or removes any entry, and edits preserve order, attachments, and the previous draft.The client implements the
_session/steeringcontract used by Codex and Claude ACP adapters. It waits for prompt activity before steering, records accepted input once, and automatically falls back only on explicit non-delivery. Claude'spromptRequiredcontinues through a normal prompt; Codex's detachedstartedNewTurnremains busy until its thread-status updates report completion. Failed or unconfirmed delivery is retained in a paused queue for review. Steering does not cancel the current turn.Validation:
make check(race tests and vet), production build, and formatting checks. In-memory ACP tests exercise acceptance, echoed input, preserved content, rejection/unknown outcomes, readiness, detached completion before/after acknowledgment, and disconnects. TUI tests cover Enter/Tab behavior, FIFO ordering, editing and draft restoration, removal/clear, session isolation, paused-queue recovery, and narrow previews. The real PTY workflow also passes.Provider contracts were checked against the current upstream Codex and Claude adapter sources. No authenticated live model calls were used for validation.