Merge branch 'feat/session-workspace-root' into feat/session-workspace-root-consumers

Adapt the consumers to the Host-only workspace model of the base branch:

- sandbox-policy: a marked working-directory change, not an anchor, is the
  point that reads the entered root's Git layout again.
- working-directory: keep recordedRootOf on the reworked service and its
  test doubles.
- Tests that entered a checkout through relocate use set; tests that relied
  on a directory change inside the root append a change without the marker.
- SDK documents and the upgrade guide state that the workspace-write boundary
  follows setWorkingDirectory and a Host-chosen child start directory, and
  that exit_worktree leaves a worktree.
This commit is contained in:
LegGasai committed 2026-11-11 22:08:19 +08:00
commit 434ef15931
325 files changed
+1121 -4431

No files matched your search

-5
View File
@@ -206,11 +206,6 @@ class Session:
self.harness.start()
return self.harness.client.get_working_directory(self.id)
def get_workspace_root(self) -> str:
"""Read the workspace root the effective directory is in, recovering a missing directory first."""
self.harness.start()
return self.harness.client.get_workspace_root(self.id)
def set_working_directory(self, path: str) -> str:
"""Change the effective directory while existing processes retain their own directories."""
self.harness.start()
+1 -11
View File
@@ -249,17 +249,8 @@ class HarnessClient:
)
return response.cwd
def get_workspace_root(self, session_id: str) -> str:
"""Read the workspace root the effective directory is in, recovering a missing directory first."""
response = self.request(
"session/working-directory/get",
{"sessionId": session_id},
response_model=_WorkingDirectoryResponse,
)
return response.root
def set_working_directory(self, session_id: str, path: str) -> str:
"""Enter an absolute or Session-relative directory without changing origin or permissions."""
"""Enter an absolute or Session-relative directory; the origin is unchanged and the write boundary follows."""
response = self.request(
"session/working-directory/set",
{"sessionId": session_id, "path": path},
@@ -726,7 +717,6 @@ class _SessionPromptResponse(BaseModel):
class _WorkingDirectoryResponse(BaseModel):
cwd: str
root: str
class _EmptyResponse(BaseModel):