Skip to content

fix(ui): optimize universal paste handling - #7148

Merged
waleedlatif1 merged 4 commits into
stagingfrom
codex/universal-paste-admission
Aug 27, 2026
Merged

fix(ui): optimize universal paste handling#7148
waleedlatif1 merged 4 commits into
stagingfrom
codex/universal-paste-admission

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • add one fast paste-admission layer across native inputs, rich text, Monaco, tables, terminals, tags, emails, and secret imports
  • reject oversized payloads before expensive parsing while preserving higher limits where downstream systems support them
  • batch structured pastes and degrade very large prompt/editor content to cheaper rendering paths

Type of Change

  • Bug fix

Testing

  • Full Sim, desktop, EMCN, and utils test suites
  • Focused paste regression suites (107 tests)
  • All-workspace typecheck, lint, block-registry check, and all 36 repository audits

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@waleedlatif1
waleedlatif1 requested a review from a team as a code owner August 27, 2026 02:36
@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Aug 27, 2026 2:57am

Request Review

@greptile-apps

greptile-apps Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR introduces shared paste-admission limits and cheaper rendering paths across web and desktop editing surfaces.

  • Adds a root capture-phase guard and surface-specific validation for prompts, rich Markdown, Monaco, tables, terminals, tags, emails, and secret imports.
  • Adds bounded desktop terminal writes and updates the desktop bridge result contract.
  • Raises the realtime Socket.IO buffer to accommodate the collaborative-document boundary.
  • Debounces chat-draft persistence and batches structured paste processing.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains within the scope of this follow-up review.

No blocking failure remains.

Important Files Changed

Filename Overview
packages/utils/src/paste.ts Defines shared UTF-8 measurement, admission policies, limits, and rendering thresholds used across paste surfaces.
apps/sim/app/_shell/paste-admission-guard.tsx Adds a root capture-phase guard that rejects oversized clipboard text before editor-specific parsing.
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/paste-admission.ts Adds projected-document admission for rich Markdown pastes before ProseMirror’s downstream parsing.
apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/prompt-editor/use-prompt-editor.ts Enforces prompt payload and result limits while preserving compact Sim selection-context pastes.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/table-paste.ts Centralizes structured table-paste parsing and bounded batch processing.
apps/desktop/src/main/ipc.ts Rejects oversized terminal input and writes admitted text to the PTY in surrogate-safe bounded chunks.
packages/desktop-bridge/src/index.ts Updates the terminal paste bridge contract to expose the oversized-payload result.
apps/realtime/src/config/socket.ts Raises the Socket.IO message buffer to include framing overhead above the collaborative-document limit.
apps/sim/app/workspace/[workspaceId]/home/components/user-input/user-input.tsx Debounces persisted composer-draft writes and flushes pending state during unmount.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  Clipboard[Clipboard payload] --> GlobalGuard[Global paste admission guard]
  GlobalGuard -->|Rejected| Warning[Show size warning]
  GlobalGuard -->|Admitted| Surface{Target surface}
  Surface --> Prompt[Prompt editor]
  Surface --> RichText[Rich Markdown]
  Surface --> Monaco[Text editor]
  Surface --> Table[Table grid]
  Surface --> Terminal[Terminal]
  Surface --> Inputs[Tags, emails, and secrets]
  Prompt --> ResultLimit[Validate projected result]
  RichText --> ResultLimit
  Monaco --> PayloadLimit[Validate payload size]
  Table --> Batch[Parse and apply in batches]
  Terminal --> NativeBridge[Desktop bridge]
  NativeBridge --> PTY[Write bounded chunks to PTY]
Loading

Reviews (4): Last reviewed commit: "fix(ui): preserve large context paste be..." | Re-trigger Greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

@waleedlatif1
waleedlatif1 force-pushed the codex/universal-paste-admission branch from 27652d4 to 9233ecb Compare August 27, 2026 02:51
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
waleedlatif1 merged commit 27b97cb into staging Aug 27, 2026
29 checks passed
@waleedlatif1
waleedlatif1 deleted the codex/universal-paste-admission branch August 27, 2026 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant