Skip to content

feat(desktop): log when Docker Desktop serves an expired token - #3867

Merged
Sayt-0 merged 1 commit into
docker:mainfrom
trungutt:log-expired-desktop-token
Jul 29, 2026
Merged

feat(desktop): log when Docker Desktop serves an expired token#3867
Sayt-0 merged 1 commit into
docker:mainfrom
trungutt:log-expired-desktop-token

Conversation

@trungutt

Copy link
Copy Markdown
Contributor

Why

When the models gateway rejects a request with a 401, the logs today can't answer the first triage question: was the token we forwarded already expired when Docker Desktop handed it to us, or was it locally valid and rejected upstream (e.g. revoked)? The only expiry-related warnings fire deep in the refresh path, so they are missing whenever a forced refresh is skipped (singleflight join, rate-limit window) or when it succeeds.

This adds a warning at the moment an expired token is received, before any recovery attempt:

WARN Docker Desktop served an expired token fingerprint=a1b2c3d4 expired_for=42m10s expires_at=2026-07-29T09:15:00Z

With it, log sequences become classifiable on their own:

stale session, stuck:      served an expired token -> Forcing a refresh -> did not deliver
                           a fresh token in time -> sending a token known to be expired
stale session, recovered:  served an expired token -> Forcing a refresh -> Recovered a fresh token
no such line before a 401: the token was locally valid; the rejection came from upstream

The fingerprint (non-reversible hash) distinguishes "same stale token served repeatedly" from "a different token each time"; expires_at is the raw exp claim, comparable against server-side request traces.

@trungutt
trungutt marked this pull request as ready for review July 29, 2026 15:32
@trungutt
trungutt requested a review from a team as a code owner July 29, 2026 15:32
@aheritier aheritier added area/core Core agent runtime, session management kind/feat PR adds a new feature (maps to feat:). Use on PRs only. labels Jul 29, 2026
@Sayt-0
Sayt-0 merged commit 5282342 into docker:main Jul 29, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Core agent runtime, session management kind/feat PR adds a new feature (maps to feat:). Use on PRs only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants