Skip to content

Commit 1e23513

Browse files
React to CLI update and Anthropic response format changes (github#27)
* E2E infrastructure: skip writing snapshots on failure + update snapshots for extended thinking * Update CLI to 0.0.383 * Regenerate types for session.usage_info and apply PR feedback
1 parent dc49827 commit 1e23513

37 files changed

+435
-119
lines changed

dotnet/src/Generated/SessionEvents.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
// Generated from: @github/copilot/session-events.schema.json
88
// Generated by: scripts/generate-session-types.ts
9-
// Generated at: 2026-01-15T19:22:26.479Z
9+
// Generated at: 2026-01-16T00:52:52.781Z
1010
//
1111
// To update these types:
1212
// 1. Update the schema in copilot-agent-runtime
@@ -39,6 +39,7 @@ internal class SessionEventConverter : JsonConverter<SessionEvent>
3939
["session.model_change"] = typeof(SessionModelChangeEvent),
4040
["session.handoff"] = typeof(SessionHandoffEvent),
4141
["session.truncation"] = typeof(SessionTruncationEvent),
42+
["session.usage_info"] = typeof(SessionUsageInfoEvent),
4243
["session.compaction_start"] = typeof(SessionCompactionStartEvent),
4344
["session.compaction_complete"] = typeof(SessionCompactionCompleteEvent),
4445
["user.message"] = typeof(UserMessageEvent),
@@ -209,6 +210,17 @@ public partial class SessionTruncationEvent : SessionEvent
209210
public SessionTruncationData Data { get; set; }
210211
}
211212

213+
/// <summary>
214+
/// Event: session.usage_info
215+
/// </summary>
216+
public partial class SessionUsageInfoEvent : SessionEvent
217+
{
218+
public override string Type => "session.usage_info";
219+
220+
[JsonPropertyName("data")]
221+
public SessionUsageInfoData Data { get; set; }
222+
}
223+
212224
/// <summary>
213225
/// Event: session.compaction_start
214226
/// </summary>
@@ -592,6 +604,18 @@ public partial class SessionTruncationData
592604
public string PerformedBy { get; set; }
593605
}
594606

607+
public partial class SessionUsageInfoData
608+
{
609+
[JsonPropertyName("tokenLimit")]
610+
public double TokenLimit { get; set; }
611+
612+
[JsonPropertyName("currentTokens")]
613+
public double CurrentTokens { get; set; }
614+
615+
[JsonPropertyName("messagesLength")]
616+
public double MessagesLength { get; set; }
617+
}
618+
595619
public partial class SessionCompactionStartData
596620
{
597621
}

dotnet/test/Harness/CapiProxy.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,16 @@ async Task<string> StartCoreAsync()
8484
}
8585
}
8686

87-
public async Task StopAsync()
87+
public async Task StopAsync(bool skipWritingCache = false)
8888
{
8989
if (_startupTask != null)
9090
{
9191
try
9292
{
9393
var url = await _startupTask;
94+
var stopUrl = skipWritingCache ? $"{url}/stop?skipWritingCache=true" : $"{url}/stop";
9495
using var client = new HttpClient();
95-
await client.PostAsync($"{url}/stop", null);
96+
await client.PostAsync(stopUrl, null);
9697
}
9798
catch { /* Best effort */ }
9899
}

dotnet/test/Harness/E2ETestContext.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ public IReadOnlyDictionary<string, string> GetEnvironment()
101101

102102
public async ValueTask DisposeAsync()
103103
{
104-
await _proxy.DisposeAsync();
104+
// Skip writing snapshots in CI to avoid corrupting them on test failures
105+
var isCI = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("CI"));
106+
await _proxy.StopAsync(skipWritingCache: isCI);
105107

106108
try { if (Directory.Exists(HomeDir)) Directory.Delete(HomeDir, true); } catch { }
107109
try { if (Directory.Exists(WorkDir)) Directory.Delete(WorkDir, true); } catch { }

go/e2e/permissions_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func TestPermissions(t *testing.T) {
9999
}
100100

101101
_, err = session.Send(copilot.MessageOptions{
102-
Prompt: "Run 'echo hello world' and tell me the output",
102+
Prompt: "Run 'echo hello' and tell me the output",
103103
})
104104
if err != nil {
105105
t.Fatalf("Failed to send message: %v", err)

go/e2e/testharness/context.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func NewTestContext(t *testing.T) *TestContext {
8282
}
8383

8484
t.Cleanup(func() {
85-
ctx.Close()
85+
ctx.Close(t.Failed())
8686
})
8787

8888
return ctx
@@ -113,9 +113,9 @@ func (c *TestContext) ConfigureForTest(t *testing.T) {
113113
}
114114

115115
// Close cleans up the test context resources.
116-
func (c *TestContext) Close() {
116+
func (c *TestContext) Close(testFailed bool) {
117117
if c.proxy != nil {
118-
c.proxy.Stop()
118+
c.proxy.StopWithOptions(testFailed)
119119
}
120120
if c.HomeDir != "" {
121121
os.RemoveAll(c.HomeDir)

go/e2e/testharness/proxy.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ func (p *CapiProxy) Start() (string, error) {
7575

7676
// Stop gracefully shuts down the proxy server.
7777
func (p *CapiProxy) Stop() error {
78+
return p.StopWithOptions(false)
79+
}
80+
81+
// StopWithOptions gracefully shuts down the proxy server.
82+
// If skipWritingCache is true, the proxy won't write captured exchanges to disk.
83+
func (p *CapiProxy) StopWithOptions(skipWritingCache bool) error {
7884
p.mu.Lock()
7985
defer p.mu.Unlock()
8086

@@ -84,8 +90,12 @@ func (p *CapiProxy) Stop() error {
8490

8591
// Send stop request to the server
8692
if p.proxyURL != "" {
93+
stopURL := p.proxyURL + "/stop"
94+
if skipWritingCache {
95+
stopURL += "?skipWritingCache=true"
96+
}
8797
// Best effort - ignore errors
88-
resp, err := http.Post(p.proxyURL+"/stop", "application/json", nil)
98+
resp, err := http.Post(stopURL, "application/json", nil)
8999
if err == nil {
90100
resp.Body.Close()
91101
}

go/generated/session_events.go

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

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
@@ -40,7 +40,7 @@
4040
"author": "GitHub",
4141
"license": "MIT",
4242
"dependencies": {
43-
"@github/copilot": "^0.0.382",
43+
"@github/copilot": "^0.0.383",
4444
"vscode-jsonrpc": "^8.2.1",
4545
"zod": "^4.3.5"
4646
},

nodejs/src/generated/session-events.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Generated from: @github/copilot/session-events.schema.json
55
* Generated by: scripts/generate-session-types.ts
6-
* Generated at: 2026-01-15T19:22:25.859Z
6+
* Generated at: 2026-01-16T00:52:51.450Z
77
*
88
* To update these types:
99
* 1. Update the schema in copilot-agent-runtime
@@ -115,6 +115,18 @@ export type SessionEvent =
115115
performedBy: string;
116116
};
117117
}
118+
| {
119+
id: string;
120+
timestamp: string;
121+
parentId: string | null;
122+
ephemeral: true;
123+
type: "session.usage_info";
124+
data: {
125+
tokenLimit: number;
126+
currentTokens: number;
127+
messagesLength: number;
128+
};
129+
}
118130
| {
119131
id: string;
120132
timestamp: string;

0 commit comments

Comments
 (0)