Repository navigation
Conversation
Size Report
Startup median (7 runs, lower is better):
|
There was a problem hiding this comment.
All reported issues were addressed across 32 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
Apex Sentinel · 🟠 Request changesSince the last review: 1 new · 0 still open · 0 no longer raised 1 finding(s): 1 major. Required fixes
🟠 Major (1)
1 finding below 💬 Talking to SentinelIn a finding's thread, reply with:
On this conversation, comment Earlier reviewsReview of
|
| Where | Finding |
|---|---|
packages/daemon/src/sessions/session-lifecycle/internal/session-open-execution.ts:270 |
🆕 Reopen on a stopped simulator is recorded as a boot and close then shuts down a pre-running device |
1 finding below minor hidden (user_settings.min_severity).
Reviewed with this repository's own Sentinel configuration (d38e35e61193).
Review of 7dd1ac93 · 14.11.2026 02:28 UTC
Apex Sentinel · ✅ Approve
2 finding(s): 2 minor.
🟡 Minor (2)
| Where | Finding |
|---|---|
packages/daemon/src/sessions/session-lifecycle/internal/session-open-state.ts:76 |
markOpenBootedDevice is called after store.publish rather than setting bootedByOpen on the draft, so the sessio… |
packages/contracts/src/client-app.ts:158 |
warnings?: string[] forces SDK callers to match daemon message text |
Reviewed with this repository's own Sentinel configuration (ddbfc855661f).
There was a problem hiding this comment.
Apex Sentinel: 2 new findings on 7dd1ac9. The verdict and the full list are in the summary comment.
|
CI is green at e5f7ab7 (16 checks, none failing), but the PR is a draft, so the device lanes were skipped and do not cover the Android or iOS lifecycle path. No conflicts. The code has two problems to fix before merge. The new sentence at website/docs/docs/sessions.md:130 says provider-owned devices are not stopped through --shutdown. On a provider session, The Android cold-open route has no live run. The route is bootStoppedLocalAndroidDevice, then markSelectionBootOccurred on the AVD selection, then the serial swap, then plain close with bootedByOpen. The PR body reports that Android cold open failed with DEVICE_NOT_FOUND for emulator-5554 and Pixel_7_CI, and the cause is not diagnosed. Whether the serial device reaches close with bootedByOpen and the emulator really stops is unproven. The iOS run used T3 client 0.21.31, so the head client and CLI warning delivery are not shown either, and the report paths in the PR body are not readable here. Please run the head-built CLI (pnpm build, then the node bin from this checkout with a fresh --state-dir): (1) with the AVD shut down and Not blocking, take or leave: the policy fact is carried per request in req.internal.shutdownCapabilityDenied and hand-copied into the replay cleanup request, while the close handler could read it from its daemon dependencies; the new client warnings pass-through (index.ts:270, index.ts:380, and serializeCloseResult) has no test, since deleting either line keeps every test green, so one client test with a fake transport would cover it; the doc comment at device-selection-resolver.ts:101 still says the boot event holds "once it succeeds", but it is now predicted before dispatch and session selections can claim it; and the cli-help.ts:132 rewrite drops "runners/daemons self-idle after 5 minutes; stale leases self-reclaim", which are unrelated to this change, so please keep them and shorten the new close sentence instead. Could the request-stamped policy flag become a daemon dependency instead? handleSessionCloseCommands would receive deviceShutdownDenied, derived once from the loaded DaemonPolicy where daemon-runtime.ts:218 already derives assertShutdownAllowed, and pass it to runSessionCloseTeardown, the way platformResourceCleanup is threaded. That would delete withShutdownPolicyDeniedFlag, the new isDaemonPolicyCapabilityDenied export path, DaemonRequestInternal.shutdownCapabilityDenied, the router stamp and the replay-cleanup copy, about 25 production lines, with no propagation invariant to keep. bootedByOpen and updateOpenDevice can stay as they are, and setting bootedByOpen on the publish draft would be a small extra simplification. No ADR change looks needed. On the other threads: the threads on boot ownership for reopens and on replay close scope are fixed at this head and can be resolved. These do not apply and can be resolved: skills/agent-device/SKILL.md:16 already limits --shutdown to a local simulator or emulator, and provider shutdown goes through session-close.ts:144-163; skills/android-emulator/SKILL.md:24 states the policy-denied case and scoping to a local emulator is correct; the publish-then-update thread has no reader between the two synchronous calls, so the draft change is only a simplification. The typed-reason thread on warnings still holds but is not blocking, because warnings: string[] is the existing contract convention. |
|
Addressed the source and documentation feedback in fcd2ec8.
I retained the existing display-warning convention; no consumer branches on warning prose. The nonblocking structured-warning suggestion remains deferred rather than being presented as fixed. Live evidence remains limited: the e5 T3-bound iOS daemon cases passed, but its old bound client omitted the warning; Android cold selection failed twice and that route stopped. The new fake-response tests prove current client/serializer projection, not fresh end-to-end device delivery. I have not used an unbound head CLI to bypass the required T3 route. This PR remains draft. |
There was a problem hiding this comment.
All reported issues were addressed across 43 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on fcd2ec8. The verdict and the full list are in the summary comment.
|
Thanks for the update. At fcd2ec8 the per-request policy marker is gone and reopen selections are now classified, so those two earlier findings are fixed. Two problems remain from the earlier review (#4539 (comment)), and one check fails. The Android cold-open route still has no live run, and the PR says there was no fresh device execution at this head. The route is Close help says plain close stops a device "your session booted", but only The Coverage gate fails because of this delta. Open review threads that still apply: #4539 (comment) (close help owner wording, same rule as above) and #4539 (comment) (commands.md provider shutdown). The second one needs a fix: commands.md:107 says provider-owned devices are never stopped this way, but I did not run tests; I judged this from the diff. The new router case in The branch now conflicts with its base 0.22, so please rebase. Before merge, fix the Coverage gate, attach the Android cold-open and close run, and align the close wording and the commands.md sentence. |
fcd2ec8 to
ebce87f
Compare
|
The code from the earlier review (fcd2ec8) is mostly fixed at ebce87f, but two items remain. The Coverage failure is repaired and all 18 checks pass. There are no conflicts. The close owner wording is fixed at The workflow help still over-states who owns the boot. cli-help-workflows.ts:32 and line 288 say plain close stops a simulator or emulator "your session booted". Only The live Android evidence is still missing. The route is session-open.ts:422: cold boot by AVD name, the serial swap, Not blocking, take or leave: Of the open inline threads, the help owner wording thread still applies, because I did not run tests. This review comes from the diff and the code at ebce87f, and the CI result comes from the check summary, not the per-job logs. I did not trace which Limrun lease kinds reach Before merge, please fix the two help lines and attach the Android cold-open to close runs on this head. |
|
Exact local affected admission passed at Command (one invocation):
Independent actual-owner source recheck: NO FINDINGS. Hosted at this head: 16 successful / 1 skipped / 1 neutral. These lanes are separate. Current-client warning rendering and supported cold Android lifecycle proof remain open; stopped device paths were not retried. No merge clearance. |
ebce87f to
8c24143
Compare
|
Published rebased A5 head8c241431f249ce4040fc0f32e5261bc771d9c4a0 on0.22root0081. Independent rebase preservation/prose recheck found no findings: all14patches equal, binary layer byte-identical, disjoint base/layer changes and automatic merge tree equals candidate. Prior actual-owner semantic review applies to unchanged A5 bytes; inaccurate narrative/device-status statements from the new report are excluded rather than treated as live proof. New exact affected admission ran ONCE: raw0,42 passed/25 skipped, all67 FAIL-OPEN checks retained, exactCommit=true,checkoutChanged=false. Direct pnpm11.17.0 frozen install/build0. Defaultorigin/mainD78/mergebase d38; actual0.22root0081 separately. Receipt UTC2026-11-14 17:16:43.404–17:24:34.924. Matching clean fingerprint b3d88311b7cc7f25311dd86d230253375dd990b452d6c609da915f813ccdfb71. ReceiptSHA1dc54abc9653d62201579ab383e4e756a46eea02454a13453db6051f07a4347b. Parent verified all87manifest hashes in evidence directory and archive and all52original/copy evidence files byte-identically, refs/results/pinnedsetup/finalindex. ArchiveSHA d971b2758fe86a9b52f47934ce59b8bbb6dd79323c8f655ced710c9fc5f5c5de, VERIFIED-UNSEALED. Initial read-only shell/controller errors were separate from actual gate execution; no rerun. No printed lock wait; actual wait unmeasured. New-head hosted checks remain owed. Current-client warning delivery and supported cold Android ownership live proof remain BLOCKED. Pixel7 twice DEVICE_NOT_FOUND and Pixel9 KO shutdown routes remain STOPPED; Pixel9 last known ON/unclaimed, no cleanup claim. No device actions or alternate route occurred. No merge/release clearance. |
|
Thanks for the update. The The close help still names the wrong owner. cli-help-workflows.ts:32 and The Android cold-open route is still covered only by unit fakes at session-open-execution.ts:443. That route boots by AVD name, swaps the name for an ADB serial, calls
If the cold open fails with I did not run tests or any device. CI state comes from the check summary, not the per-job logs. The patch is identical to the one in the earlier review, so I did not re-trace the close and open code beyond the owner reads and writes. On the inline threads: the one on |
Plain close now stops a local simulator or emulator that this session's open booted. The boot fact selection already computes (markSelectionBootOccurred) is recorded on the session by the open-state publisher, and close finalization asks the same shutdown capability close --shutdown uses. A policy that denies device-shutdown blocks the implicit stop but the close still succeeds and reports the kept device through warnings. A boot-owned iOS close no longer retains a warm runner, because the device stops. Closes #4162
R7 classifies bootedByOpen as store-established: publishOpenSession builds the record and SessionStore.markOpenBootedDevice sets the fact, matching the markCloseEffectsUnconfirmed shape.
Help, workflow topics, website docs, skills, device verification, and ADR 0029 now state that plain close stops the device its own open booted, that --shutdown is for a device the session did not boot, and how a policy denial reads on each of those paths.
The contract pinned the pre-#4162 wording 'agent-device close --shutdown'. Plain close now owns the boot-stop, so the contract anchors on the finish instruction itself, and the mutation fixture still removes exactly that.
Review round 1 on #4162: - A policy that denies device-shutdown is now a request-scoped fact the router marks once. The close lifecycle decides the refusal before it finalizes, so the refused stop never consumes the warm-runner retention a kept-running device earns, and no error is swallowed. - The boot-ownership fact is additive across every publish path, so a provisional dispatch publish (record-video test opens) cannot lose it. - SessionCloseResult and AppCloseResult carry the close response's warnings, and serializeCloseResult keeps them, so the kept-device disclosure reaches the SDK, the CLI text, and close --json. - remote-proxy.md states the plain-close exception to the denied capability, and the layering note names the real writer.
The close lifecycle consumes the derived request flag, not the predicate, so the export has no consumer outside daemon-policy.ts.
8c24143 to
93b40d7
Compare
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 93b40d7. The verdict and the full list are in the summary comment.
| const preparedSelection = markSelectionBootOccurred( | ||
| selection, | ||
| lifecycle.owner.kind === 'local-family', | ||
| ); |
There was a problem hiding this comment.
🆕 🟠 Major · Session reopen forges boot ownership from a stale booted: false snapshot
On a reopen of an existing session, markSelectionBootOccurred receives a selection whose bootOccurred is derived solely from the stored snapshot (device.booted !== true && kind === 'simulator'|'emulator'), so a session whose snapshot was recorded before boot was confirmed gets bootedByOpen: true from the first reopen onward. SessionStore.updateOpenDevice never clears it for that device identity, so a later plain close shuts down a simulator that was already running before the session opened.
| const preparedSelection = markSelectionBootOccurred( | |
| selection, | |
| lifecycle.owner.kind === 'local-family', | |
| ); | |
| const preparedSelection = markSelectionBootOccurred( | |
| selection, | |
| lifecycle.owner.kind === 'local-family' && selection?.source === 'local', | |
| ); |
Suggested change
Keep the boot fact derivable only from a selection that observed this request booting the device (source 'local' or an explicit boot stamp), and never from a source: 'session' snapshot; if reopens must be able to record it, carry an explicit booted-device argument from the boot site instead of re-deriving it from the stored DeviceInfo.
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.
There was a problem hiding this comment.
At 93b40d7c, the ordinary local iOS-simulator reopen path refreshes the device before creating this selection: session-open.ts:288–293 calls refreshSessionDeviceIfNeeded, then passes its returned device to resolveExistingSessionDeviceSelection. On Darwin, the refresh uses a live attached-runner observation (booted: true) or resolves the current exact UDID/simulator set (session-device-resolution.ts:117–145). Request execution copies platformServices per request (request-execution-scope.ts:392), so the WeakMap pin from an earlier ordinary request cannot supply its old snapshot.
For that path, a simulator already running at reopen reaches this helper with booted: true; the reported stored-false premise is not established. The proposed blanket source === 'local' guard would also remove intentional ownership when an existing-session reopen actually boots a stopped simulator. The existing cold-reopen test checks that prepared-command contract, but it bypasses the full refresh path and is not a reproduction of the reported stale-snapshot case.
This is a source trace for ordinary separate-request local iOS reopen, not Android, composite-request, race, or live proof. I have not applied the suggested guard. A concrete caller/reproduction that retains stale false after current-device selection is still needed before changing that ownership contract. Leaving this finding open and the current check unwaived; Android cold ownership and current-client warning delivery remain separate live blockers.
|
Thanks for the update. At 93b40d7 the owner wording in help now says "this session's open booted" at all three sites, so that part of the earlier review (#4539 (comment)) is fixed. One item remains: there is still no live Android run. The Android cold-open route is covered only by unit fakes. Open boots by AVD name, swaps the name for an ADB serial, then Not blocking, take or leave: the claim-currency condition gates only the permitted branch (https://github.com/callstack/agent-device/blob/93b40d7/packages/daemon/src/sessions/session-lifecycle/internal/session-close-lifecycle-teardown.ts#L100), so a lost claim under a deny policy still warns that close would stop the device, which it would not; deciding claim currency once before both branches and deriving the warning and On the other open threads: the owner-wording thread (#4539 (comment)) is fixed at this head, and the resolved-benign thread on open-boot ownership (#4539 (comment)) needs nothing more, since this change touches only the close-side claim check. Two other threads do not apply and can be resolved: #4539 (comment) (on Darwin iOS the device is refreshed before reopen, and on Android the reopen re-mark is idempotent, so the proposed The only check not passing is a review gate that is holding open thread r4578158108. That thread does not apply, so the gate needs a waiver or a reply on that thread, not a code change. The other 17 checks pass. Before merge, please attach the three live Android runs above. |
Summary
For #4162, plain close stops only a local virtual device booted by this session's
open, while its claim remains current. Prebooted, physical and provider-owned targets remain running. Policy denial keeps the device running with a warning; explicit denial remains a typed refusal. Successful native-close warnings survive outer replay and attempt projection.Published head
93b40d7c4c82cc5460c3b02db4aa5d02eff51d90is rebased on0.22root9f6435f0: 50 files/1,412 gross lines; default-main scope 209 files/5,527 gross including integration.Validation
Independent Apex/medium written source/prose recheck found no issues after the
20c2d716requested changes. The report was checked against committed blobs; inconsistent delivery-summary claims are excluded.At this head, pinned pnpm11.17/Node26.8.1 install/build passed. One focused/closure run passed 947 tests across five files. One canonical affected run passed 42 checks, skipped 25 with owners retained, and left none unrun:
exactCommit=true,checkoutChanged=false. Receipt SHA256:b09a1482dc347043b6806424c34c2f344eaba927757d6613a3308881abbe3814.Tracked bytes, logical index entries and clean fingerprints match. Raw index-file bytes changed; cause remains unproven. Complete evidence and all receipt-copy pairs were independently verified. The earlier
d59576d5closure-budget failure remains recorded; the fix changed neither limits, tests nor baselines.Size passed: +3,702 B installed/unpacked, +1,203 B download. Sentinel raises stale reopen ownership; a scoped iOS source trace was posted. The finding remains open and its check unwaived. Other hosted checks remain unverified. Android cold ownership and current-client warning rendering remain live blockers; Pixel7/Pixel9 stopped-route constraints remain. No merge or release clearance.
Named receipts and retained failures.