Skip to content

fix(alert): derive the request envelope from an alert wait window - #4581

Merged
thymikee merged 2 commits into
mainfrom
t3/alert-wait-timeout-policy
Nov 16, 2026
Merged

thymikee merged 2 commits into
mainfrom
t3/alert-wait-timeout-policy

Conversation

@thymikee

@thymikee thymikee commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Summary

alert wait previously used the fixed 90-second request envelope, so longer accepted windows could time out early. Its policy derives the envelope from the window plus the existing margin. get, accept and dismiss keep their existing budgets.

Windows above 2147453647 ms are refused with INVALID_ARGS, details.reason: alert-wait-window-too-long and details.maxWaitWindowMs, rather than shortened.

agent-device alert wait 120000       # 150-second request envelope
agent-device alert get 120000        # existing get policy
agent-device alert wait 2147453648   # refused

Closes #4566. Nine files change; no new flags or native interaction changes. Scope covers timeout admission, regression coverage and help/docs, including Apple-only get budgets and capped first/remaining wait reads.

Validation

  • Base 189570486a11ae3e637abdd55fcaff2cebb26362; head 4a808cd54215c1b9eb72ec9e6b511bd0aac23f89.
  • Initial same-command regression evidence at e9ad4fac9f: four failures against base production files, 25 tests passed with the fix. The 120000 ms wait reproduced 90000 !== 150000 before the fix.
  • Review follow-up: three focused suites passed all 57 tests, including Apple polling and typed refusal details. All 903 eager-closure checks passed.
  • Exact-head affected gate: all 11 runnable checks passed; seven hosted/parked lanes skipped. Receipt .tmp/validation/run-LiklFS/receipt.json: exactCommit=true, checkoutChanged=false, no fail-open reasons.
  • No device run; native polling/interaction unchanged. Hosted checks/reviews remain CI obligations. The numeric ceiling is source/test verified, not a multi-day live wait.
  • Cold full-diff review completed; no independent reviewer before publication.

Co-authored-by: Apex noreply@callstack.ai


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

The alert command's request envelope was the fixed 90s default, so a
longer 'alert wait' window was cut off by the transport before its poll
window ended. ALERT_TIMEOUT_POLICY now reads the action and the accepted
window through the existing positional-parser budget: only 'wait' widens
the envelope to window + margin; get, accept and dismiss keep the fixed
envelope. A window above the armable ceiling (2147453647 ms, the
client timer limit minus the request margin) is refused by the handler
before anything runs with INVALID_ARGS, details.reason
'alert-wait-window-too-long' and details.maxWaitWindowMs, never clamped.

Closes #4566

Co-authored-by: Apex <noreply@callstack.ai>
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.30 MB 6.30 MB -1.2 kB
Package (unpacked) 6.30 MB 6.30 MB -1.2 kB
Package (download) 1.91 MB 1.91 MB -103 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 23.6 ms 26.0 ms +2.4 ms
CLI --help 43.6 ms 46.8 ms +3.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 9 files

You’re at about 95% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.

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

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

Comment thread website/docs/docs/commands.md Resolved
Comment thread website/docs/docs/commands.md Resolved
@apex-sentinel-staging

apex-sentinel-staging Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve

Since the last review: 0 new · 0 still open · 0 no longer raised

No open findings.

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

💬 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.

Earlier reviews

Review of 4a808cd5 · 16.11.2026 09:15 UTC

Apex Sentinel · ✅ Approve

Since the last review: 0 new · 0 still open · 0 no longer raised

No open findings.

2 findings below minor hidden (user_settings.min_severity).

1 new finding away from what changed since e9ad4fa not shown. Comment @apex-sentinel-staging review for a full review.

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

Review of e9ad4fac · 16.11.2026 08:54 UTC

Apex Sentinel · ✅ Approve

No open findings.

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

@thymikee

Copy link
Copy Markdown
Member Author

@apex-sentinel-staging review

@thymikee

Copy link
Copy Markdown
Member Author

This PR is ready at 4a808cd. Not blocking: the new test for a wait window inside the ceiling only asserts behavior that already worked, and its last block repeats the wait-at-ceiling check, so you could fold the 120000 wait/get/accept guard into the first new test and drop or retarget the older message-regex test at snapshot-alert.test.ts:196; the same "refused up front, never shortened" rationale is also repeated in several comments and the alert description, so you could keep it once at MAX_ARMABLE_ALERT_WAIT_WINDOW_MS and point to it elsewhere. Take or leave these.

CI is green (22 checks, none failing) and there are no conflicts. Nothing else must happen before merge.

None of the earlier review threads still apply at this head, and no lower-priority threads remain. These can be resolved: the fixed alert description for the get leg (#4581 (comment)), the fixed wait-read timing text in the docs (#4581 (comment)), the fixed details.reason and maxWaitWindowMs naming (#4581 (comment)), the fixed test that no longer matches message text (#4581 (comment)), and the duplicated literal at timeout-policy.ts:31, which is harmless because of the eager-closure reason (#4581 (comment)).

Not blocking: no run of a real client-to-daemon alert wait longer than 90 s is attached, and the tests cover the registry policy functions and the daemon handler, not the client transport timer. Replay and batch steps with a long alert wait still run under the composite envelope, as they did before this PR.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 16, 2026
@thymikee
thymikee merged commit ef19edc into main Nov 16, 2026
22 checks passed
@thymikee
thymikee deleted the t3/alert-wait-timeout-policy branch November 16, 2026 09:58
thymikee added a commit that referenced this pull request Nov 16, 2026
* origin/main:
  fix(alert): derive the request envelope from an alert wait window (#4581)
  fix(android): require a nonzero chunk before a recorder counts as ready (#4559)
  chore(deps): clear astro and node-forge security alerts (#4577)
  fix(ios): establish the screen origin of a full-screen private AX root (#4573)
  docs(agents): trace behavior claims during review (#4576)
  fix(mcp): trim the press plan text back under the always-loaded byte budget (#4572)
  refactor(alert): one helper owns the alert runner budget (#4563)
  feat(interaction): multi-ref press plan lowered through the ordinary press lane (#4296)
  fix(ios): use the caller's budget for alert get and type the watchdog outcome (#4540)
  feat(recovery): bound remote health and runner-busy recovery by the command's deadline (#4541)
  fix(ios): find the navigation bar back button outside the bar's subtree (#4542)
  feat(open): report device kind, model and osVersion on open and session identity (#4543)
  fix(apple): use typed screenshot timeouts and observed shutdown recovery (#4544)
  feat(device-status): report per device whether a new session can take it (#4547)
  fix(runner): type the refusals for a control the target cannot supply (#4548)
  refactor(transport): share outgoing transfer phase ownership (#4551)
  fix(remote): bound artifact preparation and upload phases (#4552)
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.

alert wait: honour windows longer than the 90 s request envelope

1 participant