Repository navigation
fix(cli): never resolve a proxy connection through the machine-wide session pointer - #4159
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Size Report
Startup median (7 runs, lower is better):
|
There was a problem hiding this comment.
All reported issues were addressed across 11 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
Apex SentinelVerdict: Since the last review: 3 new · 1 still open · 6 no longer raised 4 finding(s): 1 minor, 3 nit. Verdict: approve. 🟡 Minor (1)
🔵 Nit (3)
Reply under an inline comment with Earlier reviewsReview of
|
| Where | Finding |
|---|---|
src/cli.ts:377 |
🆕 connect without a session is refused before provider resolution, so missing/unknown-provider guidance is replaced by REMOTE_SESSION_REQUIRED |
🟡 Minor (3)
| Where | Finding |
|---|---|
packages/remote/src/remote-connection-state.ts:377 |
--remote-config with an unreadable or invalid profile now aborts every command instead of only the commands that previously loaded it |
packages/remote/src/remote-connection-state.ts:341 |
🆕 The dropped allowActiveFallback also removes disconnect's pointer fallback when --remote-config is passed |
packages/remote/src/remote-connection-state.ts:420 |
🆕 Leased-connection detection checks only leaseProvider; a stored connection or profile with a host-allocated leaseId/leaseBackend but no leaseProvider still resolves through the machine-wide pointer |
🔵 Nit (3)
| Where | Finding |
|---|---|
packages/remote/src/remote-connection-state.ts:408 |
🆕 remoteSessionRequiredError repeats --session and AGENT_DEVICE_SESSION in both message and hint |
src/cli.ts:377 |
🆕 connect refusal echoes an unvalidated positional as details.leaseProvider |
src/cli.ts:377 |
🆕 requireLeasedRemoteConfigSession parses the remote config a second time |
Review of c093d1cb · 02.11.2026 11:00 UTC
Apex Sentinel
Verdict: request_changes
Since the last review: 6 new · 3 still open · 6 no longer raised
9 finding(s): 1 major, 5 minor, 3 nit. Verdict: request_changes. reached max rounds (1).
Required fixes
- Decide between: A session-less
batchon a leased remote config allocates its lease under the caller's session name, bypassing the REMOTE_SESSION_REQUIRED rule / session-lessopen --remote-config <leased profile>writes a session record thatbatchthen inherits, reusing the minted session and its lease
🟠 Major (1)
| Where | Finding |
|---|---|
packages/remote/src/remote-connection-state.ts:397 |
🆕 A session-less batch on a leased remote config allocates its lease under the caller's session name, bypassing the REMOTE_SESSION_REQUIRED rule |
🟡 Minor (5)
| Where | Finding |
|---|---|
packages/remote/src/remote-connection-state.ts:348 |
🆕 requireLeasedConnectionSession throws before the requested remote-config/profile path check, so disconnect and connection status can abort on an unreadable profile |
packages/remote/src/remote-connection-state.ts:371 |
🆕 The 128-char run-id cap truncates profile.runId silently |
packages/remote/src/remote-connection-state.ts:394 |
--remote-config with a lease the host already allocated is refused for open/connect, closing the profile-only recovery path for a materialization that never persisted (#4135) |
src/cli.ts:790 |
🆕 session-less open --remote-config <leased profile> writes a session record that batch then inherits, reusing the minted session and its lease |
src/cli/commands/connection.ts:441 |
🆕 Two session-less open --remote-config runs write two records for the same profile, so the profile can no longer be closed or disconnected |
🔵 Nit (3)
| Where | Finding |
|---|---|
packages/remote/src/remote-connection-state.ts:371 |
MAX_RUN_ID_LENGTH duplicates the daemon's run-id limit and only its length is enforced, not its charset |
packages/remote/src/remote-connection-state.ts:396 |
🆕 The runId the session-less open invents is built from one side of the flag/profile pair |
src/cli/commands/connection-context.ts:44 |
connection status reports Session: <name> (docs say --json carries it) that no command accepts as --session |
Review of 4c904014 · time not recorded
Apex Sentinel
Verdict: approve
Since the last review: 7 new · 2 still open · 8 no longer raised
9 finding(s): 1 minor, 8 nit. Verdict: approve. reached max rounds (1).
🟡 Minor (1)
| Where | Finding |
|---|---|
packages/remote/src/remote-connection-state.ts:381 |
🆕 Session-less open --remote-config leaks a fresh connection session and lease on every invocation; nothing ends them |
🔵 Nit (8)
| Where | Finding |
|---|---|
packages/remote/src/remote-connection-state.ts:348 |
🆕 requireLeasedConnectionSession throws before the remote-config mismatch check, so --remote-config now aborts on another session's leased connection |
packages/remote/src/remote-connection-state.ts:371 |
MAX_RUN_ID_LENGTH duplicates a daemon limit no shared contract enforces |
packages/remote/src/remote-connection-state.ts:287 |
🆕 resolveRemoteConnectionDefaults doc describes a session fallback it never performs |
packages/remote/src/remote-connection-state.ts:374 |
🆕 A session-less open --remote-config rewrites the machine-wide active-session pointer with a throwaway session that nothing ever removes |
packages/remote/src/remote-connection-state.ts:415 |
🆕 The REMOTE_SESSION_REQUIRED hint's second option does not work for a stored leased connection |
src/cli.ts:786 |
CONNECTION_STATE_COMMANDS is declared below the function that reads it |
src/cli/commands/generic.ts:44 |
🆕 withLeasedOpenFacts copies every command's leveled payload even when it adds nothing |
src/cli/commands/generic.ts:96 |
🆕 open now injects a connectionSession key into its own result data, colliding with the daemon's session field |
There was a problem hiding this comment.
Apex Sentinel: 6 new findings on 1ed49c0. The verdict and the full list are in the summary comment.
bcb3708 to
2d973be
Compare
There was a problem hiding this comment.
Apex Sentinel: 8 new findings and 1 moved to a new line on 2d973be. The verdict and the full list are in the summary comment.
2d973be to
2a6ff1e
Compare
There was a problem hiding this comment.
Apex Sentinel: 8 new findings on 2a6ff1e. The verdict and the full list are in the summary comment.
dfc1635 to
4fdf73b
Compare
There was a problem hiding this comment.
Apex Sentinel: 9 new findings on 4fdf73b. The verdict and the full list are in the summary comment.
4fdf73b to
4c90401
Compare
There was a problem hiding this comment.
Apex Sentinel: 7 new findings on 4c90401. The verdict and the full list are in the summary comment.
4c90401 to
c093d1c
Compare
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on c093d1c. The verdict and the full list are in the summary comment.
c093d1c to
015a807
Compare
There was a problem hiding this comment.
Apex Sentinel: 2 new findings on 015a807. The verdict and the full list are in the summary comment.
Without --session, a command fell back to .active-session.json, which names whichever connection saved last on the machine. With several agents on one proxy, agent A's next command ran on agent B's lease. On a leased connection (any lease provider: proxy, a device cloud, a provider plugin, or a remote config that sets leaseProvider), every command now needs an explicit session from --session, AGENT_DEVICE_SESSION, or config. That covers connect, open, open --remote-config, batch, close, disconnect, and connection status. Without one, the command is refused with INVALID_ARGS, reason REMOTE_SESSION_REQUIRED, using the lease provider the parser already read, before any profile is resolved again or any lease allocated. A named session never falls back to the pointer. Each session on a shared leased profile allocates under a client and run derived from its name, so two sessions never share a lease and one session finds its own again; a host-issued lease keeps its assigned scope. Unnamed non-leased flows are unchanged. Fixes #3931 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
015a807 to
355a90b
Compare
There was a problem hiding this comment.
Apex Sentinel: 2 new findings on 355a90b. The verdict and the full list are in the summary comment.
|
The code looks good at 355a90b. I found no problems in the code, and there are no conflicts. The Smoke Tests job failed in the iOS phase: Not blocking, and you can take or leave these: (1) I did not run the gate or the new tests locally, and I judged the regression by reading the pre-change code. No live proxy run checked that a real gateway accepts the session-suffixed |
Summary
Without
--session, a command used.active-session.json, so agent A'ssnapshotran on agent B's proxy lease. Amended rule for #3931:leaseProvider, including a remote config that sets one), every command needs an explicit session from--session,AGENT_DEVICE_SESSION, or config. That coversconnect,open,open --remote-config,batch,close,disconnect, andconnection status.INVALID_ARGS, reasonREMOTE_SESSION_REQUIRED, using the parser's lease provider. No second profile read and no lease work happen first.Behavior change: unnamed CI flows on lease providers now fail. Migration: set
AGENT_DEVICE_SESSION=<name>per job beforeconnect. Migrated here: the BrowserStack smoke test (asserting the refusal),help remote, the provider docs, and the Revyl, TestMu and proxy READMEs.Direct daemon RPC callers are not covered here; tracked in #4171.
Fixes #3931
Validation
355a90b9bb: passed,exactCommit=true.cli-leased-session.test.ts(8 tests) covers:macos-apphost lease.🤖 Generated with Claude Code