fix(cron): deliver manual runs on profile-owned gateway loop - #71132
fix(cron): deliver manual runs on profile-owned gateway loop#71132ciabata-git wants to merge 2 commits into
Conversation
Resolve the context-scoped Hermes profile independently of runner metadata, require its exact adapter registry entry, and fail closed rather than borrowing primary credentials. Also preserve exact standalone call behavior and reject stale gateway loops.
|
Thanks for preserving the existing scheduler delivery path while adding the missing manual-run context. Current main still calls Automated hermes-sweeper review. |
Summary29 PRs address or reference this cron issue complex across stalled inference, manual execution, schema validation, prompt propagation, status reporting, standalone scheduling, Matrix delivery, and Desktop Git discovery. The diffs show distinct root causes rather than one universal fix; #71132 is the strongest current Matrix-delivery continuation, while #61503 is the only PR addressing the separate UGit resolver failure. Related pull requests
Duplicates#32448/#32804/#34173/#34483/#37859 are the same cron schema-description change, with #32804 as the merged reference. #34255/#53246 are the same rejected alias-normalization approach; #41130/#50025/#41269 are the manual-run execution cluster, with #50025 as the merged reference; #41167/#41363/#43864 are the standalone-daemon cluster; #57342/#57360 are duplicates, with #57342 canonical; #61503/#63586/#71132 are competing Matrix caller-side fixes, with #71132 superseding #63586; #61502 is a distinct callee-side Matrix approach. Suggested consolidationKeep open #71132 with a salvage path as the canonical current fix for #61495: retain its profile-owned adapter/loop selection and verify under repeated manual runs that Matrix send() executes as a task on the adapter's owning loop. Close #63586 as superseded by #71132, close #57360 as duplicate of #57342, and retain #43864, #52720, #53395, #57689, and #61502 only with their explicit salvage paths; close the remaining closed/redundant PRs against their recorded references. For the separate Desktop issue, retain #61503 as the closed UGit reference implementation, while its bundled Matrix portion is superseded by #71132. Complex graphflowchart LR
classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d
classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937
classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151
classDef best stroke-width:3px,stroke:#b45309
classDef target stroke-width:3px,stroke:#4338ca
I61495(["issue #61495 (open)"])
subgraph Dup61503 ["PRs duplicating each other"]
P61503["PR #61503 (closed)"]
P63586["PR #63586 (open)"]
P71132["PR #71132 (open)"]
end
P71132 -->|best fix| I61495
class I61495 open
class P61503 closed
class P63586 open
class P71132 open
class P61503 best
class P63586 best
class P71132 best
class P71132 target
click I61495 "https://github.com/NousResearch/hermes-agent/issues/61495"
click P61503 "https://github.com/NousResearch/hermes-agent/pull/61503"
click P63586 "https://github.com/NousResearch/hermes-agent/pull/63586"
click P71132 "https://github.com/NousResearch/hermes-agent/pull/71132"
Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed (state tag in the node label). Cross-PR triage: Reviewed 29 pull requests and 11 issues in this complex. Each diff was read against this issue; Assessment working set: 287 kB of PR diffs, 82 kB of issue/PR text, 63 kB of discussion (79 comments), 51 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch. |
What does this PR do?
Manual
cronjob(action="run")executions inside a live gateway currently callrun_one_job(job)without the gateway adapter map or the event loop that owns those adapters. Matrix then may await its live mautrix/aiohttp client from a freshasyncio.run()loop and fail with:This PR passes the live, profile-owned adapter map and its owning gateway loop into the existing scheduler delivery path. Unsafe or unavailable gateway context preserves the exact standalone
run_one_job(job)behavior.This carries forward Fly's original commit from #63586, preserving authorship, and adds the multiplex-profile isolation requested in that PR's maintainer review. Unlike the original revision, a secondary profile can never inherit the primary profile's adapter credentials when its own registry entry is missing or partial.
Related Issue
Fixes #61495
Type of Change
Changes Made
tools/cronjob_tools.pygateway.run._gateway_runner_refwithout adding another registry or a Matrix-specific branch.get_hermes_home()with process-ownedget_process_hermes_home()unconditionally._profile_adapters[get_active_profile_name()]map; missing provenance fails closed instead of borrowingrunner.adapters.run_one_job; otherwise retain the exact one-argument standalone call.tests/tools/test_cronjob_run_immediate.pyHERMES_HOMEprofile resolution, metadata enabled/disabled/missing, absent registries, and partial secondary maps.How to Test
Run the focused and adjacent cron suites:
HERMES_PYTHON=/usr/local/lib/hermes-agent/venv/bin/python \ HERMES_TEST_FILE_RETRIES=0 \ scripts/run_tests.sh \ tests/tools/test_cronjob_run_immediate.py \ tests/tools/test_cronjob_tools.py \ tests/cron/test_run_one_job.py \ tests/cron/test_ticker_stall_60703.py \ tests/cron/test_scheduler_provider.py -qResult: 155 passed, 0 failed.
Run static checks:
Result: all passed.
Causal regressions were also verified during development:
Full-suite note:
scripts/run_tests.sh tests/ -qwas attempted locally but exceeded the 600-second execution cap at 29% of roughly 43,000 collected tests. Thirteen path-completion failures observed before timeout reproduce on untouchedorigin/mainin this agent worktree environment. One unrelated routing assertion sees the configured Matrix home because this worktree sits beneath the liveHERMES_HOME; it is outside the changed paths. I therefore leave the full-suite checklist item unchecked and rely on CI for the clean-environment full run.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests pass — see the bounded full-suite note above7.0.14-4-pve, Python 3.11)Documentation & Housekeeping
cli-config.yaml.exampleupdate — N/A; no config keys changedCONTRIBUTING.mdorAGENTS.mdupdate — N/A; no workflow or architectural contract changedpathlib, existing runtime APIs, and no platform-specific branchesScreenshots / Logs
Not applicable. The failure and fix are covered by causal unit/integration regressions and real delivery-resolver identity checks.