Repository navigation
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 7, 2026, 11:07 PM ET / 03:07 UTC. Summary PR surface: Source +561, Tests +357. Total +918 across 16 files. Reproducibility: yes. source inspection shows the current main path uses full-string regex parsing for large data URLs and rejects sandboxed non-image offloads above the 5 MB staging cap despite the 20 MB chat.send default. The PR body also includes live redacted logs for the before/after failure mode. Review metrics: 2 noteworthy metrics.
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 a single canonical fix that keeps extraction bounded to managed inbound PDFs, preserves non-PDF oversize rejection, and records maintainer acceptance of the broad delivery/security boundary before closing the linked issues. Do we have a high-confidence way to reproduce the issue? Yes, source inspection shows the current main path uses full-string regex parsing for large data URLs and rejects sandboxed non-image offloads above the 5 MB staging cap despite the 20 MB chat.send default. The PR body also includes live redacted logs for the before/after failure mode. Is this the best way to solve the issue? Yes, this is a coherent combined fix rather than a one-sided workaround: it updates the parser, gateway pass-through, auto-reply prompt, embedded-runner prompt, and stale UI queue paths together. The main alternative is the narrower gateway-only PR, but that would leave the Control UI stack-safe parsing and bounded PDF prompt-context gaps open. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 4780546c124d. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +561, Tests +357. Total +918 across 16 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
|
…imit chat.send accepts and passes managed PDFs through up to the default 20 MB (DEFAULT_CHAT_ATTACHMENT_MAX_MB / agents.defaults.mediaMaxMb), but inbound PDF text extraction defaulted to 10 MB, so 10-20 MB managed PDFs reached locked-down agents as the attachment marker only. Mirror the chat accept limit (mediaMaxMb else 20 MB) for the extraction default; pdfMaxBytesMb still overrides and the 25 MB cap stays the safety ceiling. Adds regression coverage for a 15 MB PDF (now extracted) and a 26 MB PDF (still skipped). Addresses the ClawSweeper P1 review finding on PR openclaw#90111.
# Conflicts: # src/auto-reply/reply/prompt-prelude.ts
|
Thanks for the thorough write-up and the real-behavior proof, Joey — the underlying problem is real and worth fixing. I'm closing this PR, though, because the approach reimplements a capability that already exists in the codebase, and that parallel path introduces correctness regressions. The linked issues (#90096–#90098) stay open; this is a "wrong mechanism," not "won't fix." The capability already existsInbound document/PDF text extraction and untrusted-content injection is already implemented in the canonical media-understanding pipeline:
And Root cause is limit defaults, not a missing featureThe PDFs in the proof were 7.97 MB and 15.6 MB. The existing extraction path's defaults are:
Those PDFs hit the 5 MB cap in Consequence: double-injectionBecause the new
The new Two confirmed correctness bugs (reproduced)1. Duplicate extraction. 2. Sandboxed small PDFs get noise instead of text. For Both are reachable in production and neither is covered by the added tests — On the embedded-runner premiseThe PR notes "Control UI/Emma uses the embedded runner path, not the auto-reply path, so fixing only get-reply was insufficient." Tracing it: Worth keepingThe gateway base64 / data-URL hardening ( Suggested path forwardA much smaller change that lands the same outcome:
That deletes |
Summary
chat.sendwithout sandbox staging-cap rejection while preserving non-PDF oversize rejectionReal behavior proof
Behavior or issue addressed: Large inbound PDFs from Signal/group-bot and Control UI/Emma were delivered to locked-down agents as attachment names or
media://inbound/...markers only, and large Control UI PDF sends could fail withRangeError: Maximum call stack size exceededbefore the agent saw the document.Real environment tested: Local installed OpenClaw
2026.6.1runtime on Joey's live workspace/gateway after applying source-equivalent runtime patches.group-botand Emma remained locked down with no broadreadorexec; PDF extraction only read managed inbound media paths.Exact steps or command run after this patch: Ran a no-delivery smoke against the real FF-Hockey
group-botsession with a managed inbound Semianalysis PDF present; ran a full gatewaychat.sendsmoke with the 7.97 MB PDF and aborted after dispatch; Joey retried a real 15.6 MB / 58-page PDF upload through the live Control UI to Emma; ran the local post-update hook and runtime syntax/config validation.Evidence after fix (screenshot, recording, terminal capture, console output, redacted runtime log, linked artifact, or copied live output): Redacted runtime log / console output from the live setup:
Observed result after fix: The gateway accepted/staged large PDF attachments without the stack overflow, managed inbound PDFs reached agents through bounded media paths, and the embedded runner prompt included extracted untrusted PDF text so Emma summarized the actual document instead of only seeing the attachment name.
What was not tested: None.
Proof limitations or environment constraints: The proof uses redacted runtime logs/copy-pasted live output instead of screenshots because the relevant evidence is server-side gateway/agent logs. The local runtime patch was equivalent behavior applied to generated installed bundles before this source PR; this PR ports that behavior into source and adds regression tests.
Before evidence (optional but encouraged): Before the fix, Signal/group-bot prompts contained only
[media attached: media://inbound/...pdf (application/pdf)]for PDFs, and Control UI/gateway logs showedchat.send attachment parse/stage failed: RangeError: Maximum call stack size exceeded.Tests and validation
Which commands did you run?
node scripts/test-projects.mjs src/media/inbound-pdf-context.test.ts src/auto-reply/reply/prompt-prelude.test.ts src/gateway/chat-attachments.test.ts src/gateway/server-methods/chat.directive-tags.test.ts ui/src/ui/chat/composer-persistence.test.ts ui/src/ui/controllers/chat.test.tspnpm tsgo:corepnpm tsgo:test:src && pnpm tsgo:test:uipnpm lint:corepnpm exec oxfmt --check --threads=1 src/media/inbound-pdf-context.ts src/media/inbound-pdf-context.runtime.ts src/media/inbound-pdf-context.test.ts src/auto-reply/templating.ts src/auto-reply/reply/get-reply.ts src/auto-reply/reply/prompt-prelude.ts src/auto-reply/reply/prompt-prelude.test.ts src/agents/embedded-agent-runner/run/attempt.ts src/gateway/chat-attachments.ts src/gateway/chat-attachments.test.ts src/gateway/server-methods/chat.ts src/gateway/server-methods/chat.directive-tags.test.ts ui/src/ui/controllers/chat.ts ui/src/ui/controllers/chat.test.ts ui/src/ui/chat/composer-persistence.ts ui/src/ui/chat/composer-persistence.test.tspnpm buildgit diff --checkWhat regression coverage was added or updated?
What failed before this fix, if known?
RangeError: Maximum call stack size exceeded.If no test was added, why not?
Closes #90096
Closes #90097
Closes #90098