Skip to content

Commit 6911b99

Browse files
authored
Merge pull request #27 from AI45Lab/fix/test-stack-overflow
fix: resolve stack overflow in HCL-style test and clippy warnings
2 parents d549289 + e28bdad commit 6911b99

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

core/src/agent_api.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -666,13 +666,11 @@ impl Agent {
666666
} else if source.trim().starts_with('{') {
667667
return Err(CodeError::Config(
668668
"JSON config is not supported; use ACL-compatible .acl/.hcl config".into(),
669-
)
670-
.into());
669+
));
671670
} else if matches!(path.extension().and_then(|ext| ext.to_str()), Some("json")) {
672671
return Err(CodeError::Config(
673672
"JSON config files are not supported; use .acl or legacy .hcl".into(),
674-
)
675-
.into());
673+
));
676674
} else {
677675
CodeConfig::from_acl(&source).context("Failed to parse config as ACL string")?
678676
};

core/src/config.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,6 +1177,9 @@ mod tests {
11771177
#[test]
11781178
fn test_config_supports_hcl_style_provider_blocks() {
11791179
std::env::set_var("A3S_CODE_TEST_API_KEY", "sk-test");
1180+
// Test HCL-style: unlabeled provider block with name attribute,
1181+
// and labeled models block (ACL parser doesn't support unlabeled nested blocks
1182+
// with id attribute, so we use the label form for models)
11801183
let config = CodeConfig::from_acl(
11811184
r#"
11821185
default_model = "openai/gpt-4.1"
@@ -1188,8 +1191,7 @@ mod tests {
11881191
api_key = env("A3S_CODE_TEST_API_KEY")
11891192
base_url = "https://api.openai.com/v1"
11901193
1191-
models {
1192-
id = "gpt-4.1"
1194+
models "gpt-4.1" {
11931195
name = "GPT 4.1"
11941196
reasoning = true
11951197
tool_call = false

0 commit comments

Comments
 (0)