Skip to content

$_END_LOG is named at second granularity with no PID or session id, so two SessionEnd hooks in the same second share one log file #488

Closed

Description

@fdaviddpt

Found by the spawned reviewer during lane #483 and recommended for filing in PR #486's body; filed here by the maintainer. Pre-existing, not introduced by that diff.

scripts/session-end-hook.sh names the flush log

_END_LOG="$REMEMBER_DIR/logs/autonomous/session-end-$(_remember_date +%H%M%S).log"

Second granularity, no PID, no session id. Two SessionEnd hooks for the same project ending in the same wall-clock second resolve to the same path. scripts/doctor.sh's own SessionEnd-liveness comments (#370) treat concurrently open windows as an ordinary case, so this is not a contrived race.

PR #486 hardened the immediate consequence -- its header write and the subshell redirect both append rather than truncate, so one hook can no longer clobber a sibling's already-written output -- but that makes the collision harmless, not absent. Two flushes still interleave into one file, and a reader cannot tell whose lines are whose.

Why it was not fixed there

Uniquifying the filename (a PID or session-id suffix) requires updating scripts/doctor.sh's session-end-*.log glob in its SessionEnd-liveness check, and scripts/doctor.sh was outside that lane's two files. Splitting it out was the right call.

What a fix has to move together

Interleaving is the visible symptom; the derivation #370 makes off that filename is the part that has to keep working.

Ranked

misreports. Nothing is destroyed and nothing leaks -- two runs' narratives arrive as one, and the operator reading it has no way to know.

Platform

Reasoned, not observed: the collision window is one second of wall clock on any platform, and nothing in the naming is platform-specific.

Activity

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