Repository navigation
fix(agents): return the full sessions_send reply past the terminal snapshot bound - #175685
Conversation
…apshot bound A waiting sessions_send returned the run's terminal reply snapshot, which is bounded to 4,096 characters, so long peer replies were cut with no signal. When the reply sits at the bound, read the accepted run's own stored reply by run id; if that is unavailable, keep the bounded text and report replyTruncated with a pointer to sessions_history.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. What this changesRecover complete waiting sessions_send replies and explicitly disclose unavailable or budget-truncated output. Example: A target returns 5,000 letter a characters followed by TAIL.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this PR addresses a current inline-reply bug, preserves bounded lifecycle evidence, and fixes the previous whitespace finding. Priority: P1 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe sessions_send completion path converts an accepted target run's terminal result into requester-visible tool output, using Gateway history readers to recover long answers. flowchart LR
A[Requesting agent] --> B[sessions_send]
B --> C[Accepted target run]
C --> D[Bounded terminal preview]
D --> E[Inline reply owner]
E --> F[Run filtered stored answer]
F --> G[Tool result budget]
G --> A
Technical reviewBest possible solution: Retain this focused inline repair and track complete delayed delivery in #175597. Do we have a high-confidence way to reproduce the issue? The bounded terminal producer and current-main inline consumer establish the failure path, consistent with the linked report's observation on OpenClaw 2026.10.3; this read-only review executed no target code. Is this the best way to solve the issue? The patch is a focused inline repair: it reuses existing recovery and sanitization owners, preserves lifecycle bounds, and discloses recovery failure without repeating the target task. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7310bf167db7. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +51, Tests +108, Docs +8. Total +167 across 8 files. Added test files: 0. View PR surface stats
Review metrics
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 HistoryReview history (1 earlier review cycle)
Reviewed October 18, 2026, 6:18 PM ET / 22:18 UTC (Revision 2). |
…ngth Truncation trims the whole retained prefix before its marker, so a cut reply can be far shorter than the bound (4,000 characters + 100 spaces + TAIL becomes 4,000 characters + marker). Treat any reply ending in the marker as possibly cut and let the accepted run's stored reply decide: it extends the prefix (recover it) or equals it (a reply that really ends in an ellipsis).
Reuse the existing run-filtered reply reader and canonical snapshot sanitizer, remove the extra recovery helpers, and disclose unavailable or budget-limited reply text without suggesting that the original task be repeated. Keep the strict output schema and session-tool docs consistent with the result. Related: openclaw#175597 Original fix by @wr-web; maintainer cleanup preserves the inline-only scope. Co-authored-by: Wang Rui <[email protected]>
|
@clawsweeper re-review Head Changed-file lint/format and independent Codex autoreview passed. PR CI is the proof gate per maintainer policy; live proof was intentionally skipped. Exact-head CI: https://github.com/openclaw/openclaw/actions/runs/39171063355 |
|
🦞👀 Re-review progress:
|
|
ClawSweeper's exact-head review reports no code findings and confirms the earlier whitespace-truncation finding is resolved. The remaining live-Gateway/base-red proof request is intentionally not followed: the maintainer proof policy for this campaign selects exact-head PR CI as the test gate and explicitly excludes live Gateway runs, leases, and local negative controls/typechecks. PR CI is the proof per maintainer policy. The selected Node and UI test shards have passed; remaining type/lint jobs are tracked in https://github.com/openclaw/openclaw/actions/runs/39171063355. The PR continues to say |
|
Merged via squash.
|
…apshot bound (openclaw#175685) * fix(agents): return the full sessions_send reply past the terminal snapshot bound A waiting sessions_send returned the run's terminal reply snapshot, which is bounded to 4,096 characters, so long peer replies were cut with no signal. When the reply sits at the bound, read the accepted run's own stored reply by run id; if that is unavailable, keep the bounded text and report replyTruncated with a pointer to sessions_history. * fix(agents): detect truncated sessions_send replies by marker, not length Truncation trims the whole retained prefix before its marker, so a cut reply can be far shorter than the bound (4,000 characters + 100 spaces + TAIL becomes 4,000 characters + marker). Treat any reply ending in the marker as possibly cut and let the accepted run's stored reply decide: it extends the prefix (recover it) or equals it (a reply that really ends in an ellipsis). * fix(agents): recover complete inline session replies Reuse the existing run-filtered reply reader and canonical snapshot sanitizer, remove the extra recovery helpers, and disclose unavailable or budget-limited reply text without suggesting that the original task be repeated. Keep the strict output schema and session-tool docs consistent with the result. Related: openclaw#175597 Original fix by @wr-web; maintainer cleanup preserves the inline-only scope. Co-authored-by: Wang Rui <[email protected]> --------- Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: Wang Rui <[email protected]>
…cters (#178271) * fix(agents): delayed sessions_send replies are cut off at 4,096 characters Recover accepted-run answers before delayed delivery and keep truncation guidance in requester instructions, not source-channel messages. Related: #175597 * docs: note that delayed sessions_send replies are recovered too * fix(agents): keep full delayed sessions_send replies after the sender's turn ends Read matched full replies from the accepted run's retained Gateway result. Keep inline history recovery and bounded lifecycle previews unchanged. Related: #175597 * refactor(agents): simplify retained reply recovery * fix(agents): recheck accepted reply authority before reading the retained answer Validate current accepted endpoint incarnations and live completion custody before reading full retained results. Preserve accepted replies after send-policy withdrawal. * fix(agents): keep the Gateway run tracker out of sessions_send tool loading The accepted-reply reader statically imported agent-dedupe, which loads the agent-job tracker and registers its lifecycle listener when the tool module loads. Tool loading must not start Gateway run tracking, so the reader now loads it only when a live in-process Gateway reaches that path, and rechecks delivery authority after the import. Explain the isolated unit-test mocks and keep the logging mock's real exports. Co-authored-by: RJ <[email protected]> Release adaptation: combined with its prerequisite #175685 (inline sessions_send recovery), which is not on the stable line. The stable line keeps the inline wait in sessions-send-tool.ts, so its terminal branch moves into settleSessionsSendReply in sessions-send-helpers.ts (keeping sessions-send-tool.ts under its line cap) and uses resolveSessionsSendReply; the delayed A2A flow keeps its non-deliverable reply filter and relies on waitForAgentRunReply only exposing visible replies. The stable line has sanitizeAgentRunTerminalReplyText (string) instead of the snapshot-returning sanitizer, so the comparison and test fixtures use it. The requester reply-flow test file does not exist on this line; the A2A, policy, and dispatch-owner tests cover the change. ---- fix(agents): return the full sessions_send reply past the terminal snapshot bound (#175685) * fix(agents): return the full sessions_send reply past the terminal snapshot bound A waiting sessions_send returned the run's terminal reply snapshot, which is bounded to 4,096 characters, so long peer replies were cut with no signal. When the reply sits at the bound, read the accepted run's own stored reply by run id; if that is unavailable, keep the bounded text and report replyTruncated with a pointer to sessions_history. * fix(agents): detect truncated sessions_send replies by marker, not length Truncation trims the whole retained prefix before its marker, so a cut reply can be far shorter than the bound (4,000 characters + 100 spaces + TAIL becomes 4,000 characters + marker). Treat any reply ending in the marker as possibly cut and let the accepted run's stored reply decide: it extends the prefix (recover it) or equals it (a reply that really ends in an ellipsis). * fix(agents): recover complete inline session replies Reuse the existing run-filtered reply reader and canonical snapshot sanitizer, remove the extra recovery helpers, and disclose unavailable or budget-limited reply text without suggesting that the original task be repeated. Keep the strict output schema and session-tool docs consistent with the result. Related: #175597 Original fix by @wr-web; maintainer cleanup preserves the inline-only scope. Co-authored-by: Wang Rui <[email protected]> (cherry picked from commit b3c8f8a) (cherry picked from commit 7bd6895)
Related: #175597. This fixes inline replies from waiting
sessions_sendcalls. Delayed inter-session delivery still uses the bounded lifecycle preview and remains a follow-up.What Problem This Solves
Fixes: a waiting
sessions_sendsilently returned only the first 4,096 characters of a target's long final reply.User Impact
Waiting callers receive the accepted run's full stored reply. If it cannot be recovered, the result preserves the preview and reports
replyTruncated: truewith recovery guidance. The normal tool-result size policy still applies; its notice directs callers to request the missing section or a file without repeating the original task.sessions_historyalso caps individual messages, so it is not advertised as guaranteed tail recovery.Why This Change Was Made
The terminal snapshot is deliberately bounded lifecycle evidence. The inline reply owner now reuses
readLatestAssistantReply, filtered by the accepted run ID, and verifies the existing sanitizer produces the same snapshot before replacing the preview. This avoids selecting a later run's answer. The strict output schema includes the new optional fields.Maintainer cleanup removes the extra truncation predicate and complete-reply wrapper, reuses the canonical sanitizer, and consolidates duplicate helper tests at the tool boundary. The known ClawSweeper P2 whitespace finding remains covered: a truncated preview can be shorter than 4,096 characters. No detached/background side effects are added or changed.
Original fix by @wr-web; maintainer cleanup by @steipete. Contributor credit is retained in Git history and a
Co-authored-bytrailer.Evidence
b32a3bed887a529a55b006d070ee0880ac9c7c11: run 39171063355, 43 successful jobs, no failures;openclaw/ci-gateis green. This covers the changed agent-tool tests, affected consumers, production/test types, lint, docs, prompt snapshots, and repository checks. No CI retry or follow-up push was needed.sessions-send-policy.test.ts:returns the accepted run's full $name with explicit tool-budget truncationcovers long replies, whitespace-shortened previews, literal ellipses, a later unrelated run, and the existing 16,000-character tool-result cap.reports a truncated preview when the accepted run's full reply is unavailablechecks explicit disclosure and the strict result schema.oxfmtandgit diff --checkpassed.checks-node-changed-3passed all 21 tests insessions-send-policy.test.ts: 7.66 s Vitest duration / 9.13 s including the runner. The five new cases took 27/55/62/50/20 ms (214 ms total). No timers, sleeps, new workers, or live processes were added.LOC against the merged main base: production +67/-16 (net +51), tests +108/-0, docs +8/-0. Compared with the contributor revision, cleanup removes 40 net lines. Net production growth is retained for exact-run recovery, explicit failure/budget notices, and schema support; unrelated deletions would obscure the fix.