Repository navigation
fix: session_close honours or refuses an explicit session_id; gitmem_session_id alias (GIT-122) - #69
Merged
Conversation
Member
Author
|
Full Same counts as the GIT-123 branch alone (#68). |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ip session_id (GIT-122) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ion; hook and templates say to include session_id (GIT-122) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
nTEG-dev
force-pushed
the
fix/git-122-session-close-id-invariant
branch
from
October 5, 2026 00:06
9c1b604 to
e17888b
Compare
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.
What
Fixes GIT-122:
session_closemust honour or refuse an explicit session id. Root cause (GIT-122, 19:07Z comment): on 2026-10-04 the Claude remote-devices bridge strips a parameter namedsession_id, so gitmem received no id, silently fell back to its registry-bound session, and overwrote an already-closed session (ed6b400e). Server log at 13:39Z:Recovered session_id from registry: ed6b400e, a path that only runs when no id arrives.Stacked on #68 (GIT-123, the e2e sandbox fix; that commit is included here). Once #68 merges I rebase and this diff is the two GIT-122 commits only.
Changes (
src/tools/session-close.ts, schema/types/tool definition)gitmem_session_idalias: same meaning assession_id, under a name a proxy won't claim. Both given and different → refused. The tool definition now requires onlyclose_type.reclose: true. A close that only partly persisted (threads not synced) is flaggedpartial_persistand stays retryable. Free-tier path gets the same rule.sessions/<id>/closing-payload.jsonwins when present and is refused if it names another session. The shared rootclosing-payload.json(still what the Stop hook andgitmem initpoint at) is read for one release when itssession_idnames the closing session, whatever the number of live sessions; refused if it names another; with nosession_idit is used only while a single session is live, otherwise ignored with the "not found at " message. The Stop hook text,gitmem inittemplates, the agent templates andsession_start's payload schema now tell agents to include"session_id", so hook and server agree under concurrent sessions.Tests (+24 unit in
session-close-id-invariant.test.ts; 1 updated; +1 hook test)Written first and failing on main (13 of the 20 fail there; the others are regression guards, e.g.
reclose: trueaccepted, partial-persist retry, explicit A while bound to B). Covers (incl. root payload with a matching id consumed with two live sessions, mismatched refused, ownerless ignored, and a test that runs the real Stop hook, follows its instruction literally and closes through the server's reader): A + payload carrying B refused; closed session refused /recloseallowed; no id with two live sessions refused; payload mismatch refused; per-session payload read and B's payload untouched; legacy fallback only when one session is live; full id in result and display; stderr log; alias alone, both equal, both different, malformed, logged.hooks/tests/test-hooks.sh: the new assertion passes; 2 "not detected" tests fail only on a machine that has agitmembinary on PATH and pass in CI (stock PATH).Known, unrelated
7 e2e tests (
user-journey6,organic-discovery1) start realclaudesessions via the Agent SDK and time out (90s/180s). Not caused by this change; undiagnosed. Full e2e summary lines are in the PR comments.Not merged, tagged or published; Chris decides. The full rollout of
gitmem_session_idto other tools is GIT-103.🤖 Generated with Claude Code