Repository navigation
fix(kernel): a conversation with jobs scheduled keeps its process out of view - #1292
Merged
Merged
Conversation
… of view A conversation no view showed (another one opened) let go of its idle Claude Code process, and with it the jobs the session had scheduled (CronCreate) and a loop's next round (ScheduleWakeup): they live in the process, and did not come at their time. The process is now kept while any is to come: jobs until deleted, a loop's round until it comes or is stopped. Fixes #994 Co-Authored-By: BaoCode <noreply@baocode.dev>
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.
Fixes #994 (and the earlier #514)
Cause. When no view shows a conversation (the user opens another one),
ChatSession.detachcallskernel.release(), which tears down an idle CLI process to save resources. Session-scopedCronCreatejobs and a pendingScheduleWakeuplive only in that process, so they never fired. Opening the conversation again restarted the CLI, which is why #514 saw tasks fire "only after re-entering".Fix. A small
ScheduledJobstracker watches the main agent'sCronCreate/CronDelete/ScheduleWakeupcalls and their successful results.release()keeps the process while anything is pending: a job until it is deleted, a wakeup until the CLI takes up a prompt of its own or the loop is stopped. Once nothing is pending, the next idle release goes through as before.Not covered: changing the model restarts the CLI, which still drops session-only jobs. Durable jobs (
.claude/scheduled_tasks.json) are picked up again on restart.Tests:
test/kernel_test.dart(a new case next to the background-task release test).🤖 Generated with BaoCode