Skip to content

Cron job result serialization fails on special characters in edit tool arguments #67488

@xianningqixi

Description

@xianningqixi

Bug Description

Cron job daily-memory-review reports Expected ',' or '}' after property value in JSON at position 492 (line 1 column 493) even though the agent task completes successfully.

Reproduction

  1. Set up a cron job with sessionTarget: isolated and delivery.mode: announce
  2. The agent uses the edit tool on a markdown file containing:
    • Chinese quotation marks (...)
    • Markdown bold syntax (**...**)
    • Mixed CJK + ASCII content
  3. The agent completes all operations successfully (files written, delivery sent)
  4. The cron framework marks the job as error with the JSON parse error

Expected Behavior

Job should be marked as ok since the agent completed successfully and delivery was sent.

Actual Behavior

  • lastRunStatus: "error"
  • lastError: "Expected ',' or '}' after property value in JSON at position 492 (line 1 column 493)"
  • lastDeliveryStatus: "delivered" (delivery actually succeeded)
  • consecutiveErrors: 1

Details

The error appears to occur in the cron framework's post-processing / result serialization step, not during agent execution. The JSON parse error at position 492 on line 1 suggests a single-line JSON string is being parsed and failing on special characters from the edit tool's oldText/newText arguments.

Environment

  • OpenClaw version: latest (as of 2026-04-16)
  • OS: Ubuntu Linux 6.8.0
  • Node: v22.22.1
  • Cron job config: agentTurn payload, isolated session, announce delivery to Telegram

Cron Job State (from jobs.json)

{
  "id": "621e8e50-da09-4ac1-bb47-8f1428af832a",
  "name": "daily-memory-review",
  "lastRunStatus": "error",
  "lastDurationMs": 120311,
  "lastDeliveryStatus": "delivered",
  "consecutiveErrors": 1,
  "lastError": "Expected ',' or '}' after property value in JSON at position 492 (line 1 column 493)"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    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