Skip to content

fix(composer): stream large clipboard attachments and commit Cut after copying - #33533

Open
teamleaderleo wants to merge 13 commits into
feat-cmux-nextfrom
lane/limits-composer-references
Open

teamleaderleo wants to merge 13 commits into
feat-cmux-nextfrom
lane/limits-composer-references

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

HOLD: this clipboard transaction still needs the coordinator's exact-head review.

Large composer copies now stream into native file references instead of silently omitting attachments or rejecting the whole copy. Copies are tested with 128 attachments, more than 128 MiB combined, text above 8 MiB and an individual attachment above 32 MiB. Large content shows progress, Cancel and Retry. Very large counts still carry metadata in whole bridge requests; I own #33551 to stream that metadata too. Large Cut removes the original selection only after every selected item reaches the clipboard, and preserves edits made during copying. Unavailable items leave valid copies usable with an explicit incomplete-copy warning and Retry; an incomplete Cut keeps its entire draft.

Leo, during the limits audit (2026-11-02):

“why are there prompt limits anyways?”
“well we ought to audit the limits and make sure 1. don't have nonsense 2. do some super sweet ergo perf stuff”

Caps removed

Original locations at bc55b1e (the small legacy inline method keeps transport bounds; the composer routes larger values through staging):

  • webviews/src/agent-session/acpmux/composer/composerCopy.ts:25: 32 MiB base64 attachment omission.
  • Packages/macOS/CmuxNext/Sources/CmuxNextAgentPane/AgentPaneComposerCopy.swift:33: 64 items; :35: 8 MiB selection/attachment text; :37: 128 MiB aggregate.
  • Packages/macOS/CmuxNext/Sources/CmuxNextAgentPane/AgentPaneImageCopies.swift:11: the composer's 32 MiB image-data route now falls back to a file URL; image representation decoding stays bounded. Standalone image-viewer Copy/Save actions remain tracked in Preserve large composer copies, captures, legacy recordings and link lists through file references #33015.

Small copies retain the existing bridge route. Larger copies use acknowledged chunks of at most 192 KiB, with file writes on the injected background file lane. Existing base64 is sliced without decoding the complete attachment. Opaque, single-use references are scoped to the pane/session and copy revision. Cancellation, replacement, failure and expiry clean abandoned bytes; only successfully published attachment files persist. A newer copy cannot be overwritten by an older reply. One deadline handles expiry and cancels when no reference needs it; there is no new polling loop.

Ordering and selection metadata travel on the clipboard too, so browser storage quota cannot lose a large prompt when WebKit returns file URLs without plain text. Remote paths retain the existing isolation and denylist rules. SVG sanitization and pixel-decode guards remain safety bounds. The platform's final plain-text clipboard representation still requires a string in memory; attachment bytes remain streamed.

This is the clipboard portion of #33015. Context-rich progress/retry captures are tracked in #33847, which I also own. The native/web transaction, progress UI, deferred Cut and cancellation/security regressions are one coupled change, so it is larger than the usual PR guideline; the tests make up most of the added lines.

Validation

  • Web regression payload: 128 attachments, 177 MiB total, 33 MiB binary, 9 MiB text and selection; full SHA-256, order, chunk sizes, Unicode boundaries and cancellation.
  • Native regression: 23 tests passed across three suites at 895b721404a97fe1bea050d08370ee6052180755, including the 177 MiB/128-file byte-and-hash case, mixed valid/unavailable 4 MiB Copy, scoped single-use references, cleanup, cancellation and remote-path isolation. The final head changes only web warning cleanup and its test; native sources are identical.
  • App compile check passed at 895b721404a97fe1bea050d08370ee6052180755 (93 seconds).
  • Composer regression: 4 MiB through the real ComposerBox; progress, Cancel, Retry, unmount, partial Copy and deferred Cut behavior. The focused six-file regression (51 passed, 0 failed) and full bun run check passed at 4b0d9b4829dd6cf41b5a17f8947f0dc102c136ad (run, receipt exit 0). The same run fetched the old source at bc4cdfbb05e0bea71cb8858edaefd92c7347dde2: all three new partial-Copy/Cut regressions failed and all ten existing status tests passed, before restoring the final source for the green run. Receipt snapshot f46301bb8c366399b85bc464ea5f657bc2da7735 is parented only by the tested head; source tree 570b635cee1d46cf22692f872ee40d620e44bdb7.
  • Gallery scene: agent-pane.composer-copy-status — copying, finishing, failed and incomplete; follows the composer's quiet status treatment in design/composer.md. Six earlier renders passed in both themes (run); exact-head context-rich captures and visual review remain in Capture composer clipboard progress and retry states #33847.
  • The incomplete-copy string has translations for all 21 locales; its strict per-entry validation passed. The full localization audit names existing unrelated catalogue debt.
  • All eight final-head web / react-apps-base-check verdicts passed (CI run).
  • The gallery failure in repo-worktrees-search was reproduced on the exact rendered head 907a576a40b114bfbb6bf94629ae6ab84eac5b58 and its base 8d08eaaf21413c0a39d72231bb54099fe75c31c3: both report shift 0.00699, baseline 0.00447, under the same full Chrome engine (paired replay, both themes, assertions passed). The workflow compared different browser engines across steps; fix(ci): use one browser for gallery head and base renders #33836 fixes that harness mismatch.
  • The guard warnings match the base by failing test and error (test_every_compile_job_names_its_warm_sources, test_the_repository_highlights_validate); the per-test classifier reports no own guard failure.
  • The broad native run is not fully reconciled. Replays of base 8d08eaaf21413c0a39d72231bb54099fe75c31c3 reproduce the same errors in seven suites: ActionContractTests, TabSelectionKeepsTabWidthsTests, PaneChromeEvenInsetTests, WindowCleanupCoverageTests, BrowserChromeIconsTests, SidebarLookContractTests and TabSwitchWorkBudgetTests. Two original failures remain unexcused by the per-test classifier: ScriptGestureTests and MarkdownLiveShareTests. ScriptGesture passes at the unchanged head; 16 ScriptGesture and four Markdown baseline repetitions also pass. I own tests: wait for the requested document in ScriptGestureTests #33941 and tests: diagnose missed Markdown live-share reload delivery #33942 for these timing failures. A head Markdown replay is still running; a rerun of the original failed native job is needed before calling this PR ready. The generated-files job propagates the matching ActionContract failure, with no stale export diff.
  • Native pre-push gate, required web lint, scoped formatting and whitespace checks passed.

Performance

Metric Before After Delta Harness or run link
Largest bridge payload, same 4 MiB attachment 5,592,497 bytes 262,219 bytes −95.31% same-fixture run, composer-copy-staging.test.ts

Changelog

Fixed: large composer copies and cuts preserve their attachments and show progress while copying.

🤖 Generated with Codex

Agent session: agent session

teamleaderleo and others added 2 commits November 3, 2026 09:26
Co-authored-by: Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-2010f0b89f67a88d2fb1
…nces

Co-authored-by: Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-2010f0b89f67a88d2fb1
@cursor

cursor Bot commented Nov 3, 2026

Copy link
Copy Markdown

Bugbot needs on-demand usage enabled

Bugbot uses usage-based billing for this team and requires on-demand usage to be enabled.

A team admin can enable on-demand usage in the Cursor dashboard.

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

Review 4b0d9b4: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr33533 -f ref=lane/limits-composer-references -f platform=macos -f backend_mode=local

Passes: CI passes on ff8784c4b6.

CI passes on ff8784c4b6 (run 41873733768 attempt 1).

Written by scripts/ci/classify_failures.py (ci-failure-attribution.yml); signatures are its SIGNATURES table. A machine verdict is the runner's fault, not this PR's; yours means the failing file is one this PR changes, also red on main that main's latest full suite fails the same way, seen on other PRs that it failed on another pull request's run lately.

web and size checks: green

Gallery before/after for ff8784c: 16 states rendered, 8 images differ, 2045 more touched states not rendered. Images are in the run's artifact, not on this public PR; the independent review of this head reads them on its own, so the PR needs no hand-made screenshots of these states.

gh run download 41873733217 -R manaflow-ai/cmux -n gallery-advisory-33533-ff8784c4b6163a4e820404721179c4895121a5d3 (then read gallery-review.json)

States
State Theme Status Diff Picked by
agent-pane.composer/font-size-chat-14 Apple System Colors Light unchanged 0% own ComposerBox.tsx
agent-pane.composer/font-size-chat-14 Apple System Colors unchanged 0% own ComposerBox.tsx
agent-pane.composer/font-size-new-chat-14 Apple System Colors Light unchanged 0% own ComposerBox.tsx
agent-pane.composer/font-size-new-chat-14 Apple System Colors unchanged 0% own ComposerBox.tsx
agent-pane.composer/font-size-new-tab-14 Apple System Colors Light unchanged 0% own ComposerBox.tsx
agent-pane.composer/font-size-new-tab-14 Apple System Colors unchanged 0% own ComposerBox.tsx
agent-pane.composer/font-size-chat-21 Apple System Colors Light unchanged 0% own ComposerBox.tsx
agent-pane.composer/font-size-chat-21 Apple System Colors unchanged 0% own ComposerBox.tsx
agent-pane.composer/font-size-new-chat-21 Apple System Colors Light unchanged 0% own ComposerBox.tsx
agent-pane.composer/font-size-new-chat-21 Apple System Colors unchanged 0% own ComposerBox.tsx
agent-pane.composer/font-size-new-tab-21 Apple System Colors Light unchanged 0% own ComposerBox.tsx
agent-pane.composer/font-size-new-tab-21 Apple System Colors unchanged 0% own ComposerBox.tsx
agent-pane.composer/font-size-chat-28 Apple System Colors Light unchanged 0% own ComposerBox.tsx
agent-pane.composer/font-size-chat-28 Apple System Colors unchanged 0% own ComposerBox.tsx
agent-pane.composer/font-size-new-chat-28 Apple System Colors Light unchanged 0% own ComposerBox.tsx
agent-pane.composer/font-size-new-chat-28 Apple System Colors unchanged 0% own ComposerBox.tsx
agent-pane.composer-copy-status/copying Apple System Colors Light new 0% own ComposerCopyStatus.gallery.tsx
agent-pane.composer-copy-status/copying Apple System Colors new 0% own ComposerCopyStatus.gallery.tsx
agent-pane.composer-copy-status/finishing Apple System Colors Light new 0% own ComposerCopyStatus.gallery.tsx
agent-pane.composer-copy-status/finishing Apple System Colors new 0% own ComposerCopyStatus.gallery.tsx
agent-pane.composer-copy-status/failed Apple System Colors Light new 0% own ComposerCopyStatus.gallery.tsx
agent-pane.composer-copy-status/failed Apple System Colors new 0% own ComposerCopyStatus.gallery.tsx
agent-pane.composer-copy-status/incomplete Apple System Colors Light new 0% own ComposerCopyStatus.gallery.tsx
agent-pane.composer-copy-status/incomplete Apple System Colors new 0% own ComposerCopyStatus.gallery.tsx
agent-pane.composer-height/old-eight-lines-normal Apple System Colors Light unchanged 0% own MarkdownField.tsx
agent-pane.composer-height/old-eight-lines-normal Apple System Colors unchanged 0% own MarkdownField.tsx
agent-pane.composer-height/old-eight-lines-short Apple System Colors Light unchanged 0% own MarkdownField.tsx
agent-pane.composer-height/old-eight-lines-short Apple System Colors unchanged 0% own MarkdownField.tsx
agent-pane.composer-height/current-forty-percent-normal Apple System Colors Light unchanged 0% own MarkdownField.tsx
agent-pane.composer-height/current-forty-percent-normal Apple System Colors unchanged 0% own MarkdownField.tsx
agent-pane.composer-height/current-forty-percent-short Apple System Colors Light unchanged 0% own MarkdownField.tsx
agent-pane.composer-height/current-forty-percent-short Apple System Colors unchanged 0% own MarkdownField.tsx

Pick other states with a Gallery: entry.id, entry.id/variant line in the PR body.

Co-authored-by: Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-2010f0b89f67a88d2fb1
@blacksmith-sh

blacksmith-sh Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Found 2 test failures on Blacksmith runners:

Failures

Test View Logs
test_every_compile_job_names_its_warm_sources (main.ThisTree.test_every_compile_job
_names_its_warm_sources)/
test_every_compile_job_names_its_warm_sources (main.ThisTree.test_every_compile_job
_names_its_warm_sources)
View Logs
test_the_repository_highlights_validate (main.DigestTests.test_the_repository_highl
ights_validate)/
test_the_repository_highlights_validate (main.DigestTests.test_the_repository_highl
ights_validate)
View Logs

Fix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

teamleaderleo and others added 2 commits November 3, 2026 10:01
Co-authored-by: Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-2010f0b89f67a88d2fb1
…-composer-references

# Conflicts:
#	Packages/macOS/CmuxNext/Sources/CmuxNextAgentPane/AgentPaneReplyLinks.swift
Co-authored-by: Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-2010f0b89f67a88d2fb1
@cursor

cursor Bot commented Nov 3, 2026

Copy link
Copy Markdown

Bugbot needs on-demand usage enabled

Bugbot uses usage-based billing for this team and requires on-demand usage to be enabled.

A team admin can enable on-demand usage in the Cursor dashboard.

Co-authored-by: Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-2010f0b89f67a88d2fb1
…URLs

Co-authored-by: Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-2010f0b89f67a88d2fb1
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (codex gpt-6-astra high, next-review): BLOCK at 9aab0c7

BLOCK at 9aab0c7
Visual verdict: no images; Leo tries the build

  1. [P1] [blocking] Packages/macOS/CmuxNext/Sources/CmuxNextAgentPane/AgentPaneComposerCopy.swift:119 — Staging now rejects every valid attachment when any item is unavailable. For example, copying a 1 MiB text attachment alongside a deleted file or remote-path chip previously copied the valid attachment; it now fails entirely, including on Retry. Preserve partial Copy behavior while keeping Cut from deleting unpublished items. Add a mixed valid/unavailable attachment regression test.

  2. [P2] [follow-up] webviews/src/agent-session/acpmux/composer/ComposerCopyStatus.gallery.tsx:11 — Supply exact-head screenshots for copying, finishing, and failed states; no images were available to review.

@teamleaderleo teamleaderleo removed the risk:high Risk tier (docs/ci/risk-tiers.md) label Nov 3, 2026
Co-authored-by: Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-2010f0b89f67a88d2fb1
@github-actions github-actions Bot added the risk:high Risk tier (docs/ci/risk-tiers.md) label Nov 3, 2026
teamleaderleo and others added 2 commits November 3, 2026 12:56
Co-authored-by: Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-2010f0b89f67a88d2fb1
Co-authored-by: Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-2010f0b89f67a88d2fb1
Co-authored-by: Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-2010f0b89f67a88d2fb1

This branch was previously deployed

1 inactive deployment
ci-routing-agent — ff8784c4 Deployed Nov 4, 2026 by teamleaderleo via cmux-tui tree preflight #112497
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:high Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant