Repository navigation
Conversation
Since #5933 the stdio captures hold only output that bypasses the logger, so the live file stays far below the 10 MB spawn-time limit (34 KB in 40 days on a busy server). The previous capture is only replaced when the live file outgrows that limit, so a large `-stdio.1.log` left by an earlier, noisier run stayed on disk indefinitely (594 MB here, 887 MB in the report). At spawn, trim the previous capture to its last 10 MB, covering both a fresh rotation and an existing oversized file. Refs #8326 Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
deleted the
bb/8326-long-lived-stdio-logs-have-no-runtime-size-thr_yvukpdncc8
branch
December 1, 2026 03:46
scowalt
pushed a commit
to scowalt/bb
that referenced
this pull request
Dec 1, 2026
## Human comments ## What was wrong get-bb#5933 (Oct 20) stopped the logger from copying every line into `server-stdio.log` / `host-daemon-stdio.log`. Since then those files only collect output that bypasses the logger, so they grow very slowly. On a busy server, the live `server-stdio.log` grew 34 KB in 40 days. The launcher only replaces `<name>-stdio.1.log` when the live file is over 10 MB at spawn, which now practically never happens. A large `.1.log` left by an earlier, noisier run therefore stays on disk indefinitely: 594 MB on my Mac (last written Oct 21) and 887 MB in the report. ## What changed - `packages/bb-app/src/logged-process.ts`: at every spawn, the launcher cuts `<name>-stdio.1.log` down to its last 10 MB, keeping the most recent output. This covers both a fresh rotation, where the run that just ended may have written far more than 10 MB, and an oversized file left by an earlier run. The live file still rotates at spawn as before. - Updated the stdio log description in `packages/bb-app/README.md`, `docs/debugging-and-qa.md` and the `bb guide machines` template. Departures from the issue's suggestions, based on measurements from a server that had been up 23 h: - **No runtime rotation.** Since get-bb#5933 the live capture grows by KBs per month (38 KB in total across 80 dev data dirs), so piping or watching the child's output costs more than it saves. - **`handlerStats` unchanged.** It holds one counter record per plugin and does not grow. It measures per-call latency, which is useful in its own right (for example, a 109 s worktree creation). It is not presented as CPU time. - **`inFlightWorkAtObservation` unchanged.** It stayed at 16–20 frames across 242 stall entries. Each stall entry already names the blocker in `stallCauseCandidate` / `longestSynchronousWork`; that blocker was a synchronous DB write in every entry I checked. ## How you verified - Two regression tests in `packages/bb-app/test/logged-process.test.ts`: - a 25 MB live capture is rotated, and the `.1.log` keeps exactly its last 10 MB, ending with the last line written; - an orphaned 600 MB `.1.log` is trimmed to 10 MB. - Both tests fail on the old code and pass with the fix. - `pnpm exec turbo run test typecheck --filter=bb-app` passes (233 tests). - Ran the fix against a copy of the real 594 MB orphan: it went from 594,062,408 bytes to 10,485,760, the final 200 bytes were unchanged, and the new run's output was appended to the live file. Fixes get-bb#8326 > AGENT GENERATED 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
Human comments
What was wrong
#5933 (Oct 20) stopped the logger from copying every line into
server-stdio.log/host-daemon-stdio.log. Since then those files only collect output that bypasses the logger, so they grow very slowly. On a busy server, the liveserver-stdio.loggrew 34 KB in 40 days. The launcher only replaces<name>-stdio.1.logwhen the live file is over 10 MB at spawn, which now practically never happens. A large.1.logleft by an earlier, noisier run therefore stays on disk indefinitely: 594 MB on my Mac (last written Oct 21) and 887 MB in the report.What changed
packages/bb-app/src/logged-process.ts: at every spawn, the launcher cuts<name>-stdio.1.logdown to its last 10 MB, keeping the most recent output. This covers both a fresh rotation, where the run that just ended may have written far more than 10 MB, and an oversized file left by an earlier run. The live file still rotates at spawn as before.packages/bb-app/README.md,docs/debugging-and-qa.mdand thebb guide machinestemplate.Departures from the issue's suggestions, based on measurements from a server that had been up 23 h:
handlerStatsunchanged. It holds one counter record per plugin and does not grow. It measures per-call latency, which is useful in its own right (for example, a 109 s worktree creation). It is not presented as CPU time.inFlightWorkAtObservationunchanged. It stayed at 16–20 frames across 242 stall entries. Each stall entry already names the blocker installCauseCandidate/longestSynchronousWork; that blocker was a synchronous DB write in every entry I checked.How you verified
packages/bb-app/test/logged-process.test.ts:.1.logkeeps exactly its last 10 MB, ending with the last line written;.1.logis trimmed to 10 MB.pnpm exec turbo run test typecheck --filter=bb-apppasses (233 tests).Fixes #8326
🤖 Generated with Claude Code