orca icon indicating copy to clipboard operation
orca copied to clipboard

fix(crash-reporting): retry failed log-backed crash report submits

Open rodboev opened this issue 4 months ago • 1 comments

Summary

Crash report submission now retries once without diagnostic logs when the first bundle-backed submit fails. The main-process crash-report path preserves the original report text, drops the log attachment on retry, and returns a bounded failure reason when both attempts fail. The renderer toast now shows a safe status, timeout, or network label instead of a generic failure message.

Refs #7776.

Testing

  • [ ] pnpm lint
  • [ ] pnpm typecheck
  • [ ] pnpm test
  • [ ] pnpm build
  • [x] Added or updated high-quality tests that would catch regressions, or explained why tests were not needed

Focused validation:

  • pnpm exec vitest run --config config/vitest.config.ts src/main/ipc/feedback.test.ts src/main/ipc/crash-reporting.test.ts - passed.
  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/crash-report/CrashReportDialogSurface.test.ts - passed.
  • pnpm run typecheck:node - passed.
  • pnpm run typecheck:web - passed.

AI Review Report

  • Cross-platform: the change stays in Electron IPC and renderer formatting. No OS-specific branching was added, and the retry logic behaves the same on macOS, Linux, and Windows.
  • SSH / remote / local: unchanged. The submit path still uses the existing main-process transport and the same crash-report data flow.
  • Provider neutrality: unchanged. The retry only drops optional diagnostic logs after a failure and does not alter identity, workspace, or GitHub provider behavior.
  • Performance: the retry adds one extra submit only on the failure path where logs were attached. The normal path stays one request.
  • UI quality: the toast now shows a bounded, explicit reason, and it only mentions log omission when the returned diagnostic status says the attachment failed.
  • Security: raw exception text, multiline failures, local paths, and token-like strings stay out of the toast. No new subprocesses, files, or endpoints were added.

Security Audit

  • No new subprocesses.
  • No filesystem writes.
  • No new network endpoints.
  • No auth changes.
  • No raw server body or unbounded exception text is shown in the renderer.

Notes

  • No visual layout change. Toast copy is covered by src/renderer/src/components/crash-report/CrashReportDialogSurface.test.ts.
  • The crash-report fallback path is owned in src/main/ipc/crash-reporting.ts; src/main/ipc/feedback.ts keeps its exact-body transport behavior.

rodboev avatar Jul 09 '26 02:07 rodboev

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds retry-with-fallback crash report submission in the main process: when submission with diagnostic logs fails, it retries once without diagnostic attachments. The IPC submit paths now use the fallback helper and return the resulting diagnostic bundle consistently. In the renderer, crash report toast text is moved into formatter helpers that distinguish success, failure, network, timeout, and diagnostic-log states. Tests were added and updated for the retry flow and the toast formatting behavior.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title concisely and accurately summarizes the main change: retrying failed crash-report submissions without diagnostic logs.
Description check ✅ Passed It covers the user-visible change, evidence, validation, and security/compatibility notes, though it doesn't use the exact template headings.

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.

coderabbitai[bot] avatar Jul 09 '26 02:07 coderabbitai[bot]

Closing as superseded by #8242, now merged. That PR covers the retry-without-logs path while also constraining fallback routing, extending the multipart timeout, surfacing sanitized errors, and fixing the automatic-capture half of #7776. Thanks for the work and focused tests here.

OrcaWin avatar Jul 11 '26 09:07 OrcaWin