Skip to content

fix(cron): don't log "agent returned [SILENT]" when the agent was never invoked#42107

Open
sanidhyasin wants to merge 1 commit into
NousResearch:mainfrom
sanidhyasin:fix/cron-silent-log-agent-not-invoked
Open

fix(cron): don't log "agent returned [SILENT]" when the agent was never invoked#42107
sanidhyasin wants to merge 1 commit into
NousResearch:mainfrom
sanidhyasin:fix/cron-silent-log-agent-not-invoked

Conversation

@sanidhyasin

Copy link
Copy Markdown
Contributor

What & why

Closes #41923.

When a cron tick is short-circuited before the LLM is ever invoked, the scheduler logs a misleading line claiming the agent ran:

INFO cron.scheduler: Job '…': wakeAgent=false, skipping agent run
INFO cron.scheduler: Job '…': agent returned [SILENT] — skipping delivery   ← wrong, agent never ran

The root cause: four pre-agent skip paths in run_job all returned the same SILENT_MARKER that a genuine agent-produced [SILENT] reply uses, so the delivery loop in _process_job couldn't tell the two apart and always logged agent returned [SILENT].

The skip paths are:

  • wakeAgent=false script gate (LLM path) — the case in the issue
  • wakeAgent=false gate on a no_agent job
  • empty no_agent script stdout
  • a prompt that resolves to nothing (script produced no output)

In all four the agent is never invoked.

Change

  • Add a distinct AGENT_NOT_INVOKED_MARKER sentinel returned by those four skip paths. It suppresses delivery exactly like SILENT_MARKER (output is still saved for audit, the run still counts as a success), but lets the delivery loop log:

    INFO cron.scheduler: Job '…': agent not invoked — skipping delivery
    
  • The genuine "agent ran and replied [SILENT]" path is untouched and keeps its existing agent returned [SILENT] — skipping delivery log line. The two markers are mutually exclusive ([SILENT] is not a substring of [SILENT:agent-not-invoked]), so the substring [SILENT] detection for real agent replies still works.

This keeps the per-cause line already emitted inside run_job (wakeAgent=false, skipping agent run, empty stdout — silent run, etc.) as the authoritative reason, and stops the second line from contradicting it.

How to test

Repro from the issue: a cron job whose pre-run script emits {"wakeAgent": false}. Before this change the scheduler logged agent returned [SILENT] — skipping delivery; now it logs agent not invoked — skipping delivery.

Automated:

pytest tests/cron/ -q
  • Updated test_run_job_no_agent_empty_output_is_silent, test_run_job_no_agent_wake_gate_is_silent, and test_wake_false_skips_agent_and_returns_silent to assert the new sentinel.
  • Added test_agent_not_invoked_marker_logs_distinct_message asserting the skip path logs agent not invoked and not agent returned, while still suppressing delivery.

All 404 tests in tests/cron/ pass.

Platforms

Logic-only change in cron/scheduler.py; no platform-specific code touched. Tested on macOS.

…er invoked

When a tick is short-circuited before the LLM runs — a `wakeAgent=false`
script gate, empty no_agent script output, or a prompt that resolves to
nothing — run_job returned the same SILENT_MARKER as a genuine
agent-produced `[SILENT]` reply. The delivery loop then logged
"agent returned [SILENT] — skipping delivery", which is misleading: the
agent was never called this tick.

Introduce a distinct AGENT_NOT_INVOKED_MARKER sentinel returned by the
four pre-agent skip paths. It suppresses delivery exactly like
SILENT_MARKER, but lets the delivery loop log "agent not invoked —
skipping delivery" instead. The genuine agent-returned-[SILENT] path is
untouched and keeps its existing log line.

Fixes NousResearch#41923
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/cron Cron scheduler and job management labels Jun 8, 2026

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Verdict: Approved

Looks Good

  • Fixes incorrect log message: when cron agent is never invoked (wake gate returns false), the system now logs "agent not invoked" instead of falsely logging "agent returned [SILENT]".
  • Renames SILENT_MARKER to AGENT_NOT_INVOKED_MARKER for clarity.
  • No security concerns, no debug artifacts.

Reviewed by Hermes Agent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cron Cron scheduler and job management P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Cron scheduler logs “agent returned [SILENT]” when wakeAgent=false skipped the agent entirely

3 participants