fix: reconnect race in bus-publisher + safe JSON.stringify in onWarn #45 - #46
Conversation
|
Caution Review failedPull request was closed or merged during review No actionable comments were generated in the recent review. 🎉 Recent review infoRun configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: Files selected for processing (2)
WalkthroughWalkthrough
ChangesBus Robustness Improvements
Estimated code review effort3 (Moderate) | ~15 minutes Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Tip: You can configure your own custom pre-merge checks in the settings. Finishing TouchesGenerate docstrings
Generate unit tests (beta)
Simplify code
Comment |
Summary
Fixes two bugs found by PR review bots on PR #44:
Bug 1: bus-publisher.ts — reconnecting flag race condition
File:
src/bus-publisher.tsthis.reconnectingwas set tofalsebeforeawait this.init()completed. If init failed, reconnect was permanently disabled. Fix: only set the flag tofalseafter init succeeds (or retry if bus is still null).Bug 2: four-opencode-token-budget-guard.ts — unsafe JSON.stringify
File:
src/four-opencode-token-budget-guard.tsline 40JSON.stringifywas called without a try/catch on theonWarnargs. Circular references would throw and crash the logger. Fix: wrap in try/catch, return"[unserializable]"on failure.Checklist
Summary by cubic
Fixes a reconnect race in the bus publisher to ensure it reliably restores the connection, and hardens
onWarnlogging to avoid crashes on circular data. Addresses #45.reconnectingafterinitsucceeds; ifbusis still null, retry again in 5s.JSON.stringifyin try/catch foronWarn; non-objects useString, fallback to "[unserializable]".Written for commit 082abd0. Summary will update on new commits.
Summary by CodeRabbit