Skip to content

After #483's fix, logs/autonomous/session-end-*.log is never reclaimed: the -empty sweep was that directory's only retention #487

Closed

Description

@fdaviddpt

Raised at maintainer review of PR #486 (#483), not by the lane. Not blocking that merge -- the fix it comes from is correct and the cost here is small and bounded per-session -- but it should not go unfiled.

What the fix changes

#483's fix seeds $_END_LOG with a one-line header before the flush subshell starts, so save-session.sh:1022's housekeeping

find "${REMEMBER_DIR}/logs/autonomous" -name "*.log" -empty -delete 2>/dev/null

no longer matches the log its own parent shell is writing into. That is the right fix for the defect.

What it makes worse

I grepped scripts/*.sh and pipeline/*.py for anything else that deletes, prunes or ages out files under logs/autonomous/. That -empty -delete is the only retention mechanism the directory has -- there is no mtime sweep, no count cap, no rotation.

So before the fix, every session-end-*.log from an ordinary successful run was reclaimed on the next flush. After it, every one of them is non-empty by construction and nothing ever removes it. One file per session, forever.

Measured in two live stores on this machine, 2026-09-01:

~/.remember/logs/autonomous           3 files: 3 session-end-*, 0 non-empty
<project>/.remember/logs/autonomous  17 files: 15 save-*, 2 session-end-*, 3 non-empty

The second store is the useful one: 12 of its 15 save-*.log are empty, so the sweep is doing real work on that class and will keep doing it. session-end-*.log is the class this fix moves out of the sweep's reach permanently.

Why it is worth a line rather than a shrug

The files are one line each, so this is not a disk problem on any realistic timescale. It is a legibility problem, and it is the same one #483 is about from the other side: #370's SessionEnd-liveness check in scripts/doctor.sh uses the presence of session-end-*.log as its proof that a flush ran. An unbounded, never-reclaimed pile of those makes "a flush ran recently" progressively harder to read off the directory, and the issue's own report of 164 stale files is what that looks like when it has been accumulating.

Ranked

fails-to-preserve, weakly -- nothing is lost and nothing misreports today. It is a retention gap opened by an otherwise-correct fix, and it is filed so the next person reading that directory knows the sweep no longer covers it.

Direction, not a prescription

A count cap or an mtime sweep over logs/autonomous/ that covers both file classes, rather than a rule keyed to emptiness. Emptiness was always a proxy for staleness and it is the proxy that produced #483 in the first place.

Platform

Measurement observed on macOS/arm64 (Darwin 24.3.0). The mechanism is one find invocation and the absence of any other, so I expect it identically everywhere -- that half is reasoned.

Activity

  1. added a commit that references this issue on Sep 1, 2026
  2. fdaviddpt commented on Sep 1, 2026

    @fdaviddpt
    ContributorAuthor

    Independently reproduced by the v0.25.0 release audit (round 1), which reached this from the other direction -- as a composition defect across #486 and the pre-existing sweep, invisible in either commit alone. Recording its control here because it is stronger evidence than the original filing had.

    Exercised, not reasoned:

    before: save-120000.log  session-end-000000.log  session-end-183000.log
    after : session-end-183000.log
    find logs -name "memory-*.log" -mtime +7 | wc -l  ->  0
    

    The seeded log survives, both empty ones are swept, and rotate_logs (scripts/log.sh:1182) matches nothing here -- its selector is -name "memory-*.log" in REMEMBER_LOG_DIR, which never covers logs/autonomous/. The auditor also grepped the whole tree for autonomous (38 hits across 16 files) looking for any other cleanup path and found none, which is the negative half this issue asserted but had not measured.

    One correction to my original text worth having on the record: I ranked this fails-to-preserve, weakly. The auditor rejected that row and returned the finding unranked, on the grounds that the defect is a failure to remove and that row would send a reviewer to a preservation path that is not involved. It rejected misreports too -- scripts/doctor.sh:453-455 reads these files and reads them correctly. Its conclusion was that no row covers unbounded resource growth. I agree, and I am not opening a table row for it on one instance.

    Not blocking v0.25.0, which ships without the fix. PR #499 carries it and is failing its Windows leg for reasons unrelated to the retention change itself -- see that PR.

  3. added
    cohort-4
    priority:low
    on Sep 1, 2026
  4. added 5 commits that reference this issue on Sep 3, 2026
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

    cohort-4priority:low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions