Skip to content

fix(scheduler): remove wait_idle from startup path#153

Merged
yishuiliunian merged 1 commit into
mainfrom
fix/remove-wait-idle-from-startup
May 15, 2026
Merged

fix(scheduler): remove wait_idle from startup path#153
yishuiliunian merged 1 commit into
mainfrom
fix/remove-wait-idle-from-startup

Conversation

@yishuiliunian
Copy link
Copy Markdown
Contributor

Summary

  • Remove wait_idle() call from session startup path that was blocking handshake on --resume
  • Add warning documentation to wait_idle() clarifying it's for tests/tooling only

Changes

  • crates/loopal-agent-server/src/session_start.rs: Remove blocking wait_idle() call
  • crates/loopal-scheduler/src/scheduler.rs: Add warning doc to wait_idle()

Root Cause

wait_idle() blocks until all pending saves complete. On --resume, cron normalization triggers disk I/O via the save worker. If the save is slow, wait_idle() blocks the startup path, causing the 30s handshake timeout.

The tick loop only needs the in-memory task set to be correct (which switch_session guarantees synchronously). Disk sync is fire-and-forget with dirty-flag retry on failure.

Test plan

  • All 75 tests pass
  • CI passes

wait_idle() blocks until all pending saves complete, which can cause
handshake timeout on --resume when cron normalization triggers disk I/O.

The tick loop only needs the in-memory task set to be correct (which
switch_session guarantees synchronously). Disk sync is fire-and-forget
with dirty-flag retry on failure.

Added warning doc to wait_idle() clarifying it's for tests/tooling only.
@yishuiliunian yishuiliunian merged commit 76de814 into main May 15, 2026
4 checks passed
@yishuiliunian yishuiliunian deleted the fix/remove-wait-idle-from-startup branch May 15, 2026 00:29
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.

1 participant