Repository navigation
fix(agents): preserve fresh tool results during aggregate recovery - #99524
snowzlmbot wants to merge 1 commit into
Conversation
|
PR body includes issue link, implementation scope, regression coverage, local validation boundary, and risk. @clawsweeper review-pr |
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close this PR as superseded by #99756. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. So I’m closing this here and keeping the remaining discussion on #99756. Review detailsDo we have a high-confidence way to reproduce the issue? Yes. The regressions freeze saturated projected history, append a fresh tool result, and place runtime context after it; an insufficient-history variant can deterministically reproduce the remaining hard-cap defect. Is this the best way to solve the issue? No, not yet. Projection freshness is the correct general invariant, but non-trailing fresh projections must remain eligible as the final recovery fallback rather than being excluded from every pass. Security review: Security review cleared: The diff changes internal prompt projection and tests only, with no concrete security or supply-chain concern. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against fa77fe10d526. |
3661f2c to
01d341e
Compare
This comment was marked as outdated.
This comment was marked as outdated.
01d341e to
22e36a0
Compare
This comment was marked as outdated.
This comment was marked as outdated.
22e36a0 to
b542fdc
Compare
|
Added current-head after-fix behavior proof and strengthened the regression assertion. Current head: After-fix terminal proof from the tool-result truncation helper with saturated history, a fresh {
"firstPassTruncatedCount": 43,
"secondPassTruncatedCount": 1,
"freshToolCallId": "fresh_exec",
"freshVisibleText": "ABC",
"freshPreservedAfterRuntimeContext": true,
"aggregateToolResultChars": 32000,
"aggregateBudgetChars": 32000,
"aggregateCapHeld": true,
"historicalToolResultsReduced": true,
"totalMessagesAfterRuntimeContext": 104
}This directly covers the review request: the fresh tool result remains visible after a runtime/context message, the aggregate cap still holds, and old history is the reduced side of the tradeoff. GitHub Actions for the new head is running now; I will request a fresh ClawSweeper review after the current-head checks settle. |
|
Current head @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
0fcad43 to
456e831
Compare
|
🦞🧹 I asked ClawSweeper to review this item again. |
456e831 to
99aee9a
Compare
|
Refreshed PR #99524 onto a no-content new head after fixing the PR context heading for the real-behavior gate.
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
+1 — hitting this on a Hermes-hosted agent running Repro shape: long-lived session, heavy exec/read traffic (transcription pipeline orchestration), then a fresh The non-trailing fresh-result protection in this PR is exactly the missing piece — the trailing-only scan in #98955 doesn't cover the case where a runtime/context message lands between the fresh result and provider dispatch. Thanks for landing this. |
|
+1 from our side. Hitting this in a Feishu DM deployment running OpenClaw 2026.6.11 with MiniMax-M3. Repro shape (matches yours exactly):
Also confirmed via |
99aee9a to
6b5d99f
Compare
6b5d99f to
bcc5aa5
Compare
|
ClawSweeper applied the proposed close for this PR.
|
|
🦞👀 Reason: structured ClawSweeper close marker: close-required (sha=bcc5aa5f92ecaa0dcf4c4b399f96ad6091c3a12a) Usage: |
Fixes #99481
Related: #96857, #98955
Summary
Preserve the current fresh tool-result text during prompt-history aggregate recovery when the fresh result is followed by a runtime/context message before provider dispatch.
Breaking changes
None.
What Problem This Solves
#98955 protects a trailing fresh tool-result batch during prompt-history aggregate truncation. #99481 showed the empty tool-result symptom could still happen on
2026.7.1-beta.1, where that trailing protection was already present.The remaining gap is non-trailing fresh tool results: runtime/context messages can be inserted after a fresh result before the provider call. The existing trailing-only scan then does not mark that fresh result as protected, so a saturated long-lived session can spend aggregate recovery on the current result and leave the model blind to the latest tool output.
Implementation
exec-style tool result and then a runtime-context-like message.Labels considered
agentssize: SP1proof: sufficientmerge-risk: 🚨 session-statestatus: 👀 ready for maintainer lookValidation
99aee9a7a6b4c2c946b1e2a257cf8be40aa509ae.main:MERGEABLE/CLEAN.git diff --check -- src/agents/embedded-agent-runner/tool-result-truncation.ts src/agents/embedded-agent-runner/tool-result-truncation.test.tspassed.node scripts/run-vitest.mjs src/agents/embedded-agent-runner/tool-result-truncation.test.tspassed: 1 file, 58 tests.checks-node-compact-large-whole-1includedsrc/agents/embedded-agent-runner/tool-result-truncation.test.tswith 58 tests passing.Evidence source map
2026.7.1-beta.1, after the trailing-result protection from fix(agents): preserve fresh tool result text under aggregate cap #98955 was already present.fresh_exectool result, then appends a runtime-context-like message so trailing-only protection no longer applies."ABC";32_000character budget;Risk
Low to moderate. The changed surface is the provider prompt-projection truncation/recovery path for saturated sessions. The tradeoff is intentional: when current fresh tool output and older projected history cannot both fit, recovery spends budget on older history before the current fresh result.
Compatibility risk is bounded by keeping trailing-batch protection and persisted trailing-batch behavior separate from the new non-trailing fresh-projection protection. Oversized fresh results still go through the per-result cap, and non-trailing protected fresh projection entries are only last-resort aggregate candidates after older candidates cannot recover enough budget.
Rollback
Revert this PR to restore the previous aggregate recovery ordering. No data migration or config rollback is required.
Docs updated
No docs change. This is an internal prompt-projection recovery fix; regression tests document the behavior boundary.
Related issue / PR
Not tested / Limitations
Review context addressed
main.99aee9a7a6b4c2c946b1e2a257cf8be40aa509ae.Maintainer / ClawSweeper review addressed