Skip to content

v0.1.14 — sessions that ended without saying so

Choose a tag to compare

@maksymenkoml maksymenkoml released this 30 Aug 06:42
· 2052 commits to main since this release

Install or upgrade:

npm install -g agents-can-communicate@0.1.14
acc install

This upgrade requires deleting your store. There is no migration, and that is deliberate — see below.

What it was

A session record is opened by a hook at session start and closed by one at session end. When a client never fires the second — it has no such event, or it was killed with its terminal — the record stayed state: "open" forever. Presence decayed to stale and stopped there, because nothing could ask whether the process still existed.

One real workspace had accumulated 227 of them. acc doctor reported the pile as "not answering", which reads as a fault and is not one: it is the same fact the roster shows, phrased as a health problem.

The fix

Presence now pairs the process with two floors, the way the writer lock already reclaims a lock that is dead and old.

offline   state is closed
offline   the recorded pid is confirmed dead        → exact, immediate
offline   no pid, and silent past thirty minutes    → we cannot tell
offline   silent past twenty-four hours, whatever the pid says
online    within the session's own cadence × 3      → unchanged
stale     everything else

The second floor is not redundant: pids are recycled, so a dead session's number can come back attached to something unrelated and answer forever.

null means nobody knows — no process table, or an ancestry that did not resolve — and is never read as dead. The chain fails open end to end.

What each client actually gets

The pid comes from walking the process ancestry until the adapter's declared binary appears in ps -o comm=, and the operating system reports the interpreter's name for a script:

Client Pid resolves Effect
codex, claude_code yes — native executables a dead session leaves the roster immediately
gemini_cli no — gemini.js runs through node leaves after thirty minutes of silence
kimi almost certainly not, unmeasured — a Node CLI leaves after thirty minutes of silence

So the age floor fixes the pile-up for all four clients, from "never leaves" to "leaves after thirty minutes". The pid is what makes removal immediate, and today for two of them. docs/CAPABILITIES.md carries the per-client table rather than implying uniform reach.

Replacing a session id is stricter than presence

Presence is a reading, never an edit — acc status --all still lists everyone who was ever here. But one consumer takes something away, and there the cost is asymmetric:

  • A wrong presence verdict costs a roster row, and self-corrects the moment that session next takes a turn.
  • A wrong replacement takes a live session's generation, after which its own heartbeats fail with exit 5. Nothing undoes that.

So only a pid confirmed dead is authority to replace an id. Silence, however long, is not. A claim is still released only by lease expiry or an explicit force release. A workstream coordinator and a task assignment are contestable once the holder reads offline, because taking either is reversible — and that is a second fix hiding in the first: before this, an open session could never classify offline, so a coordinator whose process was killed left its workstream permanently uncontestable.

Deleting the store is the upgrade path

SCHEMA_VERSION is 2 and STORE_VERSION moves with it, so a store written by 0.1.13 or earlier is refused before a single record is read, with one plain unknown store version.

That refusal is the feature. Without it the failure was three-way and none of it said what to do: acc status appeared to work, heartbeatSession threw deep inside on unknown schemaVersion: 1, and acc doctor filed every record under corrupt.

rm -rf "~/Library/Application Support/acc/workspaces"     # macOS
rm -rf "${XDG_DATA_HOME:-~/.local/share}/acc/workspaces"  # Linux

Known, and not fixed here

tests/process/store-concurrency.test.mjs can fail under heavy machine load with exit 5 another writer holds the store lock. It predates this release: acc attach resolves no pid, so that test's processes are untouched by this work. The defect is that the writer mutex's budget is a retry count rather than a wall-clock deadline — 50 × 20 ms, exhausting at about 1066 ms — so it is nearly load-invariant while the critical section it waits on scales with I/O pressure. Its own change.

Record

Built from 0badbe8
Tarball agents-can-communicate-0.1.14.tgz, 153 KB, 114 entries
sha256 b5ee8e088a2ac6f734706e3da757ef9385cb2dbaee61641bcaa8e924af292e00

Digest verified by downloading the tarball back from the registry after publishing — it matches the record byte for byte. The tag points at merge commit 6ad7a61, whose packed tree is identical to 0badbe8. 980 tests, 979 passing, 0 failing, 1 skipped.

verify-package.mjs installs the tarball into a clean directory with no workspace anywhere and drives the product against it: doctor, a non-Git workspace, an install and its removal with client config restored byte for byte.