Skip to content

fix: keep a burst of pushes from turning off phone approval - #241

Merged
samuelloranger merged 4 commits into
mainfrom
fix/push-burst-retry
Oct 5, 2026
Merged

samuelloranger merged 4 commits into
mainfrom
fix/push-burst-retry

Conversation

@samuelloranger

Copy link
Copy Markdown
Owner

Failure mode

The relay rate-limits per device token. A burst of routine pushes (several agents finishing at once) could use up that bucket, and the next permission prompt or question then got a 429. tether-notify treated any non-2xx as a plain failure with no retry, and a failed push in hold means "not held", so the prompt silently fell back to the terminal and never reached the phone.

Changes

  • Relay: urgent pushes (by the cleartext level) use a separate per-token bucket, PER_TOKEN_URGENT, so normal and quiet bursts cannot starve them. PER_IP is unchanged. A 429 now carries a Retry-After hint.
  • tether-notify: for urgent pushes only, sendPush retries on 429, 503 and transport errors, honoring Retry-After. Bounded: at most 3 retries, each wait capped at 5 s, total waiting budget 12 s per call, since hold runs synchronously inside a hook. Retries are per device, so a device that already accepted is not re-sent. Non-urgent pushes and 4xx responses are not retried. Sleep is injectable, so tests do not wait.

Tests

  • Relay: an exhausted normal bucket still admits an urgent push; an exhausted urgent bucket returns 429 with Retry-After.
  • Go: 429, 429, 200 succeeds with capped waits; 503 backoff; retry count and time budget exhausted; transport errors; no retrier means one attempt; 400 and 410 are not retried.

Deploy

The relay needs a deploy after merge so the new PER_TOKEN_URGENT binding exists. Until then c.env.PER_TOKEN_URGENT is undefined and urgent pushes would fail, so deploy the relay before or together with the host tool rollout.

Replaces #240, which closed when its stacked base branch was deleted after #238 merged.

Relay gives urgent pushes their own per-token rate-limit bucket and sends
Retry-After on 429. tether-notify retries urgent pushes on 429/503/transport
errors with bounded backoff.
@samuelloranger
samuelloranger merged commit 999beba into main Oct 5, 2026
3 checks passed
@samuelloranger
samuelloranger deleted the fix/push-burst-retry branch October 5, 2026 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant