# Queue and steering

| Key | Action | Destination |
| --- | --- | --- |
| Enter, send button | Steer | The exact active execution, at a supported safe point |
| Cmd/Ctrl+Enter | Queue | One follow-up after the preceding turn ends |
| Stop | Cancel | Separate control; neither action above cancels |

No standing preference: the key decides at send time. The active session and its running execution set the target; another session or sub-Agent is never picked.

## Delivery

1. **Queued** row kept
2. **Bind** execution, version
3. **Command** `execution.steer`
4. **Safe point** the next one
5. **Persisted** user message

| Aspect | Rule |
| --- | --- |
| Entry kept until | A matching applied receipt confirms the user message is persisted; safe-point admission alone stays applying |
| Command carries | Only message, exact execution identity, version, idempotency key. No permissions, models, tools or program changes |
| Before posting | The client keeps the immutable envelope |
| Lost acknowledgement | Delivery unconfirmed: row stays visible, normal drain cannot resend, confirmation retries reuse the envelope |
| Confirmation | One per row, asked again when its execution changes (`op:execution-update`), the session's run slot changes or the socket reopens; only a transport failure waits on a timer, doubling to 30 s. A definitive receipt clears it |
| Stale-version rejection | One new envelope against a fresh snapshot of the same execution |
| Target | Bound when the user asks. A version retry refreshes the version and cannot select a replacement execution |
| Unsupported or ended | Entry stays queued; idle reconciliation drains normal follow-ups FIFO. At execution end undelivered steering is rejected, and rows can resume queuing |
| Stop | Keeps an in-flight instruction as an unsent draft, even before admission. An uncertain command stays immutable until a definitive receipt; Stop cannot erase it or allow ordinary dispatch |
| Tools | A completed tool batch is never skipped because steering arrived |
| Owner expiry | Cannot authorize a late input write. Execution closure resolves undelivered commands, even awaiting effect reconciliation |

Errors are visible; injected flags are always released after transport failure. References: [Codex prompting](https://learn.chatgpt.com/docs/prompting#steering-and-queuing), [App Server steering](https://learn.chatgpt.com/docs/app-server#steer-an-active-turn), which binds to the expected turn with no runtime overrides. OpenProgram uses its execution command service and safe points, with no second session inbox, message broker or provider-specific transport.

## Queue card

One raised card docked above the input box. The heading counts rows and how many join this turn, and collapses the card.

| Row part | Detail |
| --- | --- |
| Tag | This turn (steer in flight), Next turn (waiting), Not sent or Unconfirmed (after a failure) |
| Text | First line; clicking expands the full message and attachments |
| Actions, on hover or keyboard focus | Add to this turn (non-cancelling), retry, edit, removal when delivery is not uncertain |
| Clear all | One write removing every row except those being delivered or edited, so it never drains a row about to go |
| Limits | Attachments keep their draft behavior; steering accepts text up to 4,096 Unicode code points |

## Storage

| Data | Where |
| --- | --- |
| Ordinary queue entries, attachments | Renderer memory |
| Pending text steering receipts, stopped or ended steering drafts | Same-window session storage; restored on refresh without replaying chat; best-effort, not a second command log |
| Accepted command | Server, canonical acceptance |
| Applied input | Persisted user message |

Pending steering cannot drain as ordinary messages until resolved. A steer settles when a read or transcript update delivers a row carrying its command id; after a read, unresolved commands are confirmed with their original identity.

## History

- A normal follow-up resolves its predecessor from the durable session head before updating the server mirror, including the preceding reply, tool results and delivered steering. Explicit branch predecessors stay.
- Cancelled and interrupted turns keep partial content and show terminal status, including empty replies. A cancellation notice does not infer who cancelled.

## Function retry acknowledgement

Each retry carries a request identity echoed by its acknowledgement or rejection. The acceptance timer ends at dispatch, not when the function finishes. A rejection or disconnected send restores only that pending card and reports the cause once. Missing acknowledgements stay uncertain and are not resubmitted. History and surface validation stay authoritative.

**Acceptance and audit coverage**

- Two queued follow-ups each start after the preceding turn ends.
- Text added while a tool runs: same execution and tool continue; the instruction reaches later model context.
- Lost acknowledgement: row retained, same command replayed without duplicate delivery.
- Ended, unavailable and unsupported targets retain input and report state.
- Scope switching cannot steer another conversation.

| Boundary | Behavior | Regression |
| --- | --- | --- |
| Input preparation | Expanded paste, attachments, 4,096 code points | `submit-reliability.test.mjs` |
| Target ownership | Session identity; snapshot replacement; same-execution version retry | `submit-reliability.test.mjs`, `test_execution_cursor_auth_audit.py` |
| Duplicate and uncertain commands | Same-envelope retry; one timer; bounded backoff | `submit-reliability.test.mjs` |
| Stop before admission | Snapshot and version-rejection races retain the draft | `submit-reliability.test.mjs` |
| Refresh and storage | Accepted, lost ACK and stopped commands; exact replay; storage denial | `test_queue_steer.py`, `submit-reliability.test.mjs` |
| Streaming | Text, reasoning and silent wait interrupt; partial content survives | `test_streaming_steer.py` |
| Tools and pause | Whole tool batch completes; paused inputs enter continuation | `test_safe_points.py`, `test_continue_step_steer.py` |
| Durable commands | Accepted order, idempotency, checkpoint rollback, owner expiry | `test_safe_points.py`, `test_continue_step_steer.py` |
| History | Cancelled partial reply; explicit next-turn predecessor; no head rewind | `test_streaming_steer.py`, `test_queue_steer.py` |

Also covered: multiple accepted inputs, provider silent waits, pause and continuation, cold history, cross-session authorization.

## Implementation status

Implemented: canonical execution commands, non-cancelling queue controls, automatic receipt confirmation, terminal assistant status notices, the lifecycle contract above. Static checks do not replace runtime acceptance in the App.
