Repository navigation
Conversation
… from cwd write-handoff.sh and doctor.sh used an ancestor walk, bounded by the innermost git toplevel, to disambiguate which store a session's note belongs to -- structurally blind to a resumed session's hint at a sibling directory, a nested repo/submodule one level in, and a non-git sibling the walk never even entered for. SessionStart now pins the resolved REMEMBER_DIR at a session-keyed pointer outside every project store ($HOME/.remember/tmp/session-store/<session-id>), written with a plain redirect and an atomic rename, overwritten on every start including --resume. write-handoff.sh and doctor.sh read that pointer first, through one shared resolver library (scripts/lib-session-store.sh) that replaces each script's own pasted copy of the ancestor-walk logic. The ancestor walk survives only as a fallback for a session that predates the pointer, and now refuses outright when more than one candidate store matches, rather than tie-breaking by mtime -- a same-second write defeated that tie-break outright. The existing stale-hint reaper in session-start-hook.sh is extended to sweep these pointers too. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…p, Windows test, plain-language changelog 1. The session-store pointer reaper swept by "no transcript under THIS project's SESSIONS_DIR", which is correct for the per-project reaper it was modelled on but wrong for a directory shared by every project: a live session started in a DIFFERENT project had no transcript under this one's folder at all, so its pointer was deleted the moment any other project's SessionStart happened to run. Sweeps by age alone now (REMEMBER_SESSION_STORE_POINTER_MAX_AGE_S, default 7 days). 2. A start that does not (re)write the pointer -- REMEMBER_DIR_UNSAFE, or the write itself failing -- used to leave an earlier start's pointer for the same session id in place, so write-handoff.sh still read a store this start never vouched for, bypassing #1064's own unsafe-store refusal. The pointer is now deleted whenever a start does not successfully republish it. Tested (resume onto an unsafe store). 3. The Windows-path shape test lived inside a module whose own module-level skipif(win32) pytest applies to every item regardless of a class's own docstring. Moved to its own file, tests/test_session_store_shape_windows_1083.py, with no skip, and triaged the parent module's remaining blanket skip in docs/windows-skip-triage.md (the CI check that enforces that list caught the omission). 4. The pointer reaper's foreground stat-per-foreign-pointer cost is moved to the same deferred/background phase this file already uses for other cleanup that nothing downstream of the current start reads back. The comment overclaiming "no new forks" is corrected. 5. changelog.d/1083.fixed.md rewritten for a non-technical reader. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…w "bash" First CI round on windows-latest showed the literal string "bash" there resolving to the WSL launcher, which prints "Windows Subsystem for Linux has no installed distributions" and exits nonzero -- exactly the hazard tests/_bash_runner.py's own module docstring documents, and that several other test files already route around via resolve_bash()/find_git_bash(). Switched to that helper, and moved the value under test onto stdin (octal-escaped via bash_octal/printf '%b') rather than argv -- argv is not trusted on Windows either, since Git Bash rebuilds it from the raw Windows command line itself (run_bash_file's own docstring). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1083
Problem
write-handoff.shanddoctor.shresolved which project store a session's note belongs to by walking up from the current directory to the nearest git toplevel, disambiguating with a session-keyed hint file where one existed. That walk is structurally blind to three shapes:.gitat all -- the walk never even starts.A same-second write also defeated the previous freshest-mtime tie-break outright (mtime is whole seconds, worse on FAT).
Fix
SessionStartnow pins the resolvedREMEMBER_DIRat a session-keyed pointer file outside every project store:~/.remember/tmp/session-store/<session_id>. It is written with a plain redirect into a temp file in the same directory, then an atomic rename -- overwritten on every start, including--resume.write-handoff.shanddoctor.shnow read that pointer first, through one new shared library (scripts/lib-session-store.sh) that both scripts source -- replacing the pasted copy of the ancestor-walk logicdoctor.shpreviously carried. When the pointer is present, resolution never guesses from the current directory at all, closing all three gaps above.The ancestor walk survives only as a fallback for a session that started before this pointer existed. In that fallback, when more than one ancestor claims the session,
write-handoff.shnow refuses outright (REFUSED: more than one candidate store matched this session...) rather than guessing by mtime.doctor.sh, whose whole job is to always report something, prints aWARNinstead and still shows its best-effort fallback.The existing stale-hint reaper in
session-start-hook.shis extended with a second sweep for these new pointers (a separate function, since the pointer's filename shape -- flat, under a directory shared across every project -- differs from the existing<prefix>.<session-id>sweep under one project's owntmp/).The
REMEMBER_DIR_UNSAFEguard (#1064/#920) is respected: the pointer is never written when the resolved store is unsafe, and a pointer value is re-validated against the same shape predicate before being trusted.Sequencing
The issue's own sequencing note asked that this not land while
session-start-hook.shwas being concurrently edited by the #1046/#1047/#1052 and #1079/#1060 lanes. Both are already merged intomain(commits735e65cande0379ca), so this branches from a base where that condition is satisfied.Tests
New file
tests/test_session_store_pointer_1083.py(21 tests) covers all six cases named in the issue's scope comment, each with a positive control:cdelsewhere entirely.~/.remember/{slug}store.TestWindowsPathShapeRunsOnEveryPlatform) that is notskipif(win32)-- it drives the shared library's own shape predicate directly as pure bash string matching, which runs identically on every platform, includingwindows-latest.tests/test_write_handoff_subdirectory_project_776.py'sTestFreshestHintWinsOnResume1058Reviewclass is updated: its two ambiguous-candidate tests now assertREFUSED(the #1083 ruling) instead of the old freshest-mtime tie-break; its third, single-candidate test is unaffected and unchanged.tests/test_locale_ranges_695.py's allowlist line numbers forscripts/write-handoff.shandscripts/doctor.share updated to match where theirlocal LC_ALL=C-guarded bracket ranges moved to after this diff's insertions.Red before the fix
Before the pointer mechanism existed, a manual reproduction of the nested-repo and non-git-sibling cases misrouted the note to the wrong (or no) store; the two
TestFreshestHintWinsOnResume1058Reviewtests failed with the old expectations once the ambiguous-refuse behavior was wired in (AssertionError: ... REFUSED: more than one candidate...where the test expectedreturncode == 0).Green after the fix
Re-run with
PATHforced to/bin:/usr/bin(bash 3.2, macOS's shipped bash) -- same 549 passed. Each shipped script also syntax-checked clean under/bin/bash -n(bash 3.2).The hook-size budget (
python3 .github/scripts/compile_hooks.py) is unaffected:session-start-hook.shcompiles to 106362 bytes, under the 122880-byte cap, since the shared resolver library is sourced only bywrite-handoff.sh/doctor.sh(neither is one of the four budget-constrained hook scripts) --session-start-hook.shitself only gained the small inline pointer-write and reaper-extension blocks.Not run locally
The full
pytestsuite andcheck_release_tree.pyagainst a real built tree were not run locally -- CI covers the full matrix; the targeted set above, plus the cross-cutting guard tests the issue's own brief named, is the local evidence.🤖 Generated with Claude Code
[AI-generated]