Repository navigation
fix(app): stop dev-run console errors and log flattening - #232
Merged
Merged
Conversation
Five issues seen in a `bun dev:desktop` run: - createRefCountMap ran create() in the first caller's scope, so a shared directory context's internal cleanups (the dir SDK event unsubscribe) fired when the first view closed while other holders still used it, and ownerless callers (event handlers, async continuations) registered cleanups Solid warns can never run, pinning items forever. Items now get their own root under the map's creating scope, disposed when the last pinning caller releases them; ownerless callers borrow without pinning. - The SSE event stream logged an error on the first failed attempt, which races a server being stopped or restarted (sandbox reset, sidecar relaunch). It now logs only after 3 consecutive failures, with the error normalized to a readable string. - The DEV duplicate-command-id warning fired on router-transition overlap (draft->session registers command.palette/input.focus twice for a moment). It now re-checks after 1s and only reports persistent duplicates. - spyRendererConsole receives Chromium's flattened console-message string, so renderer console.* with object args reached the terminal and exported debug bundles as "[object Object]". A renderer console wrapper now serializes structured arguments (Error-aware, circular-safe, truncated). - Two benign Chromium interventions (ResizeObserver loop, autofocus blocked) are dropped from the terminal transport; file logs keep them. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
quickbeard
force-pushed
the
fix/dev-run-errors
branch
from
August 14, 2026 06:25
97d9f43 to
52b3ab9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A
bun dev:desktoprun surfaced several errors/warnings in the terminal. Each traced to a distinct root cause; all five are fixed:packages/app/src/utils/refcount.ts) —createRefCountMaprancreate()in the first caller's reactive scope, so the dir SDK context's event unsubscribe fired when the first view of a directory closed, silently stopping live updates for every other view of it. Ownerless callers (event handlers, async continuations —notification.tsxsession lookup,layout.tsxopenSession) also registered cleanups Solid warns can never run (thecleanups created outside a createRootline) and pinned items forever. Items now live in their own root under the map's creating scope, disposed when the last pinning caller releases them; ownerless callers borrow without pinning. Two new tests pin the semantics.[global-sdk] event stream erroron normal server lifecycle (packages/app/src/context/server-sdk.tsx) — the first failed SSE attempt races a server being stopped or restarted (sandbox reset, sidecar relaunch). Errors now log only after 3 consecutive failed reconnects (~1s for a genuinely dead server), with the error normalized toname: message.duplicate command idwarnings on navigation (packages/app/src/context/command.tsx) — router transitions keep the outgoing page mounted while the incoming one registers, briefly duplicatingcommand.palette/input.focuson every draft→session navigation. The DEV warning now re-checks after 1s and only reports duplicates that persist; runtime keep-first behavior is unchanged.[object Object]in terminal and debug bundles (newpackages/desktop/src/renderer/console-format.ts) —spyRendererConsolereceives Chromium's pre-flattened console string, so object arguments were lost before the main process saw them. The renderer entry now installs a console wrapper that serializes structured arguments at the source (Error-aware, circular-safe, 8KB-truncated). Covered by 5 new tests.packages/desktop/src/main/logging.ts) —ResizeObserver loop completed…andAutofocus processing was blocked…are interventions the app can't act on; an electron-log hook drops exactly these two from the console transport while file logs keep them.Docs
Verification
bun typecheckclean inpackages/appandpackages/desktopbun test: 659 pass inpackages/app(incl. 2 new refcount tests), 83 pass inpackages/desktop(incl. 5 new console-format tests)🤖 Generated with Claude Code