Repository navigation
fix(acp): probe agent options with the user's model selection - #910
Merged
xintaofei merged 5 commits intoOct 9, 2026
Merged
Conversation
…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.
Collaborator
|
codeg work task |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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驱动的任务编辑器/任务设置/自动化编辑器);验证
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 干净;注:目前手工验证仅在 macOS 完成;Windows / Linux 依赖 CI 矩阵验证(同一代码路径,无平台分支)。