Skip to content

fix(sessions): read fast-path falls through to the in-process engine when the standalone is missing (PHNX-4012 follow-up) - #3555

Merged
muqsitnawaz merged 2 commits into
mainfrom
fix/sessions-fastpath-fallback
Sep 8, 2026
Merged

fix(sessions): read fast-path falls through to the in-process engine when the standalone is missing (PHNX-4012 follow-up)#3555
muqsitnawaz merged 2 commits into
mainfrom
fix/sessions-fastpath-fallback

Conversation

@muqsitnawaz

Copy link
Copy Markdown
Contributor

Problem

Since #3554 the agents sessions read fast-path (cli/src/index.ts) execs @phnx-labs/sessions-cli for search/list/id lookups and, when that binary is missing, refuses:

The standalone `sessions` CLI is not installed.
Install it, then re-run this command:
  npm i -g @phnx-labs/sessions-cli

@phnx-labs/sessions-cli is not on npm (E404), so every fleet worker and every CI runner is such a box. Main's attestation suite is red since 7c68224 on sessions.cli-list.test.ts and sessions.fleet-json.test.ts (both plain sessions --json --no-interactive queries), 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=0 silences it). A box with sessions installed still takes the fast path; other resolver errors still throw. No change to sessions-client.ts or 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 --noEmit clean. By hand, bun src/index.ts sessions --json --no-interactive under 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.ts the way secrets-standalone.ts does; the fall-through stays useful either way for boxes without it.

Tracking: PHNX-4012, PHNX-3940.

muqsitnawaz and others added 2 commits September 7, 2026 21:34
…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
@muqsitnawaz

Copy link
Copy Markdown
Contributor Author

VERDICT: APPROVE

Non-author review (code-reviewer subagent, two passes). Pass 1 traced the fall-through: bin stays null only on SESSIONS_BIN_MISSING, every other resolver error still throws, the null path reaches bootstrap.js, the hint is stderr-only and no sessions test asserts exact stderr; the new test's PATH filter is deterministic on all three CI platforms; the hard fail was defensible in isolation but not with the package unpublished, and installing it in tests/global-setup.ts is impossible today. One blocker: the sessions-client.ts header still asserted 'no fallback on the read path'. Pass 2 verified 0d76c91 fixes the docblock; only a comment changed.

Checks: the four sessions files 23/23, tsc clean, CI Tests green on ca46307 (docblock-only commit re-running).

@muqsitnawaz
muqsitnawaz merged commit d60f1f7 into main Sep 8, 2026
10 checks passed
@muqsitnawaz
muqsitnawaz deleted the fix/sessions-fastpath-fallback branch September 8, 2026 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant