Skip to content

fix(dashboard): run residual cron profile I/O off the event loop (#50948 follow-through) - #61385

Merged
kshitijk4poor merged 2 commits into
NousResearch:mainfrom
kshitijk4poor:fix/dashboard-residual-cron-event-loop-io
Jul 9, 2026
Merged

fix(dashboard): run residual cron profile I/O off the event loop (#50948 follow-through)#61385
kshitijk4poor merged 2 commits into
NousResearch:mainfrom
kshitijk4poor:fix/dashboard-residual-cron-event-loop-io

Conversation

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Summary

Two cron dashboard handlers still ran per-profile file I/O directly on the FastAPI event loop after the threadpool migration — POST /api/cron/fire (walks every profile via _find_cron_job_profile before returning its 202) and POST /api/cron/blueprints/instantiate (create_job inline). Both now route through the existing _run_cron_dashboard_io threadpool wrapper like every sibling cron endpoint.

Changes

  • hermes_cli/web_server.py: cron_fire_webhook — profile lookup off-loop; instantiate_blueprintcreate_job off-loop via functools.partial (keeps **spec kwargs from colliding with the wrapper's own parameters).
  • tests/hermes_cli/test_cron_dashboard_off_loop.py: 2 regression tests asserting the helpers execute with no running asyncio loop in their thread + kwargs arrive at create_job intact. Mutation-verified (fail on main's inline version, pass with the fix).

Validation

Before After
POST /api/cron/fire w/ many profiles profile walk stalls event loop pre-202 threadpool, loop free
new off-loop tests on main's code FAIL (2) PASS (2)

Targeted suites green: test_cron_fire_dashboard, test_web_server_cron_profiles, test_cron_fire_webhook (30 passed) + the 2 new tests. E2E via TestClient with real imports: both endpoints return correct payloads and the stubs prove off-loop execution. ruff clean, ty 0 net-new.

Credit

Supersedes #50948 — can be closed in favor of this.

Two async handlers still called the cron profile-walk helpers directly on
the FastAPI event loop after the 49fa04a/346e5673d threadpool migration:

- POST /api/cron/fire called _find_cron_job_profile() inline — it walks
  every profile and lists its jobs (file I/O per profile), stalling the
  loop before the 202 is returned.
- POST /api/cron/blueprints/instantiate called _call_cron_for_profile()
  inline for create_job.

Route both through the existing _run_cron_dashboard_io threadpool wrapper
like every other cron dashboard endpoint.

Credit: @riceharvest (NousResearch#50948) originally identified the sync-I/O-in-async-
handlers bug class for the desktop boot endpoints; 49fa04a, 346e567,
7d0ddbb, d5eee13 and 24d5bda have since fixed most of that PR's scope
via the managed threadpool + PID cache + alias-map surfaces. This covers
the two cron handlers those merges missed.
Mutation-verified: both tests fail against main's inline-call version and
pass with the threadpool routing.
@alt-glitch alt-glitch added type/perf Performance improvement or optimization comp/cli CLI entry point, hermes_cli/, setup wizard comp/dashboard Web dashboard / control panel UI (dashboard/, landing) comp/cron Cron scheduler and job management P3 Low — cosmetic, nice to have labels Jul 9, 2026
@kshitijk4poor
kshitijk4poor merged commit cb79518 into NousResearch:main Jul 9, 2026
31 checks passed
santhreal pushed a commit to santhreal/hermes-agent that referenced this pull request Jul 13, 2026
…d-residual-cron-event-loop-io

fix(dashboard): run residual cron profile I/O off the event loop (NousResearch#50948 follow-through)
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
…d-residual-cron-event-loop-io

fix(dashboard): run residual cron profile I/O off the event loop (NousResearch#50948 follow-through)
@kshitijk4poor
kshitijk4poor deleted the fix/dashboard-residual-cron-event-loop-io branch August 5, 2026 07:07
leewenjie pushed a commit to leewenjie/hermes-agent that referenced this pull request Aug 7, 2026
…d-residual-cron-event-loop-io

fix(dashboard): run residual cron profile I/O off the event loop (NousResearch#50948 follow-through)
randlee pushed a commit to randlee/hermes-agent that referenced this pull request Aug 11, 2026
…d-residual-cron-event-loop-io

fix(dashboard): run residual cron profile I/O off the event loop (NousResearch#50948 follow-through)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/cron Cron scheduler and job management comp/dashboard Web dashboard / control panel UI (dashboard/, landing) P3 Low — cosmetic, nice to have type/perf Performance improvement or optimization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants