Skip to content

desktop: add reusable terminal sentry debug instrumentation#341

Merged
MocA-Love merged 1 commit intomainfrom
feature/desktop-terminal-sentry-debug
Apr 19, 2026
Merged

desktop: add reusable terminal sentry debug instrumentation#341
MocA-Love merged 1 commit intomainfrom
feature/desktop-terminal-sentry-debug

Conversation

@MocA-Love
Copy link
Copy Markdown
Owner

Summary

  • terminal 調査用の共通 debug channel を追加し、main / renderer の Sentry 連携を共通化
  • desktop terminal の v1 / v2 / websocket / restore / backpressure 経路に調査ログを追加
  • Sentry には常時送り、console ミラーだけを debug フラグで制御する形に整理

What Changed

  • apps/desktop/src/shared/debug-channel.ts に再利用可能な debug channel 基盤を追加
  • apps/desktop/src/main/lib/debug-channel.tsapps/desktop/src/renderer/lib/debug-channel.ts に Sentry transport を追加
  • terminal.host / terminal.renderer の調査ログ入口を追加
  • terminal の lifecycle / restore / hidden keepalive / v2 runtime / websocket transport / main backpressure にログを追加
  • コメントを日本語で補足し、主問題と副次仮説が分かるように整理

Verification

  • bunx @biomejs/biome@2.4.2 check --write <edited files>
  • bun run --cwd apps/desktop typecheck は既存の CodeMirror / @codemirror/view version mismatch で失敗
    • 今回の差分で見つかった v1-terminal-cache.ts の呼び出し漏れは修正済み
    • 残りはこの PR 以前からある desktop 側の既存失敗

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 19, 2026

Warning

Rate limit exceeded

@MocA-Love has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 43 minutes and 49 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 43 minutes and 49 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e9ae12b2-f97c-468b-86a9-26b2d0a54364

📥 Commits

Reviewing files that changed from the base of the PR and between d81b911 and 9d2e9c6.

📒 Files selected for processing (17)
  • apps/desktop/src/main/lib/debug-channel.ts
  • apps/desktop/src/main/terminal-host/debug.ts
  • apps/desktop/src/main/terminal-host/session.ts
  • apps/desktop/src/renderer/lib/debug-channel.ts
  • apps/desktop/src/renderer/lib/terminal/debug.ts
  • apps/desktop/src/renderer/lib/terminal/terminal-runtime-registry.ts
  • apps/desktop/src/renderer/lib/terminal/terminal-runtime.ts
  • apps/desktop/src/renderer/lib/terminal/terminal-ws-transport.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/debug.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/helpers.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/hooks/useTerminalColdRestore.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/hooks/useTerminalConnection.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/hooks/useTerminalLifecycle.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/hooks/useTerminalRestore.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/hooks/useTerminalStream.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/v1-terminal-cache.ts
  • apps/desktop/src/shared/debug-channel.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/desktop-terminal-sentry-debug

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.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9d2e9c6dbe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"ws-connect-start",
{
terminalId: transport.debugId,
wsUrl,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Redact websocket token before debug capture

ws-connect-start sends the full wsUrl to Sentry with captureMessage: true, which leaks credentials because useWorkspaceWsUrl appends the workspace auth token as a token query param (packages/workspace-client/src/providers/WorkspaceClientProvider/WorkspaceClientProvider.tsx, useWorkspaceWsUrl). This runs on every connect/reconnect, so active workspace tokens can be exposed in telemetry payloads; log only sanitized URL parts (e.g., path/host) or explicitly strip sensitive query keys before capture.

Useful? React with 👍 / 👎.

@MocA-Love MocA-Love merged commit 9ed4a59 into main Apr 19, 2026
6 checks passed
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