Skip to content

perf+fix: lazy-load heavy panes; deleting a thread ends its terminals (#1501 G4, #1183) - #1502

Merged
currentbits merged 5 commits into
mainfrom
coder/1501-g4-lazy-git-pane-terminal-cleanup-ebd61c
Oct 6, 2026
Merged

currentbits merged 5 commits into
mainfrom
coder/1501-g4-lazy-git-pane-terminal-cleanup-ebd61c

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Item G4 of #1501.

1. Lazy panes. Changes/Git, the turn diff panel, Terminal, Browser and Simulator now load on first use via lazyNamed. The sidebar, thread view and composer still load eagerly.

2. Deleting a thread ends its terminals (#1183).

  • Delete (to Recently deleted) kills the thread's PTYs after flushing scrollback, so a restore replays the old output, the same as after a restart.
  • Every permanent-removal path goes through purgeThread: emptying the trash, the TTL expiry, project removal, retention cleanup and orphaned-worker cleanup. It now also kills shells and removes <userData>/terminals/<thread>/.
  • Archiving doesn't touch terminals.
  • A test runs delete → restore → expiry through the real services and fails without the fix.

Merge with #1500: I resolved the one conflict (the TurnDiffPanel render): G4's Suspense wrapper kept, with #1500's shared split setting (setDiffSplit).

Verified independently, on main merged with this branch and #1500:

  • typecheck exits 0 and vite build passes.
  • test:renderer passes 2786 of 2786.
  • test:electron passes 4197 of 4197.

Still open from #1183: a shell started before the worktree existed only warns ("Restart to move"), and there's no separate "Close session" action.

🤖 Generated with Claude Code

Willem and others added 4 commits October 6, 2026 16:11
…nd simulator panes (#1501 G4)

Main chunk 1,055 kB -> 999 kB. Each pane suspends inside its own
PaneWorkspace leaf, and ThreadView warms all five chunks on idle so the
first open doesn't render a blank frame.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…#1183, #1501 G4)

Moving a thread to Recently deleted kills its shells but keeps the saved
scrollback, so a restore replays it like an app restart. Every permanent
removal goes through services-shared purgeThread (delete, trash expiry,
project removal, retention, orphan sweeps), which now also kills the
shells and deletes <userData>/terminals/<thread>.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…' into g4-resolve

# Conflicts:
#	src/components/ThreadView.tsx
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-06T14:27:21.318263Z 22702df PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 22702df686

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

*/
function budgetPatch(patch) {
const omitted = new Map();
if (patch.length <= PATCH_TRUNCATE) return { patch, omitted };

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Enforce the per-file cap before returning the whole patch

When the complete patch is between 60,001 and 100,000 characters, this early return bypasses FILE_PATCH_CAP, even if nearly all of the payload belongs to one file. Such a file is sent to and rendered by the client without patchOmitted: "large", so the new “Show anyway” protection only works when the aggregate patch also exceeds PATCH_TRUNCATE; apply the per-file check regardless of the total size.

Useful? React with 👍 / 👎.

Comment thread electron/terminal.js
Comment on lines +629 to +631
function purgeThread(threadId, logDir) {
killThread(threadId);
if (logDir) fs.rmSync(threadLogDir(logDir, threadId), { recursive: true, force: true });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Make terminal-log removal best-effort during thread purge

If the terminal directory cannot be removed—for example because of a transient Windows lock, permissions, or filesystem failure—rmSync throws after store.removeThread() has already modified memory. Callers such as deleteThread, trash expiry, and project removal then abort before store.saveNow(), leaving the deletion partially applied or preventing unrelated cleanup because an auxiliary scrollback directory was unavailable; catch/log this cleanup failure rather than allowing it to fail the durable thread operation.

Useful? React with 👍 / 👎.

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