Repository navigation
fix: preserve tool-result text across media fallback and context pressure - #99756
Conversation
|
Codex review: needs changes before merge. Reviewed July 11, 2026, 2:38 PM ET / 18:38 UTC. Summary PR surface: Source +79, Tests +462. Total +541 across 17 files. Reproducibility: yes. The reported text-loss stages and the introduced empty-text-plus-audio regression both have deterministic source paths; the latter occurs when an empty text block and audio block pass through a shared provider serializer. Review metrics: none identified. Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Copy recommended automerge instructionNext step before merge
Security Review findings
Review detailsBest possible solution: Keep the fresh-result recovery and image fixes, but make fallback suppression depend on actual media delivery so empty text never hides unsupported audio or other omitted media. Do we have a high-confidence way to reproduce the issue? Yes. The reported text-loss stages and the introduced empty-text-plus-audio regression both have deterministic source paths; the latter occurs when an empty text block and audio block pass through a shared provider serializer. Is this the best way to solve the issue? No in the current head. The aggregate recovery design is bounded and appropriate, but the shared fallback abstraction is broader than the provider delivery contract and needs a narrow repair. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1a8d9d5f1508. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +79, Tests +462. Total +541 across 17 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (8 earlier review cycles)
|
31dc153 to
6522759
Compare
|
@clawsweeper re-review Addressed the two Anthropic parity findings:
Validation:
|
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Merged via squash.
|
…sure (#99756) * fix: keep text tool results ahead of stale media placeholders * fix(agents): preserve fresh results before runtime context * fix(agents): defer fresh results during aggregate recovery * fix(google): preserve omitted media fallback * fix(openai): preserve omitted media fallback * fix(agents): narrow tool-result recovery scope * fix(agents): keep one fresh-result recovery path * chore: keep sweep changelog neutral --------- Co-authored-by: AcosX <[email protected]> Co-authored-by: Acos_X <[email protected]> Co-authored-by: Colin Johnson <[email protected]> Co-authored-by: Peter Steinberger <[email protected]> (cherry picked from commit abd6cbb)
…sure (openclaw#99756) * fix: keep text tool results ahead of stale media placeholders * fix(agents): preserve fresh results before runtime context * fix(agents): defer fresh results during aggregate recovery * fix(google): preserve omitted media fallback * fix(openai): preserve omitted media fallback * fix(agents): narrow tool-result recovery scope * fix(agents): keep one fresh-result recovery path * chore: keep sweep changelog neutral --------- Co-authored-by: AcosX <[email protected]> Co-authored-by: Acos_X <[email protected]> Co-authored-by: Colin Johnson <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
…sure (openclaw#99756) * fix: keep text tool results ahead of stale media placeholders * fix(agents): preserve fresh results before runtime context * fix(agents): defer fresh results during aggregate recovery * fix(google): preserve omitted media fallback * fix(openai): preserve omitted media fallback * fix(agents): narrow tool-result recovery scope * fix(agents): keep one fresh-result recovery path * chore: keep sweep changelog neutral --------- Co-authored-by: AcosX <[email protected]> Co-authored-by: Acos_X <[email protected]> Co-authored-by: Colin Johnson <[email protected]> Co-authored-by: Peter Steinberger <[email protected]> (cherry picked from commit abd6cbb)
Refs #99241
What Problem This Solves
This PR covers the two interacting model-visible failure stages reported in #99241:
(see attached image), masking upstream text loss as a media result.The July 9 report on this PR was correct for the earlier head: the provider/media patch removed the placeholder symptom but did not stop prompt projection from emptying fresh text. This updated head fixes both stages.
Why This Change Was Made
The earlier beta fixes were important but incomplete:
v2026.7.1-beta.2contains fix(llm): preserve structured tool result text across providers #97742 and fix(agents): preserve fresh tool result text under aggregate cap #98955. They preserve structured text and protect the ordinary syntactically trailing fresh-result batch.This update adopts the general fresh-projection invariant proposed in #99524, with credit to @snowzlmbot, and carries forward this PR's runtime-context regression coverage on current
main.In aggregate recovery, an unfrozen projection that appears after a frozen baseline is treated as fresh. Recovery now reduces ordinary eligible history first, then frozen history, and only then fresh non-trailing results. The existing trailing batch remains fully protected. If historical reductions cannot satisfy the hard cap, fresh results remain eligible as the final fallback, so the cap is still enforced.
For provider serialization, a new internal media-only fallback helper prevents empty text-only results from becoming image placeholders. The exported
describeToolResultMediaPlaceholderbehavior remains identical to currentmain, preserving its public Plugin SDK contract for mixed text/media callers.User Impact
Long-lived sessions with heavy
exec,read, browser, or other tool traffic should keep the newest tool output model-readable across runtime-context, steering, and follow-up boundaries while older projected history is reduced first.Media-only results retain a descriptive placeholder. Mixed text/media results preserve explicit text. No config change, migration, or new runtime option is required.
Evidence
Reproduction and focused coverage
convertToLlmboundary regression still proves runtime-context carrier metadata survives provider conversion.Automated validation
upstream/mainnode scripts/run-oxlint.mjs <15 changed files>: passed.oxfmt --check <15 changed files>: passed.git diff --check upstream/main...HEAD: passed.OPENCLAW_BUILD_ALL_NO_PNPM=1 OPENCLAW_RUN_NODE_SKIP_DTS_BUILD=1 node scripts/build-all.mjs gatewayWatchReal Gateway / model proof
A clean checkout containing only current OpenClaw plus this PR patch was run through a real local Gateway with
deepseek-v4-flashand a 128K context window:exectool calls in one session.H01throughH40.This is direct Gateway/provider long-session proof. Browser UI proof is not included in this update.
Codex autoreview
Repository autoreview was run repeatedly with Codex (
gpt-5.5, high reasoning):upstream/main: the exported helper is unchanged, and the internal helper is not exported through the Plugin SDK.AI-assisted: reproduction analysis, implementation, validation, and final review were performed with Codex.