Skip to content

fix(cron): silent agentTurn runs no longer report errors after successful tools - #114528

Merged
steipete merged 1 commit into
mainfrom
claude/cron-silent-turn-outcome
Jul 27, 2026
Merged

steipete merged 1 commit into
mainfrom
claude/cron-silent-turn-outcome

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Resolves a problem where one-shot cron jobs running an agentTurn payload with no delivery route (for example "archive this session after my turn ends — do not send any user-facing message") finished with outcome=error and the diagnostic "⚠️ Agent couldn't generate a response. Note: some tool actions may have already been executed — please verify before retrying." even when every tool action succeeded. The run did exactly what it was asked — executed its tools and stayed silent — but cron diagnostics recorded it as a failure. Observed live on 2026-07-27 on a dev gateway while testing session archiving on the Codex harness (gpt-5.6-sol): the cron turn archived the session successfully, then was logged as an error purely because the final assistant message was intentionally empty.

Why This Change Was Made

Cron already declares its delivery contract per run: terminalReplyExpectation: "required" | "optional" (src/cron/isolated-agent/run-executor.ts), where "optional" means no user-facing reply is owed (delivery none, webhook, or invalid route). The empty-reply classifier in the embedded runner never consumed that declaration: shouldTreatEmptyAssistantReplyAsSilent treated any post-tool empty stop with replay-unsafe side effects as an ambiguous provider failure. This change threads the existing declaration into the classifier: when the run consumer declared the terminal reply optional, a normally-completed run (no abort, no timeout, no tool error, stopReason stop) whose tools succeeded is classified as intentional silence (terminalReplyKind: "silent-empty", NO_REPLY) instead of an incomplete-turn error. Required or unspecified expectations, tool failures, error stop reasons, aborts, and timeouts keep the existing failure behavior, so genuinely broken runs still surface.

User Impact

Operators no longer see false outcome=error diagnostics for silent cron automation turns whose tool actions succeeded; real failures (tool errors, provider errors, timeouts) still report as errors.

Evidence

  • Regression tests added in src/agents/embedded-agent-runner/run.incomplete-turn.test.ts: reply-optional post-tool empty stop after a replay-unsafe successful tool → silent; same attempt with required/unspecified expectation → still error path; tool-error, error-stop, and aborted variants → still error; full runEmbeddedAgent run asserts NO_REPLY payload, no meta.error, terminalReplyKind: "silent-empty".
  • node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run.incomplete-turn.test.ts → 1 file, 157 tests passed.
  • oxfmt --check clean on all four files; git diff --check clean.
  • Autoreview (Codex, gpt-5.6-sol, xhigh): clean, no accepted/actionable findings — "expectation is propagated through both terminal-resolution paths, and the regression coverage exercises the intended success and failure cases."

@steipete
steipete marked this pull request as ready for review July 27, 2026 10:57
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Jul 27, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jul 27, 2026
@clawsweeper

clawsweeper Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 27, 2026, 7:01 AM ET / 11:01 UTC.

ClawSweeper review

What this changes

This PR passes cron’s optional-terminal-reply contract into embedded agent terminal resolution so a successful tool-only run can finish as intentional silence instead of a failed incomplete turn.

Merge readiness

⛔ Blocked until real behavior proof is added - 2 items remain

Keep this PR open for maintainer review. The patch is a focused fix for false cron errors and its changed paths preserve the existing error guards, but the contributor has not supplied inspectable after-fix runtime output for the reported live gateway scenario; the maintainer label also requires explicit maintainer handling rather than cleanup closure.

Priority: P2
Reviewed head: da498725a36979343db9ff595dc323c82dddbebd

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The patch and targeted regression matrix look focused, but real after-fix behavior proof remains a merge gate.
Proof confidence 🧂 unranked krab (1/6) Needs real behavior proof before merge: The PR describes a live dev-gateway observation and focused tests, but it does not include inspectable after-fix terminal output, logs, recording, or linked artifact proving the optional-reply cron path now ends silently; add redacted runtime evidence before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR describes a live dev-gateway observation and focused tests, but it does not include inspectable after-fix terminal output, logs, recording, or linked artifact proving the optional-reply cron path now ends silently; add redacted runtime evidence before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 5 items PR boundary: The branch changes the shared embedded-agent terminal classifier and passes the existing terminal-reply expectation through all three visible resolution paths, rather than adding a cron-only duplicate classifier.
Error-path preservation: The changed classifier only tolerates potential side effects when the consumer explicitly marks the terminal reply optional; abort, timeout, tool-error, and other non-visible-turn retry guards remain part of the decision surface.
Both terminal-resolution paths receive the contract: The expectation is propagated into both settled-turn finalization and ordinary embedded-run terminal resolution, reducing the risk of path-dependent outcomes.
Findings None None.
Security None None.

