fix: defer stable loop-now dispatch to the idle-safe scheduler - #111
Merged
Conversation
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
/loop-now <target>target-specific via the persisted run-now marker from fix: keep stable loop-now targeted across busy retries #110command.execute.before; persist the marker and schedule it through the idle-safe due timer instead10m --no-nowjobs and assert/loop-now targetruns only the named targetsrc/index.jsfrom the fixed sourceWhy
The real-host regression exposed two separate problems.
First, main's committed
src/index.jslagged behind the #110 source fix: source-built Bundle Gate selected onlytarget, while general CI using the committed bundle rannaturalandtarget. The generated stable bundle was synchronized.After that sync, Ubuntu passed but Windows still timed out. Enhanced diagnostics showed that Windows persisted the target marker, logged
run target, incremented the target run, and consumed it — but the deterministic provider never received the autonomous target prompt. The target dispatch happened inside the/loop-nowcommand.execute.beforehook just before the host started its own command acknowledgement model turn. Windows accepted that re-entrant SDK call but the following host acknowledgement turn superseded/dropped it.The stable handler now mirrors the idle-safe design used by V2:
/loop-nowonly persists the one-shot request and callsscheduleDueWork(). The scheduler checks the real session state after the command turn; if still busy it retries, otherwise the executor dispatches the marked target. Source-built Windows real-host coverage passed with this change before the generated bundle was resynchronized.The existing comprehensive harness also assumed
/loop-nowside effects happened synchronously inside the command hook. It now gives the scheduler's 250 ms minimum due timer a 400 ms settle window before asserting run-now side effects; busy/concurrency behavior is unchanged.Scope
Stable
/loop-nowdispatch correctness, comprehensive regression timing, real-host regression coverage, Bundle Gate path coverage, and generated stable bundle synchronization.