Skip to content

fix(agents): retain images within tool-result context limits - #120808

Merged
steipete merged 1 commit into
mainfrom
codex/qa-native-image-tool-context-projection
Aug 9, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa-native-image-tool-context-projection

Conversation

@steipete

@steipete steipete commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

When a native image-tool result exceeded its existing context budget, the private result guard discarded every image while retaining text claiming the images had been loaded. This produced a misleading successful tool result and prevented the assistant from seeing images that actually fit within the unchanged budget.

Project the existing sanitized result into the same fixed context allowance: retain the stable prefix of images that truly fits, budget text and unknown content with the existing estimator, and report omitted images truthfully. Smaller windows that cannot fit an image now explain that accurately; larger windows retain the largest safe ordered prefix.

The existing per-image estimate, context share, minimum cap, privacy sanitization, provider behavior, and original result all remain unchanged. The production increase represents a new bounded mixed-image projection capability, with explicit coverage for CJK text, multiple text blocks, Unicode safety, unknown blocks, metadata, and immutable originals.

Verification

  • Tests-only execution of the actual native image tool, real image sanitizer, and installed result guard reproduced five failures while an existing under-budget control passed.
  • The final native-tool, result-guard, truncation, and estimator suites pass all 135 tests, including 8K, 32K, and 128K windows and exact unchanged final-budget assertions.
  • The complete remote changed gate explicitly includes the new real-chain regression test and passes formatting, core/test typechecks, zero-warning lint, and all privacy, ownership, and runtime guards.
  • Independent review verified every projected result stays within the original fixed budget and confirmed unchanged privacy and provider contracts; fresh structured review found no actionable issues.

@steipete
steipete marked this pull request as ready for review August 9, 2026 01:30
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Aug 9, 2026
@steipete
steipete merged commit 62b418d into main Aug 9, 2026
180 checks passed
@steipete
steipete deleted the codex/qa-native-image-tool-context-projection branch August 9, 2026 01:44
@steipete

steipete commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant