Skip to content

fix(tui): resume sessions with models removed from config - #5378

Merged
liruifengv merged 4 commits into
release/2026-11-25from
fix/tui-resume-removed-model
Nov 25, 2026
Merged

liruifengv merged 4 commits into
release/2026-11-25from
fix/tui-resume-removed-model

Conversation

@liruifengv

@liruifengv liruifengv commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Screenshots / Recordings

以下快照来自真实运行的源码 CLI(apps/kimi-code/src/main.ts),在 100x30 虚拟终端中用 testkit 假模型驱动。先用 old-model 创建会话并完成一轮对话,再从 config.toml 中删除 old-model,随后运行 kimi -r。

修复前(82ace45bd):在 kimi -r 中选中会话失败,再次按 Enter 会把刚恢复的会话关掉。

   Resuming session session_bbfc4247-b794-43bf-ac55-b5e127864f4d…                                  
   Error: Failed to apply startup flags: Model "old-model" is not configured in config.toml.       
   Resuming session session_bbfc4247-b794-43bf-ac55-b5e127864f4d…                                  
   Error: Failed to apply startup flags: [session.closed] Session is closed                        

修复后(本 PR):会话正常打开并展示历史与切模型警告;未换模型时发送被拦截,通过 /model 选择可用模型后正常完成对话。

 ❯ first question                                                                                  
 
 ● Hello from old model.                                                                           
   Warning: Session model "old-model" is not configured in config.toml. Use /model to select an    
 available model.                                                                                  
   Resumed session (session_ff49e281-ab46-4856-9661-2c0b6781e449).                                 
   Error: Model "old-model" is not configured in config.toml. Use /model to select an available    
 model.                                                                                            
   Switched to available-model with thinking off.                                                  
 
 ❯ continue after switching                                                                        
 
 ● Recovered after switching model.                                                                
 
  Worked for 1s · done 12:14 PM                                                                    
完整虚拟终端画面(`kimi -c` 启动恢复、`kimi -r` 选择器恢复、发送拦截、换模型后恢复)

修复前 — kimi -r 会话选择器

╭────────────────────────────────────────────────────────────────────────────────────────────────╮
 │                                                                                                │
 │  ▐█▛█▛█▌  Welcome to Kimi Code!                                                                │
 │  ▐█████▌  Run /login or /provider to get started.                                              │
 │                                                                                                │
 │  Directory: /private/var/folders/wj/zjf_sc2519q9tyvpb5st5r7m0000gn/T/verify-before-bT6f1l/work…│
 │  Session:                                                                                      │
 │  Model:     not set, run /login or /provider                                                   │
 │  Version:   2.7.3                                                                              │
 │                                                                                                │
 ╰────────────────────────────────────────────────────────────────────────────────────────────────╯
 
   Resuming session session_bbfc4247-b794-43bf-ac55-b5e127864f4d…                                  
   Error: Failed to apply startup flags: Model "old-model" is not configured in config.toml.       
   Resuming session session_bbfc4247-b794-43bf-ac55-b5e127864f4d…                                  
   Error: Failed to apply startup flags: [session.closed] Session is closed                        
 ──────────────────────────────────────────────────────────────────────────────────────────────────
 Sessions  (type to search)
 ↑↓ navigate · Ctrl+A all · Ctrl+X delete · Enter select · Esc cancel
 
 ❯ first question  just now
   session_bbfc4247-b794-43bf-ac55-b5e127864f4d
   /private/var/folders/wj/zjf_sc2519q9tyvpb5st5r7m0000gn/T/verify-before-bT6f1l/workspace
   › first question
 ──────────────────────────────────────────────────────────────────────────────────────────────────
 …/T/verify-before-bT6f1l/workspace             /tasks to check agent activity and background tasks
                                                                                        context: 0%

修复后 — kimi -c 启动恢复

