Skip to content

fix(sdk): log when a rejected access token is refreshed on demand - #1797

Merged
sung17 merged 1 commit into
mainfrom
fix/sdk-log-reactive-auth-refresh
Nov 26, 2026
Merged

sung17 merged 1 commit into
mainfrom
fix/sdk-log-reactive-auth-refresh

Conversation

@sung17

@sung17 sung17 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #1756. When a provider rejects an access token mid-call, Integration.invokeWithRefresh forces a refresh, persists it, and retries — but did so silently. A tester on a production install confirmed the TikTok recovery works (code 40105 → refreshed within ~1 s, comment automation delivered), and asked for a log line so it is visible in production.

  • Log at info after a successful reactive refresh, with the integration name and the provider's rejection reason (no token values).
  • Lives in the shared SDK path, so every OAuth2 channel with refreshAuth (TikTok, Instagram, Messenger, LINE, …) gets it. It only fires on a rejected token, so volume is low.
  • A failed refresh is unchanged: it still throws AuthRefreshException and marks the connection offline on a terminal error.

Test plan

  • packages/sdk/__tests__/ensure-fresh-auth.test.ts — new test asserts the info log on a reactive refresh (14/14 pass)
  • pnpm --filter @chatbotx.io/sdk check-types
  • pnpm lint

🤖 Generated with Claude Code

The reactive refresh in invokeWithRefresh recovered silently, so operators
could not tell a self-healed channel from one that never failed. Log it at
info level with the integration name and the provider's rejection reason.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the bug Something isn't working as expected label Nov 26, 2026
@sung17
sung17 merged commit 7e84098 into main Nov 26, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant