Skip to content

[API-203] Handle unknown agent types gracefully in CLI#55

Merged
lorenjphillips merged 1 commit into
mainfrom
loren/api-203-handle-unknown-agent-types
Apr 4, 2026
Merged

[API-203] Handle unknown agent types gracefully in CLI#55
lorenjphillips merged 1 commit into
mainfrom
loren/api-203-handle-unknown-agent-types

Conversation

@lorenjphillips

@lorenjphillips lorenjphillips commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds #[serde(other)] Unknown variant to AgentType enum so unrecognized model_type values from the API (e.g. MODEL_TYPE_DAILY, legacy types, experimental types) don't crash deserialization of the entire agents list response
  • Unknown types display as UNKNOWN in table output
  • #[value(skip)] excludes the variant from CLI create/update value selection so users can't accidentally create agents with an unknown type

Context

The CLI AgentType enum only has 5 types but the API has 14+ (including legacy read-only types). When the API returned an agent with MODEL_TYPE_DAILY (pipecat), serde deserialization failed and coval agents list broke entirely with Error: Invalid request: Invalid request parameter.

Companion backend PR: coval-ai/backend#3373

Test plan

  • cargo check — compiles clean
  • cargo test — all 32 tests pass
  • Manual: coval agents list against an org with mixed agent types

Summary by CodeRabbit

  • Bug Fixes
    • Improved robustness for unknown agent types: unrecognized or legacy agent configurations are now handled gracefully instead of causing failures.
    • Prevents errors during agent initialization and interaction, maintaining stability when encountering unfamiliar agent definitions.
    • Reduces user-facing crashes and improves reliability across mixed or evolving agent deployments.

@coderabbitai

coderabbitai Bot commented Apr 2, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d6b6f175-7705-4984-8604-675da7d82b93

📥 Commits

Reviewing files that changed from the base of the PR and between 50ba64e and 8f33358.

📒 Files selected for processing (1)
  • src/client/models/agent.rs

📝 Walkthrough

Walkthrough

Added an Unknown variant to the AgentType enum as a serde deserialization catch‑all (#[serde(other)]), excluded it from CLI enumeration (#[value(skip)]), and made Display render it as "UNKNOWN".

Changes

Cohort / File(s) Summary
Agent Type Robustness
src/client/models/agent.rs
Add AgentType::Unknown with #[serde(other)] to deserialize unrecognized model_type values into a catch‑all; mark variant #[value(skip)] so it's not offered by clap::ValueEnum; update Display to output "UNKNOWN".

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 I hopped into enums with delight,
Found a stranger in the modeling night,
"Unknown" I named it, gentle and kind,
Catching odd types that we might find,
Now serde smiles — no panic, just light.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding graceful handling for unknown agent types in the CLI, which directly corresponds to the changeset's addition of an Unknown variant to AgentType.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch loren/api-203-handle-unknown-agent-types

Comment @coderabbitai help to get the list of available commands and usage tips.

Add #[serde(other)] Unknown variant to AgentType enum so that
unrecognized model_type values from the API (e.g. MODEL_TYPE_DAILY,
legacy types, experimental types) don't crash deserialization of the
entire agents list response. Unknown types display as UNKNOWN in table
output and are excluded from CLI create/update value selection via
#[value(skip)].
@lorenjphillips lorenjphillips force-pushed the loren/api-203-handle-unknown-agent-types branch from 50ba64e to 8f33358 Compare April 2, 2026 17:48
@lorenjphillips lorenjphillips merged commit 7bb7bc4 into main Apr 4, 2026
7 checks passed
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