fix(cron): yield desktop ticker to running gateway - #44050
Open
izumi0uu wants to merge 1 commit into
Open
Conversation
izumi0uu
marked this pull request as ready for review
June 11, 2026 06:21
1 task
Collaborator
teknium1
reviewed
Jul 14, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for identifying the scheduler-ownership race; the underlying defect is present on current main.
Problems
- The PR edits the old direct
cron_tick(...)desktop call (hermes_cli/web_server.py:126on PR head). Current main instead resolves and starts a provider athermes_cli/web_server.py:150-154;InProcessCronScheduler.start()callstick()without an owner-defer option atcron/scheduler_provider.py:166-180. As written, this patch would not govern the active desktop ticker. - Current provider characterization coverage only asserts desktop
sync=Falsebehavior (tests/cron/test_scheduler_provider.py:74-101); it does not prove owner-aware deferral through the provider boundary.
Suggested changes
- Thread the narrow owner-deferral option through the current provider start contract, pass it from the desktop ticker, and retain the gateway default path at
gateway/run.py:20839-20846. - Add provider-path tests for gateway-owner deferral, no-owner execution, and the gateway's non-deferring behavior.
Automated hermes-sweeper review.
Desktop dashboard backends must yield cron execution to a live same-profile gateway so TCC/FDA-sensitive jobs retain gateway process ancestry. The cross-process tick lock prevents duplicate firing but cannot choose the correct execution owner. Thread the opt-in through InProcessCronScheduler while preserving the gateway default and keeping built-in-only policy out of external provider contracts. Cover owner deferral, no-owner execution, gateway non-deferral, and the desktop provider boundary. Fixes NousResearch#43965
izumi0uu
force-pushed
the
fix/cron-owner-desktop-ticker-43965
branch
from
July 22, 2026 14:50
f25a82e to
02a34bf
Compare
Contributor
Author
|
Addressed in 02a34bf. The desktop cron ownership guard now follows the active scheduler-provider path instead of the removed direct cron_tick(...) call. InProcessCronScheduler forwards the narrow owner-deferral option, the desktop opts in only for the built-in provider, and the gateway retains its non-deferring default without changing external provider contracts. I added provider-path regressions for gateway-owner deferral, no-owner execution, gateway behavior, and external providers. |
This was referenced Aug 3, 2026
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.
What does this PR do?
Prevents the Desktop dashboard cron ticker from executing profile cron jobs when a same-profile gateway already owns scheduler execution.
The fix now uses the gateway runtime lock as the scheduler-owner signal. Desktop backends still keep a fallback ticker for profiles with no live gateway, but each desktop tick explicitly opts into scheduler-level deferral whenever the gateway owner is active.
Related Issue
Fixes #43965
Type of Change
Changes Made
_gateway_scheduler_owner_active()incron/scheduler.pyto delegate scheduler-ownership checks togateway.status.is_gateway_runtime_lock_active().cron.scheduler.tick(...)withdefer_to_gateway_owner=Falseso non-gateway tickers can opt into owner-aware deferral without changing gateway behavior.hermes_cli/web_server.pyso the desktop dashboard ticker callscron_tick(..., defer_to_gateway_owner=True)instead of duplicating a separate gateway-liveness check.tests/cron/test_scheduler_ownership.pyto cover owner detection, fail-open behavior, early deferral before lock acquisition, and the opt-in boundary.tests/hermes_cli/test_web_server.pyto assert that the desktop ticker requests gateway-owner deferral on every tick.How to Test
./.venv/bin/pytest -q tests/cron/test_scheduler_ownership.py../.venv/bin/pytest -q tests/hermes_cli/test_web_server.py -k 'TestDesktopCronTicker'../.venv/bin/pytest -q tests/gateway/test_status.py -k 'runtime_lock or get_running_pid'../.venv/bin/pytest -q tests/cron/test_parallel_pool.py tests/cron/test_scheduler_ownership.pyto confirm the new tick parameter does not disturb existing scheduler dispatch behavior.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/A