Skip to content

fix(stability): remaining crash/hang fixes from stability pass#18

Merged
aletc1 merged 1 commit intodevfrom
claude/awesome-goldstine-307438
Apr 18, 2026
Merged

fix(stability): remaining crash/hang fixes from stability pass#18
aletc1 merged 1 commit intodevfrom
claude/awesome-goldstine-307438

Conversation

@aletc1
Copy link
Copy Markdown
Owner

@aletc1 aletc1 commented Apr 18, 2026

Closes out the 6 items still open from the 10-bug stability audit:

  • auto-create sub-chat row on send when the row is missing (prevents silent UPDATE no-op if renderer races createSubChat → send)
  • strip CLAUDE_CODE_ENTRYPOINT/CLAUDECODE from inherited env so the dev build launched from a claude CLI terminal no longer fails with "Claude Code cannot be launched inside another session"
  • 90s first-chunk wedge timeout on the SDK stream — aborts and surfaces a STREAM_WEDGE error instead of hanging the UI indefinitely
  • clearer ENOENT message when the bundled Claude binary is missing, pointing the user at bun run claude:download
  • root AppErrorBoundary + preload try/catch around exposeElectronTRPC, with one-shot auto-reload (10s debounce via sessionStorage) so IPC race crashes recover instead of leaving a black screen
  • Opus 1M context: map opus[1m] to the opus CLI shortcut and set ANTHROPIC_BETAS=context-1m-2025-08-07 on the child env so the 1M window actually engages

Closes out the 6 items still open from the 10-bug stability audit:

- auto-create sub-chat row on send when the row is missing (prevents
  silent UPDATE no-op if renderer races createSubChat → send)
- strip CLAUDE_CODE_ENTRYPOINT/CLAUDECODE from inherited env so the dev
  build launched from a `claude` CLI terminal no longer fails with
  "Claude Code cannot be launched inside another session"
- 90s first-chunk wedge timeout on the SDK stream — aborts and surfaces
  a STREAM_WEDGE error instead of hanging the UI indefinitely
- clearer ENOENT message when the bundled Claude binary is missing,
  pointing the user at `bun run claude:download`
- root AppErrorBoundary + preload try/catch around exposeElectronTRPC,
  with one-shot auto-reload (10s debounce via sessionStorage) so IPC
  race crashes recover instead of leaving a black screen
- Opus 1M context: map `opus[1m]` to the `opus` CLI shortcut and set
  ANTHROPIC_BETAS=context-1m-2025-08-07 on the child env so the 1M
  window actually engages

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@aletc1 aletc1 merged commit 30e0473 into dev Apr 18, 2026
aletc1 added a commit that referenced this pull request Apr 18, 2026
Adds the user-visible features shipped since the README was last touched
(commits #18 through #26) and groups the fork additions into four
sections for readability: Workflow & UI, Git/PRs/Worktrees, Models, and
Stability & Polish.

Highlights surfaced: split view with drag-to-split, Cmd+Shift+T, sortable
sidebar, draggable tabs, queue reorder, copy popover, PR widget +
branch switcher, two-column commit diff, Pull & Push recovery dialog,
worktree deletion safety, Sonnet 4.6 1M context + recovery action,
GPT-5.4, rich tool rendering, stream wedge timeout, and crash
auto-recovery.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
aletc1 added a commit that referenced this pull request Apr 18, 2026
…esh (#27)

* fix(security,perf): audit-driven hardening of main process

Addresses critical findings from a security/correctness/performance audit.

Security (P0):
- voice.ts, claude/env.ts: replace `execSync(${shell} -ilc '...')` with
  `execFileSync(shell, ['-ilc', ...])` and add a safe-shell allowlist to
  block `$SHELL=` command-injection via template interpolation.
- claude-token.ts: remove `shell: true` from the `claude setup-token`
  spawn and resolve the CLI to an absolute path via `which`/`where`
  before invoking, so metacharacters in PATH can't be interpreted.
- auth-manager.ts + index.ts: the `/auth` deep-link handler now requires
  an in-flight OAuth flow initiated by `startAuthFlow()`. A per-flow
  `state` nonce is generated, attached to the auth URL, and verified
  with constant-time compare on callback. Unsolicited deep links (drive-
  by CSRF via `twentyfirst-agents://auth?code=...`) are rejected.

Performance (P1):
- db/index.ts: add `PRAGMA synchronous = NORMAL` under WAL to reduce
  fsync load during high-frequency message persistence.
- db/schema/index.ts + drizzle/0009_*: add indexes on `chats.project_id`,
  `sub_chats.chat_id`, and `sub_chats.stream_id` (previously full-table
  scans on hot FK lookups).
- claude.ts: coalesce `text-delta` chunks in a 24ms buffer keyed by
  text id. Non-delta chunks flush the buffer first to preserve ordering.
  Cuts tRPC/IPC chatter during long streaming responses.

Robustness (P2):
- db/index.ts: migration failures now quarantine the DB file to
  `agents.db.broken-<timestamp>` and start fresh instead of crashing
  the app on every launch.
- index.ts: bound `cleanupGitWatchers()` in `before-quit` to 1.5s so a
  hung chokidar instance can't block app quit indefinitely.

Dismissed during verification:
- `sandbox: false` in webPreferences is intentional for electron-trpc;
  contextIsolation remains enabled.
- `activeSessions` map cleanup is already wired on unsubscribe and in
  the stream's finally block.
- The stream's async IIFE is wrapped in try/catch/finally; no
  unhandled rejection.
- Project deletion is atomic under FK cascade with `foreign_keys=ON`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* docs: refresh fork additions section with recent features

Adds the user-visible features shipped since the README was last touched
(commits #18 through #26) and groups the fork additions into four
sections for readability: Workflow & UI, Git/PRs/Worktrees, Models, and
Stability & Polish.

Highlights surfaced: split view with drag-to-split, Cmd+Shift+T, sortable
sidebar, draggable tabs, queue reorder, copy popover, PR widget +
branch switcher, two-column commit diff, Pull & Push recovery dialog,
worktree deletion safety, Sonnet 4.6 1M context + recovery action,
GPT-5.4, rich tool rendering, stream wedge timeout, and crash
auto-recovery.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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