fix(auth): honor expires_in and bound transient network retries in device login - #28
Merged
Merged
Conversation
…vice login Device login parsed expires_in but the poll loop never used it, and transport errors retried forever. Drive the loop from a pure poll_action helper so wall-clock expiry and five consecutive network failures give up. Closes #18 Co-authored-by: duyet <duyet@users.noreply.github.com>
duyet
marked this pull request as ready for review
August 28, 2026 04:34
Contributor
anyr size and startupStartup is wall time for a cold Size budget:
Budget check: ok raw timings[
{
"asset": "anyr-darwin-arm64",
"kind": "native",
"path": "/Users/runner/work/cli/cli/anyr-darwin-arm64",
"bytes": 2803480,
"size": "2.7 MiB",
"version": "0.1.11 (built 2026-08-28 04:35:18)",
"target": "aarch64-apple-darwin",
"os": "macos-latest",
"startup_version": {
"n": 21,
"min_ms": 2.54,
"median_ms": 2.61,
"p95_ms": 2.83,
"mean_ms": 2.67
},
"startup_help": {
"n": 21,
"min_ms": 2.3,
"median_ms": 2.33,
"p95_ms": 2.59,
"mean_ms": 2.37
}
},
{
"asset": "anyr-darwin-x86_64",
"kind": "native",
"path": "/Users/runner/work/cli/cli/anyr-darwin-x86_64",
"bytes": 3014656,
"size": "2.9 MiB",
"version": "0.1.11 (built 2026-08-28 04:35:32)",
"target": "x86_64-apple-darwin",
"os": "macos-latest",
"startup_version": {
"n": 21,
"min_ms": 29.55,
"median_ms": 30.34,
"p95_ms": 35.95,
"mean_ms": 31.75
},
"startup_help": {
"n": 21,
"min_ms": 28.42,
"median_ms": 28.92,
"p95_ms": 29.71,
"mean_ms": 29.04
}
},
{
"asset": "anyr-linux-arm64",
"kind": "native",
"path": "/home/runner/work/cli/cli/anyr-linux-arm64",
"bytes": 2757672,
"size": "2.6 MiB",
"version": "0.1.11 (built 2026-08-28 04:35:02)",
"target": "aarch64-unknown-linux-gnu",
"os": "ubuntu-24.04-arm",
"startup_version": {
"n": 21,
"min_ms": 0.61,
"median_ms": 0.64,
"p95_ms": 0.82,
"mean_ms": 0.66
},
"startup_help": {
"n": 21,
"min_ms": 0.61,
"median_ms": 0.65,
"p95_ms": 0.68,
"mean_ms": 0.65
}
},
{
"asset": "anyr-linux-x86_64",
"kind": "native",
"path": "/home/runner/work/cli/cli/anyr-linux-x86_64",
"bytes": 3111144,
"size": "3.0 MiB",
"version": "0.1.11 (built 2026-08-28 04:35:18)",
"target": "x86_64-unknown-linux-gnu",
"os": "ubuntu-latest",
"startup_version": {
"n": 21,
"min_ms": 1.04,
"median_ms": 1.09,
"p95_ms": 1.13,
"mean_ms": 1.09
},
"startup_help": {
"n": 21,
"min_ms": 1.02,
"median_ms": 1.05,
"p95_ms": 1.12,
"mean_ms": 1.06
}
},
{
"asset": "anyr-windows-x86_64.exe",
"kind": "native",
"path": "D:\\a\\cli\\cli\\anyr-windows-x86_64.exe",
"bytes": 2577408,
"size": "2.5 MiB",
"version": "0.1.11 (built 2026-08-28T04:36:21Z)",
"target": "x86_64-pc-windows-msvc",
"os": "windows-latest",
"startup_version": {
"n": 21,
"min_ms": 9.0,
"median_ms": 9.21,
"p95_ms": 9.9,
"mean_ms": 9.34
},
"startup_help": {
"n": 21,
"min_ms": 9.03,
"median_ms": 9.24,
"p95_ms": 9.41,
"mean_ms": 9.24
}
},
{
"asset": "anyr.wasm",
"kind": "wasm",
"path": "/home/runner/work/cli/cli/target/wasm-pkg/anyr_cli_bg.wasm",
"bytes": 179312,
"size": "175.1 KiB",
"version": "wasm",
"target": "wasm32-unknown-unknown",
"os": ""
}
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Device login parsed
expires_inbut the poll loop never used it, and transport errors retried forever (anyr relay startauto-login hits the same loop). This change extracts a purepoll_actionhelper and rewritespoll_device_tokento:expires_in(floored at 60s)poll_device_token/login_via_devicepublic signatures unchangedOnly
src/auth.rsis modified. No new crates.Closes #18
Checklist
Skip co-authors