Repository navigation
Description
Pull request creation is refused for this account (CreatePullRequest FORBIDDEN). The branch is on the fork.
Head: 985a5d708e74de790c7e3c2bae188aafac389238 on SebTardif:fix/f045-clipboard-pixel-budget
What Problem
Pasting a clipboard image decodes the whole bitmap before the 10 MB attachment cap.
User Impact
A pasted image whose encoded bytes or decoded pixels would pass 10 MB is dropped before the bitmap is allocated. A paste that fits still becomes a PNG attachment.
Why
A file attachment is rejected from its length before it is read. The clipboard path decoded the frame with GetSoftwareBitmapAsync, encoded PNG, and only then compared the PNG size with the cap. A compact image can expand to a much larger bitmap. The paste now rejects a stream that is already over the cap, and rejects the decoder's raw or oriented pixel size, before that decode. The PNG size check still runs after encoding.
Evidence
ExceedsDecodedPixelBudget did not exist, so the new tests failed to compile (CS0117).
After the helper, those three tests passed: one pixel past the cap is rejected, a bitmap exactly at the cap is accepted, and uint.MaxValue by uint.MaxValue at 4 bytes per pixel is rejected.
ClipboardPaste_ChecksThePixelBudgetBeforeDecoding passed. The stream cap and ExceedsDecodedPixelBudget both appear before GetSoftwareBitmapAsync.
./build.ps1 succeeded.
Shared tests passed 4663, skipped 24, total 4687.
Tray tests passed 4475, skipped 0, total 4475.
Real Behavior Proof
- Environment tested: the shared attachment budget and the clipboard source order. The tray window was not opened.
- Commit tested:
985a5d708e74de790c7e3c2bae188aafac389238 - Steps:
dotnet testfiltersExceedsDecodedPixelBudgetandClipboardPaste_ChecksThePixelBudgetBeforeDecoding. - Evidence: the three budget tests passed in 108 ms. The call-order test passed in 154 ms.
- Observed result: dimensions that decode past 10 MB are rejected before
GetSoftwareBitmapAsync. - Screenshot: no.
- Not verified: a live paste was not performed. A rejected paste returns no attachment and writes no log line, and producing the oversized decoded bitmap is the allocation this change avoids.
Required proof pools
none: no installer, WSL gateway, MXC, or ARM64 pool applies.
Security Impact
- New permissions or capabilities? No
- Secrets or tokens handling changed? No
- New or changed network calls? No
- Command or tool execution surface changed? No
- Data access scope changed? No
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsBacklog
Activity
clawsweeper commentedon Oct 22, 2026
Codex review: this still needs some work.
Summary
Current main still allocates and re-encodes clipboard bitmaps before checking attachment size; the proposed decoded-memory limit needs a compatibility decision.
Reproducibility: Current source proves that bitmap allocation and PNG encoding precede the size check; no live paste, allocation measurement, build, or test was run during this read-only review.
Maintainer decision needed
Next step
Choose the decoded-memory ceiling, then require a failing pre-decode rejection regression and native paste proof covering oversized input, ordinary screenshots, and visible rejection feedback.
Review details
Best possible solution:
Bound clipboard decoding with an explicit memory budget that preserves ordinary screenshots, retains the encoded attachment cap, and explains rejected pastes visibly.
Do we have a high-confidence way to reproduce the issue?
Current source proves that bitmap allocation and PNG encoding precede the size check; no live paste, allocation measurement, build, or test was run during this read-only review.
Is this the best way to solve the issue?
Checking before decoding addresses the allocation path, but reusing the encoded-file cap as a decoded-memory cap changes supported images and requires an explicit compatibility choice.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning medium; reviewed against 8ca63eb746bf.
Label changes
Label changes:
P2: Clipboard image processing has a source-confirmed unbounded pre-validation allocation path, without an established crash or urgent user regression.impact:other: The concrete concern is excessive bitmap decoding and PNG encoding memory use during image paste.issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.clawsweeper:source-repro: Current issue advisory state selects this label.clawsweeper:no-new-fix-pr: Current issue advisory state selects this label.clawsweeper:needs-maintainer-review: Current issue advisory state selects this label.clawsweeper:needs-product-decision: Current issue advisory state selects this label.Label justifications:
P2: Clipboard image processing has a source-confirmed unbounded pre-validation allocation path, without an established crash or urgent user regression.impact:other: The concrete concern is excessive bitmap decoding and PNG encoding memory use during image paste.Evidence reviewed
What I checked:
src/OpenClaw.Tray.WinUI/Chat/ChatComposerControllerClipboard.cs:137, 8ca63eb746bf)src/OpenClaw.Shared/ChatAttachment.cs:45, 8ca63eb746bf)src/OpenClaw.Tray.WinUI/Chat/ChatComposerControllerClipboard.cs, 985a5d708e74)tests/OpenClaw.Tray.UITests/ChatComposerControllerPasteFencingProofTests.cs:82, 8ca63eb746bf)src/OpenClaw.Tray.WinUI/Chat/ChatComposerControllerClipboard.cs:140, 686afdc8d4a2)src/OpenClaw.Shared/ChatAttachment.cs:16, cd4acf013e38)Likely related people:
src/OpenClaw.Tray.WinUI/Chat/ChatComposerControllerClipboard.cs)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.Reviewed October 22, 2026, 10:44 AM ET / 14:44 UTC.
github-actions commentedon Nov 6, 2026
This issue has been automatically marked as stale due to inactivity.
Please add updated OpenClaw Windows details or it will be closed.
github-actions commentedon Nov 13, 2026
Closing due to inactivity.
If this still affects OpenClaw Windows, open a new issue with the current version, logs, and fresh reproduction details.