Repository navigation
fix(daemon): show a leased session in session_list only to its lease holder - #4917
Conversation
Size Report
Startup median (7 runs, lower is better):
|
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 0d9e24c. The verdict and the full list are in the summary comment.
|
The lease gate in A second independent pass found that the session list reference still says the list shows the active sessions in the request scope (commands.md:2348). A workspace can hold a leased session, and a caller can run the documented list command there without the lease id. The base returned the active session in that case. This change omits it (session-routing.ts:94-97). The named-session troubleshooting at commands.md:1392 and the action help at session.ts:15 carry the same wording. Users who inspect sessions will not learn that a leased session needs its lease id. Please state in the reference, the action help and the troubleshooting text that the list shows sessions visible in the request scope, and that a leased session requires its lease id. Point users to their saved connection or an explicitly supplied lease id. A second independent pass found that the ambiguity recovery still sends callers to an incomplete list (session-routing.ts:307). When a workspace holds several implicit sessions, including a leased one, a platform-free session command returns Not blocking, and these can be taken or left: (1) an The code change itself looks sound. Required evidence for the PR is present. Smoke Tests (ios/macos) and one other check were still running at review time, and three cancelled runs were superseded PR-body checks with no code route. The smoke lanes drive local unleased sessions, so overlap with this diff is not expected. Before merge, the docs and hints above need the lease qualification, and the running checks need to finish green. Not verified here: tests and the HTTP probe were not run, and regression validity was judged by reading the base predicate. It was not traced whether every MCP and CLI remote connection profile injects the saved lease id into |
|
Review round at
Gate: |
This comment has been minimized.
This comment has been minimized.
|
The code at ddc8c01 fixes the problems from the earlier review (#4917 (comment)), and no new code problem was found in the delta. No conflicts are known. The Body rules check fails, and it is a PR-body lint job. The delta touches no PR body, so the failure cannot be tied to the delta. Please check the body against docs/agents/pull-requests.md before merge. Not verified here: tests and CI were not run on the delta, which only changes strings and docs. Not verified here: how the CLI injects the saved lease id into every command's meta. Please show one live run where a session created with a lease is listed by Not blocking, and these can be taken or left: for an implicit local request with a working directory, the filter in https://github.com/callstack/agent-device/blob/ddc8c01/packages/daemon/src/sessions/session-lifecycle/internal/inventory.ts#L126 calls resolveSessionScope for every reference. That repeats realpath, the ancestor walk for .git, and hashing for the same input, while the base inventory resolved the request scope once. Could session-routing.ts own a request-bound visibility predicate that resolves the session scope and request lease id once, then applies the policy to each session? Both call sites use the same disclosure policy, and the existing admission assertion allows missing fields and throws on conflicts, so it cannot replace this visibility check. One open inline thread does not apply: replies that name another session are tracked by #4923 and are out of scope, and the code is unchanged (#4917 (comment)). Please resolve it. |
|
Live check at ddc8c01: iOS 26.2 simulator (e2e-apex), an Cleanup: A closed and disconnected, proxy stopped, simulator shut down. Body rules passes on ddc8c01. I did not take the optional single-predicate refactor in |
|
The live check at ddc8c01 covers the requested evidence: the lease holder lists This head now conflicts with main. Please rebase onto main and push; the rebased head gets a delta review. |
ddc8c01 to
24f73dd
Compare
|
Rebased onto the rewritten |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 finding moved to a new line on 24f73dd. The verdict and the full list are in the summary comment.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 6f07260. The verdict and the full list are in the summary comment.
…ts lease holder Reverts 6f07260. Naming the request's own address without the lease id lets a guessing caller confirm that a session exists and holds the device.
This comment has been minimized.
This comment has been minimized.
|
The conflict from the earlier review (#4917 (comment)) is fixed. Commit db3b9b6 has one problem left in the inventory filter. All 16 checks pass, and no conflicts were reported. The base resolves the caller's workspace once per list. The head calls Can The two open inline threads (#4917 (comment) and #4917 (comment)) are fixed at this head and can be resolved. The first was marked fixed in 6f07260, but db3b9b6 reverted that commit, so the code is back at the 24f73dd shape. The second is fixed because a request without a lease ID gets Not verified here: tests, gates and the provider-scenario HTTP probe were not run. The earlier validation was at ddc8c01, and the PR's own production diff is unchanged after the rebase, so the range-diff and the passing checks were used instead. Not verified here: #4911 (admission refusal of a lease holder that omits its ID), which is only referenced in the author's reply. Once the scope is resolved once per list, nothing else stops the merge. |
|
Fixed at 6bea320: the session list scope is now resolved once per request.
The |
Apex Sentinel · ✅ Approve · review of
|
| Command | What it does |
|---|---|
@apex-sentinel-staging note <context> |
Adds context; Sentinel re-checks the cited code |
@apex-sentinel-staging pivot <why> |
Says the finding is wrong; Sentinel re-checks the cited code |
@apex-sentinel-staging like |
Marks the finding as useful |
@apex-sentinel-staging dislike <why> |
Marks it as not useful, so it is not raised again |
On this conversation, comment @apex-sentinel-staging review to run a full review once again.
|
This PR is ready at 6bea320. The earlier findings from db3b9b6 (#4917 (comment)) are fixed, and no new findings came up. The delta resolves the scope and the lease id once per list, and shares one predicate between inventory and shutdown. The 16 checks are green; the author reported one unrelated 5 s timeout in packages/client index-metro.test.ts that passes alone, and the diff does not touch that route. There are no conflicts. Not blocking: the PR body still names sessionVisibleToRequest as the rule owner and says "Tested at ddc8c01, six cases", while the head uses createSessionVisibilityPredicate and has a seventh test. Rename the symbol when the body is next edited. You can take or leave this. Of the open inline threads, the one on the shutdown refusal losing the name for the lease holder (#4917 (comment)) no longer applies, because db3b9b6 reverted that behavior and the head keeps the visible-only naming at session-shutdown.ts:66-72 with a covering test. The one on a request without a lease id (#4917 (comment)) is fixed at the head: that request gets visible=false, the refusal omits session and hint, and session-shutdown.test.ts covers both lease-id cases. Please resolve both threads. Not verified here: the tests and gates, including the new realpath test, were not run; the test was traced from the code. The provider-scenario HTTP probe and the validation run in the PR body are at ddc8c01, and the delta is a behavior-preserving refactor of the predicate that was not re-probed at the head. #4923 (replies naming another session) was not reviewed. |
…holder (#4917) * fix(daemon): show a leased session in session_list only to its lease holder * docs(sessions): say that session list shows only sessions visible to the request * fix(daemon): name the request's own session in a shutdown refusal * revert(daemon): name a leased session in a shutdown refusal only to its lease holder Reverts 6f07260. Naming the request's own address without the lease id lets a guessing caller confirm that a session exists and holds the device. * fix(daemon): resolve the session list scope once per request
…holder (callstack#4917) * fix(daemon): show a leased session in session_list only to its lease holder * docs(sessions): say that session list shows only sessions visible to the request * fix(daemon): name the request's own session in a shutdown refusal * revert(daemon): name a leased session in a shutdown refusal only to its lease holder Reverts 6f07260. Naming the request's own address without the lease id lets a guessing caller confirm that a session exists and holds the device. * fix(daemon): resolve the session list scope once per request
…holder (#4917) * fix(daemon): show a leased session in session_list only to its lease holder * docs(sessions): say that session list shows only sessions visible to the request * fix(daemon): name the request's own session in a shutdown refusal * revert(daemon): name a leased session in a shutdown refusal only to its lease holder Reverts 6f07260. Naming the request's own address without the lease id lets a guessing caller confirm that a session exists and holds the device. * fix(daemon): resolve the session list scope once per request
Summary
session_listfiltered sessions only by the tenant label the caller sends. Every holder of a shared proxy token can send any tenant label, so one client could list another client's session names. A session that holds a lease is now visible to a request only when that request sends the same lease id.sessionVisibleToRequestinsession-routing.tsowns the rule. Both callers use it: thesession_listfilter, and theshutdownDEVICE_IN_USErefusal, which names the owning session only for the lease holder. Sessions with no lease keep today's visibility. Labels never grant visibility. Complements #4911. Closes #4908.Before / after
Validation
Tested at
ddc8c01.check:affected --base origin/0.22 --runpassed withexactCommit: true(format, lint, typecheck, layering, fallow, build, vitest-related, unit, command-docs, docs-links, docs-prose). Device lanes are GitHub-authoritative.New tests: six cases. Four fail at base for the intended reason (three tenant
session_listcases, and the shutdown refusal that names the owner without the lease id). Two are guards that pass at base (the lease-id-without-tenant-isolation case, and the shutdown "sending that lease id" case). A provider-scenario probe over the real HTTP path shows base["default"]for all three calls, head["default"],[],[]. Two integrationsessions.list()callers now pass their own lease id. Unleased sessions are unchanged.Review round two: the session list docs, action help, and both recovery hints now qualify the list by request visibility and point callers to the owning connection or an explicit lease id;
client-api.mdnotesclient.sessions.list()without aleaseIdomits leased sessions. Follow-up: #4923.