fix(scheduler): deliver system injects through session cancel; defer bash job ack - #17
Draft
cursor[bot] wants to merge 1 commit into
Draft
fix(scheduler): deliver system injects through session cancel; defer bash job ack#17cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
…bash job notify ack - Exempt subagent/bash_job/goal_start injects from cancel skip so flush during cancel does not drop lifecycle notifications - Defer bash job mark_notified until kernel confirms delivery (staged until _finalize_bash_job_delivery), matching agent_wake semantics - Persist /skill load_skill context via _finalize_turn checkpoint flush Co-authored-by: Yuxuan Liu <Osc-7@users.noreply.github.com>
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
Fixes three correctness bugs found in recent scheduler/notification changes.
Bugs fixed
1. Session cancel dropped subagent/bash notifications (significant breakage)
flush_pending_subagent_lifecycle/flush_pending_for_sessionenqueued system injects while_cancelled_sessionswas still set; dispatch skipped them and pending entries were already popped → notifications lost forever.subagent,bash_job, andgoal_startfrontend injects from cancel skip (user turns still skipped;agent_wakestill aborts for poll retry).2. Bash job marked notified before delivery
deliver_via_injectcalled_mark_notifiedimmediately afterinject_turnenqueue; cancel/skip/crash before dispatch permanently dropped notifications._finalize_bash_job_deliveryonly after kernel runs the inject turn (mirrorsagent_wake).3.
/skillcontext not checkpointedload_skill_for_sessioninjected tool pair into memory only; Core TTL evict lost loaded skill context.agent._finalize_turn(None)after injection.Validation
tests/test_kernel_runtime.py(cancel exempt + user skip)tests/test_bash_job_notify_deliver.py(deferred mark)tests/test_load_skill_slash.py(finalize turn)test_cancel_skip_aborts_agent_wake_deliverystill passes