Skip to content

🐛 fix: add the lobehub cli oidc expreis should refresh aksk#13925

Merged
arvinxx merged 2 commits into
canaryfrom
fix/lhconnectfixed
Apr 27, 2026
Merged

🐛 fix: add the lobehub cli oidc expreis should refresh aksk#13925
arvinxx merged 2 commits into
canaryfrom
fix/lhconnectfixed

Conversation

@ONLY-yours

Copy link
Copy Markdown
Member

💻 Change Type

Summary

  • Fix lh connect login session expiring
    after 7 days without auto-refresh
  • Add proactive token refresh timer that
    refreshes JWT 1 hour before expiry
  • Add retry logic on auth_failed to
    attempt token refresh before exiting
    (handles expired token during
    auto-reconnect)
  • Reset refresh timer after successful
    token refresh in both auth_expired and
    auth_failed handlers

Background

Three related issues were identified:

  1. No proactive refreshconnect
    calls resolveToken() once at startup,
    never refreshes during the long-lived
    WebSocket connection (Access Token TTL: 7
    days)
  2. Reconnect uses stale token
    GatewayClient auto-reconnect reuses the
    original expired JWT → auth_failed
    process exits
  3. auth_expired is dead code
    Gateway server defines the type but never
    sends it

Test plan

  • Add test for auth_failed retry
    with successful token refresh
  • Update existing auth_failed test
    to await async handler
  • Mock getValidToken from
    ../auth/refresh
  • Add updateToken and reconnect to
    GatewayClient mock

Closes LOBE-7303

  • ✨ feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 👷 build
  • ⚡️ perf
  • ✅ test
  • 📝 docs
  • 🔨 chore

🔗 Related Issue

🔀 Description of Change

🧪 How to Test

  • Tested locally
  • Added/updated tests
  • No tests needed

📸 Screenshots / Videos

Before After
... ...

📝 Additional Information

@vercel

vercel Bot commented Apr 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lobehub Canceled Canceled Apr 17, 2026 9:49am

Request Review

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've reviewed this pull request using the Sourcery rules engine

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2eed5053f6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/cli/src/commands/connect.ts Outdated
@codecov

codecov Bot commented Apr 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.92%. Comparing base (2b44cdd) to head (8474e15).
⚠️ Report is 335 commits behind head on canary.

Additional details and impacted files
@@            Coverage Diff             @@
##           canary   #13925      +/-   ##
==========================================
+ Coverage   66.55%   66.92%   +0.36%     
==========================================
  Files        2023     2059      +36     
  Lines      170888   175202    +4314     
  Branches    19835    21430    +1595     
==========================================
+ Hits       113733   117249    +3516     
- Misses      57031    57829     +798     
  Partials      124      124              
Flag Coverage Δ
app 59.30% <ø> (+0.73%) ⬆️
database 92.42% <ø> (-0.14%) ⬇️
packages/agent-runtime 79.72% <ø> (ø)
packages/context-engine 83.22% <ø> (-0.11%) ⬇️
packages/conversation-flow 92.36% <ø> (ø)
packages/file-loaders 87.02% <ø> (ø)
packages/memory-user-memory 74.74% <ø> (ø)
packages/model-bank 99.86% <ø> (ø)
packages/model-runtime 84.21% <ø> (-0.08%) ⬇️
packages/prompts 69.24% <ø> (-0.81%) ⬇️
packages/python-interpreter 92.90% <ø> (ø)
packages/ssrf-safe-fetch 0.00% <ø> (ø)
packages/utils 90.34% <ø> (+0.19%) ⬆️
packages/web-crawler 88.66% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Store 66.25% <ø> (+0.45%) ⬆️
Services 51.75% <ø> (-0.37%) ⬇️
Server 66.93% <ø> (+0.54%) ⬆️
Libs 51.35% <ø> (-1.47%) ⬇️
Utils 91.12% <ø> (+0.10%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@arvinxx arvinxx merged commit c37817e into canary Apr 27, 2026
37 of 38 checks passed
@arvinxx arvinxx deleted the fix/lhconnectfixed branch April 27, 2026 16:47
sxueck pushed a commit to sxueck/lobehub that referenced this pull request Apr 28, 2026
…13925)

* fix: add the lobehub cli oidc expreis should refresh aksk

* fix: add the buffer seconds
mutoe pushed a commit to mutoe/lobehub that referenced this pull request May 1, 2026
…13925)

* fix: add the lobehub cli oidc expreis should refresh aksk

* fix: add the buffer seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants