Skip to content

fix(rooms): align model settings state with the saved modelRef contract - #1341

Merged
XingYu-Zhong merged 5 commits into
developfrom
codex/fix-agent-model-ref-type
Sep 23, 2026
Merged

XingYu-Zhong merged 5 commits into
developfrom
codex/fix-agent-model-ref-type

Conversation

@XingYu-Zhong

@XingYu-Zhong XingYu-Zhong commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary / 概要

  • Fixes the "Quality gates" failures currently breaking develop:
    1. tsc -p tsconfig.web.json errors in AgentModelSettings.tsx (AgentModelBinding | null not assignable to the modelRef contract).
    2. npm run check:file-lines violations: src/main/ipc/register-app-file-ipc-handlers.ts (707 lines) and src/renderer/public/remote-bridge.js (750 lines) exceed the 700-line limit.
    3. Two stale kun/ test expectations: memory-store.test.ts never enabled memoryPolicy in the turn context (so memory_create was not advertised), and model-client-1.cases.ts still expected stream: false for Codex, which the client now forces to stream: true since Codex Responses only accepts streamed requests.

Why / 背景

  • AgentModelSettings stores the main/fast model binding in state typed as AgentModelBinding, where providerId is optional, but saveAgentModels requires AgentIdentity['modelRef'] (AgentModelRef), where providerId is mandatory (zod min(1)).
  • Both file-size violations are baseline issues on develop — reproduced on a clean checkout — and they currently fail "Quality gates" for any PR (e.g. feat: add Opper as a model provider preset #1340).

Changes / 变更

  • AgentModelSettings.tsx: type the main/fast state and apply parameters as NonNullable<AgentIdentity['modelRef']> | null; guard the dropdown selection with option?.providerId so provider-less pseudo-options (the deps.model() fallback) fall back to "inherit" instead of sending a payload the API schema would reject.
  • Extract the extension:artifact:open handler + its schemas into src/main/ipc/register-extension-artifact-ipc-handlers.ts (no behavior change).
  • Move the clipboard image helpers out of src/renderer/public/remote-bridge.js into remote-bridge-clipboard.js, exposed on window.__kunRemoteBridgeClipboard; the Remote gateway serves it ahead of the bridge script in the same response, and the bridge degrades gracefully when it is absent.

Media / 截图或录屏

  • No UI change.

Tests / 测试

  • npx vitest run src/renderer/src/components/rooms/ — 188 passed
  • npx vitest run src/main/remote/ src/main/ipc/ — 417 passed
  • kun: vitest run tests/memory-store.test.ts tests/model-client.test.ts — 70 passed; tsc --noEmit -p tsconfig.json — clean
  • npx tsc --noEmit -p tsconfig.web.json and tsconfig.node.json — clean
  • npm run check:file-lines — passed
  • npx eslint on touched files — clean

Validation / 验证

  • I agree that this contribution is submitted under the Contributor License Agreement. / 我同意本贡献遵循 CLA 提交。
  • npm run test (affected files / 相关测试文件)
  • npm run typecheck
  • npm run build
  • npm run dev (no runtime or UI behavior change / 无运行时或界面行为变化)
  • Logic change: unit tests added or updated / 逻辑变更:已新增或更新单元测试

Notes / 备注

Generated with Devin

XingYu-Zhong and others added 5 commits September 23, 2026 16:46
The main/fast binding state was typed as AgentModelBinding, whose
providerId is optional, while saveAgentModels requires the
AgentModelRef shape with a mandatory providerId. tsc -p
tsconfig.web.json has been failing on develop since the bindings
state was introduced. Tighten the state to the saved ref shape and
treat provider-less fallback options as "inherit" instead of sending
a payload the API schema would reject.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Two tracked files on develop exceed the file-lines limit and fail
Quality gates for every PR. Extract the extension-artifact IPC handler
into register-extension-artifact-ipc-handlers.ts, and move the remote
bridge clipboard helpers into remote-bridge-clipboard.js which the
Remote gateway serves ahead of remote-bridge.js. No behavior change:
the clipboard helper degrades gracefully when absent.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…vior

memory_create is only advertised when the turn context enables
memoryPolicy; the approval-gating test never set it, so resolution
threw before reaching the approval path. The Codex Responses endpoint
requires streamed requests and the client now forces stream:true, so
the adapter case must expect it. Both failures reproduce on a clean
develop checkout.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The scale and rollback-migration tests do real SQLite work and sit
close to their timeout budget; both timed out on the CI runner while
passing locally. Give the migration case an explicit 30s and raise
the 100k-message scale case to 120s.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The PID-reuse guard in runtimeProcessInspectionMatchesRecord treats a
record whose startedAt predates the real process start as a different
owner, so the mock registration with a 2026-08-16 timestamp was being
unregistered instead of kept as an external writer. Stamp the record
with the current time so it matches the live test process.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@XingYu-Zhong
XingYu-Zhong merged commit 163984d into develop Sep 23, 2026
7 checks passed
@XingYu-Zhong
XingYu-Zhong deleted the codex/fix-agent-model-ref-type branch September 23, 2026 13:30
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.

1 participant