Conversation
This reverts commit e0d6347.
Tagging OptionsShould a new tag be published when this PR is merged?
|
📝 WalkthroughWalkthroughSimplifies startup and readiness lifecycle management by removing public ready/ensureStarted properties from createDeps, eliminating separate ready promise machinery, and refactoring initialization to use direct ensureGit calls with lazy middleware startup instead of eager readiness callbacks. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
daemon/main.ts (1)
266-346:⚠️ Potential issue | 🟠 MajorDon’t cache a failed startup forever.
Line 339 stores the first
start()promise inok, including the rejected case. SinceensureGit()has transient failure paths indaemon/git.ts:586-679(missing git binary, config/clone/submodule failures), one bad first request will poisonokand every later request will keep returning 424 until the process restarts. Reset the cache on rejection so a later request can retry startup.Suggested fix
- let ok: Promise<unknown> | null | false = null; + let ok: Promise<void> | null = null; ... return async (c, next) => { try { - ok ||= start(); - - await ok.then(next); + if (!ok) { + ok = start().catch((err) => { + ok = null; + throw err; + }); + } + + await ok; + await next(); } catch (err) { console.log(err); c.res = new Response("Error while starting global deps", { status: 424 }); } };🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@daemon/main.ts` around lines 266 - 346, The code caches the initial start() promise in ok and never clears it on rejection, so a failed start poisons future requests; modify the logic where ok is assigned (the ok ||= start() / start promise creation) to attach a rejection handler that resets ok to null on error (reference the ok variable and the start() function) so that a rejected start() does ok = null and rethrows the error, ensuring subsequent requests can retry startup (keep the await ok.then(next) usage unchanged).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@daemon/main.ts`:
- Around line 266-346: The code caches the initial start() promise in ok and
never clears it on rejection, so a failed start poisons future requests; modify
the logic where ok is assigned (the ok ||= start() / start promise creation) to
attach a rejection handler that resets ok to null on error (reference the ok
variable and the start() function) so that a rejected start() does ok = null and
rethrows the error, ensuring subsequent requests can retry startup (keep the
await ok.then(next) usage unchanged).
Reverts #1107
Summary by cubic
Reverts the previous “starting race condition” fix and restores lazy dependency initialization. Removes readiness hooks and simplifies startup behavior for the daemon and sandbox tasks.
Written for commit e5553e0. Summary will update on new commits.