Repository navigation
Conversation
Size Report
Startup median (7 runs, lower is better):
|
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: 2 new findings on 2b59d53. The verdict and the full list are in the summary comment.
- 🟡 Minor · Staged-upload cleanup retries a failing rm forever and reports it once ·
packages/daemon/src/resources/staged-upload-cleanup.ts:17 - 🟡 Minor · resolve() accepts a runId it never compares and the leaseId lookup picks the first match ·
packages/daemon/src/resources/provider-session-ownership.ts:78
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on d7e2418. The verdict and the full list are in the summary comment.
- 🟡 Minor · new upload errors carry no typed reason, so clients cannot tell them from crashes ·
packages/daemon/src/resources/artifact-tracking.ts:910
This comment has been minimized.
This comment has been minimized.
|
Review of 6bfaf24: the change needs fixes and one live validation before merge. CI shows 18 checks, 0 not passing, at this commit. The earlier failures in This change is device-facing under the repo rules. Every admitted request now gets A second independent pass found that ending a lease leaves its staging capacity charged. A tenant stages an upload or gets a resumable ticket under lease A, then ends A before using it. The lease registry drops the lease (lease-registry.ts:347), but neither staging registry gets the end event. The reservations stay charged until their idle timers fire (resumable-upload.ts:304, uploaded-artifact-tracking.ts:47). A successor lease can get A second independent pass found a leak in install-from-source cleanup (session-app-source-deployment.ts:143). A staged archive is consumed and materializes. If removing the materializer's extraction directory then fails (install-source-archive.ts:136), the first await in the A second independent pass found that performance reports can read a retained profile from a different owner (session-perf-runtime.ts:215). On a hookless daemon, tenant A stops an unleased CPU capture in a shared named session. Tenant B can then request a report with its own active lease. The saved source carries only a lease verifier, the null verifier passes A second independent pass found that performance stop returns another scope's capture metadata (session-perf-runtime.ts:384). On a hookless daemon, a declared tenant starts a public-network capture in a shared unleased session. A request under a different declared tenant or admitted lease can stop it, because the guard passes a null verifier and never compares the stored tenant. The stop response includes the producer's output path and artifact ID at lines 415–422. Compare the stopping request's admitted owner with the stored capture owner before finishing or returning the capture. A second independent pass found the same gap for trace (trace-runtime.ts:86). A declared tenant starts a daemon-owned trace without a lease in a shared named session on a hookless daemon. A caller in a different tenant or lease scope can stop it. The stop guard compares only a non-null lease verifier, so it commits the original reservation and returns its artifact ID and daemon path (lines 97–114). Keep the admitted tenant and lease on the live trace, and require the matching owner before stop commits or returns the reservation. A second independent pass found that script publication discloses identifiers to a different closing tenant (session-script-output.ts:162). On a hookless daemon, a declared tenant arms a remote script in an unleased shared session. A request from a different declared tenant can close that session and receive its publication ID and final artifact ID, because the close reply never compares its admitted owner with A second independent pass found that remote app staging rejects supported Unicode session names (upload-client.ts:351). An unleased remote session with a valid name such as A second independent pass found that the upload client discards typed lease refusals after preflight (upload-client.ts:604). The client gets a valid ticket, then its lease ends before the PUT or finalize. The daemon answers with a typed lease refusal (upload-authority.ts:88 and :116). Direct PUT and finalize drop the response reason at lines 569 and 604. The fallback then turns the refusal into a generic Not blocking, and each can be taken or left: (a) For a follow-up issue, not for this PR: Could the ownership logic collapse to one path? Keep the deletion of finalization registration, which is the core win. Then make Of the open inline threads, the one on the uncapped retry in Not verified here: any test run, so test validity is judged from the diff only, and whether |
6bfaf24 to
f6a93bb
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
d99fa63 to
bbc868b
Compare
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on bbc868b. The verdict and the full list are in the summary comment.
- 🟡 Minor · Cross-tenant refusal is mislabeled LEASE_OUTPUT_MISMATCH when lease state differs ·
packages/daemon/src/resources/artifact-tracking.ts:69
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
All reported issues were addressed across 40 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
This comment has been minimized.
This comment has been minimized.
|
2b0d987 fixes some of the earlier findings (#5344 (comment)), but it introduces a regression on the documented remote route, and the script publication disclosure from the earlier review is still open. The shared 32-upload limit is now documented, and On a daemon with no auth hook (for example behind This PR changes device-facing routes (capture stop and report guards for trace, perf and recording, plus the upload-to-install tenant rule), and the only evidence is unit and HTTP tests with fake runtimes. Those tests cannot catch the tenant disagreement above. The live run asked for at 6bfaf24 is still missing and is required before merge. After the fix, run a built CLI at the new head against an Android emulator with A second independent pass found the following. On a hookless daemon, tenant T starts an upload under lease A, and lease B for T can then repeat the preflight, send a chunk, or finalize the same ticket. The HTTP routes pass only the tenant to staging (upload-http.ts:149-158, #L179-L185, #L202-L217, #L234-L242), and the preflight key has no lease (#L448-L457). A finished upload can also be installed or reinstalled through B, because session-app-deployment.ts:77-81 and install-source-resolution.ts:44-54 look it up by tenant alone. Uploads can cross leases within one tenant. The rule is to admit the presented lease at upload ingress and carry the admitted tenant and lease verifier through the preflight key, PUT, finalize, staged artifact registration and both install consumers, returning a typed lease refusal before touching a foreign entry. A second independent pass found that lease end unbinds lease A without invalidating its uploads. Staged entries keep counting for the tenant until their five-minute timers run (artifact-tracking.ts:951-979), so a successor lease can hit UPLOAD_LIMIT_REACHED. Unfinished tickets stay until idle expiry (resumable-upload.ts:291-323), and a transfer already running can finish and publish after A ends, since its commit is gated only by HTTP ingress (upload-http.ts:108-124, #L234-L244, #L259-L275). At the shared lease-end boundary, invalidate the lease's tickets and staged entries and abort its active transfers. Join started filesystem work, and release reservations after the staged files are removed. A second independent pass found that one tenant can hold more than 32 distinct preflight tickets with uploads partly staged. Each new ticket creates a directory and payload (resumable-upload.ts:261, #L265-L287), and the legacy POST receives its body before the count is checked (upload.ts:52-75, upload-http.ts:149-159, #L259-L279). The count applies only when a finished file reaches trackUploadedArtifact, so concurrent staging is unbounded apart from per-file limits and idle expiry. The rule is to reserve bounded staging capacity before any ticket or legacy directory is created, carry the same reservation through finalize, and release it on consumption or after joined cleanup. A second independent pass found that tenant T can release retained install paths that were admitted under lease A, from no lease or from lease B, by supplying the materialization ID. The retain path passes only A second independent pass found that on a hookless daemon, tenant A can arm remote script recording in an unleased, explicitly named shared session, and a distinct declared tenant can then record an action there and receive A's publication ID and revision, or A's publication ID in a delivery failure (session-script-publication-capability.ts:254-283, #L291, #L295-L314). The same caller can close the session and get A's publication ID even when no final version is written (session-close.ts:389-403, #L345-L354). Finalization registers the file under A but still puts the artifact ID and publication metadata in the other caller's reply (request-finalization.ts:165-179). This was the earlier blocking finding at 6bfaf24 and it is not fixed. The rule is that the admitted reader owner is passed to both script-delivery paths and checked against the stored producer owner before any publication ID, version artifact, revision or failure is added to a reply. A second independent pass found that when a tenant stops a daemon-owned trace without a lease and closes the session, a caller in the same tenant presenting a different lease can list the trace or fetch it by ID. Both routes forward the lease header (downloadable-artifact-http.ts:107-110, #L180-L197), but the null-owner path accepts any presented lease (#L111-L119, #L697-L713, #L851-L857). This conflicts with the new rule in remote-proxy.md:109-114 that a capture downloads only in the same tenant and lease scope. For downloadable artifacts, require an absent reader lease when the saved producer is unleased, and keep the verifier comparison for leased producers so the original lease credential still works after close. A second independent pass found that the upload client drops typed refusals. When a tenant is at the staged upload limit, the daemon emits UPLOAD_LIMIT_REACHED at finalize (artifact-tracking.ts:959-966, upload-http.ts:234-244, #L267-L278), but the client drops the reason, falls back to sending the file again, and wraps the legacy rejection in a generic COMMAND_FAILED with the raw body (upload-client.ts:105-133, #L176-L185, #L280-L288, #L495-L499). A hosted-attachment lease refusal between a good preflight and the PUT or finalize is discarded the same way (http-authorization.ts:279-291, hosted-attachment-admission.ts:34-46, upload-client.ts:453-457). The rule is that REST error bodies on preflight, direct PUT, finalize and legacy upload decode into typed errors, and definitive scope and capacity refusals end the upload without a fallback. Not blocking, and these can be taken or left: the script publication fix is to pass the admitted request owner into For a follow-up issue, not for this PR: the staged-upload cap counts only finished uploads (artifact-tracking.ts:951-967), while open tickets and legacy bodies are uncounted, so every staged upload directory a tenant holds should count against one per-tenant limit before bytes are accepted, without counting a finalized ticket twice. The open inline thread on the capture lease-before-tenant wording (#5344 (comment)) still applies, as wording only. Of the lower-priority threads, none still apply. These can be resolved: #5344 (comment) (an unadmitted caller-chosen lease proves nothing, so unleased recording is correct), #5344 (comment) (a tenantless open followed by a tenanted download is not a real flow), #5344 (comment) (the docs now state the shared limit of 32), #5344 (comment) (one refusal for ownerless and foreign entries is intended), and #5344 (comment) (cleanup now runs both steps and rethrows the first error). Evidence limits: no tests were run, so test validity, including the 14-test revert proof and whether any test exercises the hookless tenanted upload-to-install route, is judged from the diff only. The tenant regression was traced through client and daemon source, not reproduced live. Not verified here: whether |
|
Answers to #5344 (comment), head
Live run at fca536c (local daemon + agent-device proxy, no authenticate)The tenanted upload was staged for |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Commit 7af202e fixes the tenant regression from the earlier review (#5344 (comment)), and typed refusals now reach the caller in the finalize step. Three findings remain. CI is pending: 17 of 18 checks pass, and the one not passing is a review check still in progress that runs no test route. The wire-compat and upload mutation jobs that failed at fca536c now pass, because 7af202e re-records the upload-client digests in the ledger. The PR changes device-facing capture routes. Trace stop (trace-runtime.ts:79), perf stop and report, and recording stop now take the output owner from the starting request and check tenant and lease. The client downloads these outputs with lease and tenant headers. The only live run (fca536c, same production code as 7af202e) covers upload to install. The earlier tenant regression was a client and daemon scope disagreement that fake-runtime tests missed. The same disagreement on capture ownership would break A second independent pass found that a remote install can reach a hosted attachment with a lease ID the attachment no longer accepts (upload-client.ts:355). Admission refuses it with LEASE_SESSION_MISMATCH and the daemon returns a typed REST refusal. But The same pass found that a valid same-origin ticket can still be refused on PUT, either by lease admission or by the tenant check at resumable-upload.ts:155 (upload-client.ts:472). The daemon sends a typed REST body, and Of the earlier inline threads, the thread on capture ownership wording still applies as wording only and does not block. The thread on the shared upload limit and the thread on install source cleanup are fixed at this head. These threads do not apply and can be resolved: #5344 (comment) (an unadmitted lease ID proves nothing, so recording the output as unleased is correct), #5344 (comment) (the opener owns the script version and the same connection downloads it) and #5344 (comment) (the refusal wording avoids revealing which entries exist). Not verified here: no tests were run, the two new tests were judged from the diff (both would fail at 2b0d987), and the live install run at fca536c was read, not reproduced. No conflicts. Once the capture run is posted and the two refusal paths are fixed, the PR can be re-checked for merge. |
Register every downloadable artifact with a required producer owner (tenant and lease). Capture output from an earlier request carries that producer; finalize no longer mixes in the requesting tenant or lease. Tenant-owned entries serve only their own tenant, so an untenanted upload or artifact is not readable by another tenant. Trace stop, perf stop, and perf report check the full capture owner. Cap staged uploads per tenant with UPLOAD_LIMIT_REACHED, and always run install-source cleanup after materialized cleanup.
…ment the lease reason
A failed preflight with a typed REST refusal reason, and a refused same-origin ticket PUT, now throw UploadRefusal instead of falling back to the legacy POST. An unsupported preflight route (404, 405, 501) and untyped failures keep the fallback.
7af202e to
daf62a2
Compare
|
Head Code findings
Live capture runBuilt CLI at Notes:
|
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.
|
Both refusal problems from the earlier review are fixed at daf62a2, and the live capture run is now posted. Two new problems remain in the upload fallback, so this is not ready yet. A second independent pass found that a recoverable preflight error now ends the upload. A daemon auth hook can hit a transient dependency error during preflight and throw a typed A second independent pass also found that an expired resumable ticket now aborts a recoverable install. The tenant is still authorized, but the ticket expires before the PUT arrives. For example, a client suspended between preflight and PUT for more than the five-minute idle TTL, inside its ten-minute budget. The daemon drops the entry (resumable-upload.ts) and answers the PUT with The open inline threads need no further change from the author. These do not apply at this head: wording only, as judged before; an unadmitted lease id proves nothing, so unleased is correct; the opener owns the script version and the same connection downloads it; one refusal for ownerless and foreign entries hides which entries exist; the remote-proxy.md upload limit is fixed at this head; cleanupInstallSources was verified at 7af202e and is unchanged. No lower-priority threads still apply. No conflicts. The only check not passing is Body rules, which was cancelled; it lints the PR description and runs no test route, so it is likely unrelated, and the other 19 checks pass. Re-run Body rules after the fixes. Not verified here: local test runs, because CI owns validation. The live capture run was read from the author comment and not reproduced. Hosted gateways that front preflight with their own typed REST bodies were not inspected, and would now end the upload instead of taking the legacy POST. |
Summary
A daemon-produced artifact belongs to the tenant and lease of the request that produced it. A tenant-owned artifact, upload or materialized path serves only its own tenant. Remote callers choose the tenant and lease they send, so those values no longer decide who owns another request's output. Staged uploads are capped per tenant.
Before / after
trackDownloadableArtifactrequires the producer'sArtifactOwner; a mismatch returnsTENANT_OUTPUT_MISMATCH.UPLOAD_LIMIT_REACHED.trace stop,perf stopandperf reportcheck tenant and lease.Validation
Head
daf62a2e3e. Production vsorigin/0.22: +272/-193.artifact-tracking.tsis at the 1000-line cap.