iOS: a canceled request releases the session lock while its runner command still runs on the device
Maintainers usually reply within 1 day
A pull request for this has already been merged.
- #3385 by @thymikee — merged
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 22/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- ios, typescript
Research direction
Start in src/daemon/request-execution-locks.ts and packages/kernel/src/keyed-lock.ts to see when the session and device locks are released, then in packages/platform-apple/src/runner/runner-exchange.ts where an abandoned charge is marked. Done means a test in which a canceled runner command keeps the session lock until the runner journal reports it terminal, plus the live iOS press-then-relaunch check. Linked PR #3385 is already open against this, so check it before starting.
Written by the indexing model from the issue text.
Description
Problem
A per-call signal (#3178) cancels a request, but on iOS the daemon releases the session's lock before the device has finished the canceled work. The next request on the same session can then run while the aborted command is still executing on the device.
- The per-session and per-device keyed locks are held by the handler's promise (
request-execution-locks.ts,keyed-lock.ts). - On abort, the runner
fetchrejects at once, the exchange marks the charge abandoned and rethrows (runner-exchange.ts), and the handler settles. The lock is released. - The runner never sees the disconnect. Its serial
commandExecutionQueueruns the command to completion. - Only runner commands queue behind it. A next request whose device work skips the runner, such as a
simctl launchfromopen --relaunch,simctl privacy, or a screenshot, can overtake the tap. So can the runner's inlinestatusanduptime.
Android holds the lock until adb returns, so it is serialized already.
Consumer impact: tester-army/e2e cannot adopt signal. It keeps an inflight set of abandoned commands and waits for each response before the next attempt starts, so that a tap from a canceled step cannot land in the retry (packages/mobile/src/surface.ts). With signal, the client's promise rejects immediately, so that wait no longer proves the device finished.
Required behavior
- A canceled request whose runner command was already sent keeps its session and device locks until the runner reports that command terminal (
completedorfailedin the command journal), or until the command's own deadline expires. The client still rejects at once withrequest_canceled. - A command that never reached the runner, or one the runner refused, releases at once, as it does today.
- A drain that hits the deadline leaves the charge abandoned, as today, so the detach/handoff rules keep seeing it.
Done when
- A test shows that a canceled runner command holds the session lock until the runner journal reports it terminal, and that a second request on the session starts only after that.
- Live on an iOS simulator: abort a long
press(orlongpress --duration) through the client, then immediately runopen --relaunch. The launch starts after the press finishes, as the request log shows.
Related: #3178 (per-call signal), #2965 (charge settlement by terminal evidence).
- Dominant language
- TypeScript
- Stars
- 4.9k
- Forks
- 328
- Avg merge
- 12h 18m
- Merged PRs (30d)
- 561
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from callstack/agent-device
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
callstack/agent-device#3407 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
callstack/agent-device#3353 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
callstack/agent-device#1869 ·
Maintainers usually reply within 1 day
-
needs-triage
Difficulty 3/5 1-2 days Newbie friendliness 76/100
callstack/agent-device#3453 ·
Maintainers usually reply within 1 day
-
CRAP: newly scored platform-apple simulator boot retry and macOS helper file listingPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 4/5 3-5 days Newbie friendliness 52/100
callstack/agent-device#3451 ·
Maintainers usually reply within 1 day
All issues in callstack/agent-device
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
openwatersio/slackwater-database#281 ·
Maintainers usually reply within 1 day
-
accepted bug via-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
pingdotgg/t3code#18690 · 1 comment ·
Maintainers usually reply within 1 day
-
Bayern feature:Application ready web
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
digitalfabrik/entitlementcard#3176 ·
Maintainers usually reply within 7 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
NanmiCoder/cc-haha#1533 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day