fix(gateway): stop Desktop cron from contending with profile gateways - #102174
Closed
fangliquanflq wants to merge 3 commits into
Closed
fangliquanflq wants to merge 3 commits into
fangliquanflq wants to merge 3 commits into
Conversation
Chunk5 review — fix(gateway): stop Desktop cron contending with profile gatewaysTwo coordinated changes: eligibility-aware cron initialisation plus a desktop-ticker stand-down for gateway-owned profiles. Addresses real contention (#100489, #102156).
Non-blocking overall. Solid multiplex work. |
This was referenced Sep 11, 2026
Collaborator
|
Superseded by #108428 (on |
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 cron scheduler from entering profiles whose jobs are already owned by either a profile-local gateway or the live default-profile multiplexer. On Windows, the duplicate manager path reported in #102156 left the same profile's cron, state, and log resources open from competing long-lived processes while Desktop tried to start that bot's backend.
Symptom
With a standalone default gateway multiplexing several profiles, opening a sleeping bot in Desktop can fail while both the gateway and Desktop cron scheduler manage the same named profile.
Impact
Affected Windows Desktop users can be unable to open bot chats until the standalone gateway is stopped and the affected profiles are rebuilt.
Bug Cause
Trigger:
hermes_cli/web_server.py:270/_start_desktop_cron_ticker()when the default gateway multiplexes a named profile.Causal chain:
_check_gateway_running(profile_home), but a multiplexer-owned named profile has no profile-local gateway PID or runtime state.Why it is wrong: The gate omits the existing authoritative multiplexer ownership probe, and the shared scheduler does not apply its supplied gate during startup recovery.
Working sibling / contrast: A profile with its own gateway is already excluded by
_check_gateway_running(). Profile, gateway, and cron status paths also already use_served_by_running_multiplexer()for named profiles.Ruled out: Generic concurrent SQLite access is not disabled; Hermes supports multiple readers and writers. This change removes duplicate cron-manager ownership rather than restricting unrelated session access.
Fix
Extend the Desktop ownership gate to reject profiles served by the live default multiplexer. Apply the scheduler's profile gate to startup recovery and heartbeat initialization as well as recurring tick cycles, so rejected profiles are never entered by the Desktop cron manager.
Related Issue
Fixes #102156
Type of Change
Changes Made
hermes_cli/web_server.py- recognize default-multiplexer ownership in the Desktop cron gate.cron/scheduler_provider.py- honor the profile gate before startup recovery and heartbeat writes.tests/cron/test_cron_multiplex_desktop_ticker_scope.py- cover direct and multiplex ownership plus zero startup writes for rejected profiles.How to Test
gateway.multiplex_profiles: trueand at least one named profile.Result: 3 passed.
Checklist
Code
fix(scope):,feat(scope):, etc.)Documentation & Housekeeping
docs/, docstrings) - N/A; behavior is covered by code comments and testscli-config.yaml.exampleif I added/changed config keys - N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows - N/AScreenshots / Logs
N/A - scheduler ownership is covered by the automated regression test.