Skip to content

fix: listener leaks, abort sessions on delete, bump diff viewer#19

Merged
aletc1 merged 1 commit intodevfrom
claude/nice-chebyshev-f139b3
Apr 18, 2026
Merged

fix: listener leaks, abort sessions on delete, bump diff viewer#19
aletc1 merged 1 commit intodevfrom
claude/nice-chebyshev-f139b3

Conversation

@aletc1
Copy link
Copy Markdown
Owner

@aletc1 aletc1 commented Apr 18, 2026

Summary

Follow-up patches addressing a few remaining items from the bug sweep:

  • Chat transport listener leaks — AbortSignal abort listeners in ipc, acp, and remote chat transports were registered without { once: true }, leaving entries attached to the signal past their single use. Added the once option so they're auto-removed after firing.
  • Abort active Claude sessions on workspace delete — Deleting a project, chat, or sub-chat previously left any in-flight Claude session running against rows the DB cascade was about to remove. Added abortClaudeSessionsForSubChats() in claude.ts and wired it into projects.delete, chats.delete, and chats.deleteSubChat so controllers are aborted and evicted from activeSessions before the cascade.
  • Diff viewer upgrade — Bumped @pierre/diffs from ^1.0.10 to 1.1.0-beta.18 (theme integration fixes). bun install ran clean.

Already-fixed items confirmed in tree (no changes needed): double-click guard on new chat, custom slash command projectPath, PostHog analytics, Cmd+[ / Cmd+] sub-chat nav, approve-plan isActive guard in split view, LRU cache eviction. The "write lock map" item doesn't apply — no such map exists in this codebase.

Changes

File Change
src/renderer/features/agents/lib/ipc-chat-transport.ts { once: true } on abort listener
src/renderer/features/agents/lib/acp-chat-transport.ts { once: true } on abort listener
src/renderer/features/agents/lib/remote-chat-transport.ts { once: true } on abort listener
src/main/lib/trpc/routers/claude.ts New abortClaudeSessionsForSubChats(ids) helper
src/main/lib/trpc/routers/projects.ts Collect sub-chat ids → abort before delete
src/main/lib/trpc/routers/chats.ts Abort on chats.delete and deleteSubChat
package.json / bun.lock @pierre/diffs1.1.0-beta.18

Test plan

  • Start a streaming agent run, hit stop — session aborts cleanly, no listener warnings in console.
  • Delete a project that has active/streaming sub-chats — streams stop and entries leave activeSessions.
  • Delete an individual chat with an active sub-chat stream — stream aborts before cascade delete.
  • Delete an individual sub-chat mid-stream — stream aborts.
  • Open a file diff view — renders with the new @pierre/diffs build, theme integration intact.
  • tsc --noEmit error count unchanged from main baseline (no regressions from this PR).

- Add { once: true } to abort listeners in ipc/acp/remote chat transports
  to prevent AbortSignal listener accumulation.
- Add abortClaudeSessionsForSubChats() helper and call it from
  projects.delete, chats.delete, and chats.deleteSubChat so in-flight
  Claude sessions are aborted before their workspace is removed.
- Bump @pierre/diffs to 1.1.0-beta.18.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@aletc1 aletc1 merged commit 39e1869 into dev Apr 18, 2026
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