Skip to content

Fix desktop lifecycle races, Changes safety, and streaming performance - #28

Merged
BunsDev merged 2 commits into
mainfrom
comprehensive-review
Sep 28, 2026
Merged

BunsDev merged 2 commits into
mainfrom
comprehensive-review

Conversation

@BunsDev

@BunsDev BunsDev commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

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 build and npm run typecheck passed.
  • 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.
  • Inspected approval and completed-thread captures at 1786×1049; existing compact-window/layout gates passed.
  • Independent review findings were fixed and re-reviewed with no remaining blockers.

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.

Copilot AI lite review requested due to automatic review settings September 28, 2026 07:21

Copilot AI 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.

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 Medium severity

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.

Comment thread apps/desktop/src/renderer/App.tsx Resolved
@BunsDev BunsDev self-assigned this Sep 28, 2026

@BunsDev BunsDev left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@BunsDev
BunsDev merged commit 586dcb2 into main Sep 28, 2026
2 checks passed
@BunsDev
BunsDev deleted the comprehensive-review branch September 28, 2026 07:37
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