Skip to content

feat(mecatui): add explicit queue and steer controls - #2397

Merged
jbeda merged 4 commits into
mainfrom
impl/queued-prompt-controls
Oct 17, 2026
Merged

jbeda merged 4 commits into
mainfrom
impl/queued-prompt-controls

Conversation

@jbeda

@jbeda jbeda commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Replace the large queue/steer cards with compact user-prompt headings and neutral previews on the user rail, aligned with the transcript theme.
  • Add /steer TEXT and /queue TEXT to explicitly choose delivery timing; either starts a normal run when idle.
  • Reject mixing only while opposite-kind input is pending. Ordinary Enter follows the pending kind, otherwise retaining the capability-driven default.
  • Pull all pending messages back into one editable draft with a single delivery prefix, preserving attachments and paste markers. Prefixes remain editor syntax and never become model-facing text.
  • Make rejected delivery attempts visible during active runs, including the manually reported queue-while-steering case.

Closes #2065.

Related bug fixes

  • Higher-fidelity pullback: retain the original editable drafts and their paste/attachment marker ownership separately from prepared submission payloads. Pullback now restores the original markers and their content rather than reconstructing the editor from expanded text. Already-prepared media is tracked separately so repeated pullback/edit/resend cycles, including switching between queue and steer, preserve attachments without loss or duplication.
  • Preserve newlines and blank lines in queue and steer previews, including after merged drafts are pulled back and resubmitted. Previews retain the three-row limit and +N more overflow indicator, and processing remains bounded to each message's leading text.
  • Conflicting queue/steer delivery errors explain how to recover: clear the input and press the configured pullback key (↑ by default).

Plan and merge status

Approved implementation plan.

Rebased onto main at e17d8394d365a94fb79258fa02a940625bfb99ff. The only conflict was in keybinding documentation. Range comparison confirmed the production patch was unchanged by the rebase; a focused independent integration review checked upstream worktree-modal, navigation, help and layout interactions with no findings. Subsequent preview and recovery-hint fixes are included in bc8f404f3.

Verification

  • task test:golden
  • task test
  • task lint
  • task test:race
  • task docs
  • task site:build
  • task build
  • go run ./cmd/mecademo (tool call, permission ask/approval, final result)
  • Rendered-screen regression demonstrated failing before the delivery-feedback fix, then passing in both conflict directions, unsupported steering, and empty instructions.
  • Spec, Standards, Test adequacy, and Domain panel review; targeted rechecks after recovery and visible-feedback fixes. No open findings.
  • After rebase, reran the complete UI suite (including committed goldens), task test, task lint, task test:race, docs/site checks, build and offline demo.
  • For bc8f404f3, reran task test, task lint, task test:race, task build, and the offline demo. Regression tests cover direct multiline queue/steer input, repeated pullback/resend, preserved blank preview rows, bounded preview processing, and recovery guidance with a rebound pullback key. Independent incremental review found no remaining issues.
  • Rebase validation encountered timing-sensitive failures in TestCarryoverHandoff and TestFireProvisionalAdmissionDeadlineKeepsPendingUntilRecovery. They passed isolated repeated checks (10 and 5 runs respectively), followed by passing complete offline/race-suite reruns. No unrelated test or production changes were made. An initial combined lint/race invocation also exhausted its aggregate tool timeout; the final standalone race gate passed.

API compatibility

Compatible, client-local change. Existing SendSteer and prompt submission paths are reused; there are no protobuf, RPC, SDK, engine, or stored-data schema changes. API major and feature identifiers are unchanged, and no client upgrade coordination is required. The TUI reserves /queue and /steer as builtins with the existing precedence over same-name workspace commands.

Limitations

Steer pullback uses the existing best-effort cancellation protocol; an already-consumed steer cannot be recalled. Queued entries merge into one follow-up prompt. Individual pending-message selection, reordering, and per-entry editing remain out of scope.

@jbeda

jbeda commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor Author

