Skip to content

feat(web): confine managed remote browser egress - #5272

Closed
thymikee wants to merge 15 commits into
fix/daybreak-daemon-boundariesfrom
fix/daybreak-remote-web-proxy
Closed

thymikee wants to merge 15 commits into
fix/daybreak-daemon-boundariesfrom
fix/daybreak-remote-web-proxy

Conversation

@thymikee

@thymikee thymikee commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Summary

Stage managed-browser egress confinement for #5306. Remote tenant web admission is unconditionally refused except close. Binding the managed provider does not grant admission.

Confinement enablement and the legacy fix/daybreak-daemon-boundaries base are explicitly deferred. This PR remains draft; no fixture provisioning, positive proof run, rebase or successor integration is in the current scope.

Before / after

  • Remote tenant open and reads refuse with remote_web_public_network_unenforced, including when the managed provider is configured.
  • Existing remote sessions can still close and retry unconfirmed cleanup.
  • Local web sessions remain available. Help, command docs and remote-proxy docs state the refusal.

Validation

Head: 221b59c. The modified router file passes all 24 focused tests. Removed the provider-bound admission capability and callback plumbing. Replaced obsolete admitted-remote-open router scenarios with refusal coverage; provider-level rollback tests remain unchanged. Command and reason docs were regenerated. No broad local gates, builds or live browser runs.

Hosted status at handoff: 17 passed, 9 pending, none failed; no unresolved review threads. Pending checks are not a pass.

Before eventual confinement enablement, require same-head macOS and Linux production tenant-daemon receipts correlating controlled public IPv4 HTTP/80 redirect/destination receipts and enforcement immediately after abrupt daemon exit before recovery. The in-process provider smoke does not establish that contract. Deferral does not waive it.

@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.78 MB 6.80 MB +19.4 kB
Package (unpacked) 6.78 MB 6.80 MB +19.4 kB
Package (download) 2.07 MB 2.08 MB +6.5 kB

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 22.4 ms 28.4 ms +6.1 ms
CLI --help 53.5 ms 46.3 ms -7.2 ms

Affected plugins

Plugin Installed (including dependencies) Unpacked Download
@agent-device/revyl 181.2 kB → 181.2 kB (0 B) 180.8 kB → 180.8 kB (0 B) 58.6 kB → 58.6 kB (0 B)
@agent-device/testmu 26.5 kB → 26.5 kB (0 B) 26.2 kB → 26.2 kB (0 B) 9.6 kB → 9.6 kB (0 B)
@agent-device/tizen 99.5 kB → 99.5 kB (0 B) 99.1 kB → 99.1 kB (0 B) 34.9 kB → 34.9 kB (-2 B)
@agent-device/webos 98.5 kB → 98.5 kB (0 B) 98.1 kB → 98.1 kB (0 B) 34.6 kB → 34.6 kB (0 B)

@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 2 new findings on a56ea57. The verdict and the full list are in the summary comment.

@thymikee

Copy link
Copy Markdown
Member Author

The proxy at a56ea57 does not yet hold its bounded, fail-closed rule: a peer can crash the host process or keep connection slots, and several limits can be passed. The six points below need fixes before merge.

A peer failure can end the host process and every proxy connection, and refused peers can use up the listener's capacity for good (public-network-proxy.ts:70). Node removes its socket error and timeout handlers before it dispatches CONNECT or Upgrade. The proxy adds an error handler only after DNS and dial succeed, and adds none on a refused upgrade. Also, refuseSocket ends only the write side of a half-open socket, so a peer that keeps its side open holds the slot. Every client socket taken from the HTTP parser must have an error handler and a deadline from dispatch until it is destroyed, in both the CONNECT and Upgrade handlers, and every refusal must close both sides after the response is flushed. Please add a test that resets a CONNECT client while a mocked lookup is stalled, then shows that the proxy still answers a new request. A reset of this kind crashed a plain Node 26.11.1 HTTP server with an unhandled ECONNRESET in an inline script.

An ordinary HTTP response can be unlimited in size and time, so one connection can hold a slot forever (public-network-proxy.ts:230). The connect timer is cleared at TCP connect, and the other timers only measure idle time. Every forwarding path must have a finite byte budget and an elapsed deadline, and must destroy both sides when either one runs out.

