Skip to content

fix(ai-agent): team model selector fallback from registry cache#185

Merged
zhuqingyv merged 1 commit into
mainfrom
fix/team-model-selector-fallback
May 8, 2026
Merged

fix(ai-agent): team model selector fallback from registry cache#185
zhuqingyv merged 1 commit into
mainfrom
fix/team-model-selector-fallback

Conversation

@zhuqingyv

@zhuqingyv zhuqingyv commented May 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix: team mode model selector UI disappears because GET /api/conversations/:id/model returns available_models: [] and current_model_label: null
  • Root cause: ACP session handshake (session/new) only triggers on first send_message, but the frontend queries the model endpoint immediately after agent warmup
  • Fix: when session live data is empty, fall back to the AgentRegistry's cached handshake data (maintained by CatalogForwarder)

Design rationale

Respects the existing three-layer state model (Desired/Observed/Advertised) — no schema changes, no DB migration, no preload semantic changes. Uses the existing CatalogForwarder → Registry data flow as the pre-handshake fallback source. Once the CLI completes its handshake, live data automatically supersedes the fallback.

Changes

  • crates/aionui-api-types/src/acp.rs: Add Deserialize to ModelInfoEntry (enables parsing from registry JSON)
  • crates/aionui-ai-agent/src/service.rs: Add registry fallback logic in get_model + private model_info_from_registry helper

Test plan

  • cargo clippy --workspace — 0 warnings
  • cargo test --workspace — all pass
  • cargo fmt --all -- --check — pass
  • Manual: create team → member warmup → immediately call GET model endpoint → should return non-empty available_models

🤖 Generated with Claude Code

…available

When the ACP CLI session hasn't completed its handshake yet (e.g. team
members after warmup but before first message), GET /api/conversations/:id/model
returned available_models: [] and current_model_label as the raw model ID.

The fix uses the AgentRegistry's cached handshake data (maintained by
CatalogForwarder) as a fallback source for the model enumeration. This
respects the existing three-layer state model: session state remains
authoritative once the handshake completes, the registry just fills the
gap during the pre-handshake window.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@zhuqingyv zhuqingyv force-pushed the fix/team-model-selector-fallback branch from f9bf122 to 620ccca Compare May 8, 2026 02:34
@zhuqingyv zhuqingyv merged commit 2d2accb into main May 8, 2026
7 checks passed
@zhuqingyv zhuqingyv deleted the fix/team-model-selector-fallback branch May 8, 2026 02:58
zhuqingyv added a commit that referenced this pull request May 8, 2026
… info unavailable (#185)" (#190)

This reverts commit 2d2accb.

Co-authored-by: zhuqingyu <zhuqingyu@bituniverse.org>
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