How this fits together

Cron schedules isolated agent turns and declares whether a terminal user-facing reply is required. The embedded runner converts the agent’s final tool and assistant state into a reply payload and cron diagnostic outcome, so this change affects whether a completed no-delivery run is reported as silent or erroneous.

flowchart LR
  A[Cron schedule] --> B[Isolated agent turn]
  B --> C[Terminal reply expectation]
  B --> D[Embedded agent runner]
  D --> E[Tool and assistant outcome]
  C --> F[Terminal classification]
  E --> F
  F --> G[Reply payload and cron diagnostics]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR describes a live dev-gateway observation and focused tests, but it does not include inspectable after-fix terminal output, logs, recording, or linked artifact proving the optional-reply cron path now ends silently; add redacted runtime evidence before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - The patch deliberately changes an error diagnostic into intentional silence when a terminal reply is optional; before merge, maintainers should see redacted after-fix output from the reported no-delivery cron run to confirm that successful tools are silent while genuine failures still remain errors.
Agent review details

Security

None.

PR surface

Source +16, Tests +139. Total +155 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 3 20 4 +16
Tests 1 139 0 +139
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 159 4 +155

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the shared terminal-reply contract propagation, add redacted live cron output demonstrating the successful silent run and one genuine failure, then land after the protected maintainer review completes.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain the shared terminal-reply contract propagation, add redacted live cron output demonstrating the successful silent run and one genuine failure, then land after the protected maintainer review completes.

Do we have a high-confidence way to reproduce the issue?

No high-confidence independent reproduction was established in this read-only review; the source path is clear and the PR describes a concrete no-delivery cron turn with successful side-effecting tools and an empty final response.

Is this the best way to solve the issue?

Yes, provisionally: threading the already-declared terminal-reply expectation into the shared classifier is narrower and less duplicative than adding cron-specific outcome rewriting, provided live proof confirms the stated failure boundary.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 87b76d0cd050.

Labels

Label changes:

  • add P2: This fixes false failure reporting for scheduled agent automation with a bounded diagnostic blast radius.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR describes a live dev-gateway observation and focused tests, but it does not include inspectable after-fix terminal output, logs, recording, or linked artifact proving the optional-reply cron path now ends silently; add redacted runtime evidence before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P2: This fixes false failure reporting for scheduled agent automation with a bounded diagnostic blast radius.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR describes a live dev-gateway observation and focused tests, but it does not include inspectable after-fix terminal output, logs, recording, or linked artifact proving the optional-reply cron path now ends silently; add redacted runtime evidence before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

Likely related people:

  • steipete: Authored the focused cron/embedded-runner patch; current-main feature-history provenance could not be independently retrieved in the read-only review environment. (role: current runtime contributor; confidence: low; commits: da498725a369; files: src/agents/embedded-agent-runner/run/incomplete-turn.ts, src/agents/embedded-agent-runner/run/terminal-resolution.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add redacted terminal output or logs from a no-delivery cron run that succeeds with tools and reports silent-empty/no error.
  • Include a contrasting redacted run where a tool or provider failure still produces the expected error diagnostic.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete

Copy link
Copy Markdown
Contributor Author

Addressing the rank-up moves:

Before-fix live evidence (redacted dev-gateway log, 2026-07-27): a no-delivery one-shot cron whose sessions patch succeeded (session verified archived via sessions.list {archived:"all"}) still logged:

[diagnostic] message processed: channel=cron chatId=unknown messageId=unknown sessionId=dff29ece-... sessionKey=agent:main:cron:8c6881e0-...:run:dff29ece-... outcome=error duration=22555ms error="⚠️ Agent couldn't generate a response. Note: some tool actions may have already been executed — please verify before retrying."

After-fix contrast: rather than a second live gateway run, the added regression tests in run.incomplete-turn.test.ts pin both sides at the exact classification boundary: the reply-optional post-tool empty stop asserts payloads == [{text:"NO_REPLY"}], no meta.error, terminalReplyKind: "silent-empty"; and the contrasting cases (tool error, stopReason: "error", abort, and required/unspecified expectation with the identical attempt) all assert the error path is preserved. Full file: 157/157 passing.

@steipete
steipete merged commit ed4ff90 into main Jul 27, 2026
181 of 190 checks passed
@steipete
steipete deleted the claude/cron-silent-turn-outcome branch July 27, 2026 11:11
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant