Skip to content

Fix model discovery fallback parity#95

Merged
beardedeagle merged 13 commits into
mainfrom
fix/model-discovery-followups
Apr 9, 2026
Merged

Fix model discovery fallback parity#95
beardedeagle merged 13 commits into
mainfrom
fix/model-discovery-followups

Conversation

@beardedeagle

@beardedeagle beardedeagle commented Apr 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix Copilot model discovery so unhealthy ACP sessions fall back to the CLI prompt path instead of returning empty results.
  • Make OpenCode model discovery shell-agnostic by using the configured login shell rather than hardcoded shell or path assumptions.
  • Preserve BeamAgent auth and catalog hardening while aligning OpenCode discovery with the same model list seen from the user's login shell.

Verification

  • rebar3 compile
  • rebar3 eunit --module=beam_agent_auth_core_tests,beam_agent_catalog_model_tests,copilot_model_discovery_tests,opencode_model_discovery_tests
  • mix 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.exs in MonkeyClaw
  • Live MonkeyClaw.ModelRegistry.refresh_all() verification: claude_count: 3, copilot_count: 15, opencode_count: 444

Notes

  • Excludes local untracked AGENT_AS_RECORD_DESIGN.md
  • No agent or plan files were committed

Copilot AI review requested due to automatic review settings April 9, 2026 07:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/2 to fallback on native_call_failed timeout/session_error cases.
  • Add OpenCode auth fallback to opencode auth list parsing 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.

Comment thread src/core/beam_agent_auth_core.erl Outdated
Comment thread src/core/beam_agent_auth_core.erl Outdated
Comment thread src/core/beam_agent_auth_core.erl Outdated
Comment thread src/core/beam_agent_auth_core.erl Outdated
Comment thread src/core/beam_agent_auth_core.erl
Comment thread src/core/beam_agent_auth_core.erl Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/core/beam_agent_auth_core.erl
Comment thread src/core/beam_agent_auth_core.erl Outdated
Comment thread src/backends/claude/claude_agent_sdk.erl Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/core/beam_agent_auth_core.erl Outdated
Comment thread src/core/beam_agent_auth_core.erl Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/core/beam_agent_auth_core.erl
Comment thread src/core/beam_agent_auth_core.erl

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/core/beam_agent_auth_core.erl Outdated
Comment thread src/core/beam_agent_auth_core.erl Outdated
@beardedeagle beardedeagle requested a review from Copilot April 9, 2026 09:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/core/beam_agent_auth_core.erl Outdated
Comment thread src/backends/claude/claude_agent_sdk.erl Outdated

@beardedeagle beardedeagle left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Submitting the draft review created while replying inline so the thread no longer remains pending. The substantive fix details stay in the inline thread reply below.

Comment thread src/backends/claude/claude_agent_sdk.erl Outdated
@beardedeagle

Copy link
Copy Markdown
Owner Author

Latest review-wave follow-up landed in 9ec35e5.

Summary:

  • quote "$HOME/.profile" in the sh-family login-shell fallback helper
  • remove the redundant Claude config variant expansion path

Verification:

  • rebar3 eunit --module=beam_agent_auth_core_tests,claude_model_discovery_tests
  • rebar3 compile
  • git diff --check

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/core/beam_agent_auth_core.erl Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/backends/opencode/opencode_client.erl
Comment thread src/core/beam_agent_auth_core.erl Outdated
@beardedeagle beardedeagle merged commit f3085e0 into main Apr 9, 2026
9 checks passed
@beardedeagle beardedeagle deleted the fix/model-discovery-followups branch April 9, 2026 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants