Skip to content

fix(ios): use the caller's budget for alert get and type the watchdog outcome - #4540

Merged
thymikee merged 2 commits into
mainfrom
fix/4523-alert-get-budget
Nov 15, 2026
Merged

thymikee merged 2 commits into
mainfrom
fix/4523-alert-get-budget

Conversation

@thymikee

@thymikee thymikee commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Summary

alert get on iOS now spends the caller's timeout as the XCTest runner budget instead of a fixed 10 s. Floor 1.5 s (ALERT_MIN_READ_BUDGET_MS), ceiling 25 s (new ALERT_RUNNER_MAX_BUDGET_MS, below the runner's 30 s watchdog and the 90 s daemon envelope), 10 s when no timeout is given. The ceiling also bounds each runner attempt of alert wait, so a long wait polls instead of hitting the watchdog.

A watchdog expiry already reports MAIN_THREAD_TIMEOUT as reason: runner_main_thread_timeout, dispatched: unknown, distinct from ALERT_NOT_FOUND; I reused it rather than add alert_state_unknown. A follow-up read-only alert get already waits out RUNNER_BUSY or reports it; a test now pins that for alert. alert get help and commands.md state the budget and outcome. 7 files.

Cut: no new reason code, no Swift change (the runner already honored timeoutMs), no change to accept/dismiss.

Closes #4523

Validation

Head: this PR's head commit, base d78be6c887. Vitest on alert.test.ts, index-busy-resend.test.ts, command-descriptor-timeout-policy.test.ts: pass. pnpm typecheck, oxlint, pnpm format: clean. Wider vitest run of packages/command-surface, src/__tests__, test/repo-guards: only release-assets timed out (5 s, host load). CI owns the full gate.

Live, iPhone 17 simulator (iOS 27.0), worktree CLI with a temporary budget log (reverted):

  • No alert: alert get → typed alert not found. get / get 3000 / get 100 / get 90000 sent the runner 10000 / 3000 / 1500 / 25000 ms.
  • Maps location prompt: alert get 3000 read “Allow “Maps” to use your location?” with a 3000 ms budget.
  • A forced watchdog expiry was not run; unit tests cover it.

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff Turn on auto-fix

… outcome

`alert get` on iOS sent the runner a fixed 10 s budget and ignored the
timeout argument. It now spends the caller's window as the runner budget,
clamped to 1.5-25 s (10 s when none is given). The 25 s ceiling also bounds
each `alert wait` runner attempt, so a long wait polls instead of meeting
the runner's 30 s main-thread watchdog.

A watchdog expiry already surfaces as `runner_main_thread_timeout` with
`dispatched: unknown`, distinct from ALERT_NOT_FOUND; a follow-up get waits
out RUNNER_BUSY. Tests and help now state both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.28 MB 6.28 MB +545 B
Package (unpacked) 6.28 MB 6.28 MB +545 B
Package (download) 1.90 MB 1.90 MB +203 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 22.7 ms 20.6 ms -2.1 ms
CLI --help 42.1 ms 42.3 ms +0.2 ms

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 7 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread packages/platform-apple/src/alert.ts Resolved
Comment thread website/docs/docs/commands.md Resolved
… outcome

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve

No open findings.

Reviewed with this repository's own Sentinel configuration (d78be6c88715).

💬 Talking to Sentinel

In a finding's thread, reply with:

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.

@thymikee

Copy link
Copy Markdown
Member Author

The PR is ready at 00b1e98: I found no problems in the code, and all 22 checks pass with none failing or pending. There are no conflicts, so only the maintainer's merge decision remains.

Not blocking, and you can take or leave each: the alert budget default, floor and 25 s cap are spread over two sites in alert.ts, so one small helper that owns all three would make the rule easier to see. alertWaitTimeoutMs in snapshot-alert.ts now also feeds alert get, so a rename and a doc tweak would help. The hand-built watchdog test in alert.test.ts pins existing behavior and the production-shaped test already covers it. The PR body still says the 25 s ceiling is below the runner's 30 s watchdog, while the code and docs say the watchdog is the same budget. A live alert wait 30000 on a quiet simulator, showing alert-wait-timeout after about 30 s, would cover the one path not run live.

On evidence: the live budget log and the Maps prompt read are author-reported, and I did not re-run them or any tests. No forced watchdog expiry was run live, and I did not trace Android's handling of the timeout.

The four earlier inline threads from the other reviewer are fixed at this head, so the author can resolve them: #4540 (comment) (contract doc now matches the watchdog), #4540 (comment) (awaitAppleAlert doc updated), #4540 (comment) (timeout policy test no longer misleading), #4540 (comment) (RUNNER_BUSY docs now match the code).

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 14, 2026
@thymikee
thymikee merged commit 89485f9 into main Nov 15, 2026
22 checks passed
@thymikee
thymikee deleted the fix/4523-alert-get-budget branch November 15, 2026 19:42
thymikee added a commit that referenced this pull request Nov 15, 2026
Follow-up to #4540 review notes: alertRunnerBudgetMs owns the default,
floor and ceiling; alertWaitTimeoutMs becomes alertTimeoutMs since it
also feeds alert get; drop the hand-built watchdog test that only pinned
existing behaviour.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iOS alert get: use the caller's budget and type the watchdog timeout

1 participant