Skip to content

Commit b0da539

Browse files
committed
AHP: opt into SDK managed-settings self-fetch
Pass selfFetchManagedSettings:true in session.create params so the runtime self-fetches enterprise bypass-permissions policy from the GitHub managed_settings endpoint at session bootstrap. The runtime enforces the result fail-closed before the first turn. Requires: github/copilot-agent-runtime#agents/managed-settings-sdk-capability
1 parent 6cde2e9 commit b0da539

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/vs/platform/agentHost/node/copilot/copilotSessionLauncher.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ type PostToolUseHookInput = Parameters<NonNullable<SessionHooks['onPostToolUse']
5959
type CopilotSessionLaunchConfig = ResumeSessionConfig & {
6060
readonly pluginDirectories?: string[];
6161
readonly remoteSession?: 'export';
62+
/**
63+
* Opt the runtime into self-fetching enterprise managed settings at session
64+
* bootstrap. Declared locally until the published `@github/copilot-sdk` carries
65+
* it on `SessionConfigBase`; it is forwarded to `createSession` and read by the
66+
* runtime at runtime regardless of the published SDK's static type.
67+
*/
68+
readonly selfFetchManagedSettings?: boolean;
6269
};
6370

6471
/**
@@ -409,6 +416,12 @@ export class CopilotSessionLauncher implements ICopilotSessionLauncher {
409416
// session must opt in via `remoteSession` to actually export
410417
// events. Without this, sessions default to "off".
411418
remoteSession: this._configurationService.getRootValue(platformRootSchema, AgentHostSessionSyncEnabledConfigKey) === true ? 'export' : undefined,
419+
// Opt the runtime into self-fetching enterprise managed settings
420+
// (bypass-permissions policy) at session bootstrap. The runtime uses
421+
// the session's gitHubToken to call /copilot_internal/managed_settings
422+
// and enforces the result fail-closed before the first turn.
423+
// Typed locally on CopilotSessionLaunchConfig pending the SDK type update.
424+
selfFetchManagedSettings: true,
412425
};
413426
}
414427
}

0 commit comments

Comments
 (0)