OAuth refresh: debug-log Oauth2/commit errors without changing behaviour
Author: tamassolteszCreated Sep 24, 2026Updated Sep 24, 2026
Labelsagent-wip
Part of PLAN-017. Surfaces currently-hidden Oauth2/commit errors at DEBUG level ONLY — no behaviour change (same responses, same rollback, same retries). Stacks on core-conn-ownership (same handler file). Full design: agent-plans PLAN-017.
Additive Logging.debug at these points in handleNonRotatingRefresh:
- Swallowed
TryRefreshTokenException(~:467, the gid/jti extractioncatch (…) { // ignore }) — log it, keep the ignore. - Atomicity gap: after a SUCCESSFUL Oauth2 exchange, if any later step
(signing / post-exchange introspect /
updateOAuthSessionInternal_Transaction/ commit) throws and the tx rolls back while Oauth2 provider already rotated — log that provider exchange had succeeded and the local mapping rolled back (stranded-mapping risk), with token suffix + gid. DEBUG, no control-flow change. - Commit failure specifically: wrap
sqlStorage.commitTransaction(con)(:520) so a throw logs a debug line noting commit failed after a successful provider exchange, then rethrows unchanged.
- Do NOT downgrade or change existing warn-level logs.
Acceptance. Diff shows ONLY Logging.debug additions inside existing
catch/flow; no response, status, retry, or rollback change. This is the
key diagnostic for the still-open invalid_refresh_token magnitude question.
No CHANGELOG needed.
Depends-on: #1450 Plan: PLAN-017
Source: supertokens/supertokens-core