Skip to content

Commit 3e282a2

Browse files
wpfleger96npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7
andauthored
feat(buzz-agent): config parity — thinking effort, model switching, normalized token limits (#1470)
Signed-off-by: Will Pfleger <[email protected]> Co-authored-by: npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@sprout-oss.stage.blox.sqprod.co>
1 parent f9d06ae commit 3e282a2

13 files changed

Lines changed: 3186 additions & 76 deletions

File tree

‎crates/buzz-agent/src/agent.rs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ const ERROR_REFLECTION_SUFFIX: &str =
2323

2424
pub struct RunCtx<'a> {
2525
pub cfg: &'a Config,
26+
/// Effective model for this session. Usually equals `cfg.model`; overridden
27+
/// per-session by `session/set_model`. All LLM calls use this value.
28+
pub effective_model: &'a str,
2629
pub session_id: &'a str,
2730
pub system_prompt: &'a str,
2831
pub llm: &'a Llm,
@@ -113,7 +116,7 @@ impl RunCtx<'_> {
113116
let response = tokio::select! {
114117
biased;
115118
_ = self.cancel.changed() => return Ok(StopReason::Cancelled),
116-
r = self.llm.complete(self.cfg, self.system_prompt, self.history, &tools) => r?,
119+
r = self.llm.complete(self.cfg, self.system_prompt, self.history, &tools, self.effective_model) => r?,
117120
_ = async {
118121
// Keepalive ticker: emit a lightweight session update every 30s
119122
// while waiting on the LLM provider. This resets the ACP harness

‎crates/buzz-agent/src/catalog.rs‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,39 @@ pub struct ModelEntry {
3232
pub const DATABRICKS_V2_KNOWN_MODELS: &[&str] =
3333
&["databricks-gpt-5-5", "databricks-claude-opus-4-7"];
3434

35+
/// Returns the discovery-failure fallback catalog for a Databricks provider.
36+
///
37+
/// This is the list of models advertised by `session/new` when
38+
/// `discover_databricks_models` returns an error (e.g., no token available).
39+
///
40+
/// - `DatabricksV2` falls back to [`DATABRICKS_V2_KNOWN_MODELS`] so the
41+
/// model-picker is always populated for AI Gateway v2 users.
42+
/// - Legacy `Databricks` falls back to only the configured model — the
43+
/// `DATABRICKS_V2_KNOWN_MODELS` IDs are AI Gateway v2 endpoints that the
44+
/// `/serving-endpoints/{model}/invocations` API may not serve.
45+
///
46+
/// Extracting this as a pure function makes the split testable without
47+
/// spawning an async runtime or making network calls.
48+
pub fn discovery_failure_fallback(provider: Provider, configured_model: &str) -> Vec<ModelEntry> {
49+
match provider {
50+
Provider::DatabricksV2 => DATABRICKS_V2_KNOWN_MODELS
51+
.iter()
52+
.map(|id| ModelEntry {
53+
id: id.to_string(),
54+
name: id.to_string(),
55+
})
56+
.collect(),
57+
Provider::Databricks => vec![ModelEntry {
58+
id: configured_model.to_string(),
59+
name: configured_model.to_string(),
60+
}],
61+
_ => vec![ModelEntry {
62+
id: configured_model.to_string(),
63+
name: configured_model.to_string(),
64+
}],
65+
}
66+
}
67+
3568
/// Discover available models for a Databricks provider.
3669
///
3770
/// Returns a non-empty `Vec<ModelEntry>` on success. Returns

‎crates/buzz-agent/src/config.rs‎

Lines changed: 1724 additions & 0 deletions
Large diffs are not rendered by default.

‎crates/buzz-agent/src/handoff.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ impl RunCtx<'_> {
3636
HANDOFF_SYSTEM_PROMPT,
3737
&prompt,
3838
HANDOFF_MAX_OUTPUT_TOKENS,
39+
self.effective_model,
3940
) => match r {
4041
Ok(s) if !s.trim().is_empty() => s,
4142
Ok(_) => {

0 commit comments

Comments
 (0)