Skip to content

Carry the bound workspace root on LocalEnvironment instead of the wire - #303

Merged
SaladDay merged 2 commits into
mainfrom
refactor/local-environment-workspace-root
Sep 30, 2026
Merged

SaladDay merged 2 commits into
mainfrom
refactor/local-environment-workspace-root

Conversation

@SaladDay

@SaladDay SaladDay commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

The Runtime–Harness protocol no longer passes a working directory on the wire. PromptRequestPayload.WorkDir is deleted. The Runtime already checks local_environment.workspace_directory against its workspace binding, and it now gives the Harness the bound directory itself through LocalEnvironment.WorkspaceRoot (json:"-", so wire input cannot supply it).

  • localworkspace.Binding.Configure sets WorkspaceRoot. Binding.Prepare rejects a request whose root differs from the binding and installs nothing.
  • The codex, mcode and claudesdk adapters run the native Harness in WorkspaceRoot.
  • docs/runtime-protocol.md and contracts/agents-api/harness-onboarding.md describe the check and where the Harness gets its directory.

Checks

  • go build ./... passes, and go vet passes on the daemon, agentdaemon/proto and execution.
  • go test ./apps/daemon/... ./internal/agentdaemon/proto/... passes: localworkspace, codex, mcode, claudesdk, dispatch and wireconformance.
  • New test TestBindingPrepareRejectsOtherWorkspaceRoot. It fails when the root check is removed.
  • Markdown link check passes.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@SaladDay
SaladDay merged commit 5022a44 into main Sep 30, 2026
6 checks passed
@SaladDay
SaladDay deleted the refactor/local-environment-workspace-root branch September 30, 2026 15:47
The prompt request's work_dir field only carried the local binding's root from
localworkspace.Binding.Configure to the Harness adapters; Core never set it and
the binding rejected it on the wire. Move the root to LocalEnvironment as a
daemon-supplied json:"-" field and delete the wire field with the guards that
existed only to reject it: the Binding.Configure check, the read-only
preparation term and the Core test assertions.

Codex, MiniMax Code and Claude read LocalEnvironment.WorkspaceRoot for
Environment execution. The adapters no longer expand ~/, reject relative paths
or create directories for a wire path; the binding validates its root at
construction. environment:none requests keep the working directory they had,
since Core never sent work_dir.

Adapter tests that set a work directory on an environment:none request moved
to real LocalEnvironment requests where the cwd mattered, and the Runtime
protocol and Harness onboarding docs describe where the root comes from.
A self_hosted request still carries local_environment.workspace_directory and
capability source directories, so the docs say the request carries no working
directory: the Runtime checks workspace_directory against its binding.
Harness onboarding owns how the Harness receives the bound root. The
SessionPlan.Cwd comment covers environment:none, and a test checks that
Binding.Prepare rejects a mismatched WorkspaceRoot.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant