Commit Graph
2 Commits
Author SHA1 Message Date
yetone 4447b06804 agent: a magpie model picked for omp puts magpie/** on its enabledModels, so omp's picker and Ctrl+P list every model magpie gives it (#1769, real-jacket)
What changed: since v0.1.1214 a default role set on a magpie model
outside a non-empty enabledModels launched, because magpie appended that
one model to the list. But omp's picker and Ctrl+P show only what the
list takes in (filterAvailableModelsByEnabledPatterns, resolveModelScope),
so they still listed the user's models plus that one, while magpie's
Agents page and `magpie models omp` list the whole catalog.

Now setting the default role on a magpie model replaces the plain
magpie/<provider>/<model> entries (what magpie added before) with one
magpie/** at the list's end. omp matches entries with Bun.Glob, whose *
stops at a slash, so it takes **: checked with bun that magpie/** matches
magpie/anthropic/claude-sonnet-4.5 and magpie/* doesn't. ompTakes reads a
trailing ** the same way. The list is still left alone when it is empty
or absent, and when the user chose which magpie models it holds (a glob
or a thinking level on magpie/, or a glob of theirs taking the model in):
then only the model is appended, as before. Disconnecting removes
magpie/** with the other magpie entries. It is done only when the role is
set, never on sync, so a user who removes magpie/** keeps it removed.

Run:
- go test -tags nogui -run 'Omp|OMP|omp' ./internal/agent: ok (122s).
  New TestOmpEnabledModelsTakeEveryMagpieModel (the reporter's config as
  v0.1.1214 left it: every model in models.yml is taken in, the user's
  entries keep their meaning, set again is idempotent, reset removes it).
  Broken by hand (always append the model): it and
  TestOmpDefaultJoinsEnabledModels go red. TestOmpRefsBeyondDefault's
  expected config now has magpie/** in place of the one model.
- gofmt -l; GOOS=linux and GOOS=windows go vet -tags nogui: clean.
- The full internal/agent package hit the 10m timeout at load 54-74 in
  TestClaudeFableTierOnClaude (writing a stash), unrelated to omp.

Not tried with a real omp binary: the glob behaviour is from omp 18.9.1's
source and a Bun.Glob check, not a picker on screen. The reporter needs to
pick the model once more in magpie for the list to change.

Reported-by: real-jacket
2026-10-13 13:03:26 +08:00
yetone e6753190cd agent: a model picked for omp's default role joins its enabledModels list when there is one, so omp starts on it and doesn't pick another (#1769)
real-jacket: with enabledModels in ~/.omp/agent/config.yml, magpie wrote
only modelRoles.default, and omp kept starting on a model of the list. omp
holds a new session's default role to that list while it names anything
(main.ts buildSessionOptions, sdk.ts resolveAllowedModels and
pickDefaultAvailableModel); its other roles resolve against every model it
has, so only the default role is held to it. Pi had the same rule, fixed
in #160.

omp_scope.go: a model picked for the default role is added to the end of a
list that doesn't already take it in, by name or by one of omp's globs
(Bun.Glob, where * doesn't cross "/"), comments and order kept
(edit.EditYAMLNode, new). No list, or an empty one, is left as it is: omp
then takes every model. Entries scoped to folders ({path, models}) are the
user's and never changed. Disconnect takes the plain magpie/... entries out
once nothing else in config.yml is on magpie (a list left empty goes,
never []); a scoped entry on magpie still counts as in use. A renamed
provider's entries are renamed once (ompScopeOnce). Check reports a
default role on magpie the list leaves out as drift, which Reapply mends.

docs/subsystems/agent-wiring.md says the same.

Run:
- omp_scope_test.go: the default joins the list (plain, glob, level
  suffix, comments kept), a list that takes it in or none is left alone,
  Disconnect clears magpie's entries and keeps the user's and scoped ones,
  and the leaving-out is drift. Each goes red with its part taken out
  (ompScopeWith not appending, dropMagpie not calling ompScopeWithout,
  Check without the list).
- go test -tags nogui ./internal/agent ./internal/edit.
- gofmt -l, go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./..., sandboxed go test ./... at the rebased head.
Not run: a real omp binary starting a session on the config written. Pi
has no RenameRefs, so a renamed provider's magpie/<old>/... entry stays in
Pi's enabledModels (not changed here).
2026-10-12 22:55:22 +08:00