fix(seed): await seedDatabase before SERVER_READY (closes Room-not-found race)#1041
Merged
Conversation
…und race) carl-install-smoke intermittently failed with "Room not found: general" on the rerun for #1038 (run 25332249956 job 74271087853). Probe landed 14-21s after install completion, but seed was kicked off via setTimeout(3000) in the orchestrator AND setTimeout(5000) in docker-entrypoint -- both fire-and-forget, so SERVER_READY / main() returned while rooms didn't exist yet, and chat/send threw before seed landed. Fix: await seedDatabase() inside SystemOrchestrator before completing SERVER_READY, and drop the duplicate setTimeout in docker-entrypoint. By the time anything downstream sees SERVER_READY (or the container's node-server PID is alive past main()), rooms+personas+recipes are in the DB and resolveRoomIdentifier("general") returns hit. This also removes the duplicate-seed race where two parallel setTimeouts could both call findOrCreateRoom on the same uniqueId before the first DataCreate landed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 4, 2026
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
carl-install-smokeintermittently fails withRoom not found: general7-21s after install completes (e.g. run 25332249956 job 74271087853 on #1038). Two fire-and-forget seed paths race the chat probe.Root cause
SystemOrchestrator.startNodeServer()schedules seed viasetTimeout(3000)(line 1117 pre-fix)docker-entrypoint.ts main()schedules seed viasetTimeout(5000)after orchestrate() returnsSERVER_READYmilestone (and main's "Server ready" log) emit BEFORE seed completesFix
await seedDatabase()BEFORE completingSERVER_READYmilestone (was setTimeout fire-and-forget)Test plan
🤖 Generated with Claude Code