Skip to content

Commit 0388b9d

Browse files
github-actions[bot]MackinnonBuckCopilot
authored
Update @github/copilot to 1.0.17 (#999)
* Update @github/copilot to 1.0.17 - Updated nodejs and test harness dependencies - Re-ran code generators - Formatted generated code * Skip permission RPC response when resolvedByHook is true When the runtime resolves a permission request via a permissionRequest hook, it sets resolvedByHook=true on the broadcast event. The SDK broadcast handlers were unconditionally invoking the permission handler and sending an RPC response, causing duplicate/invalid responses. Add a guard in all four SDKs (Node, Python, Go, .NET) to skip the permission handler and RPC response when resolvedByHook is set, while still allowing event subscribers to observe the event. Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Mackinnon Buck <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 7ecf1d8 commit 0388b9d

File tree

16 files changed

+142
-73
lines changed

16 files changed

+142
-73
lines changed

dotnet/src/Generated/SessionEvents.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1180,7 +1180,7 @@ public partial class SessionRemoteSteerableChangedData
11801180
/// <summary>Error details for timeline display including message and optional diagnostic information.</summary>
11811181
public partial class SessionErrorData
11821182
{
1183-
/// <summary>Category of error (e.g., "authentication", "authorization", "quota", "rate_limit", "query").</summary>
1183+
/// <summary>Category of error (e.g., "authentication", "authorization", "quota", "rate_limit", "context_limit", "query").</summary>
11841184
[JsonPropertyName("errorType")]
11851185
public required string ErrorType { get; set; }
11861186

@@ -2267,6 +2267,11 @@ public partial class PermissionRequestedData
22672267
/// <summary>Details of the permission being requested.</summary>
22682268
[JsonPropertyName("permissionRequest")]
22692269
public required PermissionRequest PermissionRequest { get; set; }
2270+
2271+
/// <summary>When true, this permission was already resolved by a permissionRequest hook and requires no client action.</summary>
2272+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
2273+
[JsonPropertyName("resolvedByHook")]
2274+
public bool? ResolvedByHook { get; set; }
22702275
}
22712276

22722277
/// <summary>Permission request completion notification signaling UI dismissal.</summary>
@@ -2998,6 +3003,11 @@ public partial class AssistantMessageDataToolRequestsItem
29983003
[JsonPropertyName("toolTitle")]
29993004
public string? ToolTitle { get; set; }
30003005

3006+
/// <summary>Name of the MCP server hosting this tool, when the tool is an MCP tool.</summary>
3007+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
3008+
[JsonPropertyName("mcpServerName")]
3009+
public string? McpServerName { get; set; }
3010+
30013011
/// <summary>Resolved intention summary describing what this specific call does.</summary>
30023012
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
30033013
[JsonPropertyName("intentionSummary")]
@@ -3989,6 +3999,9 @@ public enum PermissionCompletedDataResultKind
39893999
/// <summary>The <c>denied-by-content-exclusion-policy</c> variant.</summary>
39904000
[JsonStringEnumMemberName("denied-by-content-exclusion-policy")]
39914001
DeniedByContentExclusionPolicy,
4002+
/// <summary>The <c>denied-by-permission-request-hook</c> variant.</summary>
4003+
[JsonStringEnumMemberName("denied-by-permission-request-hook")]
4004+
DeniedByPermissionRequestHook,
39924005
}
39934006

39944007
/// <summary>Elicitation mode; "form" for structured input, "url" for browser-based. Defaults to "form" when absent.</summary>

dotnet/src/Session.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,9 @@ private async Task HandleBroadcastEventAsync(SessionEvent sessionEvent)
456456
if (string.IsNullOrEmpty(data.RequestId) || data.PermissionRequest is null)
457457
return;
458458

459+
if (data.ResolvedByHook == true)
460+
return; // Already resolved by a permissionRequest hook; no client action needed.
461+
459462
var handler = _permissionHandler;
460463
if (handler is null)
461464
return; // This client doesn't handle permissions; another client will.

go/generated_session_events.go

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/rpc/generated_rpc.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -652,11 +652,12 @@ type SessionPermissionsHandlePendingPermissionRequestParams struct {
652652
}
653653

