Make swallowed errors visible: log or justify every silent catch#195
Conversation
Audit follow-up: every silently-swallowed error in src/main and src/renderer non-test code now either emits a categorized, context-bearing log (bracket-prefix style per AGENTS.md) or carries a one-line comment justifying why silence is correct. No control-flow, retry, or error-propagation behavior was changed — logging only. High-frequency catches (PTY/event/poll loops) are kept silent with a justification, and the polled burn fingerprint log is time-throttled so the telemetry stays low-noise. src/main/integrations.ts is intentionally untouched (edited in parallel on another branch); its findings are deferred to a follow-up in the PR. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Your free trial PR review limit of 300 PRs has been reached. Please upgrade your plan to continue using CodeAnt AI. |
|
Warning Review limit reached
More reviews will be available in 31 minutes and 39 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (11)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Summary
Audit follow-up making every silently-swallowed error in
src/mainandsrc/renderernon-test code visible. For each site I did exactly one of:[broker],[cloud-agent],[burn]),console.warnfor expected/recoverable, with identifying context (projectId, agent name, op) and never any secret/token; orDiffPane.tsxhandleGenerate, where the store surfaces the error).Logging only — no control-flow, retry, or error-propagation changes. High-frequency catches (PTY / event / poll loops) are kept silent with a justification per AGENTS.md, and the polled
burn.getFingerprintlog is time-throttled (60s) so telemetry stays low-noise.Verify:
npm test→ 115 pass ·npx vitest run→ 263 pass (19 files). All green. (The repo'stsconfig.node.jsonhas 171 pre-existingtscerrors on cleanmain, in files this PR does not touch; my changes add none.)Sites → action
src/main/broker.tsattachCloudSandboxprevious cloud-session shutdown (~1827, audit priority)[broker]— failed shutdown can leak the previous cloud sandboxshutdown()per-session shutdown (~4073)[broker]— leaked sandbox on teardowndetachCloudSandboxshutdown (~4125)[broker]— leaked detached sandboxvoid handleSpawnedChildLineagefire-and-forget (~2391, audit priority)[broker]— lost parent/child attributionlistAgents()during spawn dedupe (~2722)[broker]— missing names risk a relay name collisionworkspaceKeyForProjectstart-gate.catch(~1771)attachCloudSandboxin-flight-attach gate (~1813)getOrAwaitSessionsForProjectrevive/start/attach gates (~1995–2003)!sessions.lengthturns a real failure into a throwlocateSessionForAgent250mslistAgents()probe (~2981)registered:falsesurfaces outcome; logging would floodwaitForAgentIdlegetStatus()poll (~3250)getPending().catch(()=>0)pending count ×2 (~3338, ~3483)getInboundDeliveryMode().catchper-agent enrichment (~3936)parsePortFromUrl/readBrokerConnectionFileInfoparse catches (~1013, ~1075)process.killcatch (~414)exit(1); nothing to log inside the shimsrc/main/cloud-agent.tsdeleteBox().catch(()=>undefined)on attach failure (~891)[cloud-agent]— leaked sandboxdeleteBox()on attach cancel (~922)[cloud-agent]deleteBox()on warm cancel ×2 (~1105, ~1132)[cloud-agent]normalizeHttpsGitRemoteURL parse catch (~428)nullis the documented "not a usable remote" sentinelvoid emitMountStatusper mount event (~1273)mount.status(), emit is sync; never rejectsvoid maybePullAfterRuntimer (~1412)emits errors(Note:
deleteBoxitself throws on failure but does not log; the.catch(()=>undefined)callers were the only visibility for box-leak failures.)src/main/burn.tsgetFingerprintcatch (~823)[burn], time-throttled 60s (polled ~15s by burn views)listProjectAgentSummariesbatch-summary fallback (~956)[burn]— fast path consistently failing stays visiblevoid ingestRecent()×2 (warmUp,refreshLedger) (~1099, ~1113)ingestRecentself-catches and once-logs viawarnedUnavailablesrc/rendererterminal-runtime-registry.tsxterm addon/term dispose+refresh// ignore×5use-terminal.tsvisibility-change fit/refresh// ignoregit-store.tsper-rootgit.status/summaryfallbacksissues-store.tsreadRemoteFile().catch(()=>null)ProjectSidebar.tsxauthRecoveryState()probes ×2ProjectSettings.tsxmounted/remote Slack channel fallbacks ×2CloudAgentPicker.tsxvoid cancelPrewarm().catchBrokerDetailsPage.tsxlistEvents().catch(()=>undefined)listDetailsDiffPane.tsxhandleGenerate,BurnProjectPage.tsx,ConversationsPanel.tsx,ChatView.tsx,DiffViewer.tsxDeferred:
src/main/integrations.tsNot touched (edited in parallel on another branch). Candidate silent swallows for a follow-up:
removeProjectIntegrationsLink(...).catch(() => undefined)(~1211) — silent link-cleanup failure.handle.refreshToken().catch(() => undefined)(~1522) — silent token-refresh failure; worth a[integrations]warn since it feeds auth-recovery UX. (Same pattern inrelay-workspace.ts:79.)response.json().catch(() => null)(~1439) — benign parse fallback; justify.voidfire-and-forgets with no.catch:syncLocalMounts(~916, ~1188),hydrateProjectCloudIntegrations(~981),pollConnect(~1837),safeInjectSystemMessage(~2171) — verify each self-handles; add a rejection log where it doesn't. (syncAgentState~1957 andsyncLocalIntegrationState~1978 already.catch-and-emit.)🤖 Generated with Claude Code