Repository navigation
Fix desktop lifecycle races, Changes safety, and streaming performance - #28
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Four moderate unresolved issues remain around cancellation races, UTF-8 chunk handling, stop fencing, and transcript loading.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
This PR hardens desktop lifecycle handling, transcript persistence, Git Changes behavior, and renderer interactions.
Changes:
- Adds cancellation, deletion, project-removal, crash, and window lifecycle safeguards.
- Improves UTF-8 streaming, transcript persistence, Changes selection, IME handling, focus, and scrolling.
- Adds extensive unit and Electron regression coverage.
| File | Summary |
|---|---|
docs/reviews/2026-09-28-desktop-review.md |
Records findings and verification. |
apps/desktop/test/runner.test.ts |
Tests lifecycle and persistence behavior. |
apps/desktop/test/line-buffer.test.ts |
Tests UTF-8 chunk boundaries. |
apps/desktop/test/git.test.ts |
Tests rename and unusual path handling. |
apps/desktop/test/codex-backend.test.ts |
Tests Codex cancellation and recovery. |
apps/desktop/test/claude-backend.test.ts |
Tests Claude cancellation. |
apps/desktop/src/renderer/transcript.ts |
Replays transcript events over snapshots. |
apps/desktop/src/renderer/styles.css |
Supports keyboard-focused file controls. |
apps/desktop/src/renderer/components/ThreadView.tsx |
Improves send-time scrolling. |
apps/desktop/src/renderer/components/SettingsDialog.tsx |
Adds focus containment. |
apps/desktop/src/renderer/components/Markdown.tsx |
Memoizes Markdown rendering. |
apps/desktop/src/renderer/components/Composer.tsx |
Makes sending IME-safe. |
apps/desktop/src/renderer/components/ChangesPanel.tsx |
Adds keyboard selection and stale-result protection. |
apps/desktop/src/renderer/App.tsx |
Coordinates transcript and Changes lifecycle. |
apps/desktop/src/main/index.ts |
Guards window and project lifecycle events. |
apps/desktop/src/main/engine/runner.ts |
Adds lifecycle fencing and coalesced persistence. |
apps/desktop/src/main/engine/git.ts |
Safely handles rename restoration and paths. |
apps/desktop/src/main/engine/backends/types.ts |
Provides UTF-8-safe line buffering. |
apps/desktop/src/main/engine/backends/codex.ts |
Handles Codex cancellation and crashes. |
apps/desktop/src/main/engine/backends/claude.ts |
Waits for process termination on cancellation. |
apps/desktop/e2e/review.spec.ts |
Covers lifecycle and interaction regressions. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
BunsDev
left a comment
There was a problem hiding this comment.
Reviewed at ea11c6a — no blockers. Follow-ups: (1) a Codex stop that is never acknowledged leaves deleteThread waiting forever, and retries fail with 'being deleted' until restart; consider a force-stop that restarts the app-server. (2) removeProject rejects partway if a thread is already being deleted. (3) The ChangesPanel diff shows 'Loading diff…' on every status refresh because a diff is tied to its exact snapshot. (4) Aborting during thread/start can leave an orphan Codex thread.

Turn cancellation, thread/project removal, and transcript loading could race live CLI output. This fixes those lifecycle failures, protects staged rename discard, and keeps the selected Changes view consistent. It also adds keyboard file selection, IME-safe sending, Settings focus containment, correct send scrolling, and safe macOS window close/reopen.
Performance fixtures now require 4 transcript writes instead of 1,003 for 1,000 output deltas; 0 completed-message reparses instead of 1,000; and 0 transcript reads instead of 20 for idle status queries. The CLI-only execution boundary and measured layout are preserved.
The review report records the architecture/plan audit, each reproduced finding, decisions, measurements, and verification limits. Terminal PRs #25/#26 remain separate; their integration must retain the runner-owned removal and window guards.
Validation:
npm run buildandnpm run typecheckpassed.npm test: 15 core + 79 desktop tests passed, including crash/restart/resume, cancellation acknowledgement, deletion fencing, rename/symlink/case-only handling, and UTF-8 boundaries.npm run test:e2e: 38 tests passed in real Electron with offline fixtures.Live paid-provider turns and human VoiceOver acceptance were not exercised. A stop waits for the CLI's terminal acknowledgement before allowing destructive deletion; partial transcript writes have a 250 ms cadence with final flushes.