Skip to content

fix: resolve default model for sessions created before login - #60

Merged
ace331 merged 2 commits into
mainfrom
fix/default-session-login-key
Jul 28, 2026
Merged

ace331 merged 2 commits into
mainfrom
fix/default-session-login-key

Conversation

@fgclaw01

Copy link
Copy Markdown
Collaborator

问题

GUI 客户端首次登录后,默认打开的会话对话提示「密钥无效或已过期」。切换到其他会话正常。

根因

时序问题:

  1. Agent 启动时无 auth.json → 创建默认 session(model 为空)
  2. 用户登录 → auth.json 写入 → reload_agent_credentials() 调用
  3. reload_credentials() 对空 model session 直接 return(跳过刷新)
  4. 用户发消息 → session 已存在 → set_model 不触发 → 无 API key → 报错

修复

reload_all_credentials() 中,对 model 为空的 session 不再跳过,而是解析默认模型并调 set_model(完整走 API key 解析路径)。

写锁内重新检查 model.is_empty() 防止 TOCTOU 竞态。

改动

agent/src/rpc/mod.rs — reload_all_credentials() 方法

fgbot added 2 commits July 28, 2026 14:17
When the agent starts without auth.json, sessions are created with
empty model. After login, reload_credentials skipped them because
self.model.is_empty() returned early. Now reload_all_credentials
resolves and applies the default model for empty-model sessions,
so the user can prompt immediately after login in the default thread.
@ace331
ace331 merged commit f242485 into main Jul 28, 2026
17 checks passed
@ace331
ace331 deleted the fix/default-session-login-key branch July 28, 2026 06:29
huichen added a commit that referenced this pull request Sep 27, 2026
…0) (#879)

#877 (coverage) carried a stale gitlink and reverted the pin #872 had
just moved, so `main` pointed at 1ece355 while the skills repo had
moved on. Restore the pin to 23925fc (future-skills main), which is
the same content #872 shipped.

Skills repo commits covered by the range 1ece355..23925fc:
- #57 document task write scopes and safe dependency wiring
- #59 repair builtin lookup/design helpers, retire unsafe review generator
- #58 future-slides defaults to editable decks with native validation
- light-weight code-development skill (future-code)
- #60 coalesced supervisor delivery for future-loop
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