Skip to content

Log retention for logs/autonomous/ lives inside save-session.sh's RUN_NDC block, so features.ndc_compression=false disables housekeeping that has nothing to do with compression #498

Closed

Description

@fdaviddpt

Raised at maintainer review of the #487/#488 lane, which found it and correctly declined to widen its diff to cover it. Pre-existing -- the gating predates both of those issues.

Verified in the tree, 2026-09-02 at 53bd09b

scripts/save-session.sh:1053:

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

That fi closes the block opened at :781:

if [ "$RUN_NDC" = true ]; then

and RUN_NDC is set false at :736 when features.ndc_compression is not true. So an operator who turns compression off also turns off the only retention logs/autonomous/ has, and nothing tells them that -- the option's name and its README description are both about compression.

Why it matters more now than it did last week

Before #483, the sweep reclaimed every ordinary session-end-*.log because they were empty. #483 seeded them with a header (correctly -- the sweep was deleting the log its own parent was writing into), which made them non-empty by construction. #487 is the follow-up that gives the directory age-keyed retention instead of emptiness-keyed.

None of that reaches an install with features.ndc_compression=false. It gets neither sweep, and autonomous_log_retention_days -- a setting whose entire purpose is to bound that directory -- silently does nothing there. A retention setting that is configured and inert is a worse state than no setting at all, because the operator has been given a reason to believe the directory is bounded.

What a fix has to decide

Not obvious, which is why the lane filed rather than guessed:

  • Move both sweeps out of the RUN_NDC block, so housekeeping runs on every save regardless of compression. Cheapest, but it makes the sweep run at save frequency rather than at NDC's 1-hour cooldown -- a find over one directory per save, which is probably fine and should be measured rather than assumed.
  • Give housekeeping its own cooldown marker, independent of last-ndc.ts. More code, keeps the frequency bounded, and stops the two concerns sharing a brake.
  • Leave the coupling and document it. Weakest -- it keeps a setting that is inert in a configuration the README presents as ordinary.

Whichever way it goes, the pin is the same shape: an install with features.ndc_compression=false and an old non-empty log in logs/autonomous/ must still reclaim it. That test cannot pass today.

Ranked

fails-to-preserve, weakly, plus a misreports edge: nothing is lost, but autonomous_log_retention_days reads as a working bound in a configuration where it is dead, and that misreading is the part an operator acts on.

Platform

Not platform-specific -- shell control flow. Read on macOS/arm64 (Darwin 24.3.0) at 53bd09b; it is a property of the source, so it holds everywhere.

Activity

  1. added
    cohort-4
    on Sep 1, 2026
  2. self-assigned this
    on Sep 3, 2026
  3. added
    priority:low
    on Sep 3, 2026
  4. added 2 commits that reference this issue on Sep 3, 2026
  5. added 2 commits that reference this issue on Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

cohort-4priority:low

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions