Skip to content

save-session never advances the saved position past an early exit, so a low-human-turn session re-extracts and bails forever #147

Closed

Description

@fdaviddpt

Split out of #125. v0.8.5 fixed the fork storm (post-tool-hook.sh now consults the last-save-ts cooldown marker before forking), but that is the symptom. The cause #125 and @VictorVvdl's comment both identify is still live, and it is the one that actually costs users their memory.

The invariant that's wrong

scripts/save-session.sh writes the cooldown marker at :128, before the gates:

:126  extract
:128  date +%s > "$COOLDOWN_MARKER"     # throttle signal — always written
:131  [ "$EXCHANGE_COUNT" -eq 0 ]  && exit 0
:133  [ "$HUMAN_COUNT" -lt "$MIN_HUMAN" ] && exit 0
...
:200  save-position                    # only reached on success
:208  save-position

Every early exit and every failure (the min_human gate, EXCHANGE_COUNT == 0, a Haiku error, any set -e/ERR abort) sits upstream of both save-position calls. So the saved position never advances, LAST_LINE stays at its old value, and the next run re-extracts the same span and dies the same way — once per cooldown window, forever.

Consequences, both confirmed in the wild:

Direction

Advance the read position as soon as extraction succeeds, independently of whether Haiku runs or any gate trips. A no-work session, an under-threshold session, and a failed summarization should all leave the cursor where the transcript actually ends — the throttle signal and the write that clears it must not sit on opposite sides of an early exit.

Care needed on: a genuinely unsummarized span must not be silently lost when the next session does have enough human turns (either carry the span forward, or accept it — decide explicitly and document it), and the IS_SKIP / malformed-entry drop paths from #119 must keep advancing too.

Recovery for anyone stuck today

@VictorVvdl's workaround — bootstrap the position manually so extraction becomes incremental again:

SID=<your-stuck-session-uuid>
JSONL=~/.claude/projects/<slug>/$SID.jsonl
python3 -c "import json; json.dump({'session':'$SID','line':$(wc -l < \"$JSONL\")}, open('$HOME/.remember/tmp/last-save.json','w'))"

Acceptance

  • Position advances after a successful extract, regardless of gate/summarizer outcome
  • Regression test: a session with HUMAN_COUNT < min_human run twice does not re-extract the same span the second time
  • Regression test: a failing Haiku call still advances the position (no re-extract loop)
  • --dry-run still does not advance the position

Reported originally by @KyleUnlock, with the month-long macOS repro and root-cause generalization from @VictorVvdl.

Activity

  1. added
    bug
    on Jul 25, 2026
  2. added a commit that references this issue on Jul 27, 2026
    3988e51
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions