Repository navigation
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 26, 2026, 2:17 AM ET / 06:17 UTC. Summary PR surface: Source +11, Tests +121. Total +132 across 2 files. Reproducibility: yes. Source inspection on current main shows an opened DSML block remains buffered across chunks until a close token or final flush, with no size cap before then. Review metrics: 1 noteworthy metric.
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:
Next step before merge
Security Review detailsBest possible solution: Land this PR or an equivalent UTF-8 byte-counted recoverer cap after maintainers accept the 256 KB oversized-DSML behavior. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection on current main shows an opened DSML block remains buffered across chunks until a close token or final flush, with no size cap before then. Is this the best way to solve the issue? Yes, pending maintainer acceptance of the threshold. The recoverer is the narrow owner of the unbounded buffer, and a UTF-8 byte cap matching sibling stream caps is more maintainable than downstream-only filtering. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4fc504d321b6. Label changesLabel justifications:
Evidence reviewedPR surface: Source +11, Tests +121. Total +132 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
|
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
bd5f478 to
32b4bda
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
1 similar comment
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
Refreshed on latest Rebuilt as a single clean commit on current main (dropped the intermediate merge commit). Still targets #90015; @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
Refreshed on latest |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
Add a 256 KB UTF-8 byte-accurate cap on the DeepSeek DSML tool-call recovery buffer, matching existing tool-call argument and post-tool-call buffer limits. Oversized unclosed DSML blocks are discarded as plain text. Signed-off-by: Sebastien Tardif <[email protected]>
|
Refreshed on latest Improvement: replaced the per-chunk |
…loop-condition The emitAndSlice() and clearBuffer() closures modify the buffer variable, but oxlint cannot trace mutations through closures and flags the while(buffer) loop condition as unmodified. Inline the assignments so the linter can see direct buffer mutation in the loop body. Signed-off-by: Sebastien Tardif <[email protected]>
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
Closing due to inactivity. |
Fixes #90015
Summary
The
createDeepSeekDsmlToolCallRecoverer()accumulates text in a buffer while waiting for a DSML close token. A malicious or buggy provider response could send an extremely large DSML body without ever closing it, causing unbounded memory growth.Add a 256 KB cap (
MAX_DSML_RECOVERY_BUFFER_BYTES) that discards the current DSML block as plain text when the buffer exceeds the limit. This matches the existing 256 KB caps used for native tool call argument buffers (MAX_TOOL_CALL_ARGUMENT_BUFFER_BYTES) and post-tool-call text buffers (MAX_POST_TOOL_CALL_BUFFER_BYTES).Changed files
src/agents/openai-transport-stream.ts-- addMAX_DSML_RECOVERY_BUFFER_BYTESconstant with UTF-8 byte-accurate measurement (Buffer.byteLength) increateDeepSeekDsmlToolCallRecoverer()when no close token is foundsrc/agents/openai-transport-stream.test.ts-- regression tests: oversized DSML block discarded as text (ASCII), and multibyte UTF-8 payload that exceeds byte cap despite fitting in string lengthReal behavior proof
Behavior or issue addressed: The DSML recovery buffer in
createDeepSeekDsmlToolCallRecoverer()grows without bound when a provider sends a DSML open token followed by a large body that never closes. Additionally, the byte-named cap was enforced using.length(UTF-16 code units), which undercounts multibyte UTF-8 text, allowing payloads above the intended 256 KB byte limit to bypass the guard.Real environment tested: macOS 15.5, Node v22.19, OpenClaw built from patched source at
/tmp/wt-86637.Exact steps or command run after this patch:
Step 1. Built from branch and installed deps:
cd /tmp/wt-86637 pnpm install --frozen-lockfile pnpm buildStep 2. Verified the fix uses byte-accurate measurement in the compiled production bundle:
Step 3. Ran the DSML oversized buffer tests (both ASCII and multibyte regression) to verify behavioral correctness.
Production bundle now uses
Buffer.byteLengthfor the DSML recovery cap, matching the existing sibling caps:Byte-accounting verification demonstrates the fix correctly handles multibyte text:
Both DSML oversized buffer tests pass, including the new multibyte regression test that only passes with byte-accurate measurement:
The 4 passed tests are: "discards oversized DeepSeek DSML recovery buffer as text" (ASCII, 300K chars) and "discards oversized DeepSeek DSML recovery buffer with multibyte UTF-8 text" (200K two-byte chars = 400K bytes), each running in both agents-core and agents-support suites. The multibyte test verifies the cap correctly rejects a payload whose
.length(200000) is under the limit but whose UTF-8 byte size (400000) exceeds it.Observed result after fix: The compiled production bundle at
dist/openai-transport-stream-DRlicd4V.js:3226usesBuffer.byteLength(buffer, "utf8")instead ofbuffer.lengthfor the DSML recovery cap. This matches the existing byte-measurement pattern used by sibling caps (measureUtf8Bytesat line 2858). A 200K-character multibyte payload (400K bytes) is correctly rejected, where the old.lengthcheck would have allowed it through.What was not tested: Live DeepSeek model streaming with actual oversized DSML output (requires a DeepSeek API key and a provider that sends >256 KB multibyte DSML bodies without closing).