fix(cron): skip provider-error classification for no_agent job failures - #70977
fix(cron): skip provider-error classification for no_agent job failures#70977brian717 wants to merge 1 commit into
Conversation
no_agent cron jobs run a bash script with no LLM/provider involved. When
such a script exits non-zero, its entire stdout is passed to
_summarize_cron_failure_for_delivery as the error string. The provider
classification branches matched bare 401/403/429/"timeout" tokens anywhere
in that text, so ordinary script output that merely mentioned a status code
(e.g. a passing auth-gate test printing "returns 401") produced a misleading
"provider authentication error" notification for a failure unrelated to any
provider.
Gate all three provider-classification branches (rate limit, timeout, auth)
behind `not job.get("no_agent")` so script-only jobs fall through to the
generic summary. Agent jobs are unaffected.
Fixes NousResearch#70908
|
Validated this earlier implementation against current |
|
Thanks for the focused fix. Current main still has the reported mismatch: The proposed guard matches that execution boundary, preserves classification for agent jobs and legacy job dictionaries, and the added tests cover the relevant token classes. This is an automated hermes-sweeper review. |
|
#74112 implemented the same production change — the Diffing the two test suites (10 cases there vs. 7 here), three cases covered there have no equivalent on this branch:
They can be cherry-picked from Filed by an AI agent (Claude Fable 5) operating autonomously on @jeff-mettel's behalf. The test-suite delta was verified by diffing both PRs ( |
|
Independent validation against current origin/main at 89c14ae (2026-08-08): the PR applies cleanly; 30 focused cron tests passed across summarize/run/no_agent/shutdown coverage; ruff check passed on the changed files; and git diff --check passed. This also matches a reproduced no_agent upstream-API failure that was being mislabeled as a provider/fallback failure. I intentionally did not open a duplicate PR. |
|
Closing with credit — the same no_agent mode gate landed on main via PR #85536 (cherry-picked from #77648, which reimplemented the identical approach later). Your Jul 24 submission predates it; together with #60593 (Jul 8, the earliest) this fix was independently submitted five times, which tells us the bug was well and truly real. Sorry the first-submitter credit in the merge notes went to a later PR — our sweep missed the earlier cluster. Thanks! |
What does this PR do?
Fixes a misleading cron notification.
no_agent=Truejobs run a bash script with no LLM or provider involved. When such a script exits non-zero, its entire stdout is handed to_summarize_cron_failure_for_deliveryas the error string. The provider classification branches in that function match bare tokens (401,403,429, "timeout") anywhere in the text, so ordinary script output that just happens to mention a status code, for example a passing auth-gate test printing "returns 401", got reported to the user as a "provider authentication error" even though no provider was ever called.The fix gates all three provider classification branches (rate limit, timeout, authentication) behind
not job.get("no_agent"). Script-only jobs now fall through to the generic failure summary, which reflects what actually broke. Agent jobs are untouched, so real provider errors are still classified exactly as before.I widened the guard to cover 429 and timeout in addition to the 401/403 case from the issue because they share the same root cause: bare tokens in script stdout being read as provider diagnostics. This matches the issue's preferred option A ("skip the provider-error classification for no_agent jobs entirely").
Related Issue
Fixes #70908
Type of Change
Changes Made
cron/scheduler.py: wrap the rate-limit, timeout, and authentication classification branches in_summarize_cron_failure_for_deliveryinsideif not job.get("no_agent"):. Pure re-indentation of the existing branches plus a comment explaining why; agent-job output is unchanged.tests/cron/test_summarize_cron_failure.py: new test module. Four cases assert a no_agent job whose stdout mentions 401/403/429/timeout is not classified as a provider error, and three regression cases assert agent jobs (including a legacy job dict with nono_agentkey) still classify 401/429 as before.How to Test
Reproduce on
main: build a job dict withno_agent=Trueand pass stdout containing a bare401to_summarize_cron_failure_for_delivery. It returns "provider authentication error" even though no provider is involved.With this change, the same input falls through to the generic summary and no longer mentions a provider.
Run the suite:
51 passed. The four no_agent tests fail on
mainand pass with the fix.Checklist
Code
Documentation & Housekeeping