Fix model discovery fallback parity#95
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves model discovery reliability and parity across backends by ensuring unhealthy native sessions fall back to CLI-based probing and by making OpenCode discovery behave like an interactive/login-shell invocation (while keeping BeamAgent’s auth hardening approach).
Changes:
- Extend
beam_agent_catalog:maybe_fallback_model_list/2to fallback onnative_call_failedtimeout/session_error cases. - Add OpenCode auth fallback to
opencode auth listparsing when the provider endpoint is unreachable and env auth isn’t present. - Add new CLI runner options (
cwd) and a login-shell capture path used by model discovery probes.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| test/public/beam_agent_catalog_model_tests.erl | Adds coverage for fallback behavior on native timeout exits. |
| test/core/beam_agent_auth_core_tests.erl | Adds tests for OpenCode CLI-auth detection and new CLI runner behaviors (cwd + login shell). |
| src/public/beam_agent_catalog.erl | Adds fallback parity for native_call_failed timeout/session_error tuples. |
| src/public/beam_agent_auth.erl | Updates public docs to reflect OpenCode auth probing order (provider/env/CLI). |
| src/core/beam_agent_auth_core.erl | Implements OpenCode CLI-auth fallback, adds run_capture_cli/4 (cwd), and introduces login-shell capture logic. |
| src/backends/opencode/opencode_client.erl | Prefers CLI-backed model catalog; switches model CLI probing to login-shell capture. |
| src/backends/copilot/copilot_client.erl | Gates native model listing on session health and adds a neutral CLI probe cwd. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Latest review-wave follow-up landed in Summary:
Verification:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Verification
rebar3 compilerebar3 eunit --module=beam_agent_auth_core_tests,beam_agent_catalog_model_tests,copilot_model_discovery_tests,opencode_model_discovery_testsmix test test/monkey_claw/agent_bridge/backend/beam_agent_list_models_test.exs test/monkey_claw/model_registry_test.exs test/monkey_claw_web/live/vault_live_test.exsinMonkeyClawMonkeyClaw.ModelRegistry.refresh_all()verification:claude_count: 3,copilot_count: 15,opencode_count: 444Notes
AGENT_AS_RECORD_DESIGN.md