Repository navigation
fix(daemon): refuse leased requests that name no session at admission - #4177
Conversation
|
@airowe is attempting to deploy a commit to the Callstack Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
All reported issues were addressed across 21 files
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 9 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
|
Reviewed 8c61837. The refusal does not yet cover the public Node client, so I would not merge this as is. The daemon decides "caller named no session" only from the raw session string at the socket and HTTP intake (request-admission.ts#L198). The Node client always sends the literal session Not blocking, and fine to take or leave: Would one intake helper in the daemon core, called by the socket parser and every HTTP builder, be simpler? It would return the session and The only failing check is Vercel, which asks for Callstack team authorization for this fork and is not a build failure. The other 13 checks, including unit and smoke, pass at this commit. There are no conflicts. Before merge, the maintainer needs to decide on the |
|
What changed
One gap your request shape would have missed Your open questions
The cost is wider than old callers The gate passed at 🤖 Generated with Claude Code |
There was a problem hiding this comment.
All reported issues were addressed across 27 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
|
The earlier findings from the first review are fixed at 0dc46ec, and I have no new code findings. I only read the code. I did not run tests or Not blocking, and you can take or leave these: The iOS smoke failure looks unrelated. The The two open P1 threads on the literal Before merge, a maintainer needs to sign off on refusing |
|
The answers to what you left unverified:
The two P1 threads: I resolved them with a reply declining the change, before your comment. They remain listed under Unresolved in the PR body, and the decision is still yours. Reopen them if you'd rather track it there. 🤖 Generated with Claude Code |
|
The code at 071a06e looks good. The change since the earlier review (0dc46ec, #4177 (comment)) only touches a daemon comment, and all 14 earlier threads are now resolved. I did not re-check those threads beyond that comment-only change, and I did not run the eager-closure-budgets check or any tests locally. The Vercel failure is a git authorization link for the website deploy. The change touches no website code, so it is likely unrelated. The other 13 checks pass. Cubic has not reviewed this head yet. Before merge, the Vercel team authorization needs to be done, and the maintainer decision on refusing |
|
e2e prep for this break: e2e-inc/e2e#1513 names the session on its lease clients (BrowserStack/TestMu AI allocate+heartbeat, Limrun allocate+install). Checked on a real daemon at 3707e62: an unnamed client is refused with REMOTE_SESSION_REQUIRED, and a named one can allocate and heartbeat. The same change also works on 0.21.35. |
|
This now conflicts with main after the latest merges (fac7ed5 no longer merges cleanly). Please rebase onto main. The earlier review still stands for the code at this head, so a rebase with no other change only needs a quick recheck of the conflict resolution. I removed ready-for-human until the conflict is resolved. |
|
The latest changes at d45e5a3 look good to me, and they fix the conflict I raised in the earlier review (#4177 (comment)). I found no new problems in the changes since then. CI is green: 13 checks, none failing. There are no conflicts. The open inline threads from the other reviewer need no code change. This one still applies to the blank socket session: #4177 (comment). It is harmless for #4171, because no lease-held session is reachable and the marker still refuses on a provider lease, so you can resolve it. This one on the whitespace HTTP session does not produce a wrong admission: #4177 (comment). Admission refuses by the marker plus the request or session lease scope, and a whitespace-named session holds no lease, so you can resolve it too. This one on the lease RPC is fixed at head, because the lease RPC carries I did not run any tests or read the CI logs. I reviewed only the new changes since the earlier review, not commits 1-9 again. The regression claims rest on reading the code against the tests. Before merge, the PR body still lists sign-off on refusing |
|
Thanks for the rebase. The conflict is resolved at a4a50d6, and I found no problems in the merge resolution in These inline comments can be resolved: the lease RPC one is fixed, because the RPC still carries The one open decision is the one the PR body lists: refusing |
|
Thanks for the merge. The conflict is cleared at 588a0b6: only the generated |
|
Thanks for the merge. The conflict is cleared at 633c462, and every file in the PR's own diff matches the reviewed version, so the earlier review still holds. The one open decision is still the one the PR body lists: refusing |
|
I updated this branch by merging The only conflict was at the end of 🤖 Generated with Claude Code |
|
This branch now conflicts with main at 633c462 after today's merges. Please merge or rebase main and resolve the conflict. The reviewed change is unchanged, so if the resolution only keeps both sides, a short note on what conflicted is enough and I will re-check it on the new head. |
The CLI already requires an explicit session on a leased remote connection, but a direct RPC or socket caller could still omit it and land in the shared default session. HTTP and socket intake now mark a missing or blank session on the daemon-only request envelope. Admission refuses a marked request that allocates a provider lease or carries a lease, with the existing REMOTE_SESSION_REQUIRED reason, before anything is allocated or dispatched. A provider named without a lease stays allowed, and an explicit session name, including "default", counts as named. Closes callstack#4171
agent_device.install_from_source did not record an omitted session, so an unnamed install could reach the provider lease held by the default session. A batch step also lost the marker, so a step carrying lease flags passed admission. Lease-exempt commands such as session_list now read only a lease they carry themselves, so an unnamed inventory command still answers while the default session holds a provider lease. The refusal also names the session parameter for direct RPC callers, and the ledger now digests the shared session helper and describes blank names for released clients correctly.
…eued requests Only inventory and lease-lifecycle commands now ignore the lease on the session they resolve. artifacts and events act through that session, so an unnamed request for them is refused again. Admission also repeats the check under the session lock, because an unnamed request can wait behind an open that leaves a provider lease on the session.
Both resolve the session's device, so an unnamed request could inspect a device another caller leased. An explicit list now names the commands that never read the session, and every other command stays refused. release_materialized_paths joins that list, because it uses no session.
A blank session name was marked as unnamed but stayed its own session, so the marker described a request that still ran somewhere else. HTTP and socket intake now both resolve a missing or blank name to the default session. A mutation case holds the marker in place, and the transport tests assert that the handler ran on that session.
… no session The Node client always sends the literal default session and reports the omission in meta.sessionExplicit, so intake never marked it and an unnamed leases.allocate still allocated a lease. One intake helper now decides this for the socket and every HTTP builder, and lease RPC params carry the fact. The commands that ignore their session's lease become a registry trait. Docs examples and in-repo clients on a provider lease now name a session.
The lease RPC projection dropped flags.session and forwarded sessionExplicit false, so a caller that named its session in flags was refused there but not on the command method. The route now forwards the shared predicate's answer. Also cover the lease method in the real-daemon test and document where each method reads the fact.
The lease RPC builder needs the predicate, and importing it from the contracts hub made three entry surfaces evaluate more modules. The record module is already in those closures.
Intake rewrote a blank session to default, so after main made each web session its own device, an HTTP RPC open with session "" ran the default browser instead of being refused with web_session_name_invalid. A missing session still runs under default. A blank one keeps its literal and still names no session, so a provider lease refuses it as before and the web name check refuses it too. Refs callstack#4171
Main's router now reports a named session that is missing, through namesSessionExplicitly from kernel/contracts. This branch moved that helper to kernel/record, so the merge left a dangling import. Refs callstack#4171
633c462 to
b36ca40
Compare
|
No code blockers found at b36ca40; the rebase resolves the earlier conflict without changing lease admission behavior. CI has 13 successful checks, two skipped checks and one neutral result. Merge still needs maintainer sign-off on refusing Not blocking: the ledger rewrite also reformats four unrelated rationales; using the repository serializer would keep that diff focused on #4171. |
…#4177) * fix(daemon): refuse leased requests that name no session at admission The CLI already requires an explicit session on a leased remote connection, but a direct RPC or socket caller could still omit it and land in the shared default session. HTTP and socket intake now mark a missing or blank session on the daemon-only request envelope. Admission refuses a marked request that allocates a provider lease or carries a lease, with the existing REMOTE_SESSION_REQUIRED reason, before anything is allocated or dispatched. A provider named without a lease stays allowed, and an explicit session name, including "default", counts as named. Closes #4171 * fix(daemon): close the remaining unnamed lease paths at admission agent_device.install_from_source did not record an omitted session, so an unnamed install could reach the provider lease held by the default session. A batch step also lost the marker, so a step carrying lease flags passed admission. Lease-exempt commands such as session_list now read only a lease they carry themselves, so an unnamed inventory command still answers while the default session holds a provider lease. The refusal also names the session parameter for direct RPC callers, and the ledger now digests the shared session helper and describes blank names for released clients correctly. * fix(daemon): keep session-held leases out of unnamed artifacts and queued requests Only inventory and lease-lifecycle commands now ignore the lease on the session they resolve. artifacts and events act through that session, so an unnamed request for them is refused again. Admission also repeats the check under the session lock, because an unnamed request can wait behind an open that leaves a provider lease on the session. * fix(daemon): refuse unnamed doctor and capabilities on a leased session Both resolve the session's device, so an unnamed request could inspect a device another caller leased. An explicit list now names the commands that never read the session, and every other command stays refused. release_materialized_paths joins that list, because it uses no session. * fix(daemon): treat a blank session as the default one at intake A blank session name was marked as unnamed but stayed its own session, so the marker described a request that still ran somewhere else. HTTP and socket intake now both resolve a missing or blank name to the default session. A mutation case holds the marker in place, and the transport tests assert that the handler ran on that session. * fix(daemon): refuse the Node client on a provider lease when it names no session The Node client always sends the literal default session and reports the omission in meta.sessionExplicit, so intake never marked it and an unnamed leases.allocate still allocated a lease. One intake helper now decides this for the socket and every HTTP builder, and lease RPC params carry the fact. The commands that ignore their session's lease become a registry trait. Docs examples and in-repo clients on a provider lease now name a session. * fix(contracts): forward a session named in flags on the lease RPC The lease RPC projection dropped flags.session and forwarded sessionExplicit false, so a caller that named its session in flags was refused there but not on the command method. The route now forwards the shared predicate's answer. Also cover the lease method in the real-daemon test and document where each method reads the fact. * refactor(kernel): home the session-naming predicate in the record module The lease RPC builder needs the predicate, and importing it from the contracts hub made three entry surfaces evaluate more modules. The record module is already in those closures. * docs(daemon): say batch steps also carry the session-omitted marker * fix(daemon): keep a blank session literal at intake Intake rewrote a blank session to default, so after main made each web session its own device, an HTTP RPC open with session "" ran the default browser instead of being refused with web_session_name_invalid. A missing session still runs under default. A blank one keeps its literal and still names no session, so a provider lease refuses it as before and the web name check refuses it too. Refs #4171 * fix(daemon): import the session naming check from kernel/record Main's router now reports a named session that is missing, through namesSessionExplicitly from kernel/contracts. This branch moved that helper to kernel/record, so the merge left a dangling import. Refs #4171 * chore(gates): reconcile admission checks with 0.22 owners --------- Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
…#4177) * fix(daemon): refuse leased requests that name no session at admission The CLI already requires an explicit session on a leased remote connection, but a direct RPC or socket caller could still omit it and land in the shared default session. HTTP and socket intake now mark a missing or blank session on the daemon-only request envelope. Admission refuses a marked request that allocates a provider lease or carries a lease, with the existing REMOTE_SESSION_REQUIRED reason, before anything is allocated or dispatched. A provider named without a lease stays allowed, and an explicit session name, including "default", counts as named. Closes #4171 * fix(daemon): close the remaining unnamed lease paths at admission agent_device.install_from_source did not record an omitted session, so an unnamed install could reach the provider lease held by the default session. A batch step also lost the marker, so a step carrying lease flags passed admission. Lease-exempt commands such as session_list now read only a lease they carry themselves, so an unnamed inventory command still answers while the default session holds a provider lease. The refusal also names the session parameter for direct RPC callers, and the ledger now digests the shared session helper and describes blank names for released clients correctly. * fix(daemon): keep session-held leases out of unnamed artifacts and queued requests Only inventory and lease-lifecycle commands now ignore the lease on the session they resolve. artifacts and events act through that session, so an unnamed request for them is refused again. Admission also repeats the check under the session lock, because an unnamed request can wait behind an open that leaves a provider lease on the session. * fix(daemon): refuse unnamed doctor and capabilities on a leased session Both resolve the session's device, so an unnamed request could inspect a device another caller leased. An explicit list now names the commands that never read the session, and every other command stays refused. release_materialized_paths joins that list, because it uses no session. * fix(daemon): treat a blank session as the default one at intake A blank session name was marked as unnamed but stayed its own session, so the marker described a request that still ran somewhere else. HTTP and socket intake now both resolve a missing or blank name to the default session. A mutation case holds the marker in place, and the transport tests assert that the handler ran on that session. * fix(daemon): refuse the Node client on a provider lease when it names no session The Node client always sends the literal default session and reports the omission in meta.sessionExplicit, so intake never marked it and an unnamed leases.allocate still allocated a lease. One intake helper now decides this for the socket and every HTTP builder, and lease RPC params carry the fact. The commands that ignore their session's lease become a registry trait. Docs examples and in-repo clients on a provider lease now name a session. * fix(contracts): forward a session named in flags on the lease RPC The lease RPC projection dropped flags.session and forwarded sessionExplicit false, so a caller that named its session in flags was refused there but not on the command method. The route now forwards the shared predicate's answer. Also cover the lease method in the real-daemon test and document where each method reads the fact. * refactor(kernel): home the session-naming predicate in the record module The lease RPC builder needs the predicate, and importing it from the contracts hub made three entry surfaces evaluate more modules. The record module is already in those closures. * docs(daemon): say batch steps also carry the session-omitted marker * fix(daemon): keep a blank session literal at intake Intake rewrote a blank session to default, so after main made each web session its own device, an HTTP RPC open with session "" ran the default browser instead of being refused with web_session_name_invalid. A missing session still runs under default. A blank one keeps its literal and still names no session, so a provider lease refuses it as before and the web name check refuses it too. Refs #4171 * fix(daemon): import the session naming check from kernel/record Main's router now reports a named session that is missing, through namesSessionExplicitly from kernel/contracts. This branch moved that helper to kernel/record, so the merge left a dangling import. Refs #4171 * chore(gates): reconcile admission checks with 0.22 owners --------- Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
…#4177) * fix(daemon): refuse leased requests that name no session at admission The CLI already requires an explicit session on a leased remote connection, but a direct RPC or socket caller could still omit it and land in the shared default session. HTTP and socket intake now mark a missing or blank session on the daemon-only request envelope. Admission refuses a marked request that allocates a provider lease or carries a lease, with the existing REMOTE_SESSION_REQUIRED reason, before anything is allocated or dispatched. A provider named without a lease stays allowed, and an explicit session name, including "default", counts as named. Closes #4171 * fix(daemon): close the remaining unnamed lease paths at admission agent_device.install_from_source did not record an omitted session, so an unnamed install could reach the provider lease held by the default session. A batch step also lost the marker, so a step carrying lease flags passed admission. Lease-exempt commands such as session_list now read only a lease they carry themselves, so an unnamed inventory command still answers while the default session holds a provider lease. The refusal also names the session parameter for direct RPC callers, and the ledger now digests the shared session helper and describes blank names for released clients correctly. * fix(daemon): keep session-held leases out of unnamed artifacts and queued requests Only inventory and lease-lifecycle commands now ignore the lease on the session they resolve. artifacts and events act through that session, so an unnamed request for them is refused again. Admission also repeats the check under the session lock, because an unnamed request can wait behind an open that leaves a provider lease on the session. * fix(daemon): refuse unnamed doctor and capabilities on a leased session Both resolve the session's device, so an unnamed request could inspect a device another caller leased. An explicit list now names the commands that never read the session, and every other command stays refused. release_materialized_paths joins that list, because it uses no session. * fix(daemon): treat a blank session as the default one at intake A blank session name was marked as unnamed but stayed its own session, so the marker described a request that still ran somewhere else. HTTP and socket intake now both resolve a missing or blank name to the default session. A mutation case holds the marker in place, and the transport tests assert that the handler ran on that session. * fix(daemon): refuse the Node client on a provider lease when it names no session The Node client always sends the literal default session and reports the omission in meta.sessionExplicit, so intake never marked it and an unnamed leases.allocate still allocated a lease. One intake helper now decides this for the socket and every HTTP builder, and lease RPC params carry the fact. The commands that ignore their session's lease become a registry trait. Docs examples and in-repo clients on a provider lease now name a session. * fix(contracts): forward a session named in flags on the lease RPC The lease RPC projection dropped flags.session and forwarded sessionExplicit false, so a caller that named its session in flags was refused there but not on the command method. The route now forwards the shared predicate's answer. Also cover the lease method in the real-daemon test and document where each method reads the fact. * refactor(kernel): home the session-naming predicate in the record module The lease RPC builder needs the predicate, and importing it from the contracts hub made three entry surfaces evaluate more modules. The record module is already in those closures. * docs(daemon): say batch steps also carry the session-omitted marker * fix(daemon): keep a blank session literal at intake Intake rewrote a blank session to default, so after main made each web session its own device, an HTTP RPC open with session "" ran the default browser instead of being refused with web_session_name_invalid. A missing session still runs under default. A blank one keeps its literal and still names no session, so a provider lease refuses it as before and the web name check refuses it too. Refs #4171 * fix(daemon): import the session naming check from kernel/record Main's router now reports a named session that is missing, through namesSessionExplicitly from kernel/contracts. This branch moved that helper to kernel/record, so the merge left a dangling import. Refs #4171 * chore(gates): reconcile admission checks with 0.22 owners --------- Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
Summary
Targets 0.22. Closes #4171. Daemon intake records unnamed sessions and refuses provider-lease allocation/use/release with typed
REMOTE_SESSION_REQUIRED. Named and provider-free requests retain their behavior.50 files; no scope expansion. Node callers name a session:
createAgentDeviceClient({ session: 'agent-a' }).Rebased remote
633c462d491dfrom merge-base0db888ac62a0ontoefe6bb9eece4. Range-diff plus edit comparison preserved 49 paths exactly (rename counted twice). Differences: upstream wire projections/acknowledgments and equivalentSessionStore.getpreflight with redundant narration removed. Upstream positional/device-pin checks and lease-retention docs remain.Validation
Tested b36ca40. Install, build, full-repository format, 23 focused admission tests, 19,753 unit tests (3 skipped), and released-baseline wire compatibility pass. Eleven focused provider-scenario tests also passed before the final equivalent lookup cleanup.
Live at tested head: Pixel_7_CI, Android 16; unnamed allocation/doctor/capabilities refused, named Settings open and heartbeat passed. Session, emulator, and dedicated daemon cleaned up. No commercial cloud-provider run.
Exact-head
check:affected --base origin/0.22 --run --head <tested-SHA>: 11 passed, 7 skipped;exactCommit=true,checkoutChanged=false.Maintainer decisions remain: refusing
meta.sessionExplicit:false, and admitting legacy lease RPC clients without the marker under the existing compatible-change acknowledgment, without a protocol bump. Independent review at this head found no regressions; contract sign-off remains open. Hosted CI is green on this head; Size was skipped. Existing ready state is preserved.