Skip to content

H2, park hidden chats - #32325

Closed
brennanb2025 wants to merge 17 commits into
mainfrom
brennanb2025/park-hidden-chats
Closed

brennanb2025 wants to merge 17 commits into
mainfrom
brennanb2025/park-hidden-chats

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 44 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2861 $\color{#cf222e}{\Huge{\mathbf{−}}}$​183 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2678
Prod 69 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2544 $\color{#cf222e}{\Huge{\mathbf{−}}}$​880 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1664

Hidden visited chats keep their editors, rendered transcripts and read subscriptions mounted, so renderer work grows with the number of chats visited. This PR parks eligible hidden structured chats after a switching grace period and keeps a small warm set. All visible split panes remain live; terminal-mode chats use their existing lifecycle.

Drafts, rich content, attachments and accepted uploads, goal mode, picked-skill origin, recall, send and command errors, attachment notices, Continue progress, queued edits, prompt progress and dismissals, read frontier, caret/selection and scroll/follow state survive parking. Find retains an unfinished accepted search and selected match. Async questions retain progress for the actual occurrence; a later identical question starts fresh. The common pattern separates disposable presentation from content, accepted work and navigation.

Intended per the October 23 ruling: composer Undo history is not preserved after parking. Exact deep return lasts while the bounded resume record exists: five minutes, eight inactive records, 5,000 items or 8 MiB per record, 16 MiB total. Expiry, eviction, oversize or authoritative replacement opens the latest messages; offline return without a record stays empty until reconnect. These outcomes do not waive reveal-latency acceptance. No setting, persisted field, wire operation or minimum host version is added.

Not ready: one measured K2/30 cold return exceeds the strict increase bar. Shipping source still uses a six-chat warm set and 30-second grace; no policy patch or performance waiver has been applied. The measured two-chat candidate had cold input acceptance of 95.7/104.8/82.9 ms versus matching main 53.8/52.2/53.5 ms. Paired increases were 41.9/52.6/29.4 ms: one is 2.6 ms beyond the required increase below 50 ms. Cold median/max were 95.7/104.8 versus 53.5/53.8 ms. These are three observations, with no p95 claim. An incoming-main conflict separately blocks merge. No completion marker is claimed.

All three observed K2 cold requested-row/editor paint witnesses had upper bounds below 150 ms: 146.146/144.346/109.304 ms, versus main 116.726/108.632/120.486 ms. Frame intervals, both instrumented clocks and observer-cost limitations are preserved; these are bounded screenshot observations, not exact physical-click or continuous-video timings. Actual warm-return input median/max were K2 43.6/45.6 ms, K6 33.9/35.3 ms and main 43.5/46.0 ms; K2 paired warm increases were -4.6/-2.4/+2.8 ms. Both K2 and main showed a delayed first-warm position transition with missing early trace frames, so no new branch-specific restoration fault or continuous blank/jump pass is inferred. The earlier K6 cold median/max 121.7/134.2 ms versus its original matched main 50.4/50.7 ms remains a separate admission/cohort; its cold latency and traced paint misses are not erased by the K2 candidate. Earlier no-op warm observations and failed or occluded attempts remain archived separately and are excluded from the actual warm-return comparison.

The bounded switching schedule used separate initial warmups, two rapid rounds and a reading round with 31-second pauses. Counts below are measured root/editor/read-owner presence before each return, not user telemetry or theoretical warm-set ratios. The resource tiers contain actual 27 or 270 open tabs, and the corrected supported workspace/tab traversal exercised 27 chats across two workspaces and 270 across 17. Reader-readiness gaps at the programmed 100 ms per-visit checkpoints are disclosed; actual delays include action and inspection work, and no per-visit paint claim is made. Original current-workspace-only resource rows remain separately qualified.

Measured result K2/30 candidate K6/30 Main
Cold returns, 3-chat schedule 0/9 0/9 0/9
Cold returns, 5-chat schedule 7/15 0/15 0/15
Cold returns, 8-chat schedule 13/24 9/24 0/24
Settled roots/editors/read owners, 27 tabs 3 7 27
Settled roots/editors/read owners, 270 tabs 3 7 270
Settled DOM elements, 270 tabs 5,172 5,482 25,890
Settled diagnostic store listeners, 270 tabs 6,711 6,895 19,515

Global workspace/status subscriptions remain. Grace cohorts can exceed the settled cap, and the measurements include their disposal. Heap samples were not normalized with forced GC and CPU covers finite renderer grace intervals; neither was uniformly better. There is no whole-app CPU or long-term leak claim. Every comparison copy stopped gracefully and its recorded identities were absent; drivers and control terminals were closed and the QA ticket released.

The corpus is synthetic scale derived from genuine isolated QA output: 960 session identities across 60 folder workspaces, with 27,780 unchanged original journal rows and 484 disclosed startup additions. Control and candidate use the same frozen UI-ready seed and M4Air, with production file-origin renderer artifacts inside the same isolated Electron development wrapper and equivalent inert instrumentation. The results do not establish packaged-release performance. All nine planned warm-set/grace combinations were screened; original onboarding-occluded captures remain invalid and excluded. The K2 candidate's measured trade-off awaits the lane owner's decision.

Three source review rounds and the required design rulings are complete, including the whole-mechanism comparison and performance ownership inventory. Exact-head CI passed at 729ab1a (PR Checks); all 41 reported checks succeeded or were intentionally skipped. Narrow conflict-sync review agreed. Real lifecycle QA used state made by v1.4.237 through a graceful upgrade, with two ordinary sends and two genuine replies each for Claude and Codex, exact original multiline drafts, accepted image work crossing hide, hidden completion and an actual async question. Independent evidence audits accepted root/editor/read-owner release, exact within-record deep return and next input, actual five-minute expiry/latest and old-runtime offline/no-record/reconnect. The matched expiry comparison showed upper-content reflow on both builds while the latest bottom marker remained visible; the conservative candidate movement flag stays disclosed without a new branch-specific loss claim. Other UI and unchanged-consumer flows use the agreed renderer, recorded-output, protocol and operation-count contracts plus CI.

Actual real QA head remains 590ddeb; test-only commits 18f2ce7, 874a64d and 30de3aa and main merge 729ab1a carry that evidence. Main performance control remains d49ad60. Recovery-retry work tracked in #32267 is outside this frozen source.

Actual formatted PR-attributable accounting against merge parent main41db63f8c25961e69632c0d9b73e959cb7a1f917: production +2,544 / -880 in 69 paths, comprising 2,454 substantive additions plus 90 documented hook-mandated mechanical additions. Ceilings remain 2,500 substantive / 2,600 gross; margins are 46 / 56. All moves, types, imports/exports, glue and style count, and deletions do not offset additions. The mechanical exception covers only mandatory braces/style, type-only rewrites and file-limit extractions. Tests are +2,861 / -183 in 44 paths. Held read-owner files and the generic prompt hook retain their required exact contents. The benchmark findings have caused no source or policy changes.

@brennanb2025
brennanb2025 marked this pull request as ready for review October 23, 2026 10:29
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review.

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9c5e7227-1f63-451b-bf5f-d585d57fceb9
📥 Commits

Reviewing files that changed from the base of the PR and between dc31056 and 5f8e75b.

📒 Files selected for processing: 3
  • src/renderer/src/components/dashboard-popout/DashboardPopoutRoot.test.tsx
  • src/renderer/src/components/native-chat/NativeChatComposer.test.tsx
  • src/renderer/src/components/native-chat/use-structured-agent-session-options.preloaded-agents.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

Walkthrough

Native-chat views now use admission and retirement tracking, and keyed state can persist across unmounts. Composer, question, and transcript state can be restored when the same view returns. Structured-session readers retain bounded snapshots and read observations. Queued-message editing and attachment intake can continue across view changes. Input readiness, view leases, menu actions, and dictation coordinate with chat inputs that are not yet mounted.

Priority: Normal

Merge Risk: Moderate · up to 5f8e7

Several native-chat lifecycle paths can still retain resources or leave user actions pending, so the PR should not merge without resolving or accepting these risks.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 18.89% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 90 functions across 66 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check Warning The description provides extensive technical and performance details, but it does not follow the required template. It omits the required section headings and required information, including an actual… Rewrite the description using every required template section. Add an actual issue link under Linked Issue, provide concise ELI5, What Changed, and Why sections, attach before/after visual proof or state N/A with a reason, document testing …
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title "H2, park hidden chats" names the core change: hidden structured chats are parked after a grace period, which the changeset implements through view admission, retirement, and keyed return st…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "H2, park hidden chats" names the core change: hidden structured chats are parked after a grace period, which the changeset implements through view admission, retirement, and keyed return state. It is short and specific. The "H2" label is a lane identifier that a teammate scanning history may not recognize, which slightly reduces clarity, but the main change is still identifiable.

Full details: Description check

Explanation

The description provides extensive technical and performance details, but it does not follow the required template. It omits the required section headings and required information, including an actual Linked Issue, ELI5 summary, focused What Changed and Why sections, Visual Proof or an explicit N/A, Testing checklist and platform coverage, AI Disclosure, Review, Notes, and Checklist confirmations.

Resolution

Rewrite the description using every required template section. Add an actual issue link under Linked Issue, provide concise ELI5, What Changed, and Why sections, attach before/after visual proof or state N/A with a reason, document testing and supported platforms, complete AI Disclosure when applicable, address Review and Notes, and mark the Checklist items accurately. Keep the existing performance limitations and not-ready status in the relevant sections.

✨ Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 7


ℹ️ Review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a2914a1c-6a34-4d09-a2de-50c7789176ef
📥 Commits

Reviewing files that changed from the base of the PR and between d9dc87b and 534788d.

📒 Files selected for processing: 76
  • src/renderer/src/components/dictation/DictationController.tsx
  • src/renderer/src/components/dictation/dictation-insertion-target.ts
  • src/renderer/src/components/native-chat/NativeChatComposer.resume-command.test.tsx
  • src/renderer/src/components/native-chat/NativeChatComposer.tsx
  • src/renderer/src/components/native-chat/NativeChatComposerField.tsx
  • src/renderer/src/components/native-chat/NativeChatInterruptedContinue.test.tsx
  • src/renderer/src/components/native-chat/NativeChatInterruptedContinue.tsx
  • src/renderer/src/components/native-chat/NativeChatMessageList.tsx
  • src/renderer/src/components/native-chat/NativeChatMessageList.windowing.test.tsx
  • src/renderer/src/components/native-chat/NativeChatPromptEditor.paragraph-selection.test.tsx
  • src/renderer/src/components/native-chat/NativeChatPromptEditor.tsx
  • src/renderer/src/components/native-chat/NativeChatQuestionCard.tsx
  • src/renderer/src/components/native-chat/NativeChatQueuedMessageEditor.test.tsx
  • src/renderer/src/components/native-chat/NativeChatQueuedMessageEditor.tsx
  • src/renderer/src/components/native-chat/NativeChatStructuredAsyncQuestion.tsx
  • src/renderer/src/components/native-chat/NativeChatStructuredQuestionCard.test.tsx
  • src/renderer/src/components/native-chat/NativeChatStructuredQuestionCard.tsx
  • src/renderer/src/components/native-chat/NativeChatStructuredSession.tsx
  • src/renderer/src/components/native-chat/NativeChatTranscriptItems.tsx
  • src/renderer/src/components/native-chat/StructuredAgentSessionAttentionBridge.test.tsx
  • src/renderer/src/components/native-chat/StructuredAgentSessionAttentionBridge.tsx
  • src/renderer/src/components/native-chat/StructuredAgentSessionPaneOverlayLayer.test.tsx
  • src/renderer/src/components/native-chat/StructuredAgentSessionPaneOverlayLayer.tsx
  • src/renderer/src/components/native-chat/native-chat-autoscroll.ts
  • src/renderer/src/components/native-chat/native-chat-composer-paste-options.ts
  • src/renderer/src/components/native-chat/native-chat-disclosure-store.ts
  • src/renderer/src/components/native-chat/native-chat-input-readiness.ts
  • src/renderer/src/components/native-chat/native-chat-pagination.ts
  • src/renderer/src/components/native-chat/native-chat-reading-position.ts
  • src/renderer/src/components/native-chat/native-chat-transcript-scroll-types.ts
  • src/renderer/src/components/native-chat/native-chat-view-parking-owner.ts
  • src/renderer/src/components/native-chat/native-chat-view-parking.count.test.tsx
  • src/renderer/src/components/native-chat/native-chat-view-state-memory.ts
  • src/renderer/src/components/native-chat/structured-agent-session-queued-edit-images.ts
  • src/renderer/src/components/native-chat/structured-agent-session-queued-edit-owner.ts
  • src/renderer/src/components/native-chat/structured-agent-session-read-owner-registry.ts
  • src/renderer/src/components/native-chat/structured-agent-session-read-owner.ts
  • src/renderer/src/components/native-chat/structured-agent-session-read-resume-cache.ts
  • src/renderer/src/components/native-chat/use-native-chat-composer-attachment-previews.ts
  • src/renderer/src/components/native-chat/use-native-chat-composer-handle.ts
  • src/renderer/src/components/native-chat/use-native-chat-composer-keydown.test.tsx
  • src/renderer/src/components/native-chat/use-native-chat-composer-notice.test.tsx
  • src/renderer/src/components/native-chat/use-native-chat-composer-notice.ts
  • src/renderer/src/components/native-chat/use-native-chat-composer-paste.ts
  • src/renderer/src/components/native-chat/use-native-chat-composer-recall.test.tsx
  • src/renderer/src/components/native-chat/use-native-chat-composer-recall.ts
  • src/renderer/src/components/native-chat/use-native-chat-composer-reveal-focus.ts
  • src/renderer/src/components/native-chat/use-native-chat-composer-submit.test.tsx
  • src/renderer/src/components/native-chat/use-native-chat-composer-submit.ts
  • src/renderer/src/components/native-chat/use-native-chat-draft.ts
  • src/renderer/src/components/native-chat/use-native-chat-external-attachments.ts
  • src/renderer/src/components/native-chat/use-native-chat-find.ts
  • src/renderer/src/components/native-chat/use-native-chat-menu-paste-lifetime.test.tsx
  • src/renderer/src/components/native-chat/use-native-chat-paste-bridge.ts
  • src/renderer/src/components/native-chat/use-native-chat-paste-lifetime.ts
  • src/renderer/src/components/native-chat/use-native-chat-picker-state.ts
  • src/renderer/src/components/native-chat/use-native-chat-prompt-card-presentation.test.ts
  • src/renderer/src/components/native-chat/use-native-chat-prompt-card-presentation.ts
  • src/renderer/src/components/native-chat/use-native-chat-question-auto-advance.ts
  • src/renderer/src/components/native-chat/use-native-chat-queued-edit-image-intake.ts
  • src/renderer/src/components/native-chat/use-native-chat-root-input-routing.ts
  • src/renderer/src/components/native-chat/use-native-chat-structured-composer-send.ts
  • src/renderer/src/components/native-chat/use-native-chat-subagent-sections.ts
  • src/renderer/src/components/native-chat/use-native-chat-transcript-reading.ts
  • src/renderer/src/components/native-chat/use-native-chat-transcript-scroll.ts
  • src/renderer/src/components/native-chat/use-native-chat-transcript-window.ts
  • src/renderer/src/components/native-chat/use-structured-agent-session-mutate.ts
  • src/renderer/src/components/native-chat/use-structured-agent-session-option-state.ts
  • src/renderer/src/components/native-chat/use-structured-agent-session-queued-edit.test.tsx
  • src/renderer/src/components/native-chat/use-structured-agent-session-queued-edit.ts
  • src/renderer/src/components/native-chat/use-structured-agent-session-read.test.tsx
  • src/renderer/src/components/native-chat/use-structured-agent-session-start-failure-facts.ts
  • src/renderer/src/components/native-chat/use-structured-prompt-response-hold.ts
  • src/renderer/src/hooks/useAppMenuSelectionActions.test.tsx
  • src/renderer/src/hooks/useAppMenuSelectionActions.ts
  • src/renderer/src/lib/app-menu-paste.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

Comment on lines +131 to +135
if (event instanceof NativeChatPasteRequest && event.clipboardEvent) {
onPaste(event.clipboardEvent)
event.preventDefault()
return
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
rg -nP -C8 'export function findNativeChatPasteField' --type=ts
rg -nP -C3 'NativeChatPasteRequest\(' --type=ts

Repository: stablyai/orca

Length of output: 5005


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- use-native-chat-paste-bridge.ts ---'
nl -ba src/renderer/src/components/native-chat/use-native-chat-paste-bridge.ts | sed -n '1,240p'
printf '%s\n' '--- native-chat-paste-request.ts ---'
nl -ba src/renderer/src/lib/native-chat-paste-request.ts | sed -n '1,180p'
printf '%s\n' '--- parking owner selected input path ---'
nl -ba src/renderer/src/components/native-chat/native-chat-view-parking-owner.ts | sed -n '100,170p'
printf '%s\n' '--- related route definitions ---'
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'function pasteTextIntoTextControl' -e 'pasteTextIntoTextControl(' -e 'handlePasteEvent' -e 'onPasteRequest' -e 'onPaste=' -e 'data-queued-message-editor' src/renderer/src/components/native-chat src/renderer/src/lib

Repository: stablyai/orca

Length of output: 20451


🏁 Script executed:

#!/bin/bash
set -e
nl -ba src/renderer/src/components/native-chat/use-native-chat-paste-bridge.ts | sed -n '1,240p'
nl -ba src/renderer/src/lib/native-chat-paste-request.ts | sed -n '1,180p'
nl -ba src/renderer/src/components/native-chat/native-chat-view-parking-owner.ts | sed -n '100,170p'
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'pasteTextIntoTextControl' -e 'handlePasteEvent' -e 'onPasteRequest' -e 'data-queued-message-editor' src/renderer/src/components/native-chat src/renderer/src/lib

Repository: stablyai/orca

Length of output: 20531


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- queued editor ---'
nl -ba src/renderer/src/components/native-chat/NativeChatQueuedMessageEditor.tsx | sed -n '1,180p'
printf '%s\n' '--- paste routing tests ---'
nl -ba src/renderer/src/components/native-chat/native-chat-paste-routing.test.tsx | sed -n '1,460p'
printf '%s\n' '--- queued editor paste/image bindings ---'
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'onPaste' -e 'handlePaste' -e 'useNativeChatQueuedEditImageIntake' -e 'saveClipboardImageAsTempFile' src/renderer/src/components/native-chat/NativeChatQueuedMessageEditor.tsx src/renderer/src/components/native-chat/use-native-chat-queued-edit-image-intake.ts src/renderer/src/components/native-chat

Repository: stablyai/orca

Length of output: 41914


Replay the clipboard event on the queued-editor field.

onOwnedPaste dispatches NativeChatPasteRequest on the queued editor's textarea and prevents the original event. onPasteRequest then passes the original event to onPaste, which uses the stale clipboard-event target. The paste can therefore be sent to the composer or discarded.

Use the request target for queued-editor replays. Dispatch a new ClipboardEvent on that textarea so useNativeChatQueuedEditImageIntake receives the event and preserves both text and image pastes. Do not replace this with pasteTextIntoTextControl; the queued editor explicitly supports image attachments.

Suggested fix
--- "a/src/renderer/src/components/native-chat/use-native-chat-paste-bridge.ts"
+++ "b/src/renderer/src/components/native-chat/use-native-chat-paste-bridge.ts"
@@ -128,11 +128,22 @@
     }
     // Named-pane pastes (terminal context menu, a paste on the cover itself) carry no event data.
     const onPasteRequest = (event: Event): void => {
       if (event instanceof NativeChatPasteRequest && event.clipboardEvent) {
-        onPaste(event.clipboardEvent)
+        const target = event.target
+        if (target instanceof HTMLTextAreaElement) {
+          target.dispatchEvent(
+            new ClipboardEvent('paste', {
+              clipboardData: event.clipboardEvent.clipboardData,
+              bubbles: true,
+              cancelable: true
+            })
+          )
+        } else {
+          onPaste(event.clipboardEvent)
+        }
         event.preventDefault()
         return
       }
       if (composerRef.current || questionAnswerInputRef?.current) {
         event.preventDefault()
         pasteClipboardIntoComposer()
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (event instanceof NativeChatPasteRequest && event.clipboardEvent) {
onPaste(event.clipboardEvent)
event.preventDefault()
return
}
if (event instanceof NativeChatPasteRequest && event.clipboardEvent) {
const target = event.target
if (target instanceof HTMLTextAreaElement) {
target.dispatchEvent(
new ClipboardEvent('paste', {
clipboardData: event.clipboardEvent.clipboardData,
bubbles: true,
cancelable: true
})
)
} else {
onPaste(event.clipboardEvent)
}
event.preventDefault()
return
}

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (2)

🟡 Minor · Serialize dictation startup before waiting for a ready input. · DictationController.tsx:128-134

src/renderer/src/components/dictation/DictationController.tsx:128-134
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Serialize dictation startup before waiting for a ready input.

captureReadyInsertionTarget() can remain pending while dictationStateRef.current is still idle. A second start can therefore enter, and a stop action returns without cancelling the pending start. If the older wait resolves last, it writes its target before the run check and can overwrite the active run's target. Final dictation text can then reach the wrong or stale input.

Reserve the startup before awaiting, keep the result local, and assign insertionTargetRef.current only after the run and cancellation checks. The PR objective makes ready-input waiting part of dictation startup, so this race is reachable on that path.

🟡 Minor · Dispatch the paste request on the chat root. · native-chat-view-parking-owner.ts:136-144

src/renderer/src/components/native-chat/native-chat-view-parking-owner.ts:136-144
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Dispatch the paste request on the chat root.

When the selected input is the structured composer or answer field, NativeChatPasteRequest is dispatched on the input, but the request listener is registered on the chat root and the event does not bubble. The original paste is already prevented, so both text and image data can be lost. Dispatch the request on the root, as the keyboard path already does.

Suggested fix
-          input.dispatchEvent(new NativeChatPasteRequest(accepted))
+          input.closest('[data-native-chat-root]')?.dispatchEvent(
+            new NativeChatPasteRequest(accepted)
+          )
🧹 Nitpick comments: 2
src/renderer/src/components/native-chat/use-native-chat-transcript-reading.ts: 1

110-116: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Move the row lookup out of the following-end path.

captureReadingPosition calls container.getBoundingClientRect() and scans rows with getBoundingClientRect() before it checks followingEnd. When followingEnd is true, the code discards the result. A reader who follows the end is the common case during streaming.

use-native-chat-transcript-window.ts calls this function from a layout effect with no dependency array (Line 126), so it runs on every render. It also runs from syncScrollState. Each call forces a synchronous layout read. This cost conflicts with the PR goal of reducing renderer work.

Return early for followingEnd before any DOM measurement:

⚡ Proposed fix
-      const { top, bottom } = container.getBoundingClientRect()
-      const row = Array.from(
-        container.querySelectorAll<HTMLElement>('[data-native-chat-row-key]')
-      ).find((element) => {
-        const rect = element.getBoundingClientRect()
-        return rect.bottom > top && rect.top < bottom
-      })
       if (followingEnd) {
         reading.current = { followingEnd, anchor: null }
-      } else if (row?.dataset.nativeChatRowKey) {
+        return
+      }
+      const { top, bottom } = container.getBoundingClientRect()
+      const row = Array.from(
+        container.querySelectorAll<HTMLElement>('[data-native-chat-row-key]')
+      ).find((element) => {
+        const rect = element.getBoundingClientRect()
+        return rect.bottom > top && rect.top < bottom
+      })
+      if (row?.dataset.nativeChatRowKey) {
src/renderer/src/components/native-chat/use-native-chat-transcript-scroll.ts: 1

109-109: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Keep syncScrollState stable across transcript updates.

syncScrollState now depends on captureReadingPosition (line 109). captureReadingPosition depends on slots, subagentSections, and journalEpoch. A content-only update changes messages, which recomputes slots as a new array. captureReadingPosition and syncScrollState then get new identities on each streaming update. Two effects re-run:

  • The visibility layout effect (lines 260-295) lists syncScrollState as a dependency. While following, it calls scrollToEndWhenMeasurable() on each update.
  • The ResizeObserver effect (lines 297-320) lists syncScrollState as a dependency. It disconnects and creates a new observer. The new observer fires an initial callback, which calls scrollToEndWhenMeasurable() and syncScrollState() again.

The window hook avoids rebuilding its item keys with the itemKeys memo (use-native-chat-transcript-window.ts, lines 77-78). The raw slots array still reaches captureReadingPosition.

Read slots, subagentSections, and journalEpoch through a ref. Update the ref in a layout effect in useNativeChatTranscriptReading, not during render. That hook runs before useNativeChatTranscriptScroll in NativeChatMessageList, so the ref is current when the scroll hook's layout effect runs. Keep isVisible in the dependency list. Then syncScrollState depends only on stable values.


ℹ️ Review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b4d4c041-b0c2-4a99-af3e-28fee1cf78cb
📥 Commits

Reviewing files that changed from the base of the PR and between 534788d and b120b03.

📒 Files selected for processing: 20
  • src/renderer/src/components/dictation/DictationController.tsx
  • src/renderer/src/components/native-chat/NativeChatPromptEditor.tsx
  • src/renderer/src/components/native-chat/NativeChatQueuedMessageEditor.tsx
  • src/renderer/src/components/native-chat/NativeChatStructuredQuestionCard.tsx
  • src/renderer/src/components/native-chat/native-chat-composer-paste-options.ts
  • src/renderer/src/components/native-chat/native-chat-disclosure-store.ts
  • src/renderer/src/components/native-chat/native-chat-view-state-memory.ts
  • src/renderer/src/components/native-chat/structured-agent-session-older-page-read.ts
  • src/renderer/src/components/native-chat/structured-agent-session-read-owner.ts
  • src/renderer/src/components/native-chat/structured-agent-session-read-resume-cache.ts
  • src/renderer/src/components/native-chat/use-native-chat-composer-attachment-previews.ts
  • src/renderer/src/components/native-chat/use-native-chat-composer-paste.ts
  • src/renderer/src/components/native-chat/use-native-chat-composer-submit.ts
  • src/renderer/src/components/native-chat/use-native-chat-queued-edit-image-intake.ts
  • src/renderer/src/components/native-chat/use-native-chat-structured-composer-send.ts
  • src/renderer/src/components/native-chat/use-native-chat-transcript-reading.ts
  • src/renderer/src/components/native-chat/use-native-chat-transcript-scroll.ts
  • src/renderer/src/components/native-chat/use-native-chat-transcript-window.ts
  • src/renderer/src/components/native-chat/use-structured-agent-session-mutate.ts
  • src/renderer/src/components/native-chat/use-structured-agent-session-queued-edit.ts
💤 Files with no reviewable changes: 1
  • src/renderer/src/components/native-chat/structured-agent-session-read-resume-cache.ts
🚧 Files skipped from review as they are similar to previous changes: 2
  • src/renderer/src/components/native-chat/native-chat-composer-paste-options.ts
  • src/renderer/src/components/native-chat/use-structured-agent-session-queued-edit.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

@OrcaWin

OrcaWin commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Closing after reviewing the parking core against the performance merits policy in #27143. The architecture is not entirely superseded: current main still retains hidden visited structured chats, and this PR demonstrably releases roots/editors/read owners. The question is whether the demonstrated benefit warrants this particular nonfree design.

The shipping K6/30 policy reports cold-return input median/max of 121.7/134.2 ms versus its paired main's 50.4/50.7 ms, with traced paint misses. Parking also deliberately loses composer Undo history; exact deep return depends on the bounded five-minute resume record, with expiry/eviction/oversize returning to latest and offline/no-record return empty until reconnect. Those costs accompany substantial new ownership, return-state, read-cache, async-work, occurrence, find and scroll-restoration machinery (+2,544 production lines across 69 paths).

The reductions are real: at 270 visited tabs K6 settles at 7 roots/editors/read owners versus 270, 5,482 DOM elements versus 25,890, and 6,895 diagnostic listeners versus 19,515. However, the reported finite renderer CPU intervals and unnormalized heap samples do not establish a substantial sustained resource or interaction benefit sufficient to outweigh the measured return regression, functional losses and continuing lifecycle cost. This does not require every metric to improve; it weighs the demonstrated gains and costs together. The measured K2 candidate is not the shipping policy and retains a material cold-return increase as documented in the body. Neither conflicts nor missing packaged QA is the reason for closure.

Two focused fixes are worth preserving separately: (1) async-question occurrence identity, which makes a later identical question fresh even when a delivered answer and replacement arrive in one settled update; and (2) deleting the run-scroll entry when its capped disclosure entry is evicted. I independently reproduced (1) with the actual main/PR production components and extractors in a continuously mounted synthetic ready-to-ready update: after cancelling the first question, main hides the second identical question while the PR shows it, including a reused provider call ID. This probe mocked the card UI and wait-start store value; it was not Electron or transport QA.

This closes the parking proposal on its present merits while preserving those independent fixes and the underlying resource-reduction goal. Branch preserved.

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.

2 participants