Skip to content

fix(desktop): クラッシュ修正・サジェストバグ修正・安定性改善#26

Merged
MocA-Love merged 9 commits intomainfrom
fix/desktop-crash-and-suggestion-bugs
Mar 30, 2026
Merged

fix(desktop): クラッシュ修正・サジェストバグ修正・安定性改善#26
MocA-Love merged 9 commits intomainfrom
fix/desktop-crash-and-suggestion-bugs

Conversation

@MocA-Love
Copy link
Copy Markdown
Owner

@MocA-Love MocA-Love commented Mar 30, 2026

Summary

  • シェル履歴サジェストが表示されないバグを修正useTerminalSuggestionuseEffect 依存配列に commandBufferRef.current が含まれていたため、setTrackedInput() による再レンダー時に80msのフェッチタイマーが毎回キャンセルされていた。依存配列を [] に変更 (Fixes ELECTRON-3)
  • アプリ終了時の napi_fatal_error クラッシュを修正before-quit ハンドラで better-sqlite3 の Database インスタンスを明示的に close() するようにした。未クローズのまま Node.js 環境がクリーンアップされると N-API コールバック中にプロセスが abort されていた (Fixes ELECTRON-2)
  • webview パーキング後の getURL() エラーを修正did-stop-loading イベントが webview の hidden container 移動後に発火した場合に getURL()/getTitle() がスローしていた。try-catch で保護 (Fixes ELECTRON-5)
  • サイドバーリサイズが webview 上で効かない問題を修正 — リサイズドラッグ中にカーソルが webview 上を通過すると Electron の webview がマウスイベントを吸収していた。リサイズ中に透明オーバーレイを追加して防止
  • Sentry エラー監視の .env 設定SENTRY_DSN_DESKTOP を設定するだけで本番ビルドのクラッシュ・エラーを自動収集可能に
  • upstream/main マージ — codex loading state, bun/turbo pin 等を取り込み

Test plan

  • ターミナルで2文字以上入力してシェル履歴サジェストが表示されること
  • アプリを Cmd+Q で終了してクラッシュダイアログが出ないこと
  • ブラウザペインでページ読み込み中にタブ切替してエラーが出ないこと
  • ブラウザペインが表示された状態で右サイドバーのリサイズがスムーズに動くこと
  • Sentry ダッシュボードにエラーが送信されること(本番ビルド + DSN 設定時)

Summary by CodeRabbit

  • New Features

    • Added Sentry error monitoring integration documentation for production crash/error reporting.
  • Bug Fixes

    • Fixed database closure on app exit preventing crashes.
    • Improved webview error handling when parked in hidden state.
    • Fixed resizable panel overlay display during dragging.
    • Fixed shell history suggestion display issue.
  • Chores

    • Updated Bun runtime (1.3.6 → 1.3.11) and build tooling.

Kitenite and others added 9 commits March 29, 2026 20:51
* fix: restore codex loading state hooks

* fix: enable codex hooks for running state

* fix: migrate stale codex preset commands

* fix: enable codex hooks in wrapper launches

* chore: drop codex loading state detours
useTerminalSuggestionのuseEffect依存配列に commandBufferRef.current が
含まれていたため、setTrackedInput()による再レンダー時にuseEffect cleanup
が走り、80msのフェッチタイマーが毎回キャンセルされていた。
依存配列を空にしてマウント時1回のみに変更(setInterval内でrefをポーリング
しているため依存は不要)。

Fixes ELECTRON-3
did-stop-loadingイベントがwebviewのhidden container移動後に発火した場合、
getURL()/getTitle()がWebView未アタッチエラーをスローしていた。
try-catchで保護し、パーキング中のイベントを安全に無視する。

Fixes ELECTRON-5
before-quitハンドラでbetter-sqlite3のDatabaseインスタンスを明示的に
close()するようにした。未クローズのままNode.js環境がクリーンアップ
されると、N-APIコールバック中にnapi_fatal_errorが発火しプロセスが
abort()されていた。

Fixes ELECTRON-2
リサイズドラッグ中にカーソルがwebview上を通過すると、Electronの
webviewがマウスイベントを吸収しdocumentレベルのmousemoveに届かなかった。
リサイズ中に透明オーバーレイを追加してイベント吸収を防止。
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 30, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8f2bad6e-5bef-4c80-8d64-d02791ff5128

📥 Commits

Reviewing files that changed from the base of the PR and between 72bed36 and 131a9f2.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (10)
  • .bun-version
  • README.md
  • apps/desktop/src/main/index.ts
  • apps/desktop/src/main/lib/agent-setup/agent-wrappers.test.ts
  • apps/desktop/src/main/lib/agent-setup/templates/codex-wrapper-exec.template.sh
  • apps/desktop/src/main/lib/local-db/index.ts
  • apps/desktop/src/renderer/screens/main/components/ResizablePanel/ResizablePanel.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/BrowserPane/hooks/usePersistentWebview/usePersistentWebview.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/hooks/useTerminalSuggestion.ts
  • package.json

📝 Walkthrough

Walkthrough

This PR addresses multiple desktop application stability issues and adds error monitoring. Key changes include: Bun runtime upgrade (1.3.6 → 1.3.11), SQLite database explicit closure on app exit, webview error handling to prevent crashes during DOM detachment, sidebar resizing overlay improvement, shell history display dependency correction, and Codex hook flag enablement. Documentation updated with Sentry integration and stability fix references.

Changes

Cohort / File(s) Summary
Runtime & Package Manager
.bun-version, package.json
Updated Bun from 1.3.6 to 1.3.11 and pinned packageManager field accordingly. Turbo downgraded from 2.8.21 to 2.8.7.
Local Database Lifecycle
apps/desktop/src/main/lib/local-db/index.ts, apps/desktop/src/main/index.ts
Added closeLocalDb() function to safely close SQLite connection with error logging; integrated into app quit handler to prevent napi_fatal_error crash from unclosed database.
Desktop Stability Fixes
apps/desktop/src/renderer/screens/main/components/ResizablePanel/ResizablePanel.tsx, apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/BrowserPane/hooks/usePersistentWebview/usePersistentWebview.ts, apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/hooks/useTerminalSuggestion.ts
Added full-screen overlay during sidebar resize to prevent interaction issues; wrapped webview getURL() and getTitle() calls in try/catch for parked webview resilience; corrected shell history polling interval dependency from [commandBufferRef.current] to [] to prevent re-initialization on ref changes.
Codex Hooks Enablement
apps/desktop/src/main/lib/agent-setup/agent-wrappers.test.ts, apps/desktop/src/main/lib/agent-setup/templates/codex-wrapper-exec.template.sh
Added --enable codex_hooks flag to Copilot Codex wrapper invocation; updated test to verify flag is passed correctly ahead of notification hooks.
Documentation
README.md
Added table entries documenting Sentry DSN configuration for error monitoring and enumerating previously fixed desktop stability issues.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Hopping through fixes with care and delight,
SQLite now closes when apps say goodnight,
Webviews and panels no longer despair,
With try/catch and overlays floating in air,
Stability blooms as the fuzzy bugs flee! 🌟

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/desktop-crash-and-suggestion-bugs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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