Skip to content

cron: run history grows indefinitely and Runs materializes the entire log #1086

Description

@PierrunoYT

Version / branch / commit

Source-reviewed on main at 99721c7.

OS and environment

Linux amd64; Go 1.26.6. AI-assisted source review. No long-duration disk-exhaustion or memory benchmark was executed.

Steps to reproduce

Suggested bounded test/benchmark, using disposable Store data:

  1. Create a cron job.
  2. Append increasing numbers of valid RunRecord entries with AppendRun.
  3. Observe runs.jsonl size and measure allocations/time for Runs after each increase.
  4. Confirm there is no retention or paging boundary as the history grows.

Expected behavior

A recurring background feature should have a bounded way to inspect recent history and a defined retention/rotation mechanism, without silently deleting history users expect to keep. The concrete policy needs maintainer agreement.

Actual behavior / source evidence

AppendRun:303-340 appends one JSON line for each run without rotation or retention.

Runs:343-364 scans the complete file and appends every valid record to a slice. The 1 MiB Scanner limit bounds one record, not total history size. Disk use grows with run count; read time and retained memory grow with the history rather than the requested recent window.

Suggested fix / regression coverage

Add a bounded recent-history/pagination path and agree on a retention policy by count or bytes. If compacting, do it atomically under the existing job lock. Verify newest records survive compaction and concurrent reads remain consistent.

Related work

#971 concerns session directories and checkpoint retention, not cron runs.jsonl. No matching cron-history report was found.

Verification

Existing go test ./... and focused race tests for internal/cron passed. Growth follows directly from the append/read loops; no OOM, disk-full incident, or measured threshold is claimed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue-approvedReviewed and approved by the core team; community PRs may implement this issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions