fix(cron): gateway-loop delivery, per-run prompt context, Matrix standalone send — run-action sweep salvage - #80838
Merged
Merged
Conversation
Pins the scheduler-boundary contract: extra_prompt is appended under '## Run Context', does not mutate job['prompt'], and the header is absent when extra_prompt is omitted. Addresses review feedback from harjothkhara on PR #57342.
Salvaged from PR #57342 by @liuhao1024 (with the injection-scan half from PR #57360 by @ghedeselmabot): cronjob(action='run', prompt=...) silently discarded the prompt argument — per-run context never reached the spawned cron session. The prompt is now threaded as extra_prompt through the whole chain (cronjob run action → _try_dispatch_background_run/_execute_job_now → _run_claimed_job → run_one_job → run_job → _build_job_prompt) and appended to the stored prompt under a '## Run Context' header for that single fire only — never persisted to the job definition. It passes the same strict _scan_cron_prompt injection scan as stored prompts before firing, and works identically on the background and sync fallback paths. Test fakes across tests/cron/ updated to accept the new kwargs (sibling-test blast radius from the signature change). Co-authored-by: liuhao1024 <liuhao1024@users.noreply.github.com>
… standalone send Fixes #61495 When manually triggering cron jobs from a live Matrix session, delivery would fail with "Timeout context manager should be used inside a task" because the aiohttp.ClientTimeout context manager requires a proper asyncio task context. Use asyncio.wait_for() instead of aiohttp.ClientTimeout to avoid this error, following the same pattern as the Weixin platform (gateway/platforms/weixin.py). Changes: - Remove aiohttp.ClientTimeout(total=30) from ClientSession constructor - Wrap the send operation in a nested async function (_do_send) - Use asyncio.wait_for(_do_send(), timeout=30) for timeout handling - Catch asyncio.TimeoutError explicitly and return clear error message
Contributor
૮ >ﻌ< ა ci reviewran on c07ef13
|
This was referenced Aug 7, 2026
teknium1
added a commit
that referenced
this pull request
Aug 7, 2026
Covers the behavior shipped in #80807 (background dispatch for cronjob action='run') and #80838 (per-run '## Run Context' prompt, gateway-loop delivery): immediate return with handle, completion re-entering the conversation, in-flight dedupe, transient context injection with prompt scanning, and the sync fallbacks.
POWERFULMOVES
pushed a commit
to POWERFULMOVES/PMOVES-hermes-agent
that referenced
this pull request
Aug 10, 2026
Covers the behavior shipped in NousResearch#80807 (background dispatch for cronjob action='run') and NousResearch#80838 (per-run '## Run Context' prompt, gateway-loop delivery): immediate return with handle, completion re-entering the conversation, in-flight dedupe, transient context injection with prompt scanning, and the sync fallbacks.
randlee
pushed a commit
to randlee/hermes-agent
that referenced
this pull request
Aug 11, 2026
Covers the behavior shipped in NousResearch#80807 (background dispatch for cronjob action='run') and NousResearch#80838 (per-run '## Run Context' prompt, gateway-loop delivery): immediate return with handle, completion re-entering the conversation, in-flight dedupe, transient context injection with prompt scanning, and the sync fallbacks.
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.
Summary
Cluster salvage of the three surviving fixes from the
cronjob(action='run')sweep (follow-up to #80807): manual runs now deliver on the live gateway loop (fixes Matrix delivery, #61495), accept transient per-run prompt context (#57331), and Matrix standalone send no longer crashes on aiohttp's task-context check.Changes
_run_claimed_jobresolves the liveGatewayRunner's adapter map + owning event loop via the existing_gateway_runner_refweakref and passes them torun_one_job, matching what scheduled ticks already do. Matrix (mautrix/aiohttp) delivery from a manual run previously failed with "Timeout context manager should be used inside a task" because it ran on a freshasyncio.run()loop. CLI-only runs keep the standalone path (adapters=None, loop=None).cronjob(action='run', prompt=...)previously discarded the prompt silently. It now threads asextra_promptthrough the full chain (run action → background/sync paths →run_one_job→run_job→_build_job_prompt), appended under a## Run Contextheader for that single fire only — never persisted. Passes the same strict_scan_cron_promptinjection scan as stored prompts. Works identically on background and sync-fallback paths._standalone_send()replacesaiohttp.ClientTimeoutin the session constructor withasyncio.wait_for(..., 30), the same pattern Weixin uses —ClientTimeoutrequires a proper task context that the standalone path doesn't always have.tests/cron/updated for the new kwargs (sibling-test blast radius from therun_job/run_one_job/_build_job_promptsignature changes).Validation
cronjob(run, prompt=...)## Run Contextin assembled prompt_scan_cron_promptE2E (real job store, temp
HERMES_HOME): background run withprompt="CONTEXT: client=Acme"→ assembled prompt contains stored prompt +## Run Context+ context; stored job untouched; injection-shaped context refused with the scanner error before any fire.Attribution: commits cherry-picked/salvaged preserve @Fly-onlyone and @liuhao1024 authorship (audit green).
Infographic