Files
multica/server
J 5744e080ef fix(agent): harden pi catalog parsing and opencode fallback (review)
Addresses review feedback on the discovery hardening:

- parsePiModels: the previous guard only dropped the `Warning:`-prefixed
  form (which collapses to an empty `Warning/` half). The real pattern
  warning can arrive without that prefix — `No models match pattern "..."` —
  and the table branch would turn it into a bogus `No/models` model. Filter
  pi's diagnostic lines (unmatched-pattern message, `Warning:`/`Error:`/`Info:`
  prefixes) before field-splitting, with the empty-half check kept as a
  structural backstop.

- discoverOpenCodeModels: parse the verbose output even on a non-zero exit and
  only fall back to plain `opencode models` when nothing parses. The earlier
  version skipped the fallback whenever verbose printed any bytes, so
  unparseable noise on a non-zero exit returned empty — worse than before.

Tests: pi non-zero-exit cases now assert the result is exactly the resolvable
model (no junk row) and cover the un-prefixed warning; new OpenCode test covers
verbose-noise-then-fallback.

Co-authored-by: multica-agent <github@multica.ai>
2026-06-04 14:19:12 +08:00
..
2026-06-03 14:32:44 +08:00