Repository navigation
fix: let the agent read every queued message in full when the queue overflows - #208259
Conversation
- drop: summarize regroups overflowed sources into one turn rendered like collect, with full text. - Removes the 160-character cut, the summary line cap, summary elisions and the overflow-only recorder. - Local TUI queue carries overflowed messages whole.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. |
- Overflowed exec completions keep full output; summarize no longer cancels sources.
|
Rejected review findings:
|
…ll-text # Conflicts: # src/auto-reply/reply/queue/delivery-context.ts
|
Codex review: passed. What this changesThis PR replaces truncated overflow summaries with full-message combined turns in the Gateway and local TUI queues. Example: With cap 2, four 302-character messages arrive while an agent is busy.
Review scores
ProductKind: Preference · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-approved change preserves queued message content, and source review found no actionable regression; a failing required Node test gate still needs attribution. Reviewed head: Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherInbound messages enter the session mailbox, which selects compatible sources for execution; the queue adapter produces model prompts, transcript rows, and source-settlement outcomes. flowchart TD
A[Inbound messages] --> B[Session mailbox]
B --> C[Overflow source group]
B --> D[Pending individual sources]
C --> E[Shared collect renderer]
D --> F[Agent execution]
E --> F
F --> G[Transcript and source settlement]
Technical reviewBest possible solution: Use the existing collect machinery to preserve complete approved overflow content while retaining mailbox-owned selection and source custody. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the truncation and overflow eviction paths, supported by the author's reported baseline failure and Telegram request captures; this read-only review executed no target code. Is this the best way to solve the issue? Reusing collect rendering and recording is a coherent, smaller implementation of the approved retention policy, with obsolete overflow machinery removed. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 139550f2cc8d. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource -353, Tests -233, Docs 0, Generated 0. Total -586 across 34 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 29, 2026, 6:50 AM ET / 11:50 UTC. |
|
Landed in 361a94c. Bug: with the default |
…verflows (openclaw#208259) ## What Problem This Solves With the default queue settings (`drop: "summarize"`, `cap: 20`), messages that overflow the cap reached the model only as 160-character previews under `[Queue overflow] Dropped N messages due to cap.`. Past about 2x cap, the oldest overflowed messages were cancelled outright (summary elisions trimmed to the cap). The user sent those messages; the agent never read them whole. ## Why This Change Was Made Invariant: the cap decides how many separate turns a backlog gets. It never decides which text the model reads. - `drop: "summarize"` keeps the overflow claim: overflowed sources still run together as one turn, grouped by delivery context. That turn now renders exactly like a `collect` batch: `[Queued messages while agent was busy]`, then each source as `Queued #N (from <sender>)` with its full approved text. Its transcript row comes from the collect recorder (full text, mentions, media). - A single overflowed source runs as itself, like a single `collect` item. - Removed: the 160-character cut and summary line cap in `applyQueueDropPolicy`, `previewQueueSummaryPrompt`, `onSummaryElide`, `summaryElisions`, `activeSummarySources`, `trimSummaryElisionsToCap`, `createOverflowSummaryRetrySource`, the overflow-only transcript recorder and its idempotency key, and `consumeQueueSummaryDelivery` (replaced by the existing mailbox-cleanup detach, now exported). `summaryEntries: {source, line}[]` became `summarySources: FollowupRun[]`. - The local TUI queue had the same cut through the shared helper: it now carries overflowed messages whole and renders them in its collect prompt. - Docs: `docs/concepts/queue.md`, `docs/gateway/config-agents/messages-and-talk.md`, `docs/concepts/session-controller.md`, and the `messages.queue.cap`/`drop` help text. Kept as is: `drop: "old" | "new"` (public config; removing it needs a migration), steering `collaborativeSteeringFallback: "reject"`, ambient room event previews (documented group contract), `droppedCount`. ## User Impact When many messages arrive while the agent is busy (default cap 20), the agent now reads every one of them in full instead of a 160-character preview, and none are cancelled past twice the cap. Overflowed messages still arrive as one combined turn, so the number of turns stays the same. ### Decisions (recorded defaults) - Accepted edge case: a flood while the agent is busy now enters one turn at full size. Compaction is the bound; no byte cap was added. - The brief's test asked for "all 4 whole in the next turn". With cap 2 the design gives one combined turn for the 2 overflowed messages and one turn each for the 2 within the cap. The test asserts every message reaches a transcript user row whole, with the 2 overflowed ones in one row. - The overflow-specific transcript idempotency key (route hash) is gone with its recorder; combined overflow turns use the collect key, the same as `collect` batches today. - Telegram E2E used `messages.queue.mode: "followup"` with `cap: 2`: the default `steer` mode injects into the active embedded run, so the queue never overflows on that runtime. ## Evidence - Unit, red on base / green on head: `queue.collect.test.ts` › "keeps every overflowed message whole in the combined turn transcript" (base: `expected '[Queue overflow] Dropped 2 messages d…' to contain '1:aaaa…'`). - Tests asserting the removed behavior (summary lines, elision eviction, overflow idempotency key) were deleted or rewritten to the new contract. - Unit tests, local: every touched test file plus `src/auto-reply/reply/queue*.test.ts`, `src/auto-reply/reply/queue/*.test.ts`, `src/sessions/session-controller.mailbox*.test.ts` (all green after the final edit). `tsgo:core`, `tsgo:core:test`, oxlint, oxfmt clean. The importer set is 276 test files, so CI runs the rest. - Real Telegram E2E (Test Server, `telegram-e2e-userbot`, `--source-gateway`, mock model with `MOCK_RESPONSE_CHUNK_DELAY_MS=12000`, `messages.queue: {mode: "followup", cap: 2}`, DM): sent `Start the slow turn now.`, then 4 messages of 377 characters each (`LONGMSGn-START … LONGMSGn-END`) 3 s apart while the first turn was busy. Telegram inbound batching merged messages 1 and 2 into one inbound on both sides. - Base `98bb8cc00cc9`: second model request user row = `[Queue overflow] Dropped 1 message due to cap.` / `Summary:` / `- LONGMSG1-START word1x0 … w…` (160 characters). `LONGMSG1-END` and every part of message 2 appear in 0 model requests. Messages 3 and 4 arrived whole. - Head: the same overflowed source reaches the second model request whole: `LONGMSG1-START … LONGMSG1-END` followed by `LONGMSG2-START … LONGMSG2-END`. All 4 start/end markers appear in the model requests. 4 replies seen in Telegram on both sides. - Extra head run with Telegram batching off (`messages.inbound.byChannel.telegram: 0`): each message got its own turn, all 4 whole. The queue did not overflow in that run (timing), so it is not overflow proof. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
With the default queue settings (
drop: "summarize",cap: 20), messages that overflow the cap reached the model only as 160-character previews under[Queue overflow] Dropped N messages due to cap.. Past about 2x cap, the oldest overflowed messages were cancelled outright (summary elisions trimmed to the cap). The user sent those messages; the agent never read them whole.Why This Change Was Made
Invariant: the cap decides how many separate turns a backlog gets. It never decides which text the model reads.
drop: "summarize"keeps the overflow claim: overflowed sources still run together as one turn, grouped by delivery context. That turn now renders exactly like acollectbatch:[Queued messages while agent was busy], then each source asQueued #N (from <sender>)with its full approved text. Its transcript row comes from the collect recorder (full text, mentions, media).collectitem.applyQueueDropPolicy,previewQueueSummaryPrompt,onSummaryElide,summaryElisions,activeSummarySources,trimSummaryElisionsToCap,createOverflowSummaryRetrySource, the overflow-only transcript recorder and its idempotency key, andconsumeQueueSummaryDelivery(replaced by the existing mailbox-cleanup detach, now exported).summaryEntries: {source, line}[]becamesummarySources: FollowupRun[].docs/concepts/queue.md,docs/gateway/config-agents/messages-and-talk.md,docs/concepts/session-controller.md, and themessages.queue.cap/drophelp text.Kept as is:
drop: "old" | "new"(public config; removing it needs a migration), steeringcollaborativeSteeringFallback: "reject", ambient room event previews (documented group contract),droppedCount.User Impact
When many messages arrive while the agent is busy (default cap 20), the agent now reads every one of them in full instead of a 160-character preview, and none are cancelled past twice the cap. Overflowed messages still arrive as one combined turn, so the number of turns stays the same.
Decisions (recorded defaults)
collectbatches today.messages.queue.mode: "followup"withcap: 2: the defaultsteermode injects into the active embedded run, so the queue never overflows on that runtime.Evidence
queue.collect.test.ts› "keeps every overflowed message whole in the combined turn transcript" (base:expected '[Queue overflow] Dropped 2 messages d…' to contain '1:aaaa…').src/auto-reply/reply/queue*.test.ts,src/auto-reply/reply/queue/*.test.ts,src/sessions/session-controller.mailbox*.test.ts(all green after the final edit).tsgo:core,tsgo:core:test, oxlint, oxfmt clean. The importer set is 276 test files, so CI runs the rest.telegram-e2e-userbot,--source-gateway, mock model withMOCK_RESPONSE_CHUNK_DELAY_MS=12000,messages.queue: {mode: "followup", cap: 2}, DM): sentStart the slow turn now., then 4 messages of 377 characters each (LONGMSGn-START … LONGMSGn-END) 3 s apart while the first turn was busy. Telegram inbound batching merged messages 1 and 2 into one inbound on both sides.d9cc195ce70f: second model request user row =[Queue overflow] Dropped 1 message due to cap./Summary:/- LONGMSG1-START word1x0 … w…(160 characters).LONGMSG1-ENDand every part of message 2 appear in 0 model requests. Messages 3 and 4 arrived whole.LONGMSG1-START … LONGMSG1-ENDfollowed byLONGMSG2-START … LONGMSG2-END. All 4 start/end markers appear in the model requests. 4 replies seen in Telegram on both sides.messages.inbound.byChannel.telegram: 0): each message got its own turn, all 4 whole. The queue did not overflow in that run (timing), so it is not overflow proof.