refactor: derive GooseMode string conversions with strum (#7706)

Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
Adrian Cole
2026-03-09 10:01:54 +08:00
committed by GitHub
parent 55d2f4dac0
commit 90d34853de
9 changed files with 32 additions and 30 deletions
+1 -7
View File
@@ -424,14 +424,8 @@ impl ProviderTester {
message: &str,
label: &str,
) -> Result<()> {
let mode_str = match mode {
GooseMode::Approve => "approve",
GooseMode::SmartApprove => "smart_approve",
GooseMode::Auto => "auto",
GooseMode::Chat => "chat",
};
// Guard must live through agent.reply() — providers read GOOSE_MODE at spawn time.
let _guard = env_lock::lock_env([("GOOSE_MODE", Some(mode_str))]);
let _guard = env_lock::lock_env([("GOOSE_MODE", Some(<&str>::from(mode)))]);
let provider = if self.is_cli_provider {
create_with_named_model(
&self.name.to_lowercase(),