Commit Graph
1 Commits
Author SHA1 Message Date
yetone e7f21dba5e codex: Disconnect keeps an effort or model list the user set by hand after Connect
@yhwangl on X asked that putting an agent's config back never write
over what the user changed by hand after magpie took it over: only the
keys magpie changed go back, and a key magpie wrote that the user has
changed since keeps the user's value.

Codex's Disconnect put back the pre-connect model_reasoning_effort and
model_catalog_json whatever they were by then. An effort the user set
by hand to high after connecting went back to the low it was before,
and a model list of their own put in by hand was deleted.

Now:
- the effort goes back only while it is still one magpie set: the one
  settle moved it to (stashed as codex.effort_set), the one picked on
  the Agents page (the applied record), or none;
- dropProvider takes model_catalog_json out only when it is magpie's
  list (or empty), and unroute puts the old list back only where the
  key is empty;
- model_provider is put back only where the key is empty.
Other agents' fields already clear only a value still magpie's, and
put the pre-connect backup only into a field left empty.

Run, at this commit's tree (HEAD df8374921 plus this change), sandbox
HOME, private GOCACHE:
- gofmt -l internal/agent: clean; go vet ./internal/agent: ok
- go test -tags nogui -count=1 -run Codex ./internal/agent: ok (121.7s)
- broken by hand (the effort and catalog checks taken out of unroute):
  TestCodexDisconnectKeepsHandEdits went red, green again with them.
Not run: the full suite (runs with the uninstall change).
2026-10-27 17:02:55 +08:00