654654
type SessionPermissionsHandlePendingPermissionRequestParamsResult struct {
655-
Kind Kind `json:"kind"`
656-
Rules []any `json:"rules,omitempty"`
657-
Feedback *string `json:"feedback,omitempty"`
658-
Message *string `json:"message,omitempty"`
659-
Path *string `json:"path,omitempty"`
655+
Kind Kind `json:"kind"`
656+
Rules []any `json:"rules,omitempty"`
657+
Feedback *string `json:"feedback,omitempty"`
658+
Message *string `json:"message,omitempty"`
659+
Path *string `json:"path,omitempty"`
660+
Interrupt *bool `json:"interrupt,omitempty"`
660661
}
661662

662663
type SessionLogResult struct {
@@ -815,6 +816,7 @@ type Kind string
815816
const (
816817
KindApproved Kind = "approved"
817818
KindDeniedByContentExclusionPolicy Kind = "denied-by-content-exclusion-policy"
819+
KindDeniedByPermissionRequestHook Kind = "denied-by-permission-request-hook"
818820
KindDeniedByRules Kind = "denied-by-rules"
819821
KindDeniedInteractivelyByUser Kind = "denied-interactively-by-user"
820822
KindDeniedNoApprovalRuleAndCouldNotRequestFromUser Kind = "denied-no-approval-rule-and-could-not-request-from-user"

go/session.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,9 @@ func (s *Session) handleBroadcastEvent(event SessionEvent) {
915915
if requestID == nil || event.Data.PermissionRequest == nil {
916916
return
917917
}
918+
if event.Data.ResolvedByHook != nil && *event.Data.ResolvedByHook {
919+
return // Already resolved by a permissionRequest hook; no client action needed.
920+
}
918921
handler := s.getPermissionHandler()
919922
if handler == nil {
920923
return

nodejs/package-lock.json

Lines changed: 28 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nodejs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"author": "GitHub",
5757
"license": "MIT",
5858
"dependencies": {
59-
"@github/copilot": "^1.0.15-2",
59+
"@github/copilot": "^1.0.17",
6060
"vscode-jsonrpc": "^8.2.1",
6161
"zod": "^4.3.6"
6262
},

nodejs/samples/package-lock.json

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nodejs/src/generated/rpc.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,11 @@ export interface SessionPermissionsHandlePendingPermissionRequestParams {
11851185
kind: "denied-by-content-exclusion-policy";
11861186
path: string;
11871187
message: string;
1188+
}
1189+
| {
1190+
kind: "denied-by-permission-request-hook";
1191+
message?: string;
1192+
interrupt?: boolean;
11881193
};
11891194
}
11901195

nodejs/src/generated/session-events.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ export type SessionEvent =
229229
*/
230230
data: {
231231
/**
232-
* Category of error (e.g., "authentication", "authorization", "quota", "rate_limit", "query")
232+
* Category of error (e.g., "authentication", "authorization", "quota", "rate_limit", "context_limit", "query")
233233
*/
234234
errorType: string;
235235
/**
@@ -1480,6 +1480,10 @@ export type SessionEvent =
14801480
* Human-readable display title for the tool
14811481
*/
14821482
toolTitle?: string;
1483+
/**
1484+
* Name of the MCP server hosting this tool, when the tool is an MCP tool
1485+
*/
1486+
mcpServerName?: string;
14831487
/**
14841488
* Resolved intention summary describing what this specific call does
14851489
*/
@@ -2872,6 +2876,10 @@ export type SessionEvent =
28722876
*/
28732877
hookMessage?: string;
28742878
};
2879+
/**
2880+
* When true, this permission was already resolved by a permissionRequest hook and requires no client action
2881+
*/
2882+
resolvedByHook?: boolean;
28752883
};
28762884
}
28772885
| {
@@ -2909,7 +2917,8 @@ export type SessionEvent =
29092917
| "denied-by-rules"
29102918
| "denied-no-approval-rule-and-could-not-request-from-user"
29112919
| "denied-interactively-by-user"
2912-
| "denied-by-content-exclusion-policy";
2920+
| "denied-by-content-exclusion-policy"
2921+
| "denied-by-permission-request-hook";
29132922
};
29142923
};
29152924
}

0 commit comments

Comments
 (0)