Repository navigation
[2.7.3] - 2026-11-15
Patch on 2.7.2: improve session-affinity pin handling under concurrent turns
and update a development-tree dependency for a security advisory.
Fixed
-
A session pin could be silently dropped under concurrent turns. With
sessionAffinityon, a shim that waited the full 1 s for the pin store's
lock gave up without writing and exited normally, so the session's next turn
was routed by the pool pick, or by an older pin, instead of the account that
had just served it. Such a writer now parks its pin in a
pool-<id>.sessions.json.pending-*file: readers combine parked pins with
the store (the pin served latest wins) and the next writer to take the lock
folds them in and removes them. A read opens every parked file of its own
session and no other session's, so no number of parked sessions hides a pin.
Parked files stay bounded while a live holder keeps the lock: a session
normally keeps one, holding its latest pin; files past the TTL are removed;
and the limits are 32 per session and 1032 in total, with the exceptions
detailed below. The store also takes the same lock as shim state, so a live
holder's lock is no longer removed by age and a dead holder's is recovered
at once. The wait stays bounded at 1 s.
(#178) -
A read could miss a session's pin while newer pins for it were being
parked. A parked pin replaces the session's older parked file. A read that
listed the older file and found it gone listed again, at most four times; if
each new listing was replaced in turn, the read returned an older stored pin
or none, although a valid pin was on disk throughout. A read now returns a
pin at least as recent as the session's latest valid pin when the read
began, whatever another process holds or however long it stops, for every
read during which fewer than 32 pins of its session are parked (see the
limits below). The read never waits. How:- A parker removes a parked file, for any reason (superseded, past the TTL,
during trimming past 1000 files), only under a short lock for that file's
session (pool-<id>.sessions.json.parked-<session key>.lock), tried once without
waiting. When the lock is busy the file stays for the next parker. - A read that finds a listed file gone, with nothing it read at least as
recent, announces itself with a marker
(pool-<id>.sessions.json.parked-<session key>.reader-<pid>-<random>.lock)
and lists again. A parker holding the session's lock removes nothing of
that session while a live reader's marker is there. Only the one parker
that already held the lock when the marker appeared can still remove
files, from one listing, oldest first; three more listings always include
one that settles the read under these removal rules. The marker goes when
the read returns; one left by a reader that died is removed by the next
parker. A read that loses no file writes nothing and takes no lock, as
before. - A read counts a pin served after its caller's clock reading: up to 60 s
ahead of that reading or of the clock when the read lists its files,
whichever is later (exactly 60 000 ms ahead counts, 60 001 ms does not).
Before, a read treated any pin ahead of its own reading as no pin, which
discarded the pin a concurrent turn had just parked.
Limits, stated plainly. Parked files are bounded whatever another process
holds and however long it is stopped: one session has at most 32
(MAX_SESSION_PARKED), and there are at most 1032 in all
(MAX_PARKED_FILES: the store's 1000-session bound plus one session's
worth). A writer counts the files before it parks. What gives way at a
bound:- While a session is being read or trimmed its superseded files are not
removed, so it can hold more than one, and the total can pass 1000 by
such files. A reader that stopped keeps its marker, and that protection
lasts until the session has 32 files. The next write of that session then
removes the superseded ones under the session's lock, marker or not,
keeps the file with the latest pin, and parks its own. So the read
guarantee above holds for every read during which fewer than 32 pins of
its session are parked; a read raced by 32 or more may end with the
latest pin it saw. - If that session's lock is itself held by a process that does not let go,
nothing of the session can be removed, and the write is refused: no file
is written, the session's latest parked pin stays readable, and the shim
says so on stderr ([multi-clawd shim] session pin not recorded: ...,
naming no session, account or path). The turn is not affected. The
session's next turn is routed by the pin that is still parked. - If the total is at 1032 after the usual trim (several sessions' surplus
is behind locks or markers that are not released), the write is refused
in the same way. A reader's protection never gives way for the total, and
no session loses its only parked pin to another session's surplus. - The count and the write are two steps, because a park below the bound
takes no lock. A turn stopped between them still writes its one file when
it resumes, so each bound can be passed by one file for each turn stopped
at exactly that point. The surplus stays without growing until that
session's lock is free; the next park then trims it.
Parked pins reach the store only when a writer takes the store lock: while
a process keeps that lock, nothing is folded, and the bounds above are what
limits the files. No live holder's lock is removed, by age or otherwise;
parkers remove files only under their session's lock; a store-lock holder
removes only files folded into a committed store; no writer overwrites
another's file. A pin that passes the TTL, falls outside the 1000 most
recently served sessions, or is more than 60 s ahead of the clock of the
writer that rewrites the store ends there, as before; a read running across
that moment may return without it. A read ends after four listings with the
latest pin it saw only if the state directory refuses the marker file,
parked files are deleted by something other than multi-clawd, or its
session reaches the 32-file bound while it runs. Nothing is signalled or
killed, and nothing waits longer than before. (#183, #186) - A parker removes a parked file, for any reason (superseded, past the TTL,
-
A session pin served earlier could replace one served later. A writer
delayed past a newer write for the same session overwrote the newer pin with
its own. The pin served latest now wins whichever writer arrives last. (#178) -
A session whose id is a name every object inherits lost its pin. With
sessionAffinityon, a session id such asconstructor,toString,
hasOwnPropertyorvalueOf(all accepted as--session-idand--resume
values) was looked up in a plain object, where it found an inherited
function instead of "no pin". A successful turn then stored nothing and
returned normally, and a read returned that function instead of a pin or
nothing. v2.7.2 stored and read these ids; the fault came in with the
ordering fix above and was never released. Pin dictionaries now have no
prototype and every lookup is an own-property check: the write, the fold of
parked pins, the read, and the trim of parked files. Session ids that are
UUIDs, which is what Claude Code issues, were never affected. (#186)
Repository
- Updated the development-tree-only
@hono/node-serverlockfile record from
2.1.5 to 2.1.6 for GHSA-jpvv-r467-5p4w / CVE-2026-126210, and raised the
committed-lockfile guard floor.package.jsonand runtime dependencies are
unchanged; this does not establish exposure in an installed plugin. (#182)