Implementation plan: queued prompt controls

  • Slug: queued-prompt-controls
  • Source provenance: .scratch/queued-prompt-controls/plan.md (ignored local planning source, not a remote link)
  • Branch: impl/queued-prompt-controls; base: main
  • Original immutable implementation/review baseline: e78d9432e6be43bbb0d6373f6ed41d45daa4cc0f
  • Authorized post-rebase integration baseline: e17d8394d365a94fb79258fa02a940625bfb99ff
  • Published PR head: f133f05b2b47cb44b09778db0f2082b69fd66bbf (replaces 8cb27b9680eb83a7acd77415d1952b261eb45f06)
  • Updated: 2026-10-17
  • Approved in the operator conversation: explicit /steer and /queue, pending-only exclusion, merged pullback preserving delivery intent, and compact pending user-prompt presentation.

This is the complete publishable plan. Local checkout paths, sibling-checkout provenance and unrelated operator working-tree details are omitted. The verification section records the intended checks; actual outcomes are reported in the PR description.

Observable contract

  • /steer TEXT explicitly uses the existing steer channel during an active run. Unsupported steering or a missing live stream produces a local error, never an implicit queue fallback.
  • /queue TEXT explicitly stages a local follow-up during an active run, including on steer-capable servers.
  • Without an active run, either command starts an ordinary run with only its payload. Reject empty payloads unless there is actual attached content. Preserve the draft and attachments on validation failure.
  • Exclusion is pending-only: explicit queue rejects pending steers; explicit steer rejects a nonempty local queue. Once pending work drains, is consumed or is pulled back, either kind is allowed again. There is no persistent per-run mode. Rejections during an active run produce visible transcript errors rather than status text hidden by the running footer.
  • Ordinary Enter follows the currently pending kind. With neither pending, retain the existing capability-driven choice: steer if supported with a stream, otherwise queue. Bare builtins retain their local behavior.
  • Pullback removes the pending local queue or requests existing steer cancellation. Restore all pending messages as one editable draft, separated by blank lines, with exactly one /queue or /steer prefix. Attachments and paste markers return with it. Resubmission makes one pending message. If the run ends first, either prefixed draft starts a normal run.
  • Delivery prefixes are editor syntax only: absent from model-facing text, pending previews, sent user transcript and stored per-message payloads. Preserve original intent through pullback without repeated internal prefixes.
  • Preserve server-authoritative acknowledgement, drain and cancellation race handling. Pullback cannot guarantee recall of an already-consumed steer. Preserve existing queue healthy-drain, error-pause and mode-gate behavior, including merging all queued entries into one follow-up run.
  • Register both builtins and completion/help. A known but unavailable explicit steer never becomes model-facing text. Do not recursively treat the payload as another client builtin: /queue /help has payload /help.
  • Keep the approved compact presentation: user-accent heading with state and right-aligned controls, neutral bounded body previews on the user rail, and no enclosing permission card. Both queue and steer use it.

Scope and compatibility

TUI-local routing and UI state only. Reuse existing SendSteer, SendPrompt, content preparation, media checks and local queue drain. No protocol, capability, SDK, engine or storage schema additions. Existing conforming remote clients need no changes; API major and features remain unchanged. Newly reserved TUI builtin names /queue and /steer take precedence over same-name workspace commands, following the existing convention.

Individual queued-message selection, reordering, per-entry editing, a new server queue and a new run lifecycle are out of scope.

Dependency-ordered tasks

  1. Implement command parsing/routing, pending-only conflict checks and ordinary Enter selection in cmd/mecatui/ui/builtins.go, update.go and a focused local file if needed. Preserve drafts/media on errors and payload semantics through normal startup/recovery. Add focused event-to-wire tests.
  2. Implement merged, prefixed pullback for queue and steer. Avoid embedded prefixes after repeated sends/edit cycles. Preserve attachments/pastes and established late-ack/drain races. Update affected tests to assert the approved editor syntax and payload-only wire behavior. This integrates with task 1 and is not separately shippable.
  3. Update owning user docs/help and extend focused regression tests for completion, idle/running behavior, conflicts, consumption, media/pastes, error preservation, pullback/resubmit, drain and pause. Do not expand the pending-message UI.
  4. Run integrated validation and panel review against the immutable start OID, including the compact-rendering changes. Exclude unrelated operator changes and ignored plans. Review the actual final-tree diff and new files; no commit is required to enable review. Fix concrete findings and perform targeted incremental rechecks.

Verification intentions

  • Run focused UI tests while iterating, including existing queue, steer, command, palette and attachment cases. New tests exercise actual Update events, returned send commands and captured wire frames.
  • Demonstrate missing behavior failing before implementation where practical.
  • Use official task test:golden for intentional fixture updates.
  • Run integrated task test, task lint, task test:race, task docs for Markdown changes, and offline go run ./cmd/mecademo. Also build binaries and the documentation site. Give full gates 600-second timeouts and run them serially.
  • Use system-temp scope for socket-using aggregate tests: managed temporary paths exceeded AF_UNIX path limits during earlier verification; shorter system-temp paths passed.
  • Review Spec, Standards, Test adequacy and applicable Domain specialists against e78d9432e6be43bbb0d6373f6ed41d45daa4cc0f. Include all implementation-owned tracked and untracked final files, not only committed changes.

Starting evidence and ownership

The compact-rendering slice entered this extension with focused tests, the official golden task and the full offline suite passing. Its owned files were cmd/mecatui/ui/view.go, steer_render_test.go, testdata/steer_card.golden and the new queued_prompt_render_test.go. The explicit-command extension and final panel/gates were still pending at that checkpoint. Unrelated operator changes remain excluded; no personal handoff update is part of this work.

Amendment

Manual testing before publication showed that a rejected /queue while steering had no visible feedback: the running footer hid statusMsg. The approved rejection behavior is enforced through the existing transcript-error rendering path, with screen-level regressions for both conflict directions, unavailable steering and empty instructions. No delivery or lifecycle semantics changed.

The operator subsequently authorized rebasing onto main. The post-rebase base is e17d8394d365a94fb79258fa02a940625bfb99ff; the original baseline and published head are retained above as historical provenance. The only conflict was in the keybindings guide: retain the feature's pending-message pullback description alongside upstream's shorter clear-draft description. Range comparison confirms the production patch is unchanged. A focused independent integration review checked upstream worktree-modal, navigation, help and layout interactions with no findings. Earlier panel coverage remains applicable to the unchanged patch; post-rebase integration gates are rerun rather than treating old gate results as fresh evidence.

Render pending input as compact user-prompt blocks. Add explicit /queue and
/steer commands, prevent mixing pending delivery kinds, and preserve delivery
intent, attachments and paste markers through merged edit-back.

Show rejected delivery attempts while a run is active instead of hiding
feedback behind the running footer.

Closes #2065

Co-authored-by: Mecatl <[email protected]>
jbeda and others added 3 commits October 17, 2026 11:22
Preserve multiline queue and steer previews within the existing row and rune bounds. Add pullback guidance to conflicting delivery errors using the configured edit-back key, with rendering and resend regressions.

Co-authored-by: Mecatl <[email protected]>
Rename enqueuePrompt to deliverDefaultPrompt to distinguish delivery selection from local queue insertion. Update callers and comments without changing behavior.

Co-authored-by: Mecatl <[email protected]>
Remove the obsolete box-width cap and bound preview processing by terminal width. Render muted edit controls inline with pending status, including steers still sending, and update rendering regressions and the steer golden.

Co-authored-by: Mecatl <[email protected]>
@jbeda
jbeda merged commit 2f1175e into main Oct 17, 2026
37 checks passed
@jbeda
jbeda deleted the impl/queued-prompt-controls branch October 17, 2026 19:20
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Oct 20, 2026
2 tasks
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.

Reduce the size of the queues prompts

1 participant