Repository navigation
fix #99163: harden large chat attachment parsing - #99213
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 5, 2026, 10:34 PM ET / 02:34 UTC. Summary PR surface: Source +42, Tests +305. Total +347 across 7 files. Reproducibility: yes. at source/report level, but not from a fresh failing current-main run in this read-only review. Current main and Review metrics: none identified. Stored data model 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. Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Land this as the canonical narrow fix for the large screenshot Do we have a high-confidence way to reproduce the issue? Yes at source/report level, but not from a fresh failing current-main run in this read-only review. Current main and Is this the best way to solve the issue? Yes for the narrow screenshot crash. Moving stack safety into shared media-core canonicalization and bounding MIME prefix decode is the maintainable layer; broader file/PDF and queue cleanup should remain on the separate tracker. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d507ba0b0b9c. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +42, Tests +305. Total +347 across 7 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
Review history (1 earlier review cycle)
|
0163e64 to
02cc6d2
Compare
02cc6d2 to
3546288
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
@clawsweeper re-review Added a real Control UI browser proof for the large clipboard image path:
Proof summary from the browser run: {
"pngBytes": 1901669,
"base64Chars": 2535560,
"dataUrlChars": 2535582,
"screenshots": [
".artifacts/control-ui-e2e/chat-large-paste-99213/01-pasted-large-image.png",
".artifacts/control-ui-e2e/chat-large-paste-99213/02-sent-large-image.png"
],
"videos": [
".artifacts/control-ui-e2e/chat-large-paste-99213/large-paste.webm"
]
}Validation run on this PR head
This should cover the requested "real Control UI / Gateway proof": paste/send a ~2MB screenshot-like image through the browser UI and confirm |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Maintainer-ready status update for #99163:
I also updated the PR body into a maintainer-review format with Root Cause, Real behavior proof, Regression Test Plan, Risk / Compatibility, What was not tested, and Canonical Fix Path sections. Recommendation: treat this PR as the canonical narrow fix for #99163. The competing candidate #99173 is still unranked / needs proof, while this PR preserves full malformed-tail validation, adds bounded MIME-prefix decoding after full validation, and has the stronger real-path proof. Broader large-attachment cleanup should remain on #90098 / #92223 rather than block this narrow crash fix. |
|
@clawsweeper re-review |
c637cac to
3aae6ec
Compare
3aae6ec to
5022b09
Compare
5022b09 to
8601e57
Compare
) * fix(gateway): harden large chat attachment parsing * test(ui): prove large chat image paste * fix(media): preserve short MIME rejection --------- Co-authored-by: xjch <[email protected]> Co-authored-by: Vincent Koc <[email protected]>
* test(scripts): deslop q0149 tests Remove the duplicate extension-only classifier row; the file-backed mirrored-dependency audit retains that classification branch and diagnostic identifiers. Stop snapshotting recommendation prose while retaining dependency ownership, versions, paths, counts, and declarations. CI-only campaign: formatting, diff check, and plain oxlint passed. Runtime tests and coverage intentionally deferred. The shard is already largely consolidated; distinct security, platform, release, and error-path harnesses remain intact. * test(scripts): consolidate q0149 owner-boundary proof Drop UI owner-route replays covered by ui-tsx-discovery's selects-the-existing-CI-owners test and periodic inventory restatements covered by ci-node-test-plan and ci-workflow-ui-full. Keep smoke admission, transitive isolation, stale-build gating, and manifest shard boundaries. Keep resource-limit production-path assertions and shell exit propagation; check-limits.test.ts owns warning escaping and summaries. Keep one storage-unavailable formatter path; openclaw-state-worker-error.test.ts owns error-code and contention variants. Remove copied dependency audit records and enum inventory replays, retaining each classification path. Factor pnpm launcher writes without removing runner cases. CI-only: oxfmt, diff check, and plain oxlint passed; no tests or coverage run. Further reduction would remove distinct script behavior; shard remains below the requested line target. * test(ui): deslop q0152 tests Remove redundant Usage E2E layers. Remaining proof: ui/src/pages/usage/view-availability.test.ts covers interrupted lower bounds; view-overview.test.ts covers unpriced totals; provider-series.test.ts covers alias folding; view-chart.test.ts covers provider stacks; view-chart.browser.test.ts covers full-range columns; view.test.ts covers missing-cost hints and provider plans/billing. ui/src/e2e/model-providers-studio-shape.e2e.test.ts retains the Models-to-Usage handoff and exhausted plan windows. ui/src/pages/usage/view-details.test.ts retains repeated assistant call counts, result exclusion, selected ranges and Reset; usage-page-details.test.ts retains refresh publication of totals, timeline and conversation; usage-page-detail-identity.test.ts retains pointer range and refresh request ownership. Remove the CLI importer replay: src/gateway/cli-session-history.test.ts retains imported-only source fidelity and local/imported deduplication, and ui/src/pages/chat/components/chat-imported-history.test.ts retains rendered imported text. chat-tool-cards.redaction.test.ts retains raw collapsed tool arguments. Keep the Activity event/render/truncation boundary scenario, removing its unrelated Chat setup. Remove unasserted screenshots and observation artifacts without changing the durable key lifecycle or attachment assertions. Remove only the deleted Usage test path from the E2E owner path list. No production/helper changes. CI-only: no tests, coverage, Testbox or typecheck runs. Plain oxlint, oxfmt and diff-check pass. Shard test LOC 1565 -> 1060 (-32.3%); declarations 13 -> 10; expanded cases 19 -> 16. Below 40%: retain unique real-WebSocket startup, nested disclosure/ordinary exec distinction, config recovery, Activity previews, responsive attachment downloads, durable API-key custody and session layout/kind grouping. * test(gateway): deslop q0150 tests Remove duplicate wizard token-persistence/restart-auth and invalid-channel scenarios. Both remain covered by the identically named cases in src/gateway/gateway.test.ts. Reuse Gateway home and ID fixtures and bind repeated chat setup. Preserve approval authority/races, clone/fetch identity fences, hot-reload compaction, diagnostic correlation, completion expiry and node deadline provenance. CI-only: oxlint, oxfmt and diff checks; no tests or coverage executed. Net reduction 101/1408 lines (7.2%); remaining distinct boundaries prevent an honest 40% cut. * test(gateway): deslop q0150 boundary suites Remove the catalog/diagnostic E2E replay. Keep catalog reload releases the agent writer while preserving same-session ordering in server-methods/sessions-mutations.catalog-queue.test.ts; retain writer timing and privacy in state/openclaw-agent-write-admission.test.ts and config/sessions/session-accessor.sqlite-scope.test.ts; retain trace propagation in logging/logger-redaction-behavior.test.ts and logging/diagnostic-log-events.test.ts. Remove the completion-expiry Gateway replay. Keep retains delete-mode successful completions through the delivery deadline in agents/subagents/registry/subagent-registry.test.ts, preserves the concrete delivery error through retries in subagent-registry-lifecycle.test.ts, and durable expiry suspension/receipts in completion/subagent-completion-admission.mailbox.test.ts and subagent-completion-admission.expired-receipt.test.ts. Keep WebSocket approval scope denial and local-only runtime authority. Duplicate winner/replay/projection/history assertions remain in server-methods/approval.test.ts and approval.channel-custody.test.ts. Trim channel wizard to omitted versus explicit channel, one select step; setup intro/outro remain in gateway.test.ts. Remove only deleted-file timing/mock baseline entries. CI-only: no test, coverage or build runs. Plain oxlint, oxfmt and diff checks passed. Cumulative shard: 1408 to 844 lines, 564 removed (40.1 percent). * test(e2e): deslop q0153 tests Remove the requester-catalog whole-Gateway replay. Retained coverage: src/gateway/server-methods/requester-model-catalog.test.ts uses requester catalogs through the real command and agent tool assembly call sites, including admitted and unadmitted callers. src/plugins/requester-models.test.ts retains capability and invocation-lifetime guards. Keep both Hugging Face onboarding cases and all request assertions; inline the single-use HTTP handler and attach cleanup directly to each test. Other E2E scenarios retain distinct credential, transcript, transport, restart, and migration contracts. CI-only campaign: oxfmt, plain oxlint, and diff check passed; no tests or coverage run. Shard test LOC 1345 -> 1126, declarations 8 -> 7, expanded cases 9 -> 8. Below the 40 percent line target to preserve distinct integration proof. * test(e2e): remove redundant q0153 runtime replays Retain preflight coverage in src/auto-reply/reply/agent-runner-memory.preflight-stale-tokens.test.ts: excludes superseded oversized history from the active context budget. Retain summary, forward-cut, and post-reopen append coverage in src/agents/sessions/session-manager-bounded.test.ts: retains the forward cut after consecutive excluded first-kept entries. Retain dreaming storage coverage in extensions/memory-core/src/dreaming-startup-cleanup.test.ts: reclaims every stale dreaming phase without touching active, unrelated, or other-agent sessions; cleans historical artifacts while automatic scheduling is disabled; does not reclaim post-startup runs when the deferred cleanup callback runs late. Retain multi-agent replacement, cleanup joining, and failure reporting in dreaming-startup-lifecycle.test.ts. Startup cleanup is independent of dreaming enablement in the production gateway_start hook. Reuse existing HTTP response and shutdown helpers in the Hugging Face fixture. The strict route guard and successful streamed reply retain endpoint coverage without recording and reasserting the same path. Keep both onboarding cases and their model, stream, prompt, config, and output assertions. CI-only validation: plain oxlint, oxfmt, and git diff --check passed; no tests or coverage run. Cumulative shard LOC 1345 -> 805 (-40.15 percent). No production or shared-support changes. * test(scripts): deslop q0151 tests Run shared Testbox preparation branches once; retain per-workflow checkout and base-ref wiring checks. The merge, linear, missing-parent and manual cases remain in testbox-base.test.ts. Remove two equivalent invalid-arity plugin inventory CLI rows; the missing --commit value row retains that branch. Share UI sequencer fixtures and assert the complete cold-run order instead of simulating a worker pool. Preserve all warm-order, phase, membership, pinning, redaction and release-history contracts. Compact workspace and release-note fixtures without production changes. CI-only shard: formatting and plain oxlint passed; tests and coverage deferred to hosted CI. This shard remains below the requested 40 percent line reduction to retain distinct proof. * test(scripts): remove duplicate q0151 proof layers Remove Testbox workflow-text snapshots while retaining the shared action's four real checkout cases. Replace Periphery's copied job/artifact inventory with a producer-consumer invariant and derive fixture job names from the workflow; formatAnnotation retains parseRepoLocation proof. Shared ratchet ancestry remains covered by check-max-lines-ratchet.test.ts: compares an explicit moving base at the branch fork; rejects unavailable ancestry with an explicit prepared-base recovery. Unresolved staged reads remain covered by check-assertion-safety-ratchet.test.ts: keeps worktree counts and staged read failures with unmerged index entries. The retained environment staged-budget case covers the retired numeric-threshold variant. Consolidate inventory surface rendering and escaping inputs without dropping their assertions. Remove duplicate sharding membership replay covered by keeps shared UI/Gateway partition ties deterministic without collapsing specifications; retain two tied bundled files and all UI phases. Cron retains replay and fixture-side tool-cap assertions. CI-only: plain oxlint, formatting and diff checks pass; no test or coverage runs. * test(scripts): deslop q0155 tests Remove repeated PR, push, and full-release runtime defaults and duplicated Node/UI Bun setup assertions. Remaining coverage: ci-workflow-planning.test.ts, routes test runtimes without adding jobs; ci-test-runtime-trial.test.ts retains explicit dispatch budgets, main dispatch defaults, automatic-event override rejection, and unsupported-policy errors. Factor Baileys fixture file reads and JSON writes without changing its install, waveform, long dependency, stale-link, sibling-preservation, or workspace-restoration assertions. CI-only audit; no test execution. Retain other shard files because their release authority, cancellation lifecycle, dependency admission, and independent invoice reconciliation paths are distinct. * test(scripts): consolidate q0155 boundary fixtures Use one CLI ownership-report fixture for closure, build-risk, missing ownership, plugin ownership and stale-record assertions. Bind the release shadow manifest to the real large-diff fixture instead of a second synthetic worktree state. Remove runtime output inventories and workflow source-string checks. ci-workflow-planning.test.ts retains runtime routing coverage; ci-workflow-guards.test.ts retains executed npm-lock command coverage. Preserve the generic admission-before-setup invariant by evaluating both condition outcomes. Remove disconnected-history replay covered by the depth-one checkout no-merge-base cases, same-branch conservative path variants, and the duplicate webhook identity failure covered by token identity failure plus authenticated webhook success. Keep cancellation, invoice reconciliation, frozen-target authorization, and patched package materialization intact. CI-only: format, diff-check and plain oxlint; no test execution. * test(scripts): reuse q0155 fixture owners Reuse PID cleanup, workflow lookup and fixture JSON writers. Remove a probe-only success log and its assertion; the embedded Baileys assertions and nonzero exit still enforce the actual install contract. Drop the pretest runtime manifest case: it merely re-exports pretestBuildMode, while the retained explicit dual-all case proves requires_bun. Real runtime-consumer placement remains covered by ci-node-test-plan.test.ts, partitions whole-config runtime consumers from ordinary serial CLI work. Retain the distinct check-changed cancellation regression (2864f56), Baileys materialization regression (432bada), independent invoice oracle, frozen-target authorization paths, and trusted Docker harness boundaries. Static gates only; no test execution. * test(scripts): deslop q0154 tests Reuse the existing loopback HTTP fixture, share release input data, and compact metadata rejection setup and protocol expectations without dropping cases. Keep transform work-count, source-edit invalidation, generation identity and disposal checks. Preparation diagnostics remain covered by vitest-worker-artifacts.test.ts (shares a completed generation between real borrower processes until both finish); cache metadata remains exercised by vitest-report-owner.test.ts (config-load-once). CI-only campaign: plain oxlint, oxfmt and diff-check pass; no test or coverage runs. Reduction is 1773 to 1728 lines, below the 40 percent target because the remaining suites retain distinct publication, ownership, parser and lifecycle boundaries. * test(scripts): remove q0154 duplicate coverage layers Keep one asset case per source-resolution branch and one notes rejection before lookup. Remove the pass-through release inventory assertion and compiler fixture input/output counts; retain runtime results, main-thread execution, transform work counts and generation ownership. Keep qualified refusal coverage for stale context, retained evidence, same/replacement heads and immediate admission. Shared stale-gate, review/head invalidation and pending/failing-check coverage remains in pr-merge-recovery.test.ts (checks current evidence for same-head recovery). Historical parser qualification remains in pr-merge-pre-dispatch-refusal.test.ts (qualifies only intact, inspected no-dispatch evidence). CI-only: oxfmt, plain oxlint and diff-check pass; no test runs. Total shard reduction is 1773 to 1651 lines, below the requested 40 percent. No obsolete subjects or additional safely redundant layers were found. * test(scripts): deduplicate q0154 owner-boundary coverage Keep transform value/work-count invalidation tests while leaving generation ownership and source routing in vitest-worker-artifacts.test.ts. Keep watcher-specific loader integration while leaving dev-dependency, private-subpath and stale-version rejection in tooling-dependencies.test.ts. Remove the qualified-refusal stale-context replay covered by pr-merge-recovery.test.ts (rejects evidence: prep-context). Remove the generated asset success replay covered by build-external-plugin-local-dist.test.ts (keeps excluded plugin graphs isolated and their runtime metadata loadable). Preserve settlement, local-dependency precedence and strict qualified-admission tests. CI-only: oxfmt, plain oxlint and diff-check passed; no tests/builds/coverage runs. Additional reduction 74 lines; shard 1773 to 1577 lines, below the 40 percent target. Independent read-only audits found no safe whole-file deletions. * test(pr): deslop q0157 tooling layers Exercise duplicate closure through dry-run/apply workflow branches instead of a separate hand-built apply plan. Remove copied CLI inventories and exact prose while retaining evidence, commit references, mutation order and bounded GitHub calls. Retain representative root/nested and hoisted/isolated package-bin cases; UI build remains covered by ui.test.ts and browser ffmpeg installation by ensure-playwright-chromium.test.ts. Remove duplicate delayed completion replay covered by pr-merge-admin-completion.test.ts. Trim state and release fixtures; remove snapshot telemetry duplicated by native descriptor assertions and exact-byte hashing. Preserve identity, process termination, authority and cleanup paths. Static gates only; no tests run under the CI-only work order. * test(pr): deslop q0157 owner-boundary fixtures Replace package-command inventory replays with root, hoisted and isolated tests at the real package-bin CLI. Pnpm forwarding remains covered by pnpm-runner.test.ts and the UI consumer by ui.test.ts. Exercise release metadata directly through its prepared CLI instead of recopying its import graph. Remove the snapshot cancellation replay: the retained hash probe proves private read-only descriptors and unlinked paths before dispatch; pr-operation-lock.test.ts covers native SIGTERM supervision. Same-tree pair acceptance remains in pr-merge-correction.test.ts and post-GC retention in pr-merge-recovery.test.ts. Consolidate duplicate-close workflow paths and two repeated candidate-identity error rows, preserving candidate tarball and entrypoint regressions. Static-only gates: plain oxlint, oxfmt, diff check; no tests or coverage run. * test(ui): deslop q0158 tests Remove the duplicate composition-blur title scenario; new-session-page.title.e2e.test.ts retains the same timing and creation handoff, with the idle row retaining no-premature-create and hidden-hint assertions. Inline the single-use large-paste recording wrapper and reuse mobile progress and scroll assertions without changing their lifecycle, geometry, payload, or artifact contracts. Retain distinct startup, resize, guest authorization, sidebar, stale-build and panel-reload coverage. CI-only validation: plain oxlint, oxfmt and git diff --check. No tests or coverage run. Reduction is below the 40% target because further removals lack equivalent branch and lifecycle proof. * test(ui): consolidate q0158 e2e owner coverage Reduce the original shard from 1529 to 917 lines (40.0%). Keep global startup routing, reader resize, mobile clearance, guest authority/cancellation, real stale-build reload, and terminal adoption. Remove copied boot-module/storage inventories and per-theme replays, not their owner contracts. Large-image regression ba9700d (#99213): retain src/gateway/chat-attachments.test.ts (parses large clipboard data URL images without full base64 decoding), src/media/sniff-mime-from-base64.test.ts (sniffs large payloads from their prefix), ui/src/lib/bytes-base64.test.ts, chat-attachment-resize.browser.test.ts, chat-flow.image-handoff.e2e.test.ts and chat-transcript-geometry.test.tsx. These cover parsing, browser paste, send handoff and committed row sizing without the standalone capture suite. Startup/history/model catalog coverage remains in chat-send.test.ts, chat-pane-model-catalog.test.ts, app-host.chat-metadata.test.ts and chat-flow.messaging.e2e.test.ts. New-session readiness/reconnect coverage remains in new-session-page.early-submit.e2e.test.ts, new-session-page.catalog-reconnect.e2e.test.ts, palette-session-draft.warm-roster.test.tsx, draft.catalog-reconnect.test.ts and draft-native-terminal-start.test.ts. Panel lazy/restoration and one-read ownership remain in lazy-custom-element-recovery.e2e.test.ts, browser-panel-width.e2e.test.ts, browser-panel.test.ts, assistant-panel.test.ts and dock-panel-layout.test.tsx. Boot chunk exclusions remain in control-ui-chunking.test.ts. Sidebar presentation remains in sidebar-roster.e2e.test.ts; measured end-follow remains in chat-transcript-geometry-updates.browser.test.tsx and chat-transcript-end-follow.browser.test.ts. CI-only validation: oxfmt, plain oxlint and git diff --check passed. No tests, coverage, builds or Testbox commands run. Coordinator reviews the static owner mappings and hosted CI supplies execution proof. * test(tooling): deslop q0159 tests Remove repeated capacity permutations; retain each qualification, rejection, and backend branch. Multi-group selection scope remains covered by test/scripts/ci-node-test-plan.selection-capacity.test.ts. Keep the immutability assertion on retained positive selections. Consolidate sweeper skip fixtures without losing per-case mutation or logging assertions. Attached-CI behavior remains covered by the cancelled-CI row; preserve draft classification separately from the runner's early draft skip. * test(tooling): reduce q0159 harness and branch replays Use the existing command and Node-script fixtures for PTY ownership, output capture, and cleanup; retain all five PTY behaviors. Remove duplicated workflow-text assertions, archive wrapper/platform replay, and exact-pin mismatch variants. Keep two Parallels bootstrap outcomes; src/infra/runtime-guard.test.ts covers the Node version matrix. Nested artifact ownership remains covered by dist-artifact-ownership.test.ts: keeps declarations alive until their writer joins. Prior-CI always-bypass and admin conflict-resolution remain covered by pr-merge-prior-ci.test.ts: revalidates delegated CI bypass before dispatch; lands one pinned REST squash. Keep PR-only authority and each distinct denial. Reduce TSX conservative-import inputs to each guard path and native recovery failures to one per decision branch. Preserve live recovery, no-worker proof, file identity, and output validation. Static format, diff, and oxlint checks pass; no tests run in CI-only mode. * test(tooling): deduplicate q0159 capacity guards Run shared capacity rejection guards once instead of replaying them across three owner fixtures. Retain exact core and isolated qualification cases, and one mixed-group rejection. The precise gateway-client success path remains covered by ci-node-test-plan.test.ts: retains owner worker fallback in precise backend plans. Remove the revoked-bypass replay: pr-merge-prior-ci.test.ts revalidates delegated CI bypass before dispatch, including live revocation. Keep all other repository, membership, ruleset, and policy denial boundaries. Formatting, diff check, and plain oxlint passed; no test runs in CI-only mode. * test(ui): deslop q0160 tests * test(ui): remove redundant q0160 E2E layers Remove question-progress composition replays: question-flow owns takeover, draft restoration and backscroll; chat-composer-question owns progress disclosure; chat-details.browser, chat-details-mobile-host.browser and chat-details-arrival own disclosure, mobile retention and absent-card branches. Keep approval error isolation in overlays.test.ts (keeps a resolve failure attached to its older request) and inline rendering in chat-footer-view.test.ts. Active-run approval dispatch remains in chat-send-submit.annotations, chat-send-detached-deadline and chat-pane-bridge tests. Retain passive Inbox and no-auth sidebar rendering here. Keep navigation retirement in started-session-navigation and new-session-page.instant-thread; creation rejection and retry remain in new-session-page.transition. Keep personal visibility reversal and cold persistence in session-involvement, menu variants in session-menu.involvement, and retain the unique sidebar hide mutation here. Drop LTR left/right resize replays covered by resizable-divider, browser-panel-width and chat-panel-layout while retaining RTL and bottom pointer regression proof. Reuse splitColumns for comment fixtures and retain one editor case per ownership branch plus both reply-menu branches. CI-only: formatting, diff check and plain oxlint passed; no tests or coverage executed. Cumulative shard reduction is 1485 to 1097 lines (26.1%), below the requested 40%; unique remaining behavior retained. * test(ui): deslop q0162 tests Remove the mocked Processes replay: background-work.real-gateway.e2e.test.ts covers exact-instance Stop, retained output, panel switching and draft persistence; chat-processes-panel.test.ts covers shared reads and Stop isolation. Keep mention loading and reduced-motion proof in chat-mention-search.e2e.test.ts. Retain both native/catalog tab routes and both gestures without their redundant cross product. Connection draft/discard validation remains in connection-page.test.ts and view.render.test.tsx; retain real browser persistence and reconnect flows here. Trim optional capture plumbing and unrelated fixtures. Preserve scope-downgrade, catalog-involvement, shared-diff lifecycle and DST regression scenarios. CI-only campaign: formatting, diff-check and plain oxlint passed; runtime and coverage validation deferred to hosted CI. * test(ui): consolidate q0162 owner-covered e2e replays Reduce the shard from its 1415-line baseline to 849 lines (40%). This follow-up removes 273 lines beyond aa879d929405; no test or coverage runs under the CI-only work order. Keep PR scope retirement at session-pull-requests.test.ts: retires broad snapshots and passive reads when only own-session reads remain. app-sidebar-session-pr-indicators.test.ts covers same-client scope revocation and own-reader badge clearing. Keep restricted publication discovery in E2E. Keep focus and disabled picker behavior in agent-select-opening.browser.test.ts and resolved-name branches in lib/agents/display.test.ts. Preserve both New Session themes and hero/picker identity propagation. Connection-page.test.ts and view.render.test.tsx own reconnect callbacks, credentials and pending controls; E2E retains persisted drafts and held-handshake target replacement. Keep Environment disclosure in chat-details.browser.test.ts and visible demand lifecycle in chat-session-workspace.test.ts and chat-details-session.test.ts. Preserve E2E error retention and Environment/Review in-flight request sharing. Collapse catalog provider copies to unlinked, admitted and unadmitted rows; the projection branch depends on backing-key membership, not provider identity. Unmarked sidebar visibility remains in sidebar-rail-toggles.capture.e2e.test.ts and the retained new-tab scenario. * test(scripts): remove redundant q0161 proof layers Keep packing contracts here; runner environment propagation and serialization remain in ci-run-node-test-shard.test.ts. Replace cache file round trips with fresh-scheduler identity proof; test-projects-routing.test.ts and test-projects-build-admission.test.ts retain caller-boundary coverage. Remove copied schema registration inventories and duplicate memory drift variants; retain generated/native equivalence, generated admission drift, and foreign uniqueness. sqlite-schema-contract.test.ts covers common drift handling. Remove the mocked Docker success-tail harness and cron source grep; docker-build-helper.test.ts retains real cron runner and harness stdin/cleanup proof. Share iOS command fixtures, reuse the workflow expression evaluator, and retain one generic optional-cache tail invariant. Validation: oxfmt, plain oxlint, git diff --check. No tests or coverage run under CI-only policy. * test: preserve cache expiry and defer catalog cleanup * test: complete Swift cache workflow step fixture * test: retain native context meter capture boundary * test: preserve packing envelope assertion semantics
…aw#182556) * test(scripts): deslop q0149 tests Remove the duplicate extension-only classifier row; the file-backed mirrored-dependency audit retains that classification branch and diagnostic identifiers. Stop snapshotting recommendation prose while retaining dependency ownership, versions, paths, counts, and declarations. CI-only campaign: formatting, diff check, and plain oxlint passed. Runtime tests and coverage intentionally deferred. The shard is already largely consolidated; distinct security, platform, release, and error-path harnesses remain intact. * test(scripts): consolidate q0149 owner-boundary proof Drop UI owner-route replays covered by ui-tsx-discovery's selects-the-existing-CI-owners test and periodic inventory restatements covered by ci-node-test-plan and ci-workflow-ui-full. Keep smoke admission, transitive isolation, stale-build gating, and manifest shard boundaries. Keep resource-limit production-path assertions and shell exit propagation; check-limits.test.ts owns warning escaping and summaries. Keep one storage-unavailable formatter path; openclaw-state-worker-error.test.ts owns error-code and contention variants. Remove copied dependency audit records and enum inventory replays, retaining each classification path. Factor pnpm launcher writes without removing runner cases. CI-only: oxfmt, diff check, and plain oxlint passed; no tests or coverage run. Further reduction would remove distinct script behavior; shard remains below the requested line target. * test(ui): deslop q0152 tests Remove redundant Usage E2E layers. Remaining proof: ui/src/pages/usage/view-availability.test.ts covers interrupted lower bounds; view-overview.test.ts covers unpriced totals; provider-series.test.ts covers alias folding; view-chart.test.ts covers provider stacks; view-chart.browser.test.ts covers full-range columns; view.test.ts covers missing-cost hints and provider plans/billing. ui/src/e2e/model-providers-studio-shape.e2e.test.ts retains the Models-to-Usage handoff and exhausted plan windows. ui/src/pages/usage/view-details.test.ts retains repeated assistant call counts, result exclusion, selected ranges and Reset; usage-page-details.test.ts retains refresh publication of totals, timeline and conversation; usage-page-detail-identity.test.ts retains pointer range and refresh request ownership. Remove the CLI importer replay: src/gateway/cli-session-history.test.ts retains imported-only source fidelity and local/imported deduplication, and ui/src/pages/chat/components/chat-imported-history.test.ts retains rendered imported text. chat-tool-cards.redaction.test.ts retains raw collapsed tool arguments. Keep the Activity event/render/truncation boundary scenario, removing its unrelated Chat setup. Remove unasserted screenshots and observation artifacts without changing the durable key lifecycle or attachment assertions. Remove only the deleted Usage test path from the E2E owner path list. No production/helper changes. CI-only: no tests, coverage, Testbox or typecheck runs. Plain oxlint, oxfmt and diff-check pass. Shard test LOC 1565 -> 1060 (-32.3%); declarations 13 -> 10; expanded cases 19 -> 16. Below 40%: retain unique real-WebSocket startup, nested disclosure/ordinary exec distinction, config recovery, Activity previews, responsive attachment downloads, durable API-key custody and session layout/kind grouping. * test(gateway): deslop q0150 tests Remove duplicate wizard token-persistence/restart-auth and invalid-channel scenarios. Both remain covered by the identically named cases in src/gateway/gateway.test.ts. Reuse Gateway home and ID fixtures and bind repeated chat setup. Preserve approval authority/races, clone/fetch identity fences, hot-reload compaction, diagnostic correlation, completion expiry and node deadline provenance. CI-only: oxlint, oxfmt and diff checks; no tests or coverage executed. Net reduction 101/1408 lines (7.2%); remaining distinct boundaries prevent an honest 40% cut. * test(gateway): deslop q0150 boundary suites Remove the catalog/diagnostic E2E replay. Keep catalog reload releases the agent writer while preserving same-session ordering in server-methods/sessions-mutations.catalog-queue.test.ts; retain writer timing and privacy in state/openclaw-agent-write-admission.test.ts and config/sessions/session-accessor.sqlite-scope.test.ts; retain trace propagation in logging/logger-redaction-behavior.test.ts and logging/diagnostic-log-events.test.ts. Remove the completion-expiry Gateway replay. Keep retains delete-mode successful completions through the delivery deadline in agents/subagents/registry/subagent-registry.test.ts, preserves the concrete delivery error through retries in subagent-registry-lifecycle.test.ts, and durable expiry suspension/receipts in completion/subagent-completion-admission.mailbox.test.ts and subagent-completion-admission.expired-receipt.test.ts. Keep WebSocket approval scope denial and local-only runtime authority. Duplicate winner/replay/projection/history assertions remain in server-methods/approval.test.ts and approval.channel-custody.test.ts. Trim channel wizard to omitted versus explicit channel, one select step; setup intro/outro remain in gateway.test.ts. Remove only deleted-file timing/mock baseline entries. CI-only: no test, coverage or build runs. Plain oxlint, oxfmt and diff checks passed. Cumulative shard: 1408 to 844 lines, 564 removed (40.1 percent). * test(e2e): deslop q0153 tests Remove the requester-catalog whole-Gateway replay. Retained coverage: src/gateway/server-methods/requester-model-catalog.test.ts uses requester catalogs through the real command and agent tool assembly call sites, including admitted and unadmitted callers. src/plugins/requester-models.test.ts retains capability and invocation-lifetime guards. Keep both Hugging Face onboarding cases and all request assertions; inline the single-use HTTP handler and attach cleanup directly to each test. Other E2E scenarios retain distinct credential, transcript, transport, restart, and migration contracts. CI-only campaign: oxfmt, plain oxlint, and diff check passed; no tests or coverage run. Shard test LOC 1345 -> 1126, declarations 8 -> 7, expanded cases 9 -> 8. Below the 40 percent line target to preserve distinct integration proof. * test(e2e): remove redundant q0153 runtime replays Retain preflight coverage in src/auto-reply/reply/agent-runner-memory.preflight-stale-tokens.test.ts: excludes superseded oversized history from the active context budget. Retain summary, forward-cut, and post-reopen append coverage in src/agents/sessions/session-manager-bounded.test.ts: retains the forward cut after consecutive excluded first-kept entries. Retain dreaming storage coverage in extensions/memory-core/src/dreaming-startup-cleanup.test.ts: reclaims every stale dreaming phase without touching active, unrelated, or other-agent sessions; cleans historical artifacts while automatic scheduling is disabled; does not reclaim post-startup runs when the deferred cleanup callback runs late. Retain multi-agent replacement, cleanup joining, and failure reporting in dreaming-startup-lifecycle.test.ts. Startup cleanup is independent of dreaming enablement in the production gateway_start hook. Reuse existing HTTP response and shutdown helpers in the Hugging Face fixture. The strict route guard and successful streamed reply retain endpoint coverage without recording and reasserting the same path. Keep both onboarding cases and their model, stream, prompt, config, and output assertions. CI-only validation: plain oxlint, oxfmt, and git diff --check passed; no tests or coverage run. Cumulative shard LOC 1345 -> 805 (-40.15 percent). No production or shared-support changes. * test(scripts): deslop q0151 tests Run shared Testbox preparation branches once; retain per-workflow checkout and base-ref wiring checks. The merge, linear, missing-parent and manual cases remain in testbox-base.test.ts. Remove two equivalent invalid-arity plugin inventory CLI rows; the missing --commit value row retains that branch. Share UI sequencer fixtures and assert the complete cold-run order instead of simulating a worker pool. Preserve all warm-order, phase, membership, pinning, redaction and release-history contracts. Compact workspace and release-note fixtures without production changes. CI-only shard: formatting and plain oxlint passed; tests and coverage deferred to hosted CI. This shard remains below the requested 40 percent line reduction to retain distinct proof. * test(scripts): remove duplicate q0151 proof layers Remove Testbox workflow-text snapshots while retaining the shared action's four real checkout cases. Replace Periphery's copied job/artifact inventory with a producer-consumer invariant and derive fixture job names from the workflow; formatAnnotation retains parseRepoLocation proof. Shared ratchet ancestry remains covered by check-max-lines-ratchet.test.ts: compares an explicit moving base at the branch fork; rejects unavailable ancestry with an explicit prepared-base recovery. Unresolved staged reads remain covered by check-assertion-safety-ratchet.test.ts: keeps worktree counts and staged read failures with unmerged index entries. The retained environment staged-budget case covers the retired numeric-threshold variant. Consolidate inventory surface rendering and escaping inputs without dropping their assertions. Remove duplicate sharding membership replay covered by keeps shared UI/Gateway partition ties deterministic without collapsing specifications; retain two tied bundled files and all UI phases. Cron retains replay and fixture-side tool-cap assertions. CI-only: plain oxlint, formatting and diff checks pass; no test or coverage runs. * test(scripts): deslop q0155 tests Remove repeated PR, push, and full-release runtime defaults and duplicated Node/UI Bun setup assertions. Remaining coverage: ci-workflow-planning.test.ts, routes test runtimes without adding jobs; ci-test-runtime-trial.test.ts retains explicit dispatch budgets, main dispatch defaults, automatic-event override rejection, and unsupported-policy errors. Factor Baileys fixture file reads and JSON writes without changing its install, waveform, long dependency, stale-link, sibling-preservation, or workspace-restoration assertions. CI-only audit; no test execution. Retain other shard files because their release authority, cancellation lifecycle, dependency admission, and independent invoice reconciliation paths are distinct. * test(scripts): consolidate q0155 boundary fixtures Use one CLI ownership-report fixture for closure, build-risk, missing ownership, plugin ownership and stale-record assertions. Bind the release shadow manifest to the real large-diff fixture instead of a second synthetic worktree state. Remove runtime output inventories and workflow source-string checks. ci-workflow-planning.test.ts retains runtime routing coverage; ci-workflow-guards.test.ts retains executed npm-lock command coverage. Preserve the generic admission-before-setup invariant by evaluating both condition outcomes. Remove disconnected-history replay covered by the depth-one checkout no-merge-base cases, same-branch conservative path variants, and the duplicate webhook identity failure covered by token identity failure plus authenticated webhook success. Keep cancellation, invoice reconciliation, frozen-target authorization, and patched package materialization intact. CI-only: format, diff-check and plain oxlint; no test execution. * test(scripts): reuse q0155 fixture owners Reuse PID cleanup, workflow lookup and fixture JSON writers. Remove a probe-only success log and its assertion; the embedded Baileys assertions and nonzero exit still enforce the actual install contract. Drop the pretest runtime manifest case: it merely re-exports pretestBuildMode, while the retained explicit dual-all case proves requires_bun. Real runtime-consumer placement remains covered by ci-node-test-plan.test.ts, partitions whole-config runtime consumers from ordinary serial CLI work. Retain the distinct check-changed cancellation regression (7a10023), Baileys materialization regression (9b45ee4), independent invoice oracle, frozen-target authorization paths, and trusted Docker harness boundaries. Static gates only; no test execution. * test(scripts): deslop q0154 tests Reuse the existing loopback HTTP fixture, share release input data, and compact metadata rejection setup and protocol expectations without dropping cases. Keep transform work-count, source-edit invalidation, generation identity and disposal checks. Preparation diagnostics remain covered by vitest-worker-artifacts.test.ts (shares a completed generation between real borrower processes until both finish); cache metadata remains exercised by vitest-report-owner.test.ts (config-load-once). CI-only campaign: plain oxlint, oxfmt and diff-check pass; no test or coverage runs. Reduction is 1773 to 1728 lines, below the 40 percent target because the remaining suites retain distinct publication, ownership, parser and lifecycle boundaries. * test(scripts): remove q0154 duplicate coverage layers Keep one asset case per source-resolution branch and one notes rejection before lookup. Remove the pass-through release inventory assertion and compiler fixture input/output counts; retain runtime results, main-thread execution, transform work counts and generation ownership. Keep qualified refusal coverage for stale context, retained evidence, same/replacement heads and immediate admission. Shared stale-gate, review/head invalidation and pending/failing-check coverage remains in pr-merge-recovery.test.ts (checks current evidence for same-head recovery). Historical parser qualification remains in pr-merge-pre-dispatch-refusal.test.ts (qualifies only intact, inspected no-dispatch evidence). CI-only: oxfmt, plain oxlint and diff-check pass; no test runs. Total shard reduction is 1773 to 1651 lines, below the requested 40 percent. No obsolete subjects or additional safely redundant layers were found. * test(scripts): deduplicate q0154 owner-boundary coverage Keep transform value/work-count invalidation tests while leaving generation ownership and source routing in vitest-worker-artifacts.test.ts. Keep watcher-specific loader integration while leaving dev-dependency, private-subpath and stale-version rejection in tooling-dependencies.test.ts. Remove the qualified-refusal stale-context replay covered by pr-merge-recovery.test.ts (rejects evidence: prep-context). Remove the generated asset success replay covered by build-external-plugin-local-dist.test.ts (keeps excluded plugin graphs isolated and their runtime metadata loadable). Preserve settlement, local-dependency precedence and strict qualified-admission tests. CI-only: oxfmt, plain oxlint and diff-check passed; no tests/builds/coverage runs. Additional reduction 74 lines; shard 1773 to 1577 lines, below the 40 percent target. Independent read-only audits found no safe whole-file deletions. * test(pr): deslop q0157 tooling layers Exercise duplicate closure through dry-run/apply workflow branches instead of a separate hand-built apply plan. Remove copied CLI inventories and exact prose while retaining evidence, commit references, mutation order and bounded GitHub calls. Retain representative root/nested and hoisted/isolated package-bin cases; UI build remains covered by ui.test.ts and browser ffmpeg installation by ensure-playwright-chromium.test.ts. Remove duplicate delayed completion replay covered by pr-merge-admin-completion.test.ts. Trim state and release fixtures; remove snapshot telemetry duplicated by native descriptor assertions and exact-byte hashing. Preserve identity, process termination, authority and cleanup paths. Static gates only; no tests run under the CI-only work order. * test(pr): deslop q0157 owner-boundary fixtures Replace package-command inventory replays with root, hoisted and isolated tests at the real package-bin CLI. Pnpm forwarding remains covered by pnpm-runner.test.ts and the UI consumer by ui.test.ts. Exercise release metadata directly through its prepared CLI instead of recopying its import graph. Remove the snapshot cancellation replay: the retained hash probe proves private read-only descriptors and unlinked paths before dispatch; pr-operation-lock.test.ts covers native SIGTERM supervision. Same-tree pair acceptance remains in pr-merge-correction.test.ts and post-GC retention in pr-merge-recovery.test.ts. Consolidate duplicate-close workflow paths and two repeated candidate-identity error rows, preserving candidate tarball and entrypoint regressions. Static-only gates: plain oxlint, oxfmt, diff check; no tests or coverage run. * test(ui): deslop q0158 tests Remove the duplicate composition-blur title scenario; new-session-page.title.e2e.test.ts retains the same timing and creation handoff, with the idle row retaining no-premature-create and hidden-hint assertions. Inline the single-use large-paste recording wrapper and reuse mobile progress and scroll assertions without changing their lifecycle, geometry, payload, or artifact contracts. Retain distinct startup, resize, guest authorization, sidebar, stale-build and panel-reload coverage. CI-only validation: plain oxlint, oxfmt and git diff --check. No tests or coverage run. Reduction is below the 40% target because further removals lack equivalent branch and lifecycle proof. * test(ui): consolidate q0158 e2e owner coverage Reduce the original shard from 1529 to 917 lines (40.0%). Keep global startup routing, reader resize, mobile clearance, guest authority/cancellation, real stale-build reload, and terminal adoption. Remove copied boot-module/storage inventories and per-theme replays, not their owner contracts. Large-image regression 61e3c61 (openclaw#99213): retain src/gateway/chat-attachments.test.ts (parses large clipboard data URL images without full base64 decoding), src/media/sniff-mime-from-base64.test.ts (sniffs large payloads from their prefix), ui/src/lib/bytes-base64.test.ts, chat-attachment-resize.browser.test.ts, chat-flow.image-handoff.e2e.test.ts and chat-transcript-geometry.test.tsx. These cover parsing, browser paste, send handoff and committed row sizing without the standalone capture suite. Startup/history/model catalog coverage remains in chat-send.test.ts, chat-pane-model-catalog.test.ts, app-host.chat-metadata.test.ts and chat-flow.messaging.e2e.test.ts. New-session readiness/reconnect coverage remains in new-session-page.early-submit.e2e.test.ts, new-session-page.catalog-reconnect.e2e.test.ts, palette-session-draft.warm-roster.test.tsx, draft.catalog-reconnect.test.ts and draft-native-terminal-start.test.ts. Panel lazy/restoration and one-read ownership remain in lazy-custom-element-recovery.e2e.test.ts, browser-panel-width.e2e.test.ts, browser-panel.test.ts, assistant-panel.test.ts and dock-panel-layout.test.tsx. Boot chunk exclusions remain in control-ui-chunking.test.ts. Sidebar presentation remains in sidebar-roster.e2e.test.ts; measured end-follow remains in chat-transcript-geometry-updates.browser.test.tsx and chat-transcript-end-follow.browser.test.ts. CI-only validation: oxfmt, plain oxlint and git diff --check passed. No tests, coverage, builds or Testbox commands run. Coordinator reviews the static owner mappings and hosted CI supplies execution proof. * test(tooling): deslop q0159 tests Remove repeated capacity permutations; retain each qualification, rejection, and backend branch. Multi-group selection scope remains covered by test/scripts/ci-node-test-plan.selection-capacity.test.ts. Keep the immutability assertion on retained positive selections. Consolidate sweeper skip fixtures without losing per-case mutation or logging assertions. Attached-CI behavior remains covered by the cancelled-CI row; preserve draft classification separately from the runner's early draft skip. * test(tooling): reduce q0159 harness and branch replays Use the existing command and Node-script fixtures for PTY ownership, output capture, and cleanup; retain all five PTY behaviors. Remove duplicated workflow-text assertions, archive wrapper/platform replay, and exact-pin mismatch variants. Keep two Parallels bootstrap outcomes; src/infra/runtime-guard.test.ts covers the Node version matrix. Nested artifact ownership remains covered by dist-artifact-ownership.test.ts: keeps declarations alive until their writer joins. Prior-CI always-bypass and admin conflict-resolution remain covered by pr-merge-prior-ci.test.ts: revalidates delegated CI bypass before dispatch; lands one pinned REST squash. Keep PR-only authority and each distinct denial. Reduce TSX conservative-import inputs to each guard path and native recovery failures to one per decision branch. Preserve live recovery, no-worker proof, file identity, and output validation. Static format, diff, and oxlint checks pass; no tests run in CI-only mode. * test(tooling): deduplicate q0159 capacity guards Run shared capacity rejection guards once instead of replaying them across three owner fixtures. Retain exact core and isolated qualification cases, and one mixed-group rejection. The precise gateway-client success path remains covered by ci-node-test-plan.test.ts: retains owner worker fallback in precise backend plans. Remove the revoked-bypass replay: pr-merge-prior-ci.test.ts revalidates delegated CI bypass before dispatch, including live revocation. Keep all other repository, membership, ruleset, and policy denial boundaries. Formatting, diff check, and plain oxlint passed; no test runs in CI-only mode. * test(ui): deslop q0160 tests * test(ui): remove redundant q0160 E2E layers Remove question-progress composition replays: question-flow owns takeover, draft restoration and backscroll; chat-composer-question owns progress disclosure; chat-details.browser, chat-details-mobile-host.browser and chat-details-arrival own disclosure, mobile retention and absent-card branches. Keep approval error isolation in overlays.test.ts (keeps a resolve failure attached to its older request) and inline rendering in chat-footer-view.test.ts. Active-run approval dispatch remains in chat-send-submit.annotations, chat-send-detached-deadline and chat-pane-bridge tests. Retain passive Inbox and no-auth sidebar rendering here. Keep navigation retirement in started-session-navigation and new-session-page.instant-thread; creation rejection and retry remain in new-session-page.transition. Keep personal visibility reversal and cold persistence in session-involvement, menu variants in session-menu.involvement, and retain the unique sidebar hide mutation here. Drop LTR left/right resize replays covered by resizable-divider, browser-panel-width and chat-panel-layout while retaining RTL and bottom pointer regression proof. Reuse splitColumns for comment fixtures and retain one editor case per ownership branch plus both reply-menu branches. CI-only: formatting, diff check and plain oxlint passed; no tests or coverage executed. Cumulative shard reduction is 1485 to 1097 lines (26.1%), below the requested 40%; unique remaining behavior retained. * test(ui): deslop q0162 tests Remove the mocked Processes replay: background-work.real-gateway.e2e.test.ts covers exact-instance Stop, retained output, panel switching and draft persistence; chat-processes-panel.test.ts covers shared reads and Stop isolation. Keep mention loading and reduced-motion proof in chat-mention-search.e2e.test.ts. Retain both native/catalog tab routes and both gestures without their redundant cross product. Connection draft/discard validation remains in connection-page.test.ts and view.render.test.tsx; retain real browser persistence and reconnect flows here. Trim optional capture plumbing and unrelated fixtures. Preserve scope-downgrade, catalog-involvement, shared-diff lifecycle and DST regression scenarios. CI-only campaign: formatting, diff-check and plain oxlint passed; runtime and coverage validation deferred to hosted CI. * test(ui): consolidate q0162 owner-covered e2e replays Reduce the shard from its 1415-line baseline to 849 lines (40%). This follow-up removes 273 lines beyond aa879d929405; no test or coverage runs under the CI-only work order. Keep PR scope retirement at session-pull-requests.test.ts: retires broad snapshots and passive reads when only own-session reads remain. app-sidebar-session-pr-indicators.test.ts covers same-client scope revocation and own-reader badge clearing. Keep restricted publication discovery in E2E. Keep focus and disabled picker behavior in agent-select-opening.browser.test.ts and resolved-name branches in lib/agents/display.test.ts. Preserve both New Session themes and hero/picker identity propagation. Connection-page.test.ts and view.render.test.tsx own reconnect callbacks, credentials and pending controls; E2E retains persisted drafts and held-handshake target replacement. Keep Environment disclosure in chat-details.browser.test.ts and visible demand lifecycle in chat-session-workspace.test.ts and chat-details-session.test.ts. Preserve E2E error retention and Environment/Review in-flight request sharing. Collapse catalog provider copies to unlinked, admitted and unadmitted rows; the projection branch depends on backing-key membership, not provider identity. Unmarked sidebar visibility remains in sidebar-rail-toggles.capture.e2e.test.ts and the retained new-tab scenario. * test(scripts): remove redundant q0161 proof layers Keep packing contracts here; runner environment propagation and serialization remain in ci-run-node-test-shard.test.ts. Replace cache file round trips with fresh-scheduler identity proof; test-projects-routing.test.ts and test-projects-build-admission.test.ts retain caller-boundary coverage. Remove copied schema registration inventories and duplicate memory drift variants; retain generated/native equivalence, generated admission drift, and foreign uniqueness. sqlite-schema-contract.test.ts covers common drift handling. Remove the mocked Docker success-tail harness and cron source grep; docker-build-helper.test.ts retains real cron runner and harness stdin/cleanup proof. Share iOS command fixtures, reuse the workflow expression evaluator, and retain one generic optional-cache tail invariant. Validation: oxfmt, plain oxlint, git diff --check. No tests or coverage run under CI-only policy. * test: preserve cache expiry and defer catalog cleanup * test: complete Swift cache workflow step fixture * test: retain native context meter capture boundary * test: preserve packing envelope assertion semantics
What Problem This Solves
Pasting a roughly 2 MB PNG screenshot into Control UI webchat can send a multi-megabyte
data:image/png;base64,...attachment through Gatewaychat.send. The Gateway attachment parser then validates and sniffs that base64 payload before delivery. On current main, the shared base64 canonicalizer builds large intermediate strings in a stack-prone shape, and MIME sniffing decodes more payload than the image signature needs.For the reported
#99163path, this can surface asRangeError: Maximum call stack size exceededduringchat.send attachment parse/stage, blocking the screenshot from reaching chat.Why This Change Was Made
The fix belongs in the shared media/Gateway parsing layer, not only in Control UI, because the same canonicalization and MIME sniff helpers are used by other attachment and image paths.
This PR keeps the existing validation contract while making the hot path stack-safe:
packages/media-core/src/base64.tsFixes #99163.
Root Cause
Large clipboard image payloads create base64 strings with millions of characters. The previous canonicalization path built the cleaned payload as one growing string. Downstream operations such as slicing or decoding could force V8 to flatten a deep cons-string tree and overflow the stack.
The affected path is:
The patch makes canonicalization chunked and iterative, then keeps MIME sniffing bounded to the image signature prefix after full-payload validation.
User Impact
Users can paste/send large screenshot-like PNG attachments through Control UI webchat without Gateway throwing
RangeError.No API shape, persisted schema, config, provider routing, workflow, dependency, permission, or credential behavior changes. Small and normal attachments keep the same behavior; invalid base64 tails are still rejected.
Evidence
Real Control UI browser proof
Added
ui/src/ui/e2e/chat-large-paste-99213.e2e.test.ts.The test starts mocked Gateway + Vite Control UI, opens
/chatin Chrome, writes a generated valid ~1.9 MB PNG data URL to the browser clipboard, presses paste in the real chat composer, waits for the attachment preview, clicks the realSend messagebutton, and asserts mocked Gateway receiveschat.sendwith oneimage/pngattachment whose base64 exactly matches the pasted payload.Proof summary:
{ "pngBytes": 1901669, "base64Chars": 2535560, "dataUrlChars": 2535582, "screenshots": [ ".artifacts/control-ui-e2e/chat-large-paste-99213/01-pasted-large-image.png", ".artifacts/control-ui-e2e/chat-large-paste-99213/02-sent-large-image.png" ], "videos": [ ".artifacts/control-ui-e2e/chat-large-paste-99213/large-paste.webm" ] }Validation command:
Result: 1 passed.
Real Gateway parser proof
Generated a valid 745x745 PNG, wrapped it as
data:image/png;base64,..., and passed it throughparseMessageWithAttachments()fromsrc/gateway/chat-attachments.tson this PR head.{ "proof": "gateway chat.send attachment parser large PNG data URL", "pngBytes": 1901669, "base64Chars": 2535560, "dataUrlChars": 2535582, "elapsedMs": 375, "images": 1, "imageMime": "image/png", "imageDataMatchesInput": true, "offloadedRefs": 0, "imageOrder": ["inline"], "message": "proof: large Control UI clipboard image", "result": "ok-no-RangeError" }Command:
Regression Test Plan
packages/media-core/src/base64.test.ts: large canonicalization stays stack-safe for ~1.9 MB PNG payloads.src/media/sniff-mime-from-base64.test.ts: MIME sniffing validates the full base64 payload and rejects invalid tails after a valid PNG prefix.src/gateway/chat-attachments.test.ts: Gateway attachment parsing accepts the large PNG data URL withoutRangeError.ui/src/ui/e2e/chat-large-paste-99213.e2e.test.ts: real browser Control UI paste/send path produces achat.sendimage attachment with matching base64 content.Validation run:
Result: 127 passed.
Additional checks:
All passed locally; GitHub CI is green on the current PR head.
Risk / Compatibility
Risk is low and scoped to attachment/base64 parsing behavior.
The main behavioral change is performance/safety: large valid image data URLs avoid stack-prone string flattening and avoid full-payload MIME decode work.
What Was Not Tested
Canonical Fix Path / Related PRs
This PR is intended as the narrow canonical fix for
#99163: the reported large screenshot Gateway parse/stageRangeError.There is another open candidate,
#99173, for the same issue. This PR is the stronger landing candidate because it now has:rating: 🦞 diamond lobsterproof: sufficientstatus: 👀 ready for maintainer lookThe broader large-attachment work remains separately tracked by
#90098/#92223and should not be folded into this narrow fix.AI Disclosure
AI-assisted implementation and proof generation. I reviewed the diff, ran focused tests, lint/type checks, real Gateway parser proof, and real Control UI browser proof before pushing.