Repository navigation
feat(remote-session): POSIX path rules for remote workspaces on Windows - #23498
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The PR removes the Windows refusal itself and fixes the reason that refusal gave ("a filesystem deny could not bind the workspace tools' POSIX targets"). The two leftovers are re-exports with no callers. Notes
What this change shipsInventory (10 items) — 8 justifiedIntent: let an operator on a Windows gateway attach a dev-preview remote workspace while file deny/allow rules still apply to the guest's paths. This is an ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 259a32e Description read[DESCRIPTION-READ] e532dc0e39bdcfad04f4cb1ba063624de35f647eda1d936fad0c581f2603f9e1 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The guest-path tag is set only by the runtime's own workspace binding, unplaced calls get both readings, and the change is behind dev mode and reverts cleanly. Notes
[DESIGN-REVIEWED] 259a32e Description read[DESCRIPTION-READ] 5fd030b52832e1d4a613445ee0c913c882b993fde39b231f776e2c1e9a7558ed That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
…teway Governance file rules now match a remote workspace tool's targets as the Linux guest's POSIX paths, chosen per call. build_permission_event tags the call's arguments with a GuestPathParams type only on a runtime whose own remote-workspace binding attached the workspace server, for a trusted identity; a stray tag on a local call is stripped. Tagged targets are normalized with posixpath (anchored at the guest workdir, .. and leading // collapsed, no ~/$VAR expansion); $/~/backslash spellings also refuse under allow-mode. Unplaced remote calls must pass both readings. Local calls keep the gateway's os.path reading unchanged. This lets a Windows gateway attach a remote workspace, so the blanket REMOTE_NEEDS_POSIX_GATEWAY refusal is retired.
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. False positive or not applicable? A repository writer can comment: |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
1efdaa3 to
259a32e
Compare
bolichen97
left a comment
There was a problem hiding this comment.
Reviewed current head 259a32ecd8dfb4541042e2c566040c20608a05b6 as Tier 2. Deep review found no blocking issue.
Security check: trusted remote workspaces use typed POSIX guest paths. Unknown origins must pass both guest and gateway rules. Unverifiable allow paths fail closed. Auto-merge remains subject to branch protection.
Problem / Motivation
Goal: Remote session workspaces can run on a Windows gateway, with governance file rules still binding the workspace's files.
Today a Windows gateway refuses every remote workspace (
REMOTE_NEEDS_POSIX_GATEWAY, from #19833). The refusal exists because governance'spathmatcher normalizes every queried path with the gateway's ownos.path. On Windows that turns a Linux guest's/workspace/app/xintoC:\workspace\app\x, so a deny written for/workspace/app/**would never match a workspace tool's target. A Windows user cannot use Session Environments at all.Why it matters
Windows is a supported gateway OS. Without this, the remote-workspace preview is unavailable to every Windows operator. Lifting the refusal without fixing the matching would be a silent governance bypass, because file denies would stop binding remote targets.
Not a goal
~and$VARin an operator's patterns still mean the gateway's values.run_command'scwd, or the contents a directory-scopedlist_directory,globorgrepreturns. Both match localexecute_bashand the local tools today.KIROCREW_DEV_MODEdeveloper preview.What changed (motivation → approach → change)
Root cause → approach: the matcher needs to know, per call, that a target names a guest file. That fact must come from the gateway's own state, never from anything the model or guest sends.
build_permission_event(acp/_dispatch_parts/permission_requests.py) tags a call's arguments with aGuestPathParamsPython type carrying the guest workdir (platform/guest_paths.py). It does so only in the branch reached when the runtime's own remote-workspace binding (set_remote_workspace, passed in bysession_handle_permissions.py) attached the workspace server, and only for a trusted identity naming a known workspace tool.GuestPathParamsthat reaches the builder another way is stripped back to a plaindict.workspacetool it does not know) is taggedalso_local. It must pass every rule under both the guest and gateway readings.classify_tool_args(governance_parts/tool_calls.py) emits each target of a tagged call as aGuestPath._match_pathnormalizes aGuestPathwithposixpath(guest_norm). A relative path is anchored at the guest workdir, never the gateway's CWD...and a leading//collapse. Nothing is case-folded, and~/$VARare never expanded with the gateway's values. The guest tool server expands neither, and a test pins that.$, a~segment or a backslash is still checked against denies as the literal path the guest opens. It also adds a never-permittable item, so an allow-mode confinement refuses it.GuestPathcompares and hashes apart from a plainstr, sogate_decision's dedupe can never keep a plain twin in its place.gate_decisionreads aReading <path>title on a tagged call as the guest's path.edit_target_candidatesanchors a remote diff-block path withposixpath.isabs. On Python 3.13, Windows'ntpath.isabs("/x")is False, which would otherwise refuse those edits.check_remote_workspace_supportedno longer refuses on Windows, andREMOTE_NEEDS_POSIX_GATEWAYandgateway_matches_posix_pathsare removed.governance.mdgains a "Path matcher — remote-workspace targets" section, andproviders.mdis updated.Alternative considered: carrying a
posix_pathsflag onAcpEvent→ToolCall→gate_tiers→_governance_denial→gate_decision. That threads the same fact explicitly, but it edits three Sensitive Change Review-watched files (hook_runtime/*). The type travels the same path by reference with no watched edit. A spy test, the product-path tests, and a fresh-context reviewer's trace of every gate site confirm nothing copies it in between.No SCR-watched file is touched (checked against
SENSITIVE_GLOBS). No dependency is added. This is not a product-shape change: no default or capability changes, and a refusal of an unsupported OS is lifted only once the feature works there.Worst case if wrong: if the tag were lost between the builder and the matcher, a remote call on Windows would get the gateway reading, and a guest-path deny would miss for it (fail-open). If the tag were forged on a local call, a
C:\...deny could miss. Tests cover both. How to undo: revert this PR, which restores the Windows refusal and the gateway-only reading.Backwards compatibility
Compatible: local matching is unchanged on every OS. On a POSIX gateway, a remote call's absolute targets match exactly as before (parity test). The only differences are stricter: no gateway-env expansion inside guest targets, relative nested paths anchored at the guest, and allow-mode refusal of
$,~and backslash spellings. A remote attach that was refused now succeeds.Reader: src/kiro_crew/acp/runtime_remote_workspace.py:check_remote_workspace_supported -- chat -- the only production reader of
REMOTE_NEEDS_POSIX_GATEWAY/gateway_matches_posix_paths; both reads are removed with them hereReader: test/test_remote_session_launch.py:test_remote_workspace_needs_a_gateway_whose_path_rules_match_posix -- release -- test of the removed refusal, deleted; replaced by test_a_remote_workspace_attaches_on_any_gateway_os
Reader: test/test_remote_session_local_only_tools.py:posix_gateway -- release -- skip marker naming the removed refusal, deleted; its tests now run on Windows with guest paths
Tests
test/test_remote_workspace_guest_paths.pyruns on every OS, including the Windows shards. It goes through the real product path (KAS permission frame →build_permission_event→ToolCall.from_event→HookManager.on_tool_call). Each test runs under this OS's reading and under a Windows reading simulated through the governance facade:/workspace/app/**bind..escapes,//and///prefixes, mixed separators and case variants for every workspace file tool; paths the guest opens elsewhere stay unbound;..escapes;~,$HOME,${HOME}and$VARfail closed under allow, and are never expanded with the gateway's values;C:\...deny;C:\or UNC spelling;Readingtitles are read as the guest's path;gate_decisionintact (spy).test_remote_session_local_only_tools.pydrops itsposix_gatewayskips and uses guest paths, so those tests run on Windows too.Proof: each new guard was mutation-checked by removing it and re-running the tests:
Locally on the head: Backend Lint 15/15, Fast Gate 29/29, and 10,765 scoped tests passed (governance, hooks, tool_paths, remote session, dispatch, facades). The one failure,
test_this_repo_s_real_primary_branch_is_allowlisted, reads this checkout'sorigin/HEADand is a host artifact.Manual verification
N/A — unit coverage is sufficient. The product-path tests drive the real permission builder and gate under both path flavours. A live Windows gateway with a Coder workspace was not run, and the Windows CI shards cover the Windows reading. A fresh-context GPT security review traced every gate site. It found no blocker, and its four minor findings are fixed in this PR.
Related Issues
Follows #19833. Git lending on Windows is #21256.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.