feat: expose AGENT_SESSION_ID env var to extension child processes (#7072)
This commit is contained in:
@@ -783,7 +783,12 @@ impl Agent {
|
||||
_ => {
|
||||
let container = self.container.lock().await;
|
||||
self.extension_manager
|
||||
.add_extension(extension.clone(), working_dir, container.as_ref())
|
||||
.add_extension(
|
||||
extension.clone(),
|
||||
working_dir,
|
||||
container.as_ref(),
|
||||
Some(session_id),
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -482,6 +482,7 @@ impl ExtensionManager {
|
||||
config: ExtensionConfig,
|
||||
working_dir: Option<PathBuf>,
|
||||
container: Option<&Container>,
|
||||
session_id: Option<&str>,
|
||||
) -> ExtensionResult<()> {
|
||||
let config_name = config.key().to_string();
|
||||
let sanitized_name = name_to_key(&config_name);
|
||||
@@ -530,7 +531,11 @@ impl ExtensionManager {
|
||||
timeout,
|
||||
..
|
||||
} => {
|
||||
let all_envs = merge_environments(envs, env_keys, &sanitized_name).await?;
|
||||
let mut all_envs = merge_environments(envs, env_keys, &sanitized_name).await?;
|
||||
|
||||
if let Some(sid) = session_id {
|
||||
all_envs.insert("AGENT_SESSION_ID".to_string(), sid.to_string());
|
||||
}
|
||||
|
||||
// Check for malicious packages before launching the process
|
||||
extension_malware_check::deny_if_malicious_cmd_args(cmd, args).await?;
|
||||
|
||||
@@ -211,7 +211,7 @@ impl ExtensionManagerClient {
|
||||
};
|
||||
|
||||
extension_manager
|
||||
.add_extension(config, None, None)
|
||||
.add_extension(config, None, None, None)
|
||||
.await
|
||||
.map(|_| {
|
||||
vec![Content::text(format!(
|
||||
|
||||
@@ -256,7 +256,7 @@ async fn test_replayed_session(
|
||||
#[allow(clippy::redundant_closure_call)]
|
||||
let result = (async || -> Result<(), Box<dyn std::error::Error>> {
|
||||
extension_manager
|
||||
.add_extension(extension_config, None, None)
|
||||
.add_extension(extension_config, None, None, None)
|
||||
.await?;
|
||||
let mut results = Vec::new();
|
||||
for tool_call in tool_calls {
|
||||
|
||||
Reference in New Issue
Block a user