Repository navigation
fix(bots): a thread a bot starts answers with its job at once; a worktree that can't be set up ends that job once, with why - #2518
Merged
Conversation
…tree that can't be set up ends that job once, with why thread_create no longer waits for a new worktree when the bot's ledger keeps a job for the thread. The job's notice says why setup failed, whether thread_create's follow sees it or the ledger reads it when the run ends, and a Retry that already started a newer run does not hide it.
…ads it first, and a retried thread_create names the same job
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.
Problem
When a personal bot starts a thread with
thread_create, the call waits until the new thread's worktree is set up before it answers. On a Git-backed project that took about 1.6 s with no extra delay and about 3 s when setup was slow, even though the bot's job for the thread was already saved.Change
thread_createanswers with that job right away. It no longer waits for the worktree.bot_jobs.line) keeps Mousse's plain reason, held to the job line limit. Git's own output stays in the thread and the notice, not in the ledger.thread_create's follow of the run, the run's end, the startup pass, or Retry. Retry clears the thread's record of the failure, so it now has the ledger read that record first (setup-retry). A restart that lost the earlier read still ends the job with why. The retried run's work then opens a follow-up job.thread_createwhose first reply was lost names the same job as the first call, for saved asks and plain launches alike.Verification
Benchmark: the real
thread_createtool on a Git-backed project copy with real local Git setup and a scripted provider. Six trials per build (three with no extra delay, three with 1,200 ms of added setup delay). Times are medians. The first-call path measured here did not change in the later review fixes.On this branch setup still finished on every trial and the run completed (setup finished a median 969 ms and 2,279 ms after the ack). The control on the same base shows the speed-up comes from this change, not from #2507.
node scripts/verify.mjsat be52f92:npx vitest run tests/run/botOwnerAsks.test.ts tests/run/botThreadsDaemon.test.ts tests/bots/botJobs.test.ts tests/run/botSupervision.test.ts tests/run/botThreadTools.test.ts tests/run/messageParent.test.ts tests/bots/botNoticeQueue.test.ts tests/bots/botDeviceHeld.test.ts tests/run/setupFailureRetry.test.tstsc --noEmit -p tsconfig.node.jsontsc --noEmit -p tsconfig.web.jsonTests cover:
thread_create's follow or the run's end tells it first.Not covered by a test: the one-line wiring in
MmsProfileServicesfromsetup-retrytocheckJobs(typechecked only).Notes
No issue