feat(sim,engine): @linkcode/sim SDK + SimulatorBackend with per-session device ownership (CODE-393)#266
Conversation
…t/reclaim ownership races
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1d235267bd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Greptile SummaryAdds the simulator host stack and daemon integration.
Confidence Score: 4/5The PR is not yet safe to merge because resuming a simulator session during reclaim can leave it operating against a device that is still being shut down. The reclaim fix preserves the ownership entry but does not synchronize with or reverse the shutdown already in flight, so the resumed session can receive operation failures or retain a stopped device. packages/host/engine/src/simulator/service.ts
What T-Rex did
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart LR
Session[Session operation] --> Service[SimulatorService]
Service --> Claim[Device ownership claim]
Claim --> Client[SimSidecarClient]
Client --> Sidecar[linkcode-sim sidecar]
Sidecar --> Simulator[iOS Simulator]
SessionStop[Session stops] --> Idle[Idle reclaim timer]
Idle --> Shutdown[Shutdown device]
Shutdown --> Release[Release claim]
Reviews (2): Last reviewed commit: "fix(sim): reconcile boot ownership on fa..." | Re-trigger Greptile |
…claim, declare foxts dep
|
Addressed the review in abc79e1: boot ownership is now reconciled in a |
| // Cancel an in-flight reclaim's claim-drop: the session is back, so it keeps ownership even if | ||
| // the shutdown started (it re-boots the device on its next op). | ||
| existing.reclaiming = false; |
There was a problem hiding this comment.
When the owning session performs another simulator operation after idle reclaim has started, claim() clears reclaiming but allows the operation to proceed while shutdownDevice() remains in flight. The operation can fail against a device being shut down, or the pending shutdown can leave the session owning a stopped device; no subsequent reboot occurs here despite the comment.
Artifacts
Repro: deterministic focused Vitest race harness
- Evidence file captured while the check ran.
Repro: focused Vitest configuration
- Evidence file captured while the check ran.
Repro: verbose failing test output with backend call ordering and assertion trace
- The full error output from the failing run.
Supersedes #249 (auto-closed when its stacked base branch was deleted during the #247 merge). Same branch, now rebased onto master with the review-comment fixes folded in.
@linkcode/simtyped sidecar client + engineSimulatorBackendport +SimulatorService(per-session device ownership, caps, idle reclaim), wired into the daemon.Review fixes (from the #249 bot review)
exit/error/dataafter a crash-respawn no longer tears down (or feeds stale bytes into) the replacement.writeFramefailure now fails the request immediately instead of leaving it pending until the reply timeout.CODE-393. Stacked under #251.