Repository navigation
fix(harmonyos): clamp the open foreground probe's hdc read to the request deadline - #5055
Conversation
…uest deadline The pre-dispatch already-foreground probe ran one `aa dump -l` read on a fixed 15s timeout, so a hung read could hold the dispatch past a request deadline the post-open foreground poll (callstack#4293) would have respected. The probe now receives the request's deadline beside the signal, clamps its read to the remaining budget (Math.min against the 15s default), skips the device entirely when a spent deadline leaves no room for one read, and still claims nothing when the deadline or a cancel cuts the read — the advisory outcome machinery is unchanged and no reason set grows. Follow-up to the optional question the callstack#4860 review left open.
|
CI status at head The one red lane is the Android emulator smoke job (run 45258852813): |
|
Retriggered the android emulator smoke lane with an empty commit ( |
|
Thanks for the fix. The code change looks reasonable at decd95e, but live evidence for the changed HarmonyOS route is still missing. This PR changes a device-facing path: the pre-dispatch Not blocking, and fine to take or leave: type the CI is still running on decd95e, and no check has failed at this head. The earlier Android emulator smoke failure at 1d6fc06 does not overlap this diff: The next step is the live HarmonyOS evidence for the tight-deadline open. After that, the change is ready once CI is green. |
…line clamp Scenario a: the already-foreground open answers with the alreadyForeground warning at 0.7 s with no added probe latency. Scenario b: an hdc wrapper that sleeps on the probe read cannot hold the dispatch past the admitted request budget — the probe read dies at its 15 s clamp, the poll read at its 5 s budget, and the open returns with the advisory unreadable warning and no alreadyForeground claim. The 2-3 s remaining-deadline variant is not expressible on the shipped CLI (open's result budget is a fixed 60 s floor and the pre-probe route spends at most ~10 s), so the clamp below 15 s stays pinned by the unit suite; the live run is the wiring half of that proof. Refs callstack#5055
|
Thanks for the update and the new evidence doc. The Part (a) run is now recorded, and that part of the earlier findings is fixed. One required live run is still missing at f42463d. The evidence doc runs part (b) only at the 15s default, so it cannot show whether the request deadline reaches the probe on a real daemon request (evidence doc, line 50). It also says a budget below 15s cannot be expressed on the shipped CLI. That looks wrong: Please attach one more run at the PR's code SHA (1d6fc06, equal to f42463d) from CI is green at f42463d: 14 checks, none failing. The earlier Android emulator smoke failure at 1d6fc06 did not touch this code, and the new commit only adds a docs file. Not verified here: the replay route was traced statically, not run, since no HarmonyOS device or hdc was available. The evidence doc's timings were not reproduced either. Before merge, the live replay run above is needed. |
66e129b to
2b9d875
Compare
|
Thanks for the update. At 6df63a6 the live |
Three take-or-leave items from the callstack#5055 review. The open lifecycle binds readForegroundBundle as DirectApplicationLifecycleParams' own shape, so the contract owns the type. The remaining-read-budget clamp arithmetic (Math.min against a read's default, floored at 0, spent deadline answers 0) moves to one helper beside hdc.ts that both the open-time probe and the post-open poll budget call. The probe's doc comment now says the clamp bounds the read, not the dispatch it precedes. Follow-up to the optional question the callstack#4860 review left open. Co-Authored-By: Claude Code <noreply@anthropic.com>
…3b8a Same replay route on the JDY-AL50 at the review-polish code SHA, screen PIN-locked: the probe's aa dump -l read lived 2.23s under a 3s replay deadline (cut at +3.29s, not 25s wrapper, not 15s default), the aa start dispatch followed without waiting on the hung read, and the request settled daemon_request_timeout with no alreadyForeground claim. Names the observed hdc resolution mechanism: the daemon prefers its toolchain roots over PATH, so the wrapper rides HDC_SDK_PATH. Co-Authored-By: Claude Code <noreply@anthropic.com>
Cite the evidence commits that exist in this PR's history instead of the unreferenced 66e129b, and scrub the local absolute paths from the committed replay JSON artifacts (repo-relative script paths, placeholder state dir). Co-Authored-By: Claude Code <noreply@anthropic.com>
|
Polish applied as Your two notes are fixed too: the doc cites the evidence commits that exist in this history (2b9d875, 6df63a6) instead of Live re-run of the replay leg at the final code SHA Timeline, client request start against the wrapper's epochs (the wrapper sleeps 25 s only on CLI wall 3.68 s; the request settled The already-foreground leg was recorded at 01:58 UTC on the unlocked screen (scenario a in the evidence doc: the New head |
|
Thanks for the polish. At ab2366e both notes from the earlier review (#5055 (comment)) are closed, and the new changes add no regression. All 15 checks pass at this head, and the earlier Android emulator smoke failure at 1d6fc06 did not touch this diff and is green now. No conflicts were reported, and nothing else is needed before merge. Not verified here: the JDY-AL50 device timings were not reproduced, only checked for consistency against the committed artifacts and the quoted wrapper timeline, and tests were not run locally because the change is a behavior-preserving refactor with green CI. |
|
Leg B re-recorded on the unlocked device, closing the note from the review thread.
|
Summary
Follow-up to #4860 (answered yes): the pre-dispatch already-foreground probe read the device on a fixed 15s hdc timeout, so a hung
aa dump -lcould hold the dispatch past the request deadline the #4293 poll already respects.readForegroundBundlenow receives the request deadline beside the signal, and the probe clamps its read to the remaining budget (Math.min against 15s); a spent deadline skips the device. A deadline or cancel mid-read keeps the advisory outcome: the probe claims nothing, no new error code or CLI change. The post-open poll is untouched.Before / after
open <bundle>, 2s of request budget left, hung foreground read (unit test, fake timers):The clamp test pins the read timeout at 2000ms under a +2s deadline (15000 far); a spent deadline reads nothing.
Validation
pnpm tsc -bandpnpm formatzero-diff; reason tables unchanged.check:affectedstops at the local layering gate; detach control at baseecb2089867gives byte-identical violation lists at the polish head — zero PR-introduced violations.node bin/agent-device.mjsafterpnpm build+pnpm clean:daemon(docdocs/evidence/harmonyos-open-probe-clamp-2026-11-24.md): the already-foreground open warnedalreadyForegroundin 0.84 s; at the polish head9e23b8a13,replay --timeout 3000against an hdc wrapper hanging onaa dump -lcut the probe's read at +3.29 s (2.23 s lived, not 15 s), dispatched without waiting, settleddaemon_request_timeout/3000, noalreadyForegroundclaim (wall 3.68 s). An unlocked-screen re-record awaits the next device unlock.Refs #4860
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.