openclaw - 💡(How to fix) Fix cron run-log: hard-coded 2000-char summary truncation makes long agent outputs unreadable [1 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#69678Fetched 2026-04-22 07:49:24
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

Root Cause

This makes it hard to:

  • audit what was actually sent on a past run,
  • diagnose "did the agent produce a complete output?" vs "did delivery drop something?",
  • decide whether to manually re-trigger (which I just did, then duplicated 3 messages to a chat group because the truncated log looked incomplete).

Code Example

function pickSummaryFromOutput(text) {
    const clean = (text ?? "").trim();
    if (!clean) return;
    const limit = 2e3;
    return clean.length > limit
      ? `${truncateUtf16Safe(clean, limit)}`
      : clean;
}

---

"cron": {
  "runLog": {
    "maxBytes": "2mb",
    "keepLines": 2000,
    "maxSummaryChars": 20000   // new — default e.g. 8000 or 20000
  }
}
RAW_BUFFERClick to expand / collapse

Problem

pickSummaryFromOutput in src/cron/isolated-agent/helpers.ts hard-codes the summary length cap at 2000 chars before writing each entry to cron/runs/<jobId>.jsonl:

function pickSummaryFromOutput(text) {
    const clean = (text ?? "").trim();
    if (!clean) return;
    const limit = 2e3;
    return clean.length > limit
      ? `${truncateUtf16Safe(clean, limit)}`
      : clean;
}

(file in published bundle: dist/helpers-C968UOoJ.js, lines 18–23)

For agents whose deliverable IS the assistant text — e.g. a daily news-digest cron that produces 6–8 markdown briefings of ~400 chars each — this means the run-log is silently truncated mid-item. The actual delivered message (Feishu/Slack/etc.) is fine, but openclaw cron runs --id <id> only ever shows the first ~5 items, with the trailing .

This makes it hard to:

  • audit what was actually sent on a past run,
  • diagnose "did the agent produce a complete output?" vs "did delivery drop something?",
  • decide whether to manually re-trigger (which I just did, then duplicated 3 messages to a chat group because the truncated log looked incomplete).

Reproduce

  1. Configure a cron job whose agent reply is > 2000 chars (e.g. a markdown digest with 6+ sections).
  2. Let it run, then openclaw cron runs --id <jobId>.
  3. The summary field in every entry is exactly 2001 chars (2000 + "…"), regardless of the real output length.

OpenClaw 2026.4.14 (323493f), Windows 11.

Suggested fix

Make the limit configurable under the existing cron.runLog config group (already has maxBytes and keepLines):

"cron": {
  "runLog": {
    "maxBytes": "2mb",
    "keepLines": 2000,
    "maxSummaryChars": 20000   // new — default e.g. 8000 or 20000
  }
}

Plumb it through appendCronRunLogpickSummaryFromOutput. The 2000-char default predates the prune-by-maxBytes/keepLines logic that already bounds total file size, so per-entry truncation is now double protection — the bound on total bytes is what actually matters for disk usage.

If keeping a hard default is preferred, even bumping it to ~20000 chars (roughly one Slack/Feishu max-message worth) would cover almost every real cron summary without meaningful disk impact (maxBytes already caps the file at 2 MB).

Happy to send a PR if the direction is agreed.

extent analysis

TL;DR

Increase the summary length cap in pickSummaryFromOutput to a configurable value, such as maxSummaryChars, to prevent silent truncation of run logs.

Guidance

  • Review the cron.runLog configuration to understand the existing settings for maxBytes and keepLines, and consider adding a maxSummaryChars setting to control the summary length cap.
  • Update the pickSummaryFromOutput function to use the new maxSummaryChars setting, rather than the hard-coded 2000 character limit.
  • Test the updated function with a cron job that produces a large output to verify that the summary is no longer truncated.
  • Consider the trade-off between increasing the summary length cap and the potential impact on disk usage, given the existing maxBytes cap.

Example

function pickSummaryFromOutput(text, maxSummaryChars = 20000) {
  const clean = (text ?? "").trim();
  if (!clean) return;
  return clean.length > maxSummaryChars
    ? `${truncateUtf16Safe(clean, maxSummaryChars)}`
    : clean;
}

Notes

The suggested fix involves making the summary length cap configurable, which would allow for more flexibility in handling different types of cron jobs. However, it's worth considering the potential impact on disk usage and whether a hard default value would be sufficient.

Recommendation

Apply workaround by increasing the summary length cap to a configurable value, such as maxSummaryChars, to prevent silent truncation of run logs. This approach allows for more flexibility and control over the summary length, while also considering the potential impact on disk usage.

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 - 💡(How to fix) Fix cron run-log: hard-coded 2000-char summary truncation makes long agent outputs unreadable [1 participants]