Skip to content

Commit 012f981

Browse files
examonCopilot
andcommitted
Regenerate clearContext bindings for the tightened runtime contract
Mirrors github/copilot-agent-runtime#14002 after review: - `HistoryClearContextRequest.prompt` is now required. A cleared window holding only system and developer messages is not a conversation a model can answer, so every clear seeds the window it creates. - `HistoryClearContextResult` loses the `cleared` discriminator. The RPC now rejects the cases it was meant to describe - a remote session, or a call made while no tool call is in flight - so there is one error channel instead of a success flag plus an error channel. - `ContextClearedData.prependMessages` is gone. It had no producer, and it was a permanent commitment on a durable event for a code path nothing exercised. Regenerated with `scripts/codegen`; only the clear-context hunks are taken, so unrelated schema drift stays out of this PR. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 1ca9787 commit 012f981

4 files changed

Lines changed: 2 additions & 101 deletions

File tree

dotnet/src/Generated/SessionEvents.cs

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

java/src/generated/java/com/github/copilot/generated/SessionEvent.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,7 @@
139139
@JsonSubTypes.Type(value = SessionCanvasRecordedEvent.class, name = "session.canvas.recorded"),
140140
@JsonSubTypes.Type(value = SessionCanvasRemovedEvent.class, name = "session.canvas.removed"),
141141
@JsonSubTypes.Type(value = SessionExtensionsAttachmentsPushedEvent.class, name = "session.extensions.attachments_pushed"),
142-
@JsonSubTypes.Type(value = McpAppToolCallCompleteEvent.class, name = "mcp_app.tool_call_complete"),
143-
@JsonSubTypes.Type(value = SessionContextClearedEvent.class, name = "session.context_cleared")
142+
@JsonSubTypes.Type(value = McpAppToolCallCompleteEvent.class, name = "mcp_app.tool_call_complete")
144143
})
145144
@javax.annotation.processing.Generated("copilot-sdk-codegen")
146145
public abstract sealed class SessionEvent permits
@@ -259,7 +258,6 @@ public abstract sealed class SessionEvent permits
259258
SessionCanvasRemovedEvent,
260259
SessionExtensionsAttachmentsPushedEvent,
261260
McpAppToolCallCompleteEvent,
262-
SessionContextClearedEvent,
263261
UnknownSessionEvent {
264262

265263
/** Unique event identifier (UUID v4), generated when the event is emitted. */

nodejs/src/generated/session-events.ts

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

rust/src/generated/session_events.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,6 @@ pub enum SessionEventType {
318318
SessionExtensionsAttachmentsPushed,
319319
#[serde(rename = "mcp_app.tool_call_complete")]
320320
McpAppToolCallComplete,
321-
#[serde(rename = "session.context_cleared")]
322-
SessionContextCleared,
323321
/// Unknown event type for forward compatibility.
324322
#[default]
325323
#[serde(other)]
@@ -632,8 +630,6 @@ pub enum SessionEventData {
632630
SessionExtensionsAttachmentsPushed(SessionExtensionsAttachmentsPushedData),
633631
#[serde(rename = "mcp_app.tool_call_complete")]
634632
McpAppToolCallComplete(McpAppToolCallCompleteData),
635-
#[serde(rename = "session.context_cleared")]
636-
SessionContextCleared(SessionContextClearedData),
637633
}
638634

639635
/// A session event with typed data payload.
@@ -5022,20 +5018,6 @@ pub struct McpAppToolCallCompleteData {
50225018
pub tool_name: String,
50235019
}
50245020

5025-
/// Session event "session.context_cleared". Context-cleared details emitted when the clear_context tool resets the conversation
5026-
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5027-
#[serde(rename_all = "camelCase")]
5028-
pub struct SessionContextClearedData {
5029-
/// Optional initial message set after clearing
5030-
#[serde(skip_serializing_if = "Option::is_none")]
5031-
pub initial_message: Option<String>,
5032-
/// Number of conversation messages that were cleared
5033-
pub messages_cleared: i64,
5034-
/// Runtime-injected messages re-seeded into the freshly-cleared context (e.g. self-paced loop wrappers). Persisted so a resumed session reproduces the same post-clear window instead of resurrecting the pre-clear history.
5035-
#[serde(skip_serializing_if = "Option::is_none")]
5036-
pub prepend_messages: Option<Vec<String>>,
5037-
}
5038-
50395021
/// Hosting platform type of the repository (github or ado)
50405022
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
50415023
pub enum WorkingDirectoryContextHostType {

0 commit comments

Comments
 (0)