Skip to content

Agent ends silently after message tool without executing next planned tool #5336

@tiubak

Description

@tiubak

Environment

  • OpenClaw version: v2026.1.29 (latest stable as of 2026-01-31)
  • Commit: 6522de6
  • Model: zai/glm-4.7
  • Thinking: low
  • Runtime: Linux 6.8.0-94-generic
  • Session: agent:main:main (direct chat)
  • Message channel: telegram
  • Capability: inlineButtons

Description

Summary: The agent execution flow incorrectly determines tasks are "complete" after a message tool is called, ending the run without executing the next planned tool. This causes tasks to be dropped silently with no error reporting.

Steps to Reproduce

  1. User requests multi-step workflow (e.g., "Generate image, video, and text")
  2. Agent successfully executes step 1 (image generation) ✅
  3. Agent successfully executes step 2 (video generation) ✅
  4. Agent executes step 2a (status check via exec) ✅
  5. Agent executes step 2b (update via message tool) ✅
  6. Agent ends run without error
  7. Next planned step (text generation) is never executed
  8. User must prompt again to trigger completion

Expected Behavior

Agent should:

  1. Execute all planned steps in sequence
  2. Only end when all steps complete
  3. Or explicitly signal completion/end state
  4. Report errors if a step fails

Actual Behavior

Agent:

  1. Ends run after message tool without waiting for next step
  2. No error is logged
  3. No timeout or failure indication
  4. Task is silently dropped

Log Evidence

From system logs (redacted for paths):

{"time":"2026-01-31T05:02:17.628Z", "tool":"exec", "action":"start", "toolCallId":"call_bed6885e670f42cab059d36b"}
{"time":"2026-01-31T05:02:17.655Z", "tool":"exec", "action":"end", "toolCallId":"call_bed6885e670f42cab059d36b"}
{"time":"2026-01-31T05:02:38.438Z", "tool":"message", "action":"start", "toolCallId":"call_4ef9a0925db1458fa5647d6d"}
{"time":"2026-01-31T05:02:41.458Z", "tool":"message", "action":"end", "toolCallId":"call_4ef9a0925db1458fa5647d6d"}
{"time":"2026-01-31T05:02:54.280Z", "action":"agent end", "runId":"fb784cdd-984c-46fd-90bb-e41dd365c405"}
// NOTE: No exec tool start event for text generation occurred!

Critical Gap:

  • Message tool ended at 05:02:41.458
  • Agent run ended at 05:02:54.280
  • No tool execution happened in between
  • Text generation never executed

Related Issues

  • Partial fix exists: Commit 8ea8801d0 (2026-01-24)
    • Fix description: "Agents: show tool error fallback when last assistant turn only invoked tools (prevents silent stops)"
    • This fix is present in the installation
    • But the bug still occurred after this fix was applied
    • Suggests fix doesn't cover all cases or there's a regression

Impact

  • Severity: Critical - multi-step workflows fail silently
  • Frequency: Occurs in multi-step workflows when message tool is used
  • Workaround: Dedicated sub-agents work reliably (isolated process)
  • User Impact: Requires manual intervention/re-prompting to complete tasks

Additional Context

This appears to be a state machine issue where:

  1. Agent transitions to "DONE" state prematurely
  2. After calling message tool (not exec or other tools)
  3. Without validating that all planned steps executed
  4. Multiple paths to "DONE" state exist without verification

Workaround

Currently using dedicated agent at /root/.openclaw/workspace/skills/pollinations-agent/ which:

  • Runs in isolated process (cannot be dropped by main session)
  • Validates all outputs before claiming completion
  • Works reliably for all generation tasks
  • Proves the issue is specific to main session's execution flow

Console Output

Session: agent:main:main
Model: glm-4.7
Tokens: 48k/205k (24%)
Gateway: Running
No errors reported

Debugging Attempts

Attempted:

  • System log analysis (found evidence of agent end)
  • Changelog review (found related fix from Jan 24)
  • Issue search (no exact match for this specific case)
  • Version verification (confirmed fix is installed)
  • Environment status check (no errors reported)

Scope of Bug

Confirmed to affect:

  • Main session: agent:main:main
  • Message channel: Telegram
  • Tool: message tool specifically
  • Pattern: Multi-step workflows with mid-workflow updates

Confirmed NOT to affect:

  • Single-step commands
  • Isolated sub-agents (pollinations-agent works perfectly)
  • Direct exec commands
  • Tool calls before message tool

Additional Context

This bug affects:

  • User productivity: Requires manual intervention to complete tasks
  • Agent reliability: Silent failures reduce trust
  • Multi-step workflows: Common pattern for complex tasks
  • Development workflows: Affects testing and debugging

Console Output

Additional Observations

  1. Message tool appears to be trigger: The bug consistently occurs after a message tool call, suggesting this tool may be triggering premature completion
  2. No timeout indication: 21-second gap between exec end (05:02:17) and message start (05:02:38) with no error logged
  3. Workaround verification: When using dedicated pollinations-agent (isolated process), all three generations (image, video, text) complete successfully
  4. Session state: Active session shows healthy token usage (24%) with no resource warnings

Reproduction Steps

  1. Send multi-step request to agent: "Generate image, then video, then text"
  2. Observe agent planning phase (may show "I'll generate...")
  3. Wait for image generation to complete (exec tool)
  4. Wait for video generation to complete (exec tool)
  5. Agent sends status update: "Now generating text with Pollinations..." (message tool)
  6. BUG OCCURS HERE: Agent run ends without calling text generation API
  7. No further tool execution happens
  8. User must send new message to trigger completion
    on types

Additional Notes

  • Token usage is well within limits (24%)
  • No resource exhaustion indicators
  • Clean "agent end" without error
  • Silent failure is hallmark of this bug
  • Affects multi-step workflows specifically
  • Pattern: Message tool → premature completion

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions