ductor icon indicating copy to clipboard operation
ductor copied to clipboard

TASKMEMORY.md silently truncated at 4000 chars

Open nzshock opened this issue 8 months ago • 2 comments

Problem

When a task completes, the content of TASKMEMORY.md is appended to the result delivered to the parent agent. However, if TASKMEMORY exceeds 4000 characters, it's silently truncated with no warning logged.

For complex research tasks that write detailed findings to TASKMEMORY, this means the parent agent receives incomplete results without knowing data was lost.

Suggested fix

Log a warning when truncation occurs, e.g.:

if len(memory_content) > TASKMEMORY_LIMIT:
    logger.warning(
        "Task %s TASKMEMORY truncated from %d to %d chars",
        task_id, len(memory_content), TASKMEMORY_LIMIT,
    )

Optionally, also append a note to the delivered result:

[Note: TASKMEMORY was truncated from X to 4000 chars. Full content at workspace/tasks/<id>/TASKMEMORY.md]

This lets the parent agent know to read the full file if needed.

Environment

  • ductor v0.15.0
  • Windows 11, Python 3.13

nzshock avatar Mar 26 '26 08:03 nzshock

Fixed in v0.16.0 (commit 3eb464b). TASKMEMORY.md truncation at the 4000-char limit now emits an explicit warning log line (was silent before). The limit itself stays — raising it or switching to chunk-writes is a scope expansion that needs more thought. At least you'll now see when it's kicking in. Also (v0.16.0 MED fix): TASKMEMORY content is now preserved on cancelled tasks too, not just done — the truncation warning applies there as well.

PleasePrompto avatar Apr 21 '26 10:04 PleasePrompto

Fixed in v0.16.0 (commit 3eb464b).

TASKMEMORY.md truncation at the 4000-char limit now emits an explicit warning log line (was silent before). The limit itself stays put for now — raising it or switching to chunk-writes is a scope expansion that needs more thought. At least you'll see when it's kicking in. Grouped with #90 into the same task-persistence commit. A v0.16.0 late-stage fix also ensures TASKMEMORY is preserved on cancelled tasks too, not just done — so the warning applies there as well.

PleasePrompto avatar Apr 21 '26 10:04 PleasePrompto