refactor: move disable_session_naming into AgentConfig (#7062)
Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
@@ -55,6 +55,7 @@ pub struct AcpServerConfig {
|
||||
pub data_dir: std::path::PathBuf,
|
||||
pub config_dir: std::path::PathBuf,
|
||||
pub goose_mode: goose::config::GooseMode,
|
||||
pub disable_session_naming: bool,
|
||||
}
|
||||
|
||||
fn mcp_server_to_extension_config(mcp_server: McpServer) -> Result<ExtensionConfig, String> {
|
||||
@@ -309,6 +310,7 @@ impl GooseAcpAgent {
|
||||
data_dir: Paths::data_dir(),
|
||||
config_dir: Paths::config_dir(),
|
||||
goose_mode,
|
||||
disable_session_naming: config.get_goose_disable_session_naming().unwrap_or(false),
|
||||
})
|
||||
.await
|
||||
}
|
||||
@@ -323,6 +325,7 @@ impl GooseAcpAgent {
|
||||
permission_manager,
|
||||
None,
|
||||
config.goose_mode,
|
||||
config.disable_session_naming,
|
||||
));
|
||||
|
||||
let agent_ptr = Arc::new(agent);
|
||||
|
||||
@@ -66,6 +66,9 @@ impl AcpServer {
|
||||
data_dir: self.config.data_dir.clone(),
|
||||
config_dir: self.config.config_dir.clone(),
|
||||
goose_mode,
|
||||
disable_session_naming: global_config
|
||||
.get_goose_disable_session_naming()
|
||||
.unwrap_or(false),
|
||||
};
|
||||
|
||||
let agent = GooseAcpAgent::with_config(acp_config).await?;
|
||||
|
||||
+2
-11
@@ -119,8 +119,7 @@ impl ExpectedSessionId {
|
||||
}
|
||||
}
|
||||
|
||||
/// Calling this ensures incidental requests that might error asynchronously, such as
|
||||
/// session rename have coherent session IDs.
|
||||
/// Calling this ensures requests have coherent session IDs.
|
||||
pub fn assert_matches(&self, actual: &str) {
|
||||
let result = self.validate(Some(actual));
|
||||
assert!(result.is_ok(), "{}", result.unwrap_err());
|
||||
@@ -165,15 +164,6 @@ impl OpenAiFixture {
|
||||
.set_body_json(serde_json::json!({"error": {"message": e}}));
|
||||
}
|
||||
|
||||
// Session rename (async, unpredictable order) - canned response
|
||||
if body.contains("Reply with only a description in four words or less") {
|
||||
return ResponseTemplate::new(200)
|
||||
.insert_header("content-type", "application/json")
|
||||
.set_body_string(include_str!(
|
||||
"../test_data/openai_session_description.json"
|
||||
));
|
||||
}
|
||||
|
||||
// See if the actual request matches the expected pattern
|
||||
let mut q = queue.lock().unwrap();
|
||||
let (expected_body, response) = q.front().cloned().unwrap_or_default();
|
||||
@@ -396,6 +386,7 @@ pub async fn spawn_acp_server_in_process(
|
||||
data_dir: data_root.to_path_buf(),
|
||||
config_dir: data_root.to_path_buf(),
|
||||
goose_mode,
|
||||
disable_session_naming: true,
|
||||
};
|
||||
|
||||
let (client_read, server_write) = tokio::io::duplex(64 * 1024);
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
{"id":"chatcmpl-test","object":"chat.completion","created":1766229622,"model":"gpt-5-nano","choices":[{"index":0,"message":{"role":"assistant","content":"Test session"},"finish_reason":"stop"}],"usage":{"prompt_tokens":79,"completion_tokens":10,"total_tokens":89}}
|
||||
Reference in New Issue
Block a user