Skip to content

fix(assistant): sync Bot model selection and surface execution failures - #6181

Merged
M4n5ter merged 7 commits into
mainfrom
fix/assistant-bot-model-sync
Oct 20, 2026
Merged

M4n5ter merged 7 commits into
mainfrom
fix/assistant-bot-model-sync

Conversation

@M4n5ter

@M4n5ter M4n5ter commented Oct 20, 2026 •

Copy link
Copy Markdown
Member
English

Summary

Changing the personal assistant's model could leave its hidden Bot using the previous connection and model, with failures invisible in the conversation.

  • Synchronize the selected connection, model, and thinking level before each new Bot wake, including replacement wakes created during recovery.
  • Keep the existing worker, history, and permission policy; defer changes while execution or user interactions are pending.
  • Deliver generic preparation and execution failure notices through the durable conversation outbox. Keep full diagnostics local and preserve Inbox messages so new input can trigger a retry.

Verification

  • Review follow-up: one production line now emits a fixed failure notice. Existing preparation/execution regressions include synthetic key/path diagnostics, preserve local errors, and fail before this change.
  • Passed: repository lint, format check, build, typecheck, and Knip for Desktop and UI.
  • Passed locally: 140 Bot/catalog/service tests and three affected Host/model composition cases.
  • Verified red/green: the real Host recovery regression detects execution on the old connection/model and passes with this fix. It also checks restart history, the generic conversation notice, and the current provider error retained locally.
  • CI on e53ec1312: the required test check passed, including 2,835 passing Runtime Host tests (20 skipped), all 187 assistant integration tests, and CLI release-candidate build/install validation.
  • A full local Runtime Host run hit two timing failures (Bash terminal wait and Candidate handover); both passed isolated reruns, and the complete suite passed in CI.

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: OpenAI Codex implemented, tested, reviewed, and documented this change. This PR was opened by OpenAI Codex at the contributor's request. All commits include Generated-by: OpenAI Codex.

Checklist

  • Tests cover the change and fail without it
  • Required local checks and current-head CI pass.

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No
简体中文

概述

切换个人助手的模型后,隐藏的 Bot 可能继续使用原来的连接和模型,执行失败也不会显示在聊天中。

  • 每次新 Bot 唤醒前同步选中的连接、模型和思考级别,包括恢复过程中创建的替代唤醒。
  • 保留现有 worker、历史和权限策略;执行或用户交互尚未结束时暂缓变更。
  • 通过持久化聊天发件箱投递通用的准备和执行失败提示,完整诊断仅留在本地。保留 Inbox 消息,收到新消息后可重试。

验证

  • 审查修复:仅改一行生产代码,改用固定失败提示。沿用准备/执行失败回归,加入合成密钥/路径诊断并保留本地错误检查;这些用例在修复前失败。
  • 已通过:全仓 lint、格式检查、构建、类型检查,以及 Desktop 和 UI 的 Knip 检查。
  • 本地已通过:140 项 Bot/会话目录/服务测试,以及 3 项受影响的 Host/模型组合测试。
  • 已验证先失败、修复后通过:真实 Host 恢复回归测试能抓住继续使用旧连接和模型的执行,并在修复后通过;同时验证重启后的历史、聊天中的通用失败提示,以及本地保留的当前 provider 错误。
  • e53ec1312 的必需 test 检查已通过:Runtime Host 2,835 项通过、20 项跳过;助手集成 187 项全部通过;CLI 发布候选产物的构建及安装验证通过。
  • 一次本地全量 Runtime Host 测试遇到两项时序失败(Bash 终态等待、Candidate 交接);两项均在单独重跑中通过,CI 中的完整测试组也已通过。

AI 使用

  • 生成式工具未作实质性贡献
  • 生成式工具作了实质性贡献

工具及范围:OpenAI Codex 完成了实现、测试、审查和说明,并按贡献者要求创建此 PR。所有提交均包含 Generated-by: OpenAI Codex。

检查清单

  • 测试覆盖本次变更,并在缺少修复时失败
  • 必需本地检查和当前 HEAD 的 CI 均已通过。

此 PR 是否改变行为?

  • 是——已在上方概述中说明
  • 否

Reconcile idle Bot workers with the conversation connection, model and thinking level through the existing configuration authority. Preserve worker history and pending interactions. Publish provider failures through the durable conversation outbox without consuming retries on publication failures.

Generated-by: OpenAI Codex
Make model readiness an explicit admission precondition, including replacement wakes created inside recovery. Defer busy workers while preserving wake identity, and keep preparation failures outside ambiguous submission retries. Cover the recovered running-wake transition through the real Host.

Generated-by: OpenAI Codex
Share the recovery lifecycle for route synchronization, restart and visible provider failures. Merge overlapping publication and thinking tests, remove the duplicate mocked controller lifecycle, and drop an unreachable failure guard.

Generated-by: OpenAI Codex
Use the interaction coordinator as the pending-request authority and restore the unrelated Plugin Agent resume order. Remove unnecessary model discovery from the Host fixture and combine restart routing with current provider failure reporting.

Generated-by: OpenAI Codex
@github-actions github-actions Bot added the effort/L Under 1000 readable lines label Oct 20, 2026
@M4n5ter
M4n5ter requested a review from xxhZs October 20, 2026 03:00
The K3 lowest-effort scenario requires a model without an off option. Earlier Host integration tests refresh process metadata from models.dev, whose current K3 declaration now includes none. Install explicit no-off metadata for this case and restore the bundled catalog afterward, while retaining the real request assertions.

Generated-by: OpenAI Codex

@Astro-Han Astro-Han 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.

Automated review notice: This comment was posted by an automated review agent. It is not an independent human review and does not replace one.

I reviewed all ten changed files at 5d6164bffbc21c67f0f92ef8a9c3945cb9aebcb8. Before a new Bot wake is admitted, the Host now copies the owner's selected connection, model and thinking level into an idle worker through the existing configuration authority, while preserving worker history and permissions. Existing executions and pending interactions defer that update. The controller also publishes preparation and execution failures through the durable conversation outbox and keeps unread input available for a later retry (server/session-catalog-coordinator.ts:424, assistant/bot/controller.ts:172, under packages/runtime-host/src).

One P2 finding: packages/runtime-host/src/assistant/bot/controller.ts:185 publishes unrestricted error text into the user conversation. Provider diagnostics may contain credentials or private Host details, and the existing IM bridge forwards these new assistant messages verbatim. In a controlled integration case, a synthetic authentication diagnostic containing a synthetic API-key marker and private path survived the actual provider-error classifier, Host execution, Bot outbox, conversation ledger, web message projection and Feishu bridge, reaching the captured IM send interface unchanged. Replacing only this visible error interpolation with a generic notice removed both markers. No real credential or external IM service was used. The inline comment describes the required boundary.

The model synchronization and recovery regression passed through the production Host composition; replacing only the synchronization call with a no-op made that same test execute on the previous route and fail. In total, 140 Bot/catalog/service tests, four assistant Host composition cases, 35 interaction/admission tests, 25 IM bridge tests and the three assistant integration groups (83, 24 and 80 tests) passed. They cover route changes, replacement wakes, restart history, pending interactions, preserved worker policy, durable failure publication and retry after fresh input. I found no additional regression in the checked IM admission and delivery paths.

The Kimi test change fixes a metadata-dependent premise rather than weakening the real request assertions. I installed a refreshed K3 declaration that permits none: without the new per-test metadata pin, the existing request assertion failed with thinking === undefined; with the pin it passed. In the complete 42-test execution-model composition file, Kimi passed, while the unchanged Bash live-sandbox-boundary case failed because its tool result omitted the expected workspace path (41 passed, one failed). That Bash assertion also failed in isolation and after restoring all four changed production modules to main. I have not established its underlying sandbox cause and do not attribute it to this PR.

The normal clean root test build, all workspace type checks, production renderer build, lint, formatting, ASF headers, 168 architecture tests, the strict architecture comparison against main, surface inventory, Windows skip inventory and E2E budget passed. The protocol guard found no protocol changes at epoch 225. A trial merge with main b0ed5707ff3dc645c66253ed93e50936e3f9d45d had no conflicts; that merged tree was not tested. At the final status check, exact-head CI run 39362331291 was still in progress.

I did not run the full Runtime Host or repository suite, native Windows/WSL or installer tests, live IM delivery, or paid provider calls. The synthetic provider error and captured IM transport establish the disclosure path without claiming that a real credential has leaked. The P2 should be addressed before merging; CI completion and the merge decision remain with the maintainers.

id: `bot-error:${id}`,
turnId: `assistant-output:error:${id}`,
ts: Date.now(),
text: `助手消息处理暂时停止:${String(error)}。消息已保留;请检查当前模型和连接,发送新消息可重试。`,

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.

[P2] Sanitize failure text before publishing it to the conversation

This interpolation forwards every preparation/execution error verbatim. For completed provider failures, executionFailure supplies the terminal provider message, and the provider classifier truncates that message without redacting secrets. The new assistant bubble is then copied to the conversation ledger and forwarded unchanged by the existing web/IM paths. I reproduced a synthetic invalid-key diagnostic containing a synthetic API-key marker and private Host path reaching the actual Feishu bridge's captured sendMessage argument through the production Host and Bot outbox. This newly sends diagnostic contents to an external messaging service whenever a provider includes such details in an error. Publish a bounded, sanitized user-facing failure notice and retain unrestricted diagnostics locally; apply the same protection to preparation errors caught here.

Publish a fixed retry notice for preparation and execution failures while retaining detailed errors in the local Bot store. Update the existing regressions with synthetic credential and path diagnostics and preserve the current local provider failure check.

Generated-by: OpenAI Codex
Merge main at 9afda61. Keep its two Kimi metadata scenarios instead of the older single-scenario pin. Preserve the Bot model synchronization and generic failure notice.

Generated-by: OpenAI Codex
@M4n5ter
M4n5ter merged commit e66a655 into main Oct 20, 2026
1 check passed
@M4n5ter
M4n5ter deleted the fix/assistant-bot-model-sync branch October 20, 2026 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/L Under 1000 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants