Commit d386d18
committed
setup: drop the agent -> oneof-variant identity map
Review feedback on #267: `_AGENT_MODEL_CONFIG_VARIANT` mapped each agent to its
`AgentModelConfig` oneof key, but the proto's field names are ucode's tool names
verbatim — claude, codex, opencode, pi, gemini, copilot — so every entry mapped a
name to itself. One use site, so the tool now serves as the key directly.
The dict's only other effect was a KeyError on an unknown agent, which was already
unreachable: `serialize_managed_config` filters to `tool in AGENT_TOOL_TO_ENUM`
before calling this, and the `AGENT_TOOL_TO_ENUM[tool]` lookup two lines down would
raise first anyway.
No new test. The variant keys are already covered — hard-coding the wrong one fails
`test_codex_model_config_has_no_model_list` and
`test_flat_list_agents_use_repeated_models`, and the round-trip through
`normalize_managed_config` asserts the alignment for every agent.
The other half of that review comment — validating a model against its agent's
dialect, so a manifest can't pin a GPT id for Claude Code — is deliberately not
here. It turned out to need a decision rather than a patch: the agent -> families
mapping already exists twice (`agents._TOOL_DISCOVERY_SOURCES` and
`managed_setup._AGENT_MODEL_FAMILIES`) and the two disagree for codex, copilot,
opencode, and pi. Picking one requires checking each agent's own writer, and the
likely outcome is that this module's opencode entry is wrong — it lists `codex`
while `build_opencode_base_urls` serves no OpenAI route — which would be a picker
bug in the wizard, not a refactor. Landing that separately.
Co-authored-by: Isaac1 parent ca31bbb commit d386d18
1 file changed
Lines changed: 5 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | 51 | | |
63 | 52 | | |
64 | 53 | | |
| |||
250 | 239 | | |
251 | 240 | | |
252 | 241 | | |
253 | | - | |
254 | | - | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
255 | 247 | | |
256 | 248 | | |
257 | 249 | | |
| |||
0 commit comments