One client socket can start two forwarding operations (public-network-proxy.ts:73). The one-use marker is used only in the request handler. A CONNECT that follows an ordinary request still in admission starts a second admission, and both can write to the same socket. Every handler that can start admission must first claim the raw client socket through the same guard.

A closed client can leave its upstream dial running (public-network-proxy.ts:123). The close handler that destroys the upstream is added only after the dial resolves. The slot is freed, and proxy.close() can resolve, while the upstream socket stays live until the dial deadline. Closing the client or the proxy must cancel a pending dial, and the slot must stay taken until the upstream socket is gone.

Extra headers can hide forbidden fields from admission (public-network-proxy.ts:52). maxHeadersCount drops headers past the limit but does not reject the request, so the Host and body-framing checks see only part of the message. Admission must see every header within the byte limit, and a request with too many headers must be refused.

Malformed absolute-form targets can be forwarded (public-network-proxy.ts:257). The URL parser accepts excess slashes with an empty raw authority and erases empty userinfo, so a matching Host header lets such a target pass. The public-address policy still applies to the destination. The raw authority and delimiters must be checked before normalization, with the same strict authority parser for the target and the Host header.

Not blocking: these can be taken or left: give CONNECT tunnels a lifetime limit through the same per-connection budget (tunnel limit); keep concurrent DNS lookups below the thread pool size or use a resolver with its own timeout (lookup); size the 8-connection limit from the browser caller, because Chromium can open up to 32 sockets per proxy and extra ones are destroyed (limit); use stream.pipeline so an upstream reset also ends the client response, and consider trying the other admitted addresses when the first fails (pipe); handle an upstream response or request that closes early, including a refused protocol switch (upstream request); refuse Expect in checkContinue before Node sends 100 Continue (request handler); remove standard hop-by-hop response headers and those named by the origin's Connection header (response headers); keep Content-Length on HEAD responses (reframing); drop x-agent-device-refusal here, or use a proxy-owned name, because the daemon already owns that header with another meaning, and assert on status and the lack of upstream connections instead (header); let the caller pass the shared limits instead of module-level counters, and derive Refusal from the classifier's reasons (counters); add tests for the byte limit, the timeouts, the global limit and a mixed public and private DNS answer (tests); share one rawRequest test helper (copy); collect the full CONNECT response and payload across data events in the tunnel test (fixture); and count TCP connections, not only HTTP requests, in the private-service fixture (fixture).

Should this proxy land together with its first caller, so that the owner of the browser launch sets the limits and the unused-export check sees a consumer? That would first need a decision at #5258 on whether primitives without a caller may land, or whether the stack folds #5268 and this PR into the phase that wires them. In that phase, would a socks5:// proxy be worth weighing? Chromium would send hostnames and tunnel http, https and ws alike, which could remove about 150 lines of HTTP forwarding and header handling, at the cost of a small hand-written binary handshake parser.

The Repo Guards & Compatibility failure is likely related to this change. Its "Check for production-unused exports" step reports that admitPublicDestinationAddress (public-network-addresses.ts:89) has no production consumer, because its only importer is this PR's proxy and no entry point reaches that file. The Body rules check was cancelled, likely by a newer run, and no log was captured. One other check is still queued.

Not verified here: the PR's test files were not run, the crash was not reproduced through startPublicNetworkProxy, the thread pool and Chromium socket limit points come from defaults and were not measured, and the refusal of tenant web commands in #5243 was not traced.

Before merge, the six fixes above are needed, starting with the socket error and refusal handling, because it affects the whole host even without browser wiring.

@blacksmith-sh

This comment has been minimized.

@apex-sentinel-staging

This comment has been minimized.

@thymikee

Copy link
Copy Markdown
Member Author

At 107e165, two points from the earlier review are fixed, but resolver work, pending dials, and handed-off sockets can still outlive their limits.

public-network-proxy.ts:366: the deadline frees the pending-resolution slot while dns.lookup is still running or queued. A slow resolver can then collect unfinished jobs beyond every connection limit and keep using the shared resolver pool after the client has gone. Unfinished lookups must count against their own limit until the underlying call settles, while the client still gets its answer at the deadline. The timeout test currently expects the opposite. Please drive startPublicNetworkProxy with a lookup that never settles, and show that resolver calls stop at the limit and later requests get capacity_exceeded after earlier deadlines pass.

public-network-proxy.ts:133: closing the client frees its connection slot, but a pending upstream dial keeps running, and close() can resolve while it is still alive. Canceled clients can leave outbound sockets behind while new clients reuse their slots. Every dial must belong to the client and proxy lifetime before it is awaited, and its slot must stay taken until the upstream socket is destroyed. Please show that a client close and a proxy.close() during a pending dial each leave no upstream socket.

public-network-proxy.ts:83: Node removes its error and timeout listeners when it hands over a CONNECT or Upgrade socket, and the refusal path only calls socket.end. A refused peer that keeps its side open can hold a counted slot with no idle limit, and an early socket error can go unhandled. Every socket taken from the HTTP parser must have an error handler and a deadline from handoff until destroy, and every refusal must destroy the socket after the reply is flushed. Please show on both routes that a half-open refused peer is destroyed, and that a reset during a stalled lookup is handled.

The PR summary says the proxy fails closed, including on malformed framing and excess work. The code does not fully support that: unfinished lookups and pending dials are not capped, and the header and target checks listed below have gaps. Please make the code match the claim, or narrow the claim.

Not blocking: these can be taken or left: strip Trailer and other hop-by-hop response headers, including Connection-nominated ones, so writeHead cannot throw (line 230), pass an upstream response abort on to the client (line 243), give the refusal header a proxy-owned name and remove it from origin responses (line 402), refuse Expect: 100-continue through checkContinue before any interim reply (line 54), share one raw request fixture across the tests (forwarding test), and send the tunnel payload once the full header terminator has arrived (same file).

For a follow-up issue, not for this PR:

These earlier threads no longer apply and can be resolved: this one, because single close or keep-alive values are now accepted while upgrade and unknown tokens are still refused; and this one, because each proxy now has its own pending-resolution limit, released at the deadline, and the connection cap stays process-wide on purpose.

Repo Guards & Compatibility fails in the Fallow audit step: startPublicNetworkProxy and the PublicNetworkProxy and PublicNetworkProxyOptions re-exports added at index.ts:45 are unused. This is likely caused by this commit, and the exports need a real consumer or should land with one. The Body rules check was cancelled, likely because a newer run replaced it.

Not verified here: no tests were run locally, the 8/8 pass count was not observed, the crash and pipelining paths were not reproduced through startPublicNetworkProxy, the buildup of stalled lookups was not measured, and the cause of the Body rules cancellation was not inspected.

Before merge, the resolver limit, pending dial, and socket handoff problems need fixes, and Repo Guards needs to pass.

@thymikee
thymikee added this pull request to stack #5296 December 1, 2026 06:41
Base automatically changed from fix/daybreak-remote-web-address-policy to fix/daybreak-daemon-boundaries December 1, 2026 08:15
@thymikee
thymikee force-pushed the fix/daybreak-remote-web-proxy branch from 107e165 to 3c4b97b Compare December 1, 2026 09:25
@thymikee
thymikee force-pushed the fix/daybreak-remote-web-proxy branch from ba8408e to 930953d Compare December 1, 2026 09:44
@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 2 new findings on 930953d. The verdict and the full list are in the summary comment.

@thymikee

thymikee commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

At 930953d, none of the three problems from the earlier review is fixed. public-network-proxy.ts has not changed since 107e165, so all three must still be fixed before merge.

A DNS lookup frees its slot at the deadline, but settleWithin does not cancel the lookup. A client that keeps reconnecting with slow or never-resolving hostnames gets 502 upstream_unavailable and can start 8 more lookups per proxy every 5 seconds while the old ones are unfinished. Nothing bounds this across proxies, so unfinished work grows and can fill the libuv threadpool that the daemon's fs, crypto and zlib work uses. This breaks the rule that per-proxy and process-wide budgets bound all outstanding work. Every lookup must hold a per-proxy and a process-wide resolver slot until the dns.lookup promise itself settles (release it in .finally() on that promise), while the client still gets an answer at the deadline. Please change the timeout test to run startPublicNetworkProxy with a never-settling lookup, and assert that resolver calls stop at the limit and later requests get capacity_exceeded after earlier deadlines pass.

A CONNECT dial is not tied to the client or proxy lifetime. If the client closes during the dial, its per-proxy and process-wide connection slots are freed while net.connect keeps running for up to 5 seconds. proxy.close() can also resolve with the dial still pending, and the upstream handshake can complete afterwards. A close-and-reconnect loop can therefore exceed the 8 and 64 connection budgets. Every upstream dial must be owned by its client and its proxy before it is awaited: both kinds of close destroy it, close() waits for it, and the connection slot stays taken until the upstream socket is destroyed. Please test that a client close and a proxy.close() during a pending dial each leave no upstream socket.

A refused socket is only half-closed. Node removes its HTTP error and timeout handlers when it hands a socket to connect or upgrade, and refuseSocket only calls end(). A refused peer that never sends FIN can hold its slot forever, so 8 such peers exhaust a proxy and 64 exhaust the process. A paused CONNECT client also has no error handler during lookup and dial, so a reset there, or a failed refusal write, is likely to crash the daemon. Every handed-off socket must keep an error handler and an idle deadline until it is destroyed, and every refusal must destroy it after the reply flushes (end(cb), then destroy), with a fallback timer. Please test on both routes that a half-open refused peer is destroyed, and that a reset during a stalled lookup is handled.

Repo Guards & Compatibility fails at this commit, likely because of this PR. The production-exports gate reports admitPublicDestinationAddress as unused, while the same job passes on base ac87811. The likely cause is that the new proxy loads that module dynamically and, since the index.ts re-export was removed, the proxy has no production consumer. The gate must pass through a first production consumer or a different import shape, without an allowlist.

One lower-priority open thread still applies. These threads can be resolved: CONNECT ports, because the tunnel has byte and idle limits and a port allowlist is outside this bounded-budget requirement (a maintainer decision); keep-alive handling, because single close and keep-alive values are now accepted; and stalled DNS slots, because the lookup limit is now per proxy (early release is the separate problem above).

Not verified here: no tests were run and the 8/8 pass count was not observed. The lookup buildup, the dial after close and the half-open or reset behavior were not reproduced through startPublicNetworkProxy; the first two follow from the code, and the possible daemon crash rests on how Node hands off HTTP sockets. The cause of the gate failure is inferred from its output and the import shape. The changes since the last review were compared as a whole patch, not hunk by hunk, because most of that diff comes from the rebase.

@thymikee
thymikee force-pushed the fix/daybreak-remote-web-proxy branch from 930953d to b21da40 Compare December 1, 2026 12:01
@blacksmith-sh

This comment has been minimized.

@thymikee thymikee changed the title feat(web): add bounded public-network proxy primitive feat(web): confine managed remote browser egress Dec 1, 2026
@thymikee
thymikee marked this pull request as ready for review December 1, 2026 12:49

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 47 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread scripts/check-tmpdir-leaks-model.ts Resolved
@thymikee
thymikee marked this pull request as draft December 1, 2026 12:59
@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging

This comment has been minimized.

@thymikee

thymikee commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

At 302f1dd, the first-open cleanup issue from the earlier review is fixed, but remote web admission still needs production evidence before merge.

The macOS and Linux confinement smoke constructs the provider in-process, opens example.com over HTTPS, and disposes a runtime slot. It does not establish that the production tenant route maintains the public-only invariant for the browser lifetime. Keep the existing remote-web refusal in effect until same-head production daemon runs on both platforms with the pinned browser correlate a controlled public IPv4 HTTP/80 redirect and destination with fixture receipts, and demonstrate authenticated proxy enforcement or host-enforced denial immediately after abrupt daemon exit and before recovery. The same-head Windows typed refusal is established.

a second independent pass found that a bound confined provider admits a remote tenant web request on macOS and Linux while the production evidence required by #5306 remains outstanding. No bypass was observed in this review. Keep the PR in draft until both platforms supply the agreed production receipts with the pinned browser at this head; if the cleanup change must ship first, retain the existing remote-web refusal.

The proof-cleanup timeout thread no longer applies: the close now retries on the same lease without another request. No lower-priority threads still apply.

The latest GitHub check snapshot for 302f1dd reports 25 passed, with no pending or failed checks. The same-head smoke logs show five live cases with zero skips on each of macOS and Linux and one focused Windows refusal case with zero skips. Those provider runs did not exercise production tenant admission or abrupt daemon exit. No conflicts are known.

