You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SDK permissions: Workspace path is not detected correctly #329955
I correlated this with the recent VS Code-hosted Copilot session logs from the #329613 test pass and traced it into the shared runtime.
What the logs show
The AHP createSession request supplied the correct workspace (file:///Users/josh/git/vscode), and the persisted session cwd was /Users/josh/git/vscode. This is not a VS Code working-directory handoff failure.
The tools were classified correctly: apply_patch produced a write permission request with an absolute fileName, and view produced a read request. This is not an alternate-tool bypass.
Shell, Domain, and filesystem-root (Read(//tmp/test-file.txt)) rules worked in the same session.
Workspace-root path rules did not: Edit(/managed-allow/**) prompted instead of auto-approving, while Edit(/managed-deny/**) prompted and could be approved instead of being denied.
Root cause
The runtime's managed path matcher used PathManager.workspace_path() as the /... selector root. For local sessions, that value can be Copilot's internal session-state workspace (for example, ~/.copilot/session-state/<session-id>), not the user's project directory. As a result, /managed-deny/** was expanded under the internal session directory and did not match /Users/josh/git/vscode/managed-deny/...; because managed rules were active, the operation then fell through to the managed default-ask behavior.
This also explains why an explicit ask selector looked superficially correct: a matched ask and an unmatched operation both prompt under an active managed policy.
Fix and coverage
The runtime fix anchors managed /... Read/Edit selectors to the path manager's resolved primary project directory while leaving ./, ~/, //, and internal session-workspace access unchanged.
Regression coverage now deliberately uses different project and internal session-workspace directories and verifies both Read and Edit allow/deny behavior. The focused tests (2), broader managed-runtime tests (241), Rust formatting/Clippy, and repository format/lint all pass; three independent reviewers found no blocking issues.
The VS Code-hosted session was on @github/copilot 1.0.79-2, but the root-selection defect was also present on current runtime main, so updating only the bundled CLI version would not resolve it.
The workbench resolves the requested workspace folders and sends them as AHP workingDirectories file URIs.
Agent Host parses those strings back into URI objects. Copilot uses index 0 as the primary/process root.
Copilot sessions are provisional until the first send. For worktree isolation, Agent Host resolves/creates the worktree before materialization and replaces index 0 with that final worktree URI.
CopilotSessionLauncher passes plan.workingDirectory.fsPath to CopilotClient.createSession/resumeSession, forwards secondary roots as additionalDirectories, and sets enableManagedSettings: true.
@github/copilot-sdk forwards those values unchanged in session.create/session.resume.
The runtime stores that filesystem path as the session working directory and initializes the permission path manager's primary directory from it. Infinite-session workspacePath is a separate internal session-state directory.
Before every turn, VS Code synchronizes its approval level through session.rpc.permissions.setAllowAll. Managed deny/ask policy still takes precedence; VS Code also honors managedApprovalRequired and refuses to auto-approve/persist those prompts.
Resume follows the same path using the persisted/resolved working directory (including restored worktrees).
With the fix, /... managed selectors use the primary directory from step 6, so they line up with the absolute Read/Edit paths emitted by runtime tools. No VS Code-side path conversion change is needed.
Additional verification
I added an SDK-shaped runtime regression that creates:
a project working directory,
a different infinite-session state workspace,
managed Edit(/managed-deny/**) and Read(/managed-allow/**) rules,
VS Code-style Allow All mode.
It verifies the edit is still denied and the read is allowed. The expanded managed runtime slice is 242/242 passing. The relevant VS Code tests for resolved worktree → SDK working directory and managed confirmation under global/session Allow All pass; the local VS Code node suite completed with 13,557 passing.
Remaining gaps
Deployment blocker: the current VS Code checkout/Insiders reproduction bundles @github/copilot 1.0.79-2, which does not contain this runtime fix. The fix must merge, ship in a newer CLI package, and be consumed by VS Code before the manual scenario can pass in-product.
No single cross-repo E2E: runtime now covers the SDK-shaped permission state and VS Code separately covers working-directory forwarding plus managed prompt handling, but no test currently drives AHP createSession all the way through a real managed Read/Edit tool call. That would be the strongest release gate.
VS Code launch invariant is not directly asserted:enableManagedSettings: true is present in CopilotSessionLauncher, but I found no VS Code test that fails if this flag is removed.
Multi-root semantics need a decision: Copilot's hidden multi-root support grants secondary roots as additionalDirectories, while /... managed selectors currently anchor only to the immutable primary root. If /src/** is intended to apply independently to every workspace folder, that behavior and its deny semantics need specification and coverage before multi-root is enabled broadly.
Manual ask cases are ambiguous: an explicit managed ask and an unmatched operation both prompt because active managed policy defaults to ask. Manual verification should always include matching allow and deny cases, not ask alone.
Reopening for deployment and in-product verification. A fresh VS Code Agent Host session on August 26 was still running copilot-client-darwin-arm64/1.0.81-0, while the runtime fix in github/copilot-agent-runtime#15396 first shipped in CLI 1.0.81-1.
The managed policy contained Edit(/managed-deny/**) and the primary workspace was /Users/josh/git/tankgame. An apply_patch call attempted to create /Users/josh/git/tankgame/managed-deny/copilot-permission-probe.txt. Instead of being denied, Agent Host emitted an ordinary permission.requested; after Allow Once, the tool completed with Added 1 file(s).
Controls in the same session behaved correctly: a native read of /Users/josh/.ssh/config was denied by Read(~/.ssh/**), and a native read of /tmp/test-file.txt was denied by Read(//tmp/test-file.txt). This confirms that managed permissions were loaded and that the failure remained specific to the workspace-root selector path on the pre-fix runtime.
The pending dependency bump in #332803 moves Agent Host to @github/copilot 1.0.81-12, which should contain #15396. Keeping this issue open until that bump lands and the original Edit(/managed-deny/**) scenario is manually revalidated in VS Code.
Test-plan provenance: this regression was found while re-running the managed SDK permissions scenarios from TPI #329613. The failing case is the TPI's workspace-root Edit(/managed-deny/**) check with Allow All enabled: it must be denied without an approval option.
Tracking deployment through #332803 before repeating that TPI case on the updated bundled runtime.
This was still broken as of 1.136.2, but it's marked as being in a closed milestone and now nobody's assigned. Can we get some eyes on this? joshspicer
Activity
joshspicer commentedon Aug 10, 2026
AI Correlation
I correlated this with the recent VS Code-hosted Copilot session logs from the #329613 test pass and traced it into the shared runtime.
What the logs show
createSessionrequest supplied the correct workspace (file:///Users/josh/git/vscode), and the persisted session cwd was/Users/josh/git/vscode. This is not a VS Code working-directory handoff failure.apply_patchproduced awritepermission request with an absolutefileName, andviewproduced areadrequest. This is not an alternate-tool bypass.Read(//tmp/test-file.txt)) rules worked in the same session.Edit(/managed-allow/**)prompted instead of auto-approving, whileEdit(/managed-deny/**)prompted and could be approved instead of being denied.Root cause
The runtime's managed path matcher used
PathManager.workspace_path()as the/...selector root. For local sessions, that value can be Copilot's internal session-state workspace (for example,~/.copilot/session-state/<session-id>), not the user's project directory. As a result,/managed-deny/**was expanded under the internal session directory and did not match/Users/josh/git/vscode/managed-deny/...; because managed rules were active, the operation then fell through to the managed default-ask behavior.This also explains why an explicit
askselector looked superficially correct: a matched ask and an unmatched operation both prompt under an active managed policy.Fix and coverage
The runtime fix anchors managed
/...Read/Edit selectors to the path manager's resolved primary project directory while leaving./,~/,//, and internal session-workspace access unchanged.Regression coverage now deliberately uses different project and internal session-workspace directories and verifies both Read and Edit allow/deny behavior. The focused tests (2), broader managed-runtime tests (241), Rust formatting/Clippy, and repository format/lint all pass; three independent reviewers found no blocking issues.
The VS Code-hosted session was on
@github/copilot 1.0.79-2, but the root-selection defect was also present on current runtimemain, so updating only the bundled CLI version would not resolve it.joshspicer commentedon Aug 10, 2026
AI trace
VS Code → SDK → runtime path
workingDirectoriesfile URIs.URIobjects. Copilot uses index 0 as the primary/process root.CopilotSessionLauncherpassesplan.workingDirectory.fsPathtoCopilotClient.createSession/resumeSession, forwards secondary roots asadditionalDirectories, and setsenableManagedSettings: true.@github/copilot-sdkforwards those values unchanged insession.create/session.resume.workspacePathis a separate internal session-state directory.session.rpc.permissions.setAllowAll. Managed deny/ask policy still takes precedence; VS Code also honorsmanagedApprovalRequiredand refuses to auto-approve/persist those prompts.With the fix,
/...managed selectors use the primary directory from step 6, so they line up with the absolute Read/Edit paths emitted by runtime tools. No VS Code-side path conversion change is needed.Additional verification
I added an SDK-shaped runtime regression that creates:
Edit(/managed-deny/**)andRead(/managed-allow/**)rules,It verifies the edit is still denied and the read is allowed. The expanded managed runtime slice is 242/242 passing. The relevant VS Code tests for resolved worktree → SDK working directory and managed confirmation under global/session Allow All pass; the local VS Code node suite completed with 13,557 passing.
Remaining gaps
@github/copilot 1.0.79-2, which does not contain this runtime fix. The fix must merge, ship in a newer CLI package, and be consumed by VS Code before the manual scenario can pass in-product.createSessionall the way through a real managed Read/Edit tool call. That would be the strongest release gate.enableManagedSettings: trueis present inCopilotSessionLauncher, but I found no VS Code test that fails if this flag is removed.additionalDirectories, while/...managed selectors currently anchor only to the immutable primary root. If/src/**is intended to apply independently to every workspace folder, that behavior and its deny semantics need specification and coverage before multi-root is enabled broadly.joshspicer commentedon Aug 26, 2026
Reopening for deployment and in-product verification. A fresh VS Code Agent Host session on August 26 was still running
copilot-client-darwin-arm64/1.0.81-0, while the runtime fix in github/copilot-agent-runtime#15396 first shipped in CLI1.0.81-1.The managed policy contained
Edit(/managed-deny/**)and the primary workspace was/Users/josh/git/tankgame. Anapply_patchcall attempted to create/Users/josh/git/tankgame/managed-deny/copilot-permission-probe.txt. Instead of being denied, Agent Host emitted an ordinarypermission.requested; after Allow Once, the tool completed withAdded 1 file(s).Controls in the same session behaved correctly: a native read of
/Users/josh/.ssh/configwas denied byRead(~/.ssh/**), and a native read of/tmp/test-file.txtwas denied byRead(//tmp/test-file.txt). This confirms that managed permissions were loaded and that the failure remained specific to the workspace-root selector path on the pre-fix runtime.The pending dependency bump in #332803 moves Agent Host to
@github/copilot1.0.81-12, which should contain #15396. Keeping this issue open until that bump lands and the originalEdit(/managed-deny/**)scenario is manually revalidated in VS Code.joshspicer commentedon Aug 26, 2026
Test-plan provenance: this regression was found while re-running the managed SDK permissions scenarios from TPI #329613. The failing case is the TPI's workspace-root
Edit(/managed-deny/**)check with Allow All enabled: it must be denied without an approval option.Tracking deployment through #332803 before repeating that TPI case on the updated bundled runtime.
BatCountry commentedon Sep 10, 2026
This was still broken as of 1.136.2, but it's marked as being in a closed milestone and now nobody's assigned. Can we get some eyes on this? joshspicer