CLI device login exits on transient HTTP 502 during token polling #348

Closed
opened 2026-09-28 14:32:56 +00:00 by kayg · 2 comments
Owner

Reproduction

Run calternal login https://calternal.cloud --device and leave the device request pending. On 2026-09-28 the start request succeeded, but a POST to /api/v1/auth/cli/token returned HTTP 502. The CLI exited with login exchange returned HTTP 502 instead of continuing to poll. A separate request with an invalid device code returned HTTP 400, so the route was reachable. No bearer token was issued. No Paperless data was involved.

Expected

Retry a transient HTTP 5xx or transport failure until the five-minute device request expires, with a bounded delay. If the retry limit is reached, report that the exchange can be retried.

Actual

Any non-2xx response other than HTTP 202 ends device login immediately.

## Reproduction Run `calternal login https://calternal.cloud --device` and leave the device request pending. On 2026-09-28 the start request succeeded, but a POST to `/api/v1/auth/cli/token` returned HTTP 502. The CLI exited with `login exchange returned HTTP 502` instead of continuing to poll. A separate request with an invalid device code returned HTTP 400, so the route was reachable. No bearer token was issued. No Paperless data was involved. ## Expected Retry a transient HTTP 5xx or transport failure until the five-minute device request expires, with a bounded delay. If the retry limit is reached, report that the exchange can be retried. ## Actual Any non-2xx response other than HTTP 202 ends device login immediately.
Author
Owner

Folded into #350 (agent-grade CLI): generic retry with backoff/jitter and Retry-After on transient errors for every command, including device-login token polling.

Folded into #350 (agent-grade CLI): generic retry with backoff/jitter and Retry-After on transient errors for every command, including device-login token polling.
Author
Owner

Integration status: the device-login retry implementation (0c38b723) is on job/cli-agent but is not on dev (413ccaa7); the current dev tree has no send_with_retry call in the login path. A read-only merge preview reports one conflict in crates/calternal-cli/src/remote_commands.rs, limited to test imports. I will add the local-server polling regression and run it after the CLI change reaches dev.

Integration status: the device-login retry implementation (`0c38b723`) is on `job/cli-agent` but is not on `dev` (`413ccaa7`); the current `dev` tree has no `send_with_retry` call in the login path. A read-only merge preview reports one conflict in `crates/calternal-cli/src/remote_commands.rs`, limited to test imports. I will add the local-server polling regression and run it after the CLI change reaches `dev`.
kayg closed this issue 2026-09-29 08:29:20 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal#348
No description provided.