fix(agents): detect full C1 range in image-generate inline directive check#103405
fix(agents): detect full C1 range in image-generate inline directive check#103405lsr911 wants to merge 2 commits into
Conversation
…check Same C1 gap pattern as openclaw#103274. Add full C1 range (0x80-0x9f). Co-Authored-By: Claude <[email protected]>
|
Codex review: needs real behavior proof before merge. Reviewed July 11, 2026, 4:37 AM ET / 08:37 UTC. Summary PR surface: Source +6, Tests 0. Total +6 across 2 files. Reproducibility: yes. from source at high confidence: current main omits U+0080–U+009F at the image-summary sanitizer, and the added execute-path regression exercises U+009B. A real provider-backed reproduction was not supplied. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Use one shared generated-media summary sanitizer for image, video, and music provider/model text and string override values, preserve the original structured details, and demonstrate the result with redacted real runtime output. Do we have a high-confidence way to reproduce the issue? Yes, from source at high confidence: current main omits U+0080–U+009F at the image-summary sanitizer, and the added execute-path regression exercises U+009B. A real provider-backed reproduction was not supplied. Is this the best way to solve the issue? No. The predicate addition is correct for image generation, but the narrowest maintainable solution is a shared generated-media output boundary that also covers equivalent video and music interpolation paths. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 585914fcd510. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +6, Tests 0. Total +6 across 2 files. View PR surface stats
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
|
Extend the existing summary-escaping regression so an ignored-override value carrying the C1 CSI introducer U+009B (an alt ANSI escape prefix) is escaped to \u009b before generated-media directives are appended, matching the existing C0/DEL/LS/PS coverage. Signed-off-by: lsr911 <[email protected]>
|
Superseded by #104362 — a single sink-wide C1 (0x80–0x9f) pass that folds this sink's fix in with a valid U+009B regression, alongside an audit of every other control-character sink (already-covered / deferred / out-of-scope). This consolidates the isolated C1 PRs per the direction on #103226. Closing in favor of the consolidated review. |
…g sinks Terminal-control sanitizers guard untrusted text before it reaches a terminal or log (CWE-117). The canonical range is C0 (0x00-0x1f), DEL (0x7f), and C1 (0x80-0x9f) - the range already used by the shared sanitizeForLog and by renderTerminalBufferText (openclaw#103274). C1 includes the 8-bit CSI introducer U+009B. Deliberate sink-wide pass: closes the C1 gap in twelve terminal/log output sinks, each keeping its own strip/escape/replace/truncate/reject action and gaining a focused valid-U+009B regression test. The PR body audits every other control-char sink (already-covered, deferred, or out-of-scope). Consolidates the isolated PRs openclaw#103379 openclaw#103380 openclaw#103381 openclaw#103382 openclaw#103383 openclaw#103402 Signed-off-by: lsr911 <[email protected]> openclaw#103405 and re-lands the sanitizeForConsole fix from openclaw#103226 cleanly.
What Problem This Solves
sanitizeInlineDirectiveText()insrc/agents/tools/image-generate-tool.tsescapes control characters in provider/model/override text before generated-media directives are appended to the image-tool summary (so untrusted values can't injectMEDIA:directives or terminal escapes). ItsisInlineDirectiveControlCharacter()predicate covered C0 (0x00-0x1f), DEL (0x7f), LS (0x2028) and PS (0x2029), but not the C1 control range (0x80-0x9f) — which includes the CSI introducer U+009B, an alternative ANSI escape prefix equivalent toESC [.Change
Add
(code >= 0x80 && code <= 0x9f)toisInlineDirectiveControlCharacter, so C1 bytes are escaped to a visible backslash-u sequence alongside the existing ranges.Testing / Proof
Extended the existing summary-escaping regression in
src/agents/tools/image-generate-tool.test.ts("escapes image-generation summary text before appending tool MEDIA output") so anignoredOverridesvalue now carries a U+009B control byte (followed by[2J). The test asserts the emitted summary contains the escaped backslash-u form of U+009B rather than the raw byte, while the structureddetailsobject still round-trips the original raw value unchanged.The test drives the real image-tool
executepath throughsanitizeInlineDirectiveText, so the passing run is the before/after proof: on currentmainthe U+009B passes through the escaping boundary raw; with this change it is escaped to its visible backslash-u form before the media directive is appended.