Skip to main content

codetether_rlm/events/
fallback.rs

1//! Subcall fallback event for RLM routing.
2
3use serde::{Deserialize, Serialize};
4
5/// Emitted when a configured subcall model cannot be resolved
6/// and the router falls back to the root model.
7///
8/// This is a cost signal — downstream consumers should log
9/// or surface it so the operator knows the subcall tier is
10/// misconfigured or unavailable.
11///
12/// # Examples
13///
14/// ```rust
15/// use codetether_rlm::events::RlmSubcallFallback;
16///
17/// let fb = RlmSubcallFallback {
18///     requested_model: "deepseek-r1".into(),
19///     fallback_model: "gpt-4o".into(),
20///     reason: "model not found in provider registry".into(),
21/// };
22/// assert!(!fb.requested_model.is_empty());
23/// ```
24#[derive(Debug, Clone, Serialize, Deserialize)]
25pub struct RlmSubcallFallback {
26    /// The model that was requested for the subcall.
27    pub requested_model: String,
28    /// The model actually used (typically the root model).
29    pub fallback_model: String,
30    /// Why the subcall model was unavailable.
31    pub reason: String,
32}