You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1b8d837
Browse filesBrowse the repository at this point in the historyBrowse files
Allow busy TUI sessions to forward prompts into the configured queue while
keeping queued-turn admission, cancellation, restart, and transcript ownership
consistent across the TUI, Gateway, and followup queue.
Co-authored-by: Sebastien Tardif <[email protected]>
Copy file name to clipboardExpand all lines: docs/concepts/queue.md
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -118,6 +118,28 @@ keys.
118
118
- Applies to auto-reply agent runs across all inbound channels that use the gateway reply pipeline (WhatsApp web, Telegram, Slack, Discord, Signal, iMessage, webchat, etc.).
119
119
- Default lane (`main`) is process-wide for inbound + main heartbeats; set `agents.defaults.maxConcurrent` to allow multiple sessions in parallel.
120
120
- Additional lanes may exist (e.g. `cron`, `cron-nested`, `nested`, `subagent`) so background jobs can run in parallel without blocking inbound replies. Isolated cron agent turns hold a `cron` slot while their inner agent execution uses `cron-nested`; both use `cron.maxConcurrentRuns`. Shared non-cron `nested` flows keep their own lane behavior. These detached runs are tracked as [background tasks](/automation/tasks).
121
+
122
+
## Queued-turn cancellation
123
+
124
+
When Gateway admits a prompt into the followup/collect queue (for example a TUI
125
+
or webchat `chat.send` while another turn is active), it keeps a **Gateway-owned
126
+
cancel identity** for that client `runId` until the queued content runs or is
127
+
dropped. The identity follows content folded into an overflow summary.
128
+
129
+
-`chat.abort` with a specific `runId` cancels that turn while it is still queued,
130
+
if the requester is authorized (same ownership rules as active runs).
131
+
-`chat.abort` for a session without `runId` cancels **authorized queued turns
132
+
first**, then aborts authorized active runs. That order prevents queue drain
133
+
from promoting work into a half-stopped session.
134
+
- Clearing the entire session queue without per-requester checks is not the stop
135
+
path for multi-owner sessions.
136
+
- Queued waits are not projected as active agent runs for `sessions.list` and do
137
+
not own active-run timeout semantics; only the active phase does.
138
+
139
+
Clients (including the TUI) forward mid-run prompts and let Gateway apply the
140
+
queue mode. Esc/`/stop` uses a session-scoped abort so lost local handles cannot
141
+
leave a still-queued prompt running.
142
+
121
143
- Per-session lanes guarantee that only one agent run touches a given session at a time.
122
144
- No external dependencies or background worker threads; pure TypeScript + promises.
0 commit comments