openclaw - ✅(Solved) Fix [Bug] Cron task summary ignores agent self-correction - picks tool error over final assistant reply [2 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#74807Fetched 2026-05-01 05:41:09
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
2
Timeline (top)
cross-referenced ×2commented ×1mentioned ×1subscribed ×1

Error Message

When a Cron agentTurn job runs in an isolated session, the final summary/announcement picks the last tool error message as the task result instead of the agent's final self-corrected assistant reply. 3. Agent recognises the error, adjusts its approach, and successfully completes the task in subsequent turns. The summary should prefer the last assistant turn in the session as the authoritative outcome, not an intermediate tool error. If the agent's final message indicates success, the announcement should reflect success. 3. Only fall back to tool-error-based summaries if the session ends with a tool call (no final assistant reply), or the assistant explicitly reports failure. Discovered during analysis of a daily-cleanup Cron job that self-corrected a file-edit error but was still reported as failed.

Root Cause

The summary logic appears to prefer tool results (which are system-generated) over the agent's final assistant message when determining what to announce. This means any intermediate tool failure that the agent later overcomes is surfaced as the final status.

Fix Action

Fixed

PR fix notes

PR #74834: fix: 5 targeted bug fixes (gemini-cli, plugin commands, openrouter thinking, cron summary, LLM-only tools)

Description (problem / solution / changelog)

Summary

Five independent targeted fixes, each addressing a distinct bug:

1. fix(google): remove unsupported --skip-trust flag from gemini-cli backend (#74749)

gemini-cli >= 0.38.x dropped --skip-trust. Passing it causes yargs to exit non-zero on every call, resulting in 100% failure rate for the gemini CLI backend. Removed from both args and resumeArgs.

2. fix(plugins): guard against undefined plugin command handler result (#74800)

Plugin command handlers typed as Promise<PluginCommandResult> can return undefined at runtime. The caller in commands-plugin.ts immediately destructures result.continueAgent, crashing with Cannot read properties of undefined. Added a ?? {} fallback at the execution boundary.

3. fix(openrouter): add resolveThinkingProfile with xhigh for reasoning models (#74788)

OpenRouter had no resolveThinkingProfile, so /think xhigh was rejected for all models including openrouter/deepseek/deepseek-v4-pro. Added a profile that exposes xhigh for models with reasoning: true (unless explicitly excluded via isOpenRouterProxyReasoningUnsupportedModel).

4. fix(cron): prefer finalAssistantVisibleText over raw error text in task summary (#74807)

When a cron agentTurn run had only error payloads (tool call failed, agent self-corrected but never sent an explicit reply via messaging tool), fallbackSummary fell through to pickSummaryFromOutput(firstText) where firstText was the tool error. Now prefers finalAssistantVisibleText as an intermediate fallback before resorting to raw payload text.

5. fix(agents): skip tool allowlist guard for LLM-only runs (#74810)

buildEmptyExplicitToolAllowlistError raised an error when callableToolNames was empty, even when disableTools: true. LLM-only runs intentionally disable tools, so an empty callable set is expected. Added early return when disableTools === true.

Testing

Each fix is independently testable:

  • #74749: pnpm test -- src/agents/cli-backends.test.ts
  • #74800: Trigger any plugin command whose handler returns undefined
  • #74788: pnpm test -- src/agents/pi-embedded-runner/openrouter-model-capabilities.test.ts
  • #74807: pnpm test -- src/cron/isolated-agent
  • #74810: pnpm test -- src/agents/tool-allowlist-guard

🤖 Generated with Claude Code

Changed files

  • extensions/google/cli-backend.ts (modified, +2/-10)
  • extensions/openrouter/index.ts (modified, +18/-0)
  • src/agents/cli-backends.test.ts (modified, +2/-10)
  • src/agents/tool-allowlist-guard.ts (modified, +4/-0)
  • src/cron/isolated-agent/helpers.ts (modified, +10/-2)
  • src/plugins/commands.ts (modified, +1/-1)

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

Description (problem / solution / changelog)

Summary

Targeted single-fix PR.

Closes #74807

🤖 Generated with Claude Code

Changed files

  • src/cron/isolated-agent/helpers.ts (modified, +10/-2)
RAW_BUFFERClick to expand / collapse

Problem

When a Cron agentTurn job runs in an isolated session, the final summary/announcement picks the last tool error message as the task result instead of the agent's final self-corrected assistant reply.

Observed behaviour

  1. Agent runs a task that involves file editing via tool calls.
  2. First edit call fails (e.g. oldText not found).
  3. Agent recognises the error, adjusts its approach, and successfully completes the task in subsequent turns.
  4. The Cron system scans the session transcript and selects the failing tool result as the "last meaningful output" for the summary/announcement.
  5. User receives a failure announcement even though the task actually succeeded.

Root cause

The summary logic appears to prefer tool results (which are system-generated) over the agent's final assistant message when determining what to announce. This means any intermediate tool failure that the agent later overcomes is surfaced as the final status.

Expected behaviour

The summary should prefer the last assistant turn in the session as the authoritative outcome, not an intermediate tool error. If the agent's final message indicates success, the announcement should reflect success.

Suggested fix

When walking the session transcript to build the announcement:

  1. Start from the last assistant message (not the last tool/system message).
  2. If the assistant's final turn claims success, trust that over any prior tool errors.
  3. Only fall back to tool-error-based summaries if the session ends with a tool call (no final assistant reply), or the assistant explicitly reports failure.

Environment

  • OpenClaw version: 2026.4.26
  • Cron job type: agentTurn in isolated session
  • Models affected: all (framework-level issue)

Discovered during analysis of a daily-cleanup Cron job that self-corrected a file-edit error but was still reported as failed.

extent analysis

TL;DR

Modify the summary logic to prioritize the last assistant message over intermediate tool errors when determining the task result.

Guidance

  • Review the session transcript processing code to ensure it starts from the last assistant message when building the announcement.
  • Update the logic to trust the assistant's final turn claim of success over any prior tool errors.
  • Consider adding a fallback to tool-error-based summaries only when the session ends with a tool call or the assistant explicitly reports failure.
  • Verify the fix by testing scenarios where the agent self-corrects after an initial tool error.

Example

def build_announcement(session_transcript):
    # Start from the last assistant message
    last_assistant_message = next((message for message in reversed(session_transcript) if message['type'] == 'assistant'), None)
    if last_assistant_message and last_assistant_message['success']:
        # Trust the assistant's final turn claim of success
        return last_assistant_message['text']
    # Fallback to tool-error-based summary if necessary
    # ...

Notes

This fix assumes that the assistant messages have a clear indication of success or failure. If this is not the case, additional logic may be needed to determine the outcome.

Recommendation

Apply the suggested fix to modify the summary logic, as it directly addresses the root cause of the issue and ensures that the announcement reflects the actual task outcome.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Bug] Cron task summary ignores agent self-correction - picks tool error over final assistant reply [2 pull requests, 1 comments, 2 participants]