mirror of
https://ghproxy.cflmy.top/https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-11-29 00:30:04 +08:00
A Session that works in a linked worktree could not run `git add` or `git commit` under workspace-write: the worktree's index and the repository's objects live in the repository's Git directory, outside the Session's workspace root, and the sandbox policy reads no Git layout. The new plugin `@deepseek-ai/dsh-sandbox-policy-git` registers that directory through `ctx.sandboxPolicy.registerWritableRoot`. The worktree service depends on it and mounts it; no bundle patch and no forge file changes. - The layout is read at Agent creation and after `next()` in the `working-directory/access` waterfall, which every Host move and the validation before each model request pass through. Each read replaces the Session's registration; Agent disposal and plugin unload remove it. - A directory qualifies only when the Git directory names it as a worktree: the `.git` file points at `<common>/worktrees/<name>`, whose `commondir` resolves to `<common>` and whose `gitdir` resolves back to that `.git` file, and `<common>` neither contains the directory nor lies inside it. - The grant is the whole Git directory. The plugin registers nothing on Windows, where process confinement ignores additional writable directories; its suites are excluded there. - A read failure grants nothing, warns once per Session and directory, and never fails the directory operation. The worktree sandbox tests that pinned the denial now pin the commit and the creation from a linked checkout without a manual registration. Two worktree tests that hooked the next `fs.lstat` call hook the service's own path check. The recorded scenario `session/worktree-commit` pins the policy context the model sees while it works in the worktree and after it leaves.