fix: retain child-local bash output scope
This commit is contained in:
@@ -491,19 +491,17 @@ impl Tool for SubWorkerSpawnTool {
|
|||||||
.await
|
.await
|
||||||
.map_err(|error| ToolError::ExecutionFailed(format!("build Internal Worker: {error}")))?;
|
.map_err(|error| ToolError::ExecutionFailed(format!("build Internal Worker: {error}")))?;
|
||||||
child.bind_workdir_session(Some(workdir_delegation.scoped_session.clone()));
|
child.bind_workdir_session(Some(workdir_delegation.scoped_session.clone()));
|
||||||
if !transports_delegation_context {
|
child
|
||||||
child
|
.add_scope_rules([ScopeRule {
|
||||||
.add_scope_rules([ScopeRule {
|
target: child_bash_output_dir.clone(),
|
||||||
target: child_bash_output_dir.clone(),
|
permission: manifest::Permission::Read,
|
||||||
permission: manifest::Permission::Read,
|
recursive: true,
|
||||||
recursive: true,
|
}])
|
||||||
}])
|
.map_err(|error| {
|
||||||
.map_err(|error| {
|
ToolError::ExecutionFailed(format!(
|
||||||
ToolError::ExecutionFailed(format!(
|
"grant Internal Worker Bash output scope: {error}"
|
||||||
"grant Internal Worker Bash output scope: {error}"
|
))
|
||||||
))
|
})?;
|
||||||
})?;
|
|
||||||
}
|
|
||||||
let child_scope = child.scope().clone();
|
let child_scope = child.scope().clone();
|
||||||
let child_registry = SpawnedWorkerRegistry::new_internal(input.name.clone(), child_scope);
|
let child_registry = SpawnedWorkerRegistry::new_internal(input.name.clone(), child_scope);
|
||||||
register_worker_tools(
|
register_worker_tools(
|
||||||
@@ -1489,12 +1487,6 @@ enabled = false
|
|||||||
);
|
);
|
||||||
let child_bash_output_dir = bash_output_dir.join("sub-workers").join("remote-child");
|
let child_bash_output_dir = bash_output_dir.join("sub-workers").join("remote-child");
|
||||||
assert!(child_bash_output_dir.is_dir());
|
assert!(child_bash_output_dir.is_dir());
|
||||||
assert!(
|
|
||||||
record
|
|
||||||
.scope_delegated
|
|
||||||
.iter()
|
|
||||||
.all(|rule| rule.target != child_bash_output_dir)
|
|
||||||
);
|
|
||||||
for required in ["Read", "Write", "Edit", "Glob", "Grep", "Bash"] {
|
for required in ["Read", "Write", "Edit", "Glob", "Grep", "Bash"] {
|
||||||
assert!(
|
assert!(
|
||||||
record.installed_tools.iter().any(|name| name == required),
|
record.installed_tools.iter().any(|name| name == required),
|
||||||
|
|||||||
Reference in New Issue
Block a user