Repository navigation
Conversation
The desktop app and the bb-app launcher each gave the server 60 seconds to answer /health, then stopped it. The server runs migrate(db) before it listens, so a long migration on a big bb.db or a starved host was killed, rolled back, and failed again on every launch. Both now wait without a deadline while the process lives. Desktop shows "Still starting bb" after 10 seconds, and fails only when bb-app exits, offering Try again and Choose server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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
Two separate 60-second deadlines stopped a bb server that was still alive and starting. The desktop app (
apps/desktop/src/main.tsstartOwnedRuntime,STARTUP_TIMEOUT_MS = 60_000) racedwaitForCompatibleServeragainst that deadline, then showed "Could not start bb / Timed out waiting for bb" with no buttons and stopped the runtime. Separately, the bb-app launcher (packages/bb-app/src/launcher.tsstartFullStackServerProcess→waitForServerHealth,HEALTH_CHECK_TIMEOUT_MS = 60_000) SIGTERMed its server child on the same deadline. The server runsmigrate(db)before it listens (apps/server/src/db.ts,start-server.ts), so a long migration on a largebb.dbor a CPU-starved host was killed and rolled back, then failed the same way on every launch. Fixing only the desktop deadline would not have been enough, because the launcher would still have killed the server.Related: #7753 (15 GB
bb.db, event-loop stalls up to 62 s), #2480. Credit: T3 Code fixed the same class in pingdotgg/t3code#35056 ("wait for the server's database upgrade instead of reporting a failed start") and pingdotgg/t3code#26247, which pointed us at it.What changed
waitForServerHealthhas no deadline. It polls until the child echoes its launch id or the child exits, andchildProcessis now required. After 15 s it logs once that the server is still starting and may be upgrading its database.HEALTH_CHECK_TIMEOUT_MSstill applies to the host daemon status wait, which is unchanged.waitForCompatibleServertakes anAbortSignalinstead of a timeout and returns only a settled result (compatible or incompatible). The newowned-runtime-startup.ts(waitForOwnedRuntimeStartup) races the probe against the bb-app process exit with no deadline, stops probing once either side wins, and fires a slow-start callback after 10 s.STARTUP_TIMEOUT_MSis renamed toMACHINE_READY_TIMEOUT_MS, since it now only bounds the existing "computer connected" wait. That wait opens bb anyway and never kills anything.apps/desktop/README.mddocuments the no-deadline startup.No server/daemon wire changes.
How you verified
Repro on origin/main (502cf5a): I launched the unmodified desktop dev app (
apps/desktop/scripts/run-electron-dev.mjs, isolated worktree data dir) with aNODE_OPTIONS=--importpreload. The preload holds only the realapps/server/dist/index.jsprocess for 90 s before it loads, which is the same thing the desktop sees as a slowmigrate(db)before listen.Same repro with this branch:
Tests:
apps/desktop/test/owned-runtime-startup.test.ts, against a real child HTTP server:packages/bb-app/test/server-health-identity.test.ts:waitForServerHealthstays pending through 3 simulated minutes, then resolves when the child answers;Date.now()60 s deadline back intowaitForCompatibleServerandwaitForServerHealth: both tests failed, and both pass with this change.pnpm exec turbo run lint typecheck lint:type-aware test --filter=@bb/desktop --filter=bb-app: all green (desktop 629 passed, bb-app 232 passed).🤖 Generated with Claude Code