Honor environment-resolved workspace roots (#40912)

## What changed

- Add effective workspace roots to `EnvironmentConfig` and use them when
  materializing permission profiles and filesystem context.
- Preserve selection roots for thread-owned configurations while allowing a
  ready environment attachment to supply its resolved roots.
- Propagate resolved roots to child environments and validate both command and
  `apply_patch` writes in owner-provided secondary workspaces.

GitOrigin-RevId: 1832c168ce1fc37fa67efc2a472998ab4f448c70
This commit is contained in:
sayan-oai authored and copyberry committed 2026-08-26 16:28:35 +00:00
1 parent 5b92c2d2f5
commit 7625bd5665
29 files changed
+191 -67

No files matched your search

+6 -6
View File
@@ -455,10 +455,10 @@ impl AgentControl {
let owner_environment = parent_environments
.turn_environments()
.find(|environment| {
environment.selection.environment_id == *environment_id
&& environment.cwd() == &selection.cwd
&& environment.workspace_roots()
== selection.workspace_roots.as_slice()
let parent_selection = &environment.selection;
parent_selection.environment_id == selection.environment_id
&& parent_selection.cwd == selection.cwd
&& parent_selection.workspace_roots == selection.workspace_roots
})
.ok_or_else(|| {
invalid_environment("no longer matches a ready parent environment")
@@ -493,8 +493,8 @@ impl AgentControl {
let cwd = selection.cwd.to_abs_path().map_err(|_| {
invalid_environment("working directory is not a local absolute path")
})?;
let roots = selection
.workspace_roots
let roots = owner_environment
.workspace_roots()
.iter()
.map(PathUri::to_abs_path)
.collect::<Result<Vec<_>, _>>()