╭────────────────────────────────────────────────────────────────────────────────────────────────╮
 │                                                                                                │
 │  ▐█▛█▛█▌  Welcome to Kimi Code!                                                                │
 │  ▐█████▌  Send /help for help information.                                                     │
 │                                                                                                │
 │  Directory: /private/var/folders/wj/zjf_sc2519q9tyvpb5st5r7m0000gn/T/verify-resume-5HYYvj/work…│
 │  Session:   session_ff49e281-ab46-4856-9661-2c0b6781e449                                       │
 │  Model:     old-model                                                                          │
 │  Version:   2.7.3                                                                              │
 │                                                                                                │
 ╰────────────────────────────────────────────────────────────────────────────────────────────────╯
 
 
   Ask When Needed mode: OFF                                                                       
 
 ❯ first question                                                                                  
 
 ● Hello from old model.                                                                           
   Warning: Session model "old-model" is not configured in config.toml. Use /model to select an    
 available model.                                                                                  
 
 ╭────────────────────────────────────────────────────────────────────────────────────────────────╮
 │ >                                                                                              │
 ╰────────────────────────────────────────────────────────────────────────────────────────────────╯
 old-model  …/T/verify-resume-5HYYvj/workspace        /compact compresses context when it gets long
                                                                                        context: 0%

修复后 — kimi -r 选择器恢复、发送拦截,以及 /model 换模型后恢复

╭────────────────────────────────────────────────────────────────────────────────────────────────╮
 │                                                                                                │
 │  ▐█▛█▛█▌  Welcome to Kimi Code!                                                                │
 │  ▐█████▌  Send /help for help information.                                                     │
 │                                                                                                │
 │  Directory: /private/var/folders/wj/zjf_sc2519q9tyvpb5st5r7m0000gn/T/verify-resume-5HYYvj/work…│
 │  Session:   session_ff49e281-ab46-4856-9661-2c0b6781e449                                       │
 │  Model:     available-model                                                                    │
 │  Version:   2.7.3                                                                              │
 │                                                                                                │
 ╰────────────────────────────────────────────────────────────────────────────────────────────────╯
 
 
   Ask When Needed mode: OFF                                                                       
 
 ❯ first question                                                                                  
 
 ● Hello from old model.                                                                           
   Warning: Session model "old-model" is not configured in config.toml. Use /model to select an    
 available model.                                                                                  
   Resumed session (session_ff49e281-ab46-4856-9661-2c0b6781e449).                                 
   Error: Model "old-model" is not configured in config.toml. Use /model to select an available    
 model.                                                                                            
   Switched to available-model with thinking off.                                                  
 
 ❯ continue after switching                                                                        
 
 ● Recovered after switching model.                                                                
 
  Worked for 1s · done 12:14 PM                                                                    
 ╭────────────────────────────────────────────────────────────────────────────────────────────────╮
 │ >                                                                                              │
 ╰────────────────────────────────────────────────────────────────────────────────────────────────╯
 available-model  …/T/verify-resume-5HYYvj/workspace  /compact compresses context when it gets long
                                                                           context: 6% (13.9k/256k)

Requirement or Bug

当会话保存的模型别名已从 config.toml 中删除后,TUI 用户无法恢复该会话(kimi -r、kimi -r <id>、kimi -c 或 /sessions 均受影响)。选中会话时报 Model "<alias>" is not configured in config.toml.(且被误标为 Failed to apply startup flags),再次选中同一条会话则报 [session.closed] Session is closed。

本 PR 让 TUI 与 #5212 中 Desktop/Web 的恢复行为对齐:进入会话时保留历史并给出切模型警告;在用户通过 /model 选择可用模型之前拦截发送;切换模型后可正常继续对话,resume 本身不改写会话保存的别名。问题来自内部反馈,未重复创建 GitHub issue。

Bug Reproduction Steps

  1. 在 config.toml 中配置两个模型(testkit 和 old-model),运行 kimi -m old-model,发送 first question,等回复完成后 /exit。
  2. 从 config.toml 中删除 [models."old-model"]。
  3. 运行 kimi -r,在该会话上连续按两次 Enter;再尝试运行 kimi -c。
  4. 修复前:第一次 Enter 报 Error: Failed to apply startup flags: Model "old-model" is not configured in config.toml.,第二次 Enter 报 Error: Failed to apply startup flags: [session.closed] Session is closed,kimi -c 也会在启动阶段失败。
  5. 修复后:kimi -r 和 kimi -c 都能打开会话并显示历史与警告;此时直接发送消息会在提交前被拦截;执行 /model 选择 testkit 后再发送,可正常完成回合。

Root Cause

本 PR 是根本修复,不是绕过。

TUI 通过 SDKRpcClientV2(@moonshot-ai/kimi-code-sdk)直接驱动进程内的 v2 引擎,不经过 kap-server。#5212 修复了 kap-server 的兼容状态桥接(readLegacyStatus),但 packages/node-sdk/src/v2/session-wiring.ts 中镜像的 SDK 状态桥接和 SDKRpcClientV2.getStatus() 仍在无保护地调用 resolveModelContext():

  1. harness.resumeSession() 本身是成功的,因为 resumedAgentState() 已经容忍了模型别名缺失。
  2. KimiTUI.resumeSession() 把 switchToSession() 放在了 try/catch 之外。switchToSession() -> syncRuntimeState() -> getStatus() 抛出 config.invalid,一路抛到会话选择器的统一 catch,被误标为 Failed to apply startup flags。任何触发 agent.status.updated 的操作(setPermission、setPlanMode、回合生命周期)也会在 SessionEventWiring 中以同样方式抛错。
  3. 失败时 setSession() 已经执行了 this.session = session,而 syncRuntimeState() 在更新 appState.sessionId 之前就抛错了。第二次按 Enter 时,harness.resumeSession() 从缓存返回同一个 Session 实例,setSession() 把 previous === session 关闭——把正要切入的会话自己关掉了。
sequenceDiagram
    participant User as 用户
    participant Picker as TUI 会话选择器
    participant TUI as KimiTUI
    participant SDK as SDKRpcClientV2
    User->>Picker: 第 1 次按 Enter 选中会话
    Picker->>TUI: resumeSession(id)
    TUI->>SDK: resumeSession(id)
    SDK-->>TUI: 返回 Session(恢复成功)
    TUI->>TUI: setSession(session):this.session = session
    TUI->>SDK: switchToSession -> getStatus()(在 try/catch 之外)
    SDK--xTUI: 抛出 Model "..." is not configured
    TUI--xPicker: 向上抛错,显示 Failed to apply startup flags
    User->>Picker: 第 2 次按 Enter 选中同一会话
    Picker->>TUI: resumeSession(id)
    TUI->>TUI: setSession(同一 Session):previous === session 被 close
    TUI->>SDK: 对已关闭的 Session 调 getStatus()
    SDK--xPicker: [session.closed] Session is closed
Loading

Code Changes

核心思路: 让 SDK 的 v1 兼容状态读取只容忍「主 agent 绑定别名已从 config.toml 删除」这一种精确错误(上下文窗口回落到默认模型),在 resume 结果中填充 TUI 现有启动恢复和选择器恢复都会展示的 warning,并在 TUI 发送前拦截不可用模型的提交,引导用户用 /model 换模型。用户主动切换之前,不改写会话保存的模型别名。

决策 选择 未选择 理由
resume 时的模型绑定 保留原别名,提示用户用 /model 切换 resume 时自动改绑 default_model 与 #5212 一致:恢复过程保持只读,不静默改写会话或默认模型
模型不可用时的发送 在 TUI 提交前拦截并提示 /model 照常提交,让引擎里的回合失败 避免把注定失败的用户消息写进 wire.jsonl,与 Desktop 的发送门禁一致
缺失模型判定 在 agent-core-v2 叶子模块共享判定,kap-server 与 node-sdk 共同复用 在 node-sdk 里再抄一份 两端共用同一条精确规则,避免再次只改一边
 agent-core-v2
+  agent/profile/errors.ts        # isMissingConfiguredModelError(叶子模块,避免循环依赖)
+  agent/profile/missingModel.ts   # missingConfiguredModelAlias(仅从契约模块 agent/loop/loop.ts 导入 token)
 kap-server
   legacyStatus / agentState / sessionEventBroadcaster
-  本地定义 isMissingConfiguredModel 与 missingConfiguredModelAlias
+  改为从 agent-core-v2 导入共享实现(KAP 行为不变)
 node-sdk
+  v2/session-wiring.ts           # readStatusModelContext,供状态事件与 getStatus 共用
   sdk-rpc-client-v2.ts
     resumeSession
       materializeMainAgent
+      检测保存别名失效 -> 写入 ResumedSessionSummary.warning
     switchToSession -> getStatus
-      无保护调用 resolveModelContext()
+      readStatusModelContext(回落到默认模型上下文窗口)
 apps/kimi-code (TUI)
