fix: PTY exit handling, error handling, sidebar persistence - #7
Merged
Conversation
… cleanup - Fix onExit handler accumulation: register once per session via guard set - Add try/catch on /api/projects for SDK errors - Persist sidebarOpen in Zustand (survives refresh), default to open - Client clears session immediately on PTY exit (WS close code 4010) - Extract PageTheme type alias in Sidebar (simplifier) - Type the listSessions result to avoid implicit any Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
aterrylu
enabled auto-merge (squash)
March 8, 2026 19:55
nox-0x
approved these changes
Mar 8, 2026
nox-0x
left a comment
Collaborator
There was a problem hiding this comment.
Solid follow-up to #6. PTY exit notification is correctly guarded against duplicate handlers (the exitHandlerRegistered set + cleanup in onExit handles reconnect races cleanly), error handling on /api/projects is proper, and the sidebarOpen persistence is straightforward. The removed env/CLAUDECODE deletion was dead code (the local copy was never passed to listSessions), so that removal is correct. LGTM.
3 tasks
8 tasks
aterrylu
added a commit
that referenced
this pull request
Jun 10, 2026
…sktop gap (#195) The desktop app had 1 test file vs the server's 19 — which is why 'the hosted server works great but the desktop app is always problematic.' Goes 1 → 6 files (48 cases), testing the highest-risk main-process logic with electron + child_process fully MOCKED (zero real spawns). Coverage: - server-supervisor (THE critical module): acquireOrConnect Built-in-vs-Always-on decision — live owner → connect, NEVER spawn (asserted); dead pid/port → Built-in spawn; AUTONOMOS_READY parsing + argv; AUTONOMOS_ALREADY_RUNNING race; early-exit/ spawn-error/missing-bundle → clean reject, no spawn. - config/tokens (security): safeStorage round-trip, plaintext fallback, the encrypted-flag keychain-flip edge, decrypt-failure → null, tokens.dat 0o600. - migrate + config/migration: install-service shellout argv; migrateConfig validation (garbage → defaults, bad connections dropped, localhost dedup). - drag-controller: extracted from window-manager (1:1, electron-free) — offset reposition + timer-leak guards (failure-class #7). Testability seams (mirror the server's _setDependencies pattern, prod defaults to real): electron-deps.ts (lazy real require, _setElectronForTesting stub), _setDependenciesForTesting on server-supervisor/migrate, drag-controller injection. window-manager keeps identical public signatures — no callers changed. FINDING (pinned with a FINDING-commented test): migration.ts isLocalhostRemote never strips IPv6-loopback dups — new URL('http://[::1]:..').hostname is '[::1]' (bracketed), so the '::1' compare is dead code. Behavior preserved; flagged for a deliberate future fix. make check green 4x (392 node:test + 203 vitest, 0 fail); biome + tsc clean. Zero process spawns (claude PIDs unchanged across runs). Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
4 tasks
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.
Summary
Follow-up fixes from code reviewer and simplifier on PR #6:
/api/projectsendpoint now catches SDK errors gracefully instead of crashingsidebarOpenpersisted in Zustand — survives page refresh. Defaults to open for discoverabilityPageThemetype alias, typelistSessionsresult to avoid implicitanyTest plan
/api/projectsshould return 500 not crash🤖 Generated with Claude Code