First-open rollback ownership is supported by static production tracing, the daemon router test structure, and a mocked provider regression; the live smokes do not exercise autonomous retry after a failed first open. The focused 15-test result is author-reported, and historical checks in the PR body were not revalidated as current checks. CLI, Node, and MCP convergence is supported by source inspection. Not verified here: an independent live session through any surface.

Before merge, keep remote web admission closed until the macOS and Linux production tenant-daemon receipts establish the redirect destination and post-exit enforcement described above.

@thymikee
thymikee force-pushed the fix/daybreak-remote-web-proxy branch from 302f1dd to 3e807ac Compare December 2, 2026 16:56
@apex-sentinel-staging

This comment has been minimized.

@thymikee

thymikee commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

At 3e807ac, the first-open cleanup is fixed, but remote web admission still opens before browser-lifetime confinement is established. The checks are green; the web lanes run local web and provider smokes or Windows refusal, not production tenant lifetime runs. No conflicts are known.

The confinement smoke constructs a provider directly and observes a post-disposal probe while the test process stays alive. It does not establish confinement for the lifetime of a browser admitted by the production tenant daemon. Before merge, keep remote web admission closed until same-head production tenant-daemon runs on macOS and Linux with the pinned browser correlate a controlled public IPv4 HTTP/80 redirect and destination with fixture receipts, and demonstrate authenticated proxy enforcement or host-enforced denial immediately after abrupt daemon exit and before recovery.

The admission guard accepts a public-network-only web request when the default provider is bound, but that flag does not prove lifetime enforcement. This enables managed remote tenant web before the required evidence exists. Retain the refusal for remote tenant web except close until the required production receipts establish confinement, and keep help and user docs aligned with that refusal.

A second independent pass found that admission skips the previous refusal when provider construction sets the flag, while the smoke disposes an in-process runtime. Could the non-close refusal remain in place until the macOS and Linux production runs provide the redirect and destination receipts and establish enforcement immediately after abrupt daemon exit? No private-destination connection was observed in this review.

The first-open cleanup is supported by production source tracing and a pre-fix comparison of mocked tests. Not verified here: an independent live session, failure reproduction, or local test was run. The earlier proof-cleanup fix remains at head. The previous Windows receipt applies to 302f1dd; no production lifetime receipt was supplied for 3e807ac.

@thymikee

thymikee commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

Addressed the admission finding from the review at 221b59c. Remote tenant web non-close operations unconditionally refuse; provider construction no longer supplies an admission capability. Help and user docs match. The modified router suite passes24tests, including existing-session read refusal and remote close retry. This does not claim production lifetime proof. The public redirect/destination and abrupt-daemon-exit receipts remain absent, so the PR stays draft and admission stays closed.

@apex-sentinel-staging

This comment has been minimized.

@thymikee

thymikee commented Dec 3, 2026

Copy link
Copy Markdown
Member Author

The earlier findings from 3e807ac are fixed at 221b59c, but one new problem remains in the admission order. The delta changes what the typed refusal says for one route, and the new help and docs do not match the code.

A remote tenant (proxy client or auth-hook tenant) can send snapshot, or any non-close command, for a session name that a local caller opened as a web session on the same daemon. admitDevice runs assertWebSessionConfinement first. The local session has no public-network marker and the request is remote, so it throws remote_web_session_confinement_mismatch before assertRemoteWebDeviceAdmitted at line 624 runs. On base 61f0e4d this route returned remote_web_public_network_unenforced, and commands.md said so explicitly. The delta now rewrites the help (cli-help.ts:694), commands.md:556 and remote-proxy.md:10 to say every remote tenant web command is disabled with remote_web_public_network_unenforced. The router tests at request-router-web-sessions.test.ts:290 and :341 assert the mismatch reason instead. The request is still refused, so this is not a confinement bypass. But an agent that follows the help and branches on remote_web_public_network_unenforced will read this refusal as a session-policy clash and may retry under another session name. The rule the code must satisfy is: while admission is closed, every remote non-close web admission refuses with remote_web_public_network_unenforced. The single admitDevice closure enumerates every bind path (request-runtime-binding.ts:136, :159, :169). The smallest fix is to call assertRemoteWebDeviceAdmitted before assertWebSessionConfinement at request-execution-scope.ts:619-624, then change the expectations at request-router-web-sessions.test.ts:314 and :396 to remote_web_public_network_unenforced. The mismatch check then still covers a local request on a confined session.

Not blocking, and fine to take or leave: with admission closed for every remote non-close web request, no production caller can create a public-network session, so the proxy, address classification, confined launch and process-record fields run only in tests and the in-process smoke. Could the admission, docs and session-marker part land now, with the proxy and confined launch moving to the enablement PR that carries the receipts, or should this stay a draft until then?

Required evidence is satisfied. CI is green: 28 checks with 0 not passing at 221b59c. Those checks cover the daemon admission, router tests, help and docs, but the web-confinement lanes run the local and in-process smokes and the Windows refusal, so they do not exercise remote tenant admission, which is closed at this head. No conflicts. Not verified here: tests or live runs, since this was a read-only review, and whether tenant isolation namespacing stops an auth-hook tenant from naming a local session. Before merge, the admission order and the two router expectations need to change as described above.

@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 1c5e303

Warning

The isolation lease for this review ended before the review finished (an artifact of the staging environment). There is a chance that some of its findings are unverified, or that something was missed. Comment @apex-sentinel-staging review to run it again.

Since the review of 221b59c: 1 new · 0 still open · 0 no longer raised

1 finding(s): 1 minor.

🟡 Minor (1)

Where Finding
packages/daemon/src/sessions/session-lifecycle/internal/session-close.ts:457 🆕 session-close aborts release on close error, leaking proxy and device lease

3 new findings away from what changed since 221b59c not shown. Comment @apex-sentinel-staging review for a full review.

Reviewed with this repository's own Sentinel configuration (7c6ef4a2ed46).

💬 Talking to Sentinel

In a finding's thread, reply with:

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.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 new finding on 1c5e303. The verdict and the full list are in the summary comment.

Comment on lines 457 to +462
platformResourceCleanup: params.platformResourceCleanup,
});
let session = sessionStore.requireCurrent(ref);
if (session.webConfinement === 'public-network' && platformCloseError) {
throw platformCloseError;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🆕 🟡 Minor · session-close aborts release on close error, leaking proxy and device lease

A confined web session whose platform close fails (for example the backend answers confirmation_required) never reaches the release/retire step, so the session stays published and its device claim is never released. runCloseTeardownAndRelease rethrows at line 460, skipping the rest of the teardown. On permanent failure the session can only be freed by daemon restart.

Suggested change

Keep the confined session published when its platform close is unconfirmed, but still run the release path that frees the device claim and marks the session so a later close can retry; do not skip the rest of runCloseTeardownAndRelease with a bare throw.

Raised as major, posted as minor: no verification confirmed it.

Details

persona: javascript

Useful? Reply @apex-sentinel-staging like, or @apex-sentinel-staging dislike <why> if it is not.

Reply @apex-sentinel-staging note ... to add context, or @apex-sentinel-staging pivot ... if it is wrong — I will re-check the cited code.

@thymikee

thymikee commented Dec 3, 2026

Copy link
Copy Markdown
Member Author

The admission-order problem from the earlier review (#5272 (comment)) is fixed at 1c5e303, and this review found no new problems. CI shows 26 checks with none failing at this head, including the router tests for the reordered admission in the unit lanes. No conflicts. Not verified here: tests and live runs, since this was a read-only review, and the later refusals remote_web_provider_unconfined and remote_web_browser_unconfined, which sit behind admission and were covered in earlier rounds. The PR is still a draft, and the open question about landing admission and docs now while the proxy and confined launch move to the enablement PR is the maintainer's to decide before merge. The inline thread on session-close.ts (#5272 (comment)) does not apply and can be resolved: it is outside this change, and keeping the session published after an unconfirmed close is intentional, matching the device-claim branch.

@thymikee

thymikee commented Dec 3, 2026

Copy link
Copy Markdown
Member Author

Closing. Remote web is not supported for now: #5348 refuses remote (public-network-only) requests that reach the managed web browser with REMOTE_WEB_PUBLIC_NETWORK_UNENFORCED. Remote web may be supported later; docs/experiments/remote-web-public-network-confinement.md (in #5348) describes the confinement that would have to replace that refusal.

@thymikee thymikee closed this Dec 3, 2026
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