Skip to content

fix: defer stable loop-now dispatch to the idle-safe scheduler - #111

Merged
ByBrawe merged 25 commits into
mainfrom
test/stable-loop-now-real-host
Aug 18, 2026
Merged

fix: defer stable loop-now dispatch to the idle-safe scheduler#111
ByBrawe merged 25 commits into
mainfrom
test/stable-loop-now-real-host

Conversation

@ByBrawe

@ByBrawe ByBrawe commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • keep /loop-now <target> target-specific via the persisted run-now marker from fix: keep stable loop-now targeted across busy retries #110
  • stop calling the executor re-entrantly from command.execute.before; persist the marker and schedule it through the idle-safe due timer instead
  • preserve target priority across busy sessions while allowing the host command acknowledgement turn to finish before the autonomous target turn starts
  • update the comprehensive harness to wait for the scheduler's idle-safe run-now boundary instead of assuming immediate command-hook dispatch
  • extend the real OpenCode host canary with two delayed 10m --no-now jobs and assert /loop-now target runs only the named target
  • add state + loop-log timeout diagnostics to the host canary
  • make Single-file Bundle Gate run when stable host-canary files change
  • regenerate committed src/index.js from the fixed source

Why

The real-host regression exposed two separate problems.

First, main's committed src/index.js lagged behind the #110 source fix: source-built Bundle Gate selected only target, while general CI using the committed bundle ran natural and target. 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-now command.execute.before hook 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-now only persists the one-shot request and calls scheduleDueWork(). 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-now side 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-now dispatch correctness, comprehensive regression timing, real-host regression coverage, Bundle Gate path coverage, and generated stable bundle synchronization.

Copilot AI lite review requested due to automatic review settings August 18, 2026 00:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@ByBrawe ByBrawe closed this Aug 18, 2026
@ByBrawe ByBrawe reopened this Aug 18, 2026
@ByBrawe ByBrawe changed the title test: cover targeted loop-now on real host fix: defer stable loop-now dispatch to the idle-safe scheduler Aug 18, 2026
@ByBrawe ByBrawe closed this Aug 18, 2026
@ByBrawe ByBrawe reopened this Aug 18, 2026
@ByBrawe ByBrawe closed this Aug 18, 2026
@ByBrawe ByBrawe reopened this Aug 18, 2026
@ByBrawe
ByBrawe merged commit 4550b98 into main Aug 18, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants