Skip to content

fix(cron): prefer finalAssistantVisibleText over raw error text in task summary#74840

Closed
andyliu wants to merge 1 commit into
openclaw:mainfrom
andyliu:fix/cron-summary-prefers-assistant-reply
Closed

fix(cron): prefer finalAssistantVisibleText over raw error text in task summary#74840
andyliu wants to merge 1 commit into
openclaw:mainfrom
andyliu:fix/cron-summary-prefers-assistant-reply

Conversation

@andyliu

@andyliu andyliu commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Targeted single-fix PR.

Closes #74807

🤖 Generated with Claude Code

…sk summary

When a cron agentTurn run had no non-error payloads (e.g. a tool call
failed and the agent self-corrected via LLM output rather than an
explicit messaging tool call), fallbackSummary fell through to
pickSummaryFromOutput(firstText) where firstText was the tool error payload.

Introduce finalAssistantVisibleText as an intermediate fallback in
both fallbackSummary and fallbackOutputText so that the agent's
self-corrected reply is surfaced instead of the raw error text.

Closes openclaw#74807
@clawsweeper

clawsweeper Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

Summary
The PR changes resolveCronPayloadOutcome to include finalAssistantVisibleText as an intermediate fallback for cron summary and output text selection.

Reproducibility: yes. by source inspection. Calling resolveCronPayloadOutcome with only error payloads, finalAssistantVisibleText, and preferFinalAssistantVisibleText: true still resolves to the last error, and the current helper test asserts that shape.

Real behavior proof
Needs real behavior proof before merge: The PR body and comments do not include after-fix real behavior proof; a redacted terminal log, copied live output, screenshot, recording, or linked artifact is needed before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, ask a maintainer to comment @clawsweeper re-review.

Next step before merge
The PR has a concrete correctness blocker, but the external contributor proof gate is unsatisfied, so maintainers should request proof and a repaired diff rather than queue an automated repair.

Security
Cleared: The diff only changes cron summary fallback logic and does not touch CI, dependencies, secrets, permissions, package metadata, release scripts, or other supply-chain surfaces.

Review findings

  • [P2] Rework the fatal-error fallback — src/cron/isolated-agent/helpers.ts:263-270
Review details

Best possible solution:

Repair resolveCronPayloadOutcome so trusted recovered final assistant text can win for self-corrected all-error payload summaries while unresolved fatal payloads and structured delivery failures still report errors, with focused regression coverage.

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

Yes, by source inspection. Calling resolveCronPayloadOutcome with only error payloads, finalAssistantVisibleText, and preferFinalAssistantVisibleText: true still resolves to the last error, and the current helper test asserts that shape.

Is this the best way to solve the issue?

No. The PR adds final assistant text only after payload fallbacks have already selected error text and before an unchanged fatal delivery override replaces the result with the error again.

Full review comments:

  • [P2] Rework the fatal-error fallback — src/cron/isolated-agent/helpers.ts:263-270
    This still does not let the recovered all-error case use finalAssistantVisibleText: the payload fallback helpers return the last error first, and hasFatalStructuredErrorPayload still forces fatalDeliveryText to replace the output. Move the recovery/fatal classification before the fatal override and add a regression for only error payloads plus final assistant text.
    Confidence: 0.94

Overall correctness: patch is incorrect
Overall confidence: 0.92

Acceptance criteria:

  • node scripts/run-vitest.mjs src/cron/isolated-agent.helpers.test.ts
  • Run a real cron agentTurn scenario or equivalent packaged/local cron run showing the final assistant reply is announced instead of a recovered tool error, with private data redacted.

What I checked:

Likely related people:

  • welfo-beo: Authored merged work that added finalAssistantVisibleText handling across the isolated cron resolver, runner, and tests. (role: feature introducer; confidence: high; commits: 81c7304a18b8, 01bfe4f25e3f; files: src/cron/isolated-agent/helpers.ts, src/cron/isolated-agent.helpers.test.ts, src/cron/isolated-agent/run.ts)
  • jalehman: Reviewed/co-authored the final announce delivery work and appears in the follow-up final-reply scoping history for this cron surface. (role: reviewer and adjacent contributor; confidence: medium; commits: 81c7304a18b8, a97e0abb2bf0, f3928f79ebc5; files: src/cron/isolated-agent/helpers.ts, src/cron/isolated-agent.helpers.test.ts, src/cron/isolated-agent/run.ts)
  • hydro13: Authored merged resolver work that preserved multi-payload announce output while keeping error-only runs falling back to the last error payload. (role: adjacent cron output contributor; confidence: medium; commits: bdd9bc93f12c, 779d2ce830ff; files: src/cron/isolated-agent/helpers.ts, src/cron/isolated-agent.helpers.test.ts)
  • steipete: Recently changed the same resolver and tests around presentation warnings, denial classification, and run-level failure behavior. (role: recent classifier contributor; confidence: medium; commits: 9f62c738930a, 382e03a2d838, b0c70786fd63; files: src/cron/isolated-agent/helpers.ts, src/cron/isolated-agent.helpers.test.ts, src/cron/isolated-agent/run.ts)

Remaining risk / open question:

  • The contributor has not supplied after-fix real cron evidence, so merge would rely only on source review and tests.
  • A repair must distinguish recovered final assistant text from genuinely fatal tool, run-level, denial, and structured delivery failures.

Codex review notes: model gpt-5.5, reasoning high; reviewed against a6aa48350b7e.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Cron task summary ignores agent self-correction - picks tool error over final assistant reply

1 participant