fix(approvals): seal approved bash/python and file writes in the agent workspace when no workspace is set (#6705)

#6683 made an exact approval seal a launch boundary (and a filesystem root)
in the request's workspace, but only when a workspace is bound. Agent mode
with no folder picked is the default, and there the approval still sealed
nothing, so "Allow" always ended in "Approved action has no sealed
process/job identity" (bash/python) or "Approved filesystem action has no
sealed resource identity" (write_file). In Docker every agent turn carries
the backend runtime context, so bash and write_file always ask for approval
and never ran.

With no workspace, seal the root in the agent workspace, which is where
agent_cwd() already runs bash/python in that case. Inherited (child)
authorities still cannot widen.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Grzegorz
2026-10-23 13:19:04 -06:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 98a16242c6
commit f8e043e8ca
3 changed files with 82 additions and 4 deletions
+6
View File
@@ -1221,6 +1221,12 @@ def agent_cwd() -> str:
if vetted is None:
raise RuntimeError("active workspace is not a safe real directory")
return vetted
return default_agent_workspace()
def default_agent_workspace() -> str:
"""The agent workspace under the data dir, where subprocesses run when no
workspace is bound."""
resolved = os.path.realpath(_AGENT_WORKDIR)
if resolved not in _agent_readable_data_subdirs() or vet_workspace(resolved) != resolved:
raise RuntimeError("agent workspace is not a safe real directory")