Fix Slash-Command UI Freeze on New Tasks (Bug#1081)#1107
Open
DevDesai444 wants to merge 1 commit intogeneralaction:mainfrom
Open
Fix Slash-Command UI Freeze on New Tasks (Bug#1081)#1107DevDesai444 wants to merge 1 commit intogeneralaction:mainfrom
DevDesai444 wants to merge 1 commit intogeneralaction:mainfrom
Conversation
|
@DevDesai444 is attempting to deploy a commit to the General Action Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Greptile SummaryResolves UI freeze when typing
All optimizations preserve existing behavior (scroll position, first-frame handling, activity detection) while eliminating synchronous contention on the slash-command path. Tests pass and manual validation confirms no visible freeze. Confidence Score: 4/5
|
| Filename | Overview |
|---|---|
| src/main/services/ptyIpc.ts | Emits global PTY activity events with sampled chunks and broadcasts exit events |
| src/renderer/components/ChatInterface.tsx | Adds deduplication to localStorage writes with token-based caching |
| src/renderer/lib/activityStore.ts | Refactors to prefer global feed with ref-counted direct fallback subscriptions |
| src/renderer/terminal/TerminalSessionManager.ts | Implements frame-sliced terminal writes and slow input handler logging |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User types '/' in fresh task] --> B[Terminal input handler]
B --> C{Before PR}
C -->|Large PTY burst| D[Synchronous xterm write]
C -->|Activity events| E[Per-provider/per-kind listeners]
C -->|Classification| F[Full chunk processing]
C -->|localStorage| G[Repeated writes]
D --> H[UI freeze/stutter]
E --> H
F --> H
G --> H
B --> I{After PR}
I -->|Large PTY burst| J[Frame-sliced writes via queue]
I -->|Activity events| K[Global feed + fallback]
I -->|Classification| L[Sampled tail chunks]
I -->|localStorage| M[Deduplicated writes]
J --> N[Smooth UI]
K --> N
L --> N
M --> N
J --> O[requestAnimationFrame drain]
O --> P[16KB slices]
P --> Q[xterm callback chain]
K --> R[Global pty:activity channel]
R --> S[Shared listener]
S --> T[Route by PTY ID]
Last reviewed commit: a3b3f4c
Contributor
|
Hi @DevDesai444, Thank you for your interest in contributing and for opening this PR. |
Contributor
Author
|
@arnestrickmann, is there any change required in this PR ? |
a3b3f4c to
ad085c1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes UI freezewhen typing
/immediately after creating a new task (#1081).Problem Identified
The first slash-command interaction on a fresh task could block the renderer thread due to a combination of startup-time hot paths:
This made the UI feel frozen/stuttery right when
/was typed.How This PR Solves It
1) Reduce main-thread blocking from terminal output
TerminalSessionManagerso big PTY bursts are processed incrementally instead of one heavy synchronous write.terminalSession:slowInputHandler) to surface future regressions.2) Reduce activity-event overhead
pty:activity) and global PTY exit channel (pty:exit:global).activityStorenow prefers the global feed and only falls back to direct listeners when needed.3) Bound classifier work per event
sampleActivityChunk) and classify only sampled tail data in hot paths.4) Remove redundant synchronous storage writes
agent:lockedwrites so terminal activity does not repeatedly hit localStorage for identical values.Why this addresses #1081
The freeze was not caused by React command palette rendering itself; it was caused by renderer contention during first terminal interaction/output.
This PR removes the biggest synchronous hotspots on that exact path, so slash command UI appears without the initial jank.
Validation
pnpm run type-check✅pnpm run lint✅ (existing repo warnings only)pnpm run format✅pnpm exec vitest run src/test/main/ptyIpc.test.ts✅/→ no visible freeze/stutter.Check.mp4