Skip to content

fix(acp): probe agent options with the user's model selection - #910

Merged
xintaofei merged 5 commits into
spacering-net:mainfrom
Liang-HZ:fix/acp-probe-model-selection
Oct 9, 2026
Merged

xintaofei merged 5 commits into
spacering-net:mainfrom
Liang-HZ:fix/acp-probe-model-selection

Conversation

@Liang-HZ

@Liang-HZ Liang-HZ commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Fixes #907

问题

委托设置(以及任务/自动化编辑器)的选项列表来自一次性的探测会话,但探测不应用用户已保存的模型选择。对于"选项随模型变化"的 agent(opencode 按模型重列 effort),面板展示的是 agent 默认模型的选项:例如选中 opencode-go/deepseek-v4.1-flash 时显示 apex 的 [none, low, medium, high],而该模型实际支持 [low, high, max] —— max 选不到,选 none/medium 会在委托运行时被 opencode 拒绝(InvalidEffortError),子智能体起不来。

修复

  • 把调用方的配置选择(目前只传 model)从 acp_describe_agent_options 透传到 probe_agent_options → spawn_agent 的 preferred config:探测会话先应用所选模型,opencode 返回/推送该模型的选项后再取快照;
  • 前端把快照缓存按 (agent, folder, model) 分键,模型变化时 debounce 重探测(覆盖委托设置面板 + useAgentOptions 驱动的任务编辑器/任务设置/自动化编辑器);
  • 被 agent 拒绝的取值走既有的应用路径:记日志并跳过,不会让探测本身失败。

验证

  • macOS (darwin-arm64) 实机验证:应用选择后,探测会话日志出现 re-asserting 'model'='opencode-go/deepseek-v4.1-flash' — the agent reverted it after codeg applied it at session establishment,Effort 选项随所选模型变为 [low, high, max, default];
  • useAgentOptions 新增单测(模型传参 + 变更后重探测),vitest 通过;eslint 干净;
  • Rust 侧为纯链路透传、无平台特定代码;CI 矩阵(ubuntu / macos / windows)会覆盖三平台的编译与测试。

注:目前手工验证仅在 macOS 完成;Windows / Linux 依赖 CI 矩阵验证(同一代码路径,无平台分支)。

Liang-HZ and others added 5 commits October 9, 2026 14:42
…fault

The delegation-settings panel (and the task / automation editors) read an
agent's config options from a transient probe session that never applied the
user's saved model. An agent that derives one option's choices from another's
value — opencode re-lists `effort` per model — therefore showed the agent's
DEFAULT model options next to the user's model selection: apex's
[none, low, medium, high] while opencode-go/deepseek-v4.1-flash really takes
[low, high, max]. max was unreachable, and picking none / medium failed at
delegation time with InvalidEffortError.

Thread the caller's selections (the model) through acp_describe_agent_options
-> probe_agent_options -> spawn_agent's preferred config, and key the
frontend snapshot caches by model so switching the model re-probes. Values the
agent rejects are logged and skipped by the existing apply path, so a stale
preference can never fail the probe itself.
Applying the caller's model on the probe session left that model as the
model selector's current value, and the delegation panel labels its
"Default" choice and "Agent default" hint with that value — so a saved
model override read as the agent's own default, and picking "Default"
silently switched delegations to a different model.

Establishment now records each option's value as the agent picked it,
before saved preferences are replayed, and the probe reports that value
for every option it applied. Options the agent derives from the
selection (opencode's per-model effort) keep the answer for it.
The delegation panel only bumped its request id on a cache miss, so a
probe still running for the previous agent or model could land after a
cache hit and replace the snapshot on screen with its own options. Bump
first, as useAgentOptions already does.
Keying probes by model split the task editor's two probe hosts: the
mode/model bar probed with the selected model while the brief's composer
probed without one, so opening the editor on a saved model spawned the
agent twice — and since probes of one agent run one at a time, one of
them waited for the other. The composer now takes the host's selections
and probes with them, which puts both back on one cache key.
@xintaofei

Copy link
Copy Markdown
Collaborator

codeg work task 302 is done — #910 (11 files, +551/-13).

@xintaofei
xintaofei merged commit 2a88f92 into spacering-net:main Oct 9, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants