fix(sessions): read fast-path falls through to the in-process engine when the standalone is missing (PHNX-4012 follow-up) - #3555
Conversation
…when the standalone is missing (PHNX-4012 follow-up) The intercept in cli/src/index.ts exec'd @phnx-labs/sessions-cli for read queries and, without that binary, refused with "The standalone `sessions` CLI is not installed" (exit 1). The package is not published, so every worker and every CI runner is such a box: main's attestation suite went red on sessions.cli-list and sessions.fleet-json after #3554 (its scoped PR test job never ran them), blocking every release. A missing standalone now falls through to the in-repo engine with a one-line stderr hint (AGENTS_SESSIONS_FASTPATH_HINT=0 silences it); an installed `sessions` still takes the fast path. The new test strips PATH of any `sessions` and pins the fall-through on the shared sessions fixture. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014qq5fiWVRBmBV9f5KR58dY
…ller decides the fallback Review blocker on #3555: the header still asserted 'no fallback to the in-repo engine on the read path', which index.ts now does. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014qq5fiWVRBmBV9f5KR58dY
|
VERDICT: APPROVE Non-author review (code-reviewer subagent, two passes). Pass 1 traced the fall-through: Checks: the four sessions files 23/23, tsc clean, CI Tests green on ca46307 (docblock-only commit re-running). |
Problem
Since #3554 the
agents sessionsread fast-path (cli/src/index.ts) execs@phnx-labs/sessions-clifor search/list/id lookups and, when that binary is missing, refuses:@phnx-labs/sessions-cliis not on npm (E404), so every fleet worker and every CI runner is such a box. Main's attestation suite is red since 7c68224 onsessions.cli-list.test.tsandsessions.fleet-json.test.ts(both plainsessions --json --no-interactivequeries), which #3554's scoped PR test job never ran; attestation runs the full suite. That blocks every release, including 1.22.91 (#3553).Change
A missing standalone (
SESSIONS_BIN_MISSING) falls through to the in-repo engine, with a one-line stderr hint (AGENTS_SESSIONS_FASTPATH_HINT=0silences it). A box withsessionsinstalled still takes the fast path; other resolver errors still throw. No change tosessions-client.tsor its tests.Verification
Locally with PATH stripped of every
sessions:index.sessions-fastpath.test.ts(new fall-through case on the shared fixture),sessions.cli-list.test.ts,sessions.fleet-json.test.ts,sessions-client.test.ts: 23 passed.tsc --noEmitclean. By hand,bun src/index.ts sessions --json --no-interactiveunder a bare HOME now reaches the engine (agents-cli is not set up. Run: agents setup) instead of the refusal.Alternative for the feature owner: publish sessions-cli and install a pinned version in
tests/global-setup.tsthe waysecrets-standalone.tsdoes; the fall-through stays useful either way for boxes without it.Tracking: PHNX-4012, PHNX-3940.