+  utils/model-switch.ts          # hasUnavailableSessionModel(基于 config.models 的 availableModels 判定并统一报错)
   普通消息 / inline skill / 插件命令 / /btw / /init / 已打开的 Btw 面板输入
+    提交前拦截并提示 Use /model to select an available model.
   Session.setModel()
+    换绑成功后清除缓存的 resumeState.warning(避免启动 -m 覆盖后仍打印旧警告)
   setSession
-    无条件 close previous
+    previous === session 时跳过 close
   resumeSession
-    switchToSession 在 try/catch 之外
+    switchToSession 移入 try/catch(报 Failed to resume session ...)

阅读顺序建议:

  1. packages/agent-core-v2/src/agent/profile/errors.ts 与 packages/agent-core-v2/src/agent/profile/missingModel.ts:共享判定与别名查询。missingModel.ts 从纯契约模块 agent/loop/loop.ts 导入 IAgentLoopService,不改动 loopService.ts 实现,也不会引入初始化环。
  2. packages/node-sdk/src/v2/session-wiring.ts:readStatusModelContext() 及其在 withStatusSnapshot() 中的使用。
  3. packages/node-sdk/src/sdk-rpc-client-v2.ts:getStatus() 与 resumedSessionSummary() 的警告生成。
  4. apps/kimi-code/src/tui/utils/model-switch.ts、apps/kimi-code/src/tui/kimi-tui.ts、apps/kimi-code/src/tui/commands/{dispatch,btw,session}.ts:各入口的发送拦截、setSession 防自我关闭、resumeSession 错误边界;packages/node-sdk/src/session.ts:setModel() 成功后清除过时的 resume 警告。

kap-server 的改动仅为收敛重复实现、替换 import;.changeset/tui-resume-removed-model.md 只包含 @moonshot-ai/kimi-code 的 patch 条目。

Behavior Changes and Affected Users

Behavior Before After Who relies on the old behavior Escape hatch
恢复主 agent 模型别名已从 config.toml 删除的会话 resumeSession 虽返回 Session,但 TUI 在 getStatus() / switchToSession 中失败;启动参数 -r <id> / -c 同样失败 正常恢复并返回 ResumedSessionSummary.warning;TUI 展示历史并提示 Warning: Session model "<alias>" is not configured in config.toml. Use /model to select an available model. 删除或下架过模型别名后恢复旧会话的 TUI 交互用户与 SDK 调用方 通过 /model(或 session.setModel())选择可用模型
主 agent 绑定别名缺失时的 SDKRpcClientV2.getStatus() 与 agent.status.updated 事件 同步抛出 config.invalid(导致 getStatus、setPermission、setPlanMode 和事件转发失败) 正常返回,保留原别名,maxContextTokens 回落到默认模型上下文窗口(无可用默认模型时为 0 / undefined) TUI 及基于 KimiHarness 的进程内 SDK 调用方 通过 setModel() / /model 绑定已配置模型
主 agent 未绑定模型但配置了 default_model 时的 withStatusSnapshot() maxContextTokens: undefined 回落到默认模型的上下文窗口,与 kap-server 的 readLegacyStatus 对齐 消费未绑定主 agent 状态事件的 SDK 调用方 无需处理(对齐既有 kap-server 契约)
会话模型不在 availableModels 中时,在 TUI 提交普通消息、inline skill、插件命令、/btw、/init 或在已打开的 Btw 面板中发送 照常提交到引擎:主会话先写 wire.jsonl 再失败;/btw 会 fork 出继承失效别名的 side agent 再失败 提交前统一拦截,提示 Error: Model "<alias>" is not configured in config.toml. Use /model to select an available model.;/model、/reload 和 shell 命令仍可用 会话模型被删除(或在磁盘上删除后尚未 /reload)的 TUI 用户 运行 /model 切换模型;或在 config.toml 中补回该模型后运行 /reload
启动恢复时通过 -m 指定可用模型(或 resume 后调用 Session.setModel()) 模型已成功换绑、可正常发送,但 getResumeState().warning 仍保留旧警告,finishStartup 仍提示运行 /model Session.setModel() 成功后清除 resumeState.warning,不再打印误导性警告;setModel 失败时保留警告 用 kimi -r <id> -m <model> / kimi -c -m <model> 启动的 TUI 用户与 SDK 调用方 无需处理(缺陷修复)
用当前已激活的同一个 Session 实例调用 KimiTUI.setSession() 关闭该 Session,导致 this.session 变成已关闭状态 保持会话打开,仅重新注册处理器 TUI 会话选择器重试路径 无需处理(缺陷修复)
KimiTUI.resumeSession() 中 switchToSession() 抛出的错误 冒泡到选择器 catch,显示 Failed to apply startup flags: ... 在 resumeSession() 内捕获,显示 Failed to resume session <id>: ... 排查恢复失败原因的 TUI 用户 无需处理(报错文案更准确)
其他模型配置错误(provider 配置非法、缺少 max_context_size、不支持的 thinking effort)以及子 agent 模型别名缺失 状态读取和状态事件抛错 仍然抛错;resumedSessionSummary 保留 resumedAgentState 在 resume 期间原有的容错行为 依赖严格配置校验的各端调用方 修正 config.toml
模型配置正常的会话,以及 kap-server 的 HTTP/WS 行为 正常工作 行为不变;KAP schema、notice 和默认值均未改动 TUI、print 模式、Desktop/Web、KAP 外部调用方、ACP、VS Code 无需处理

受影响模块与测试覆盖:

  • packages/node-sdk/test/session-event-wiring.test.ts:默认模型上下文窗口回落、无默认模型时为 0、其他配置错误与子 agent 缺失别名仍严格抛错。
  • packages/node-sdk/test/sdk-rpc-client-v2.test.ts:真实引擎端到端恢复失效别名会话,覆盖 warning、getStatus()、setPermission()、setPlanMode()、agent.status.updated 载荷,以及 setModel() 换绑恢复。
  • apps/kimi-code/test/tui/kimi-tui-message-flow.test.ts:普通消息、inline skill、插件命令、/btw、/init 及已打开 Btw 面板输入的发送前拦截(及模型恢复可用后正常发送)、setSession 同实例不关闭、switchToSession 警告展示。
  • apps/kimi-code/test/tui/kimi-tui-startup.test.ts:启动恢复(-c / -r)时展示警告,以及 -r <id> -m <可用模型> 覆盖后不再展示旧警告。
  • packages/node-sdk/test/sdk-rpc-client-v2.test.ts:真实 Session.setModel() 成功后清除 getResumeState().warning,失败时保留。
  • 真实 CLI 验证(macOS,源码入口 apps/kimi-code/src/main.ts + VirtualTerminal + testkit 假模型):在 base 82ace45bd 上复现了选择器连续两次失败;在本分支验证 kimi -c 和 kimi -r 均正常恢复并展示历史与警告,被拦截的消息未进入模型请求或历史,/model 切换后模型收到 ["first question", "continue after switching"] 并正常渲染回复。
实际运行的命令与结果
  • pnpm lint — 通过(0 warnings,0 errors)。
  • pnpm exec tsc -p packages/agent-core-v2/tsconfig.json --noEmit — 通过。
  • pnpm exec tsc -p packages/node-sdk/tsconfig.json --noEmit — 通过。
  • pnpm exec tsc -p packages/kap-server/tsconfig.json --noEmit — 通过。
  • pnpm exec tsc -p apps/kimi-code/tsconfig.json --noEmit — 通过。
  • pnpm exec vitest run --reporter=agent apps/kimi-code/test/tui/kimi-tui-startup.test.ts apps/kimi-code/test/tui/kimi-tui-message-flow.test.ts — 687 条通过。
  • pnpm exec vitest run --reporter=agent packages/node-sdk/test/session-event-wiring.test.ts packages/node-sdk/test/sdk-rpc-client-v2.test.ts packages/kap-server/test/sessionEventBroadcaster.test.ts — 192 条通过,1 条本机 macOS 既有失败:sdk-rpc-client-v2.test.ts > serves suggestFiles through the workspace handler fs service。原因是本机安装了 /opt/homebrew/bin/fd,而 fdSuggest.ts 未传 --no-require-git,导致 fd 在非 git 的 /tmp 目录不读取 .gitignore(Linux CI 走 rg --no-require-git 路径无此问题)。与本次改动无关,未夹带修改。
  • pnpm exec vitest run --reporter=agent packages/kap-server/test/sessions.test.ts -t 'removed|configuration errors' — 4 条通过。
  • pnpm run check:duplication 82ace45bdda95f7378e85701692a1e2a0b339101 — 通过(无新增重复)。
  • 平台说明:已在 macOS 上核对;本次改动不涉及路径处理、子进程、shell 或终端按键解码,Linux 由常规 PR CI 覆盖。

Checklist

  • I have read the CONTRIBUTING document.
  • 内部问题反馈(Desktop/Web 对应修复:fix(kap-server): resume sessions with unavailable models #5212),未重复创建 GitHub issue。
  • I have added tests that prove my feature works.
  • The behavior-change table above is complete, and every removed behavior or flipped default is named in the changeset and either has an escape hatch or was explicitly approved by a maintainer in this PR.
  • 已运行 gen-changesets 技能(仅 @moonshot-ai/kimi-code patch)。
  • 已运行 gen-docs 技能评估——无需更新文档:本次修复恢复的是文档已承诺的会话恢复能力,未新增或修改 CLI 参数、斜杠命令或配置项。

Tolerate a removed main-agent model alias in the v2 SDK status and status-event bridges, surface a resume warning in the TUI, and block prompt submission until an available model is selected. Avoid closing the incoming session when setSession receives the already-active instance.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T05:22:43.338248Z 4d43cbc Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@changeset-bot

changeset-bot Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4d43cbc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@4d43cbc
npx https://pkg.pr.new/@moonshot-ai/kimi-code@4d43cbc

commit: 4d43cbc

@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: a77a08516f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread .changeset/tui-resume-removed-model.md Resolved
…ervice

Place missingConfiguredModelAlias in agent/profile/missingModel.ts and import IAgentLoopService from its contract module so loopService.ts stays unchanged.
…esume warning

Block /btw, /init, and input routed to an open Btw panel when the session model alias is no longer configured, and clear the cached resume warning once Session.setModel succeeds so startup -m overrides do not print a stale warning.
@liruifengv

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: 4d43cbc276

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/kimi-code/src/tui/kimi-tui.ts Resolved
Comment thread packages/node-sdk/src/session.ts Resolved
@liruifengv

Copy link
Copy Markdown
Collaborator Author

@codex

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 4d43cbc276

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@liruifengv
liruifengv merged commit f323e36 into release/2026-11-25 Nov 25, 2026
24 checks passed
@liruifengv
liruifengv deleted the fix/tui-resume-removed-model branch November 25, 2026 05:47
kimi-agent-bot pushed a commit that referenced this pull request Nov 25, 2026
* fix(tui): resume sessions with models removed from config

Tolerate a removed main-agent model alias in the v2 SDK status and status-event bridges, surface a resume warning in the TUI, and block prompt submission until an available model is selected. Avoid closing the incoming session when setSession receives the already-active instance.

* refactor(agent-core-v2): move missing-model alias lookup out of loopService

Place missingConfiguredModelAlias in agent/profile/missingModel.ts and import IAgentLoopService from its contract module so loopService.ts stays unchanged.

* fix(tui): gate /btw and /init on unavailable models and clear stale resume warning

Block /btw, /init, and input routed to an open Btw panel when the session model alias is no longer configured, and clear the cached resume warning once Session.setModel succeeds so startup -m overrides do not print a stale warning.

* refactor(tui): report unavailable session model errors in one helper
kimi-agent-bot pushed a commit that referenced this pull request Nov 25, 2026
* fix(tui): resume sessions with models removed from config

Tolerate a removed main-agent model alias in the v2 SDK status and status-event bridges, surface a resume warning in the TUI, and block prompt submission until an available model is selected. Avoid closing the incoming session when setSession receives the already-active instance.

* refactor(agent-core-v2): move missing-model alias lookup out of loopService

Place missingConfiguredModelAlias in agent/profile/missingModel.ts and import IAgentLoopService from its contract module so loopService.ts stays unchanged.

* fix(tui): gate /btw and /init on unavailable models and clear stale resume warning

Block /btw, /init, and input routed to an open Btw panel when the session model alias is no longer configured, and clear the cached resume warning once Session.setModel succeeds so startup -m overrides do not print a stale warning.

* refactor(tui): report unavailable session model errors in one helper
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