Skip to content

[Bug]: Write tool reports error in isolated cron agentTurn jobs despite file being successfully created #30773

@gchahrouri

Description

@gchahrouri

Summary

In isolated agentTurn cron jobs, the write tool consistently reports a failure (shown as lastError and lastDeliveryError in cron job state), but the file is actually created successfully on disk. This causes consecutiveErrors to increment on every run even though the job completed its work correctly.

Steps to Reproduce

  1. Create a cron job with sessionTarget: "isolated" and payload.kind: "agentTurn"
  2. In the agent turn, instruct the agent to write a file to a path within an agent workspace (e.g. /home/user/agents/project/agent/memory/DATE.md)
  3. Observe: the file is written correctly to disk
  4. Observe: cron job state shows lastRunStatus: "error" and lastError: "⚠️ ✍️ Write: to ~/agents/.../memory/DATE.md (NNN chars) failed"

Expected Behavior

If the file is written successfully, the job should report lastRunStatus: "ok". The error state should only trigger if the write genuinely failed.

Actual Behavior

Job reports error on every run. consecutiveErrors increments indefinitely. Files exist on disk with correct content. Example from a real job:

{
  "lastRunStatus": "error",
  "lastError": "⚠️ ✍️ Write: `to ~/agents/always-invert/cv/memory/2026-03-01-morning.md (682 chars)` failed",
  "consecutiveErrors": 2
}

Verified the file exists and contains correct content:

$ cat /home/george-agent/agents/always-invert/cv/memory/2026-03-01-morning.md
# ai-cv Morning Standup — 2026-03-01
...

This affects all isolated agentTurn cron jobs that write memory files — tested across 5 separate jobs (ai-cv, ai-infra, ai-data, ai-sim morning/nightly standups). Every job shows the same pattern.

Additional Notes

  • The Telegram message tool calls in the same jobs succeed without error
  • The write path uses ~/agents/... (tilde expansion) — possible the sandbox reports a path resolution failure even after successfully writing
  • Issue may be related to Edit tool does not expand ~ (tilde) in file paths #30669 (Edit tool does not expand ~ in tilde paths) — write tool may be resolving the path correctly for the actual write but failing a post-write verification step against the unexpanded path

OpenClaw Version

2026.2.24

Operating System

Ubuntu (Linux 6.17.0-14-generic x64)

Install Method

npm global (npm install -g openclaw)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions