Repository navigation
feat(cli): replace cloud connection profiles with hosted session leases - #5085
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: 2 new findings on b2e2c8f. The verdict and the full list are in the summary comment.
|
Reviewed b2e2c8f. This needs changes before merge: src/cli/connection/ended-lease.ts:34: src/cli/connection/active-connection.ts:50: src/commands/schema/cli-help.ts:485: the new provider sentence reads "--max-minutes to request a duration to cap the charge for the session in USD (for example 0.50) to start the session with a hosted app archive". These are fragments of removed flags. A second independent pass found these further problems. Each is phrased as the rule the code must satisfy. src/cli/connection/cloud-access.ts:40: after a lease is created on a custom issuer, unsetting src/cli/connection/cloud-session-api.ts:442: a create response can return the bearer it received in the POST as packages/provider-limrun/src/device-session.ts:188: stopping a recording on a hosted Limrun attachment feeds packages/daemon-client/src/daemon-client-rpc.ts:155: a device daemon can return an RPC error with the scoped token in its message. src/cli/commands/connection-presentation.ts:204: the create response can echo a key or attachment token in src/cli/connection/cloud-connect.ts:82: after src/cli/connection/cloud-session-api.ts:234: an ID with an unpaired UTF-16 surrogate passes src/cli.ts:405: a session-aware command without a session flag, run while the active connection is a non-leased private profile under a non-default name, gets that name from src/cli/connection/active-connection.ts:44: under umask 002 a direct connection can leave src/cli/connection/connect-provider-adapters.ts:174: bare src/cli/connection/cloud-access.ts:42: with src/cli.ts:516: a state directory with a saved cloud profile from the base's built-in cloud route holds a Not blocking, and fine to take or leave: replace the Would a smaller design deliver the same lease ownership? One option is three PRs. (1) Lease lifecycle only: CI: the three Integration Tests failures all report "daemon leak oracle: LEAK (after-shutdown) … stray state-dir entries: connection-locks/", and this diff creates that directory (the The PR also has merge conflicts with main, and it sits on 6e0c761 while #5084 was amended to f6ab008, so a rebase is needed. The review above covers b2e2c8f against its parent 6e0c761, and the conflict with the amended base was not re-reviewed. Live validation is required before merge, because this change re-routes dispatch and credentials for device commands and the PR body lists live transport verification as pending. Against the hosted session API (staging is fine) at the final head, please attach the output of: Before merge, the lock stall on direct |
b2e2c8f to
ff503e0
Compare
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on ff503e0. The verdict and the full list are in the summary comment.
ff503e0 to
93dac30
Compare
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 93dac30. The verdict and the full list are in the summary comment.
93dac30 to
46baced
Compare
51ce884 to
3471fb2
Compare
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 3471fb2. The verdict and the full list are in the summary comment.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 4d90c49. The verdict and the full list are in the summary comment.
|
At 4d90c49, one problem needs a fix: the diagnostics deadline can leave an incomplete record behind. The earlier review of 5efa384 found no required fixes. The thread fixes made by this head are listed below. In remote-request-diagnostics.ts, a second independent pass found that the 10-second deadline now only aborts the HTTP request and returns timeout. If the diagnostics GET has finished at the HTTP layer but a slow filesystem still holds the final write, the closed request emits no error on abort. The file sink can stay open and the file is never removed, so a caller that archives remote-diagnostics can pick up an incomplete record. A loopback Node check with a delayed writable stream showed the request closing before the sink finished, with no abort error in that interval. faf8224 and 5efa384 both settled and removed the output on the deadline. The rule: before timeout is reported, every download that has started must be failed, its sink destroyed and its partial file removed, even if the socket is already closed. A request admitted after the deadline must still send nothing. To validate, let the response end while the final write stays pending past the deadline, then show a timeout result and no file at the destination. Not blocking: the Of the open threads, artifact download inside dispatch still applies as an advisory maintainer note, and 2 lower-priority threads also still apply. These no longer apply and can be resolved. Contended operations: withdrawn by its author; contended hosted operations are refused. Ended lease lock: it now tries the lock without the 180-second wait. Lock test: the test now asserts that the blocking acquire is never called. Help text: it now names The only check not passing is Body rules, which was cancelled, not failed. It checks the PR description and metadata, so it is likely unrelated to the code change. The other 17 checks pass at this head. Not verified here: tests were not run locally, and CI at this head was relied on for the new and changed tests. Code covered by the earlier review, such as the cloud connect release path and connection lock callers, was not traced again beyond the points touched since then. Before merge, the diagnostics deadline needs the fix above and the Body rules check needs a re-run. |
This comment has been minimized.
This comment has been minimized.
|
At 44cd162, the diagnostics deadline problem from the earlier review of 4d90c49 is fixed, and no required code fix remains. On the deadline, each started download is now settled, and the report waits until its sink is closed and the partial file is removed. A request admitted after the deadline still sends nothing. Of the open threads, artifact download inside dispatch still applies as an advisory maintainer note, and 2 lower-priority threads also still apply. The threads that the earlier review marked as fixed can be resolved, including diagnostics timeout, which now also covers started downloads. These do not apply and can be resolved too. Contended operations: withdrawn by its author; contended hosted operations are refused. Ended lease lock: it tries the lock without waiting. Lock test: the test asserts that the blocking acquire is never called. Help text: it names All CI jobs pass at this head except Proof, which was skipped. No conflicts are known. Not verified here: tests were not run locally, and CI at this head was relied on. The new test stalls the response, so it does not exercise an ended response with a pending final write; the abort listener that covers that case was checked by reading the code. Code outside the changes since 4d90c49 was not reviewed again, and the live-device evidence is from aaad938. Nothing in the changes since 4d90c49 holds up the merge. The three advisory threads that still apply are for the maintainer to weigh. |
thymikee
left a comment
There was a problem hiding this comment.
On the artifact materialization advisory, this PR keeps the dispatch guard through the full materialization. A single materialization can make multiple authenticated requests, including fallback and retries. A guard around the initial check alone could let a later request leave after disconnect retires the session. A transfer can delay teardown on the same session. Shortening the lock safely requires admission at each authenticated request handoff.
This comment has been minimized.
This comment has been minimized.
|
At 0d6af48, one code fix is still needed. Since the earlier review at 44cd162, an artifact transfer no longer holds the connection lock, so connect and disconnect can proceed while a body streams. The new per-download admission can now end too early. A second independent pass found that admission can release before the queued GET headers are sent, which is likely a defect. A hosted screenshot, recorded action, or successful or failed batch receipt gets its artifact ID after the attachment closes the RPC connection, so the GET needs another connection. If that connection is delayed, No high-priority review thread still applies, and 2 lower-priority threads still apply. These do not apply and can be resolved. Download inside dispatch: only the synchronous start of each GET is wrapped now. Contended operations: withdrawn by its author; contended disconnect is refused. Ended lease lock: it tries the lock without waiting. Lock test: the spy is gone, but the test would still time out on a blocking acquire. Help text: unchanged since it was checked to name The Body rules check was cancelled, not failed. It checks the PR body and is likely unrelated to the code changes. The other 16 checks pass at this head. No conflicts are known. Not verified here: tests were not run locally, and CI at this head was relied on, including the eager-closure check for the lazy import. The live hosted-device evidence is from aaad938, and no live run at this head exercised per-download admission. A new live run was not judged necessary for the admission change since 44cd162, because the endpoint, credential and headers are the same. In the failed-batch path, a refused admission now returns the localized error with its Before merge, the admission fix above is needed and Body rules needs a re-run. The lower-priority threads on request retriability and test brittleness are advisory, for the maintainer to weigh. |
This comment has been minimized.
This comment has been minimized.
|
At 0a0baf4, the admission problem from the earlier review at 0d6af48 is fixed, but one likely defect needs a fix before merge: a refused artifact download can delete an existing output file. Likely defect: a second independent pass found that, when admission rejects the GET, the download path destroys the unsent request, and No high-priority open thread still applies, and 2 lower-priority threads still apply. These threads do not apply and can be resolved: withdrawn by its author, a contended hosted disconnect is refused; All 17 checks pass at 0a0baf4. Not verified here: no tests were run locally, and CI was relied on. No live hosted run exercised per-download admission at this commit; the endpoint, credential and headers are unchanged, so a new live run was not judged necessary. The timing of Node's |
This comment has been minimized.
This comment has been minimized.
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.
|
At 9bb90e4, the code has no remaining problem that needs a fix before merge. The defect from the earlier review at 0a0baf4 is fixed: when admission refuses an artifact download, the failure path now returns that error without running destination cleanup, so an existing output file is kept. A new test covers this case and also expects that no request reaches the server. No high-priority open thread still applies, and 2 lower-priority threads still apply. These threads do not apply and can be resolved: withdrawn by its author, a contended hosted disconnect is refused; The only check that is not passing is Not verified here: the new test was not run locally. That it fails at 0a0baf4 and passes now is inferred from the code, where every failure at 0a0baf4 ran the destination cleanup, which removes an ordinary output file. Before merge, the cancelled |
Summary
Replace hosted connection profiles with session create and teardown. Persist the attempt key and keep observed lease IDs until the API confirms teardown. Fence owned sessions when sending probes or device commands and before pulling artifacts. Delete the superseded profile module and hosted-profile tests. Direct provider cases remain.
Before / after
connect cloud --platform ios --session example --jsoncreates a hosted lease and reports the ID and deadline.snapshot -i --session exampleuses the lease's scoped credential.disconnect --session example --jsonends the lease. Retry after an inconclusive teardown.Validation
Head
9bb90e4608306b4ff3d35ece0542619faf32af87. Coverage timed out twice in the SOCKS/TLS fixture. A controlled delay reproduced the timeout before the ordering fix and passed afterward. The fixture now acknowledges CONNECT after the upstream relay is ready. All 25 focused SOCKS and artifact tests, lint, and type checking passed. Fresh CI is pending.Previous head
6b4c4933de6aa523493709e4af9a2aa18b153656. Refused artifact admission destroys the unsent request and preserves existing output. Cleanup still runs after an admitted send starts. The regression reproduced deletion at0a0baf4and passed on this head. All 23 focused tests, lint, type checking, and the protocol v3 wire check passed. Fresh CI is pending.Earlier hosted iOS and Android connect, open, snapshot, and release passed on
aaad938870b91029cbe988474f543b178d07b29a, with each session settling at $0.10 under a $0.50 cap.