Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
778 changes: 773 additions & 5 deletions dotnet/src/Generated/Rpc.cs

Large diffs are not rendered by default.

454 changes: 454 additions & 0 deletions dotnet/src/Generated/SessionEvents.cs

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions dotnet/test/E2E/RpcSessionStateE2ETests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ public async Task Should_Call_Metadata_Snapshot_SetWorkingDirectory_And_RecordCo
{
var firstDirectory = CreateUniqueDirectory();
var secondDirectory = CreateUniqueDirectory();
var contextDirectory = CreateUniqueDirectory();
var branch = $"rpc-context-{Guid.NewGuid():N}";
await using var session = await CreateSessionAsync(new SessionConfig
{
Expand Down Expand Up @@ -324,7 +323,7 @@ await TestHelper.WaitForConditionAsync(

var context = new SessionWorkingDirectoryContext
{
Cwd = contextDirectory,
Cwd = secondDirectory,
GitRoot = firstDirectory,
Branch = branch,
Repository = "github/copilot-sdk-e2e",
Expand All @@ -338,8 +337,8 @@ await TestHelper.WaitForConditionAsync(
Assert.NotNull(recordResult);

var contextChanged = await contextChangedTask;
Assert.True(PathEquals(contextDirectory, contextChanged.Data.Cwd),
$"Expected context cwd '{contextDirectory}', actual '{contextChanged.Data.Cwd}'.");
Assert.True(PathEquals(secondDirectory, contextChanged.Data.Cwd),
$"Expected context cwd '{secondDirectory}', actual '{contextChanged.Data.Cwd}'.");
Assert.True(PathEquals(firstDirectory, contextChanged.Data.GitRoot),
$"Expected context git root '{firstDirectory}', actual '{contextChanged.Data.GitRoot}'.");
Assert.Equal(branch, contextChanged.Data.Branch);
Expand Down
5 changes: 2 additions & 3 deletions go/internal/e2e/rpc_session_state_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,6 @@ func TestRPCSessionStateE2E(t *testing.T) {
t.Run("should call metadata snapshot set working directory and record context change", func(t *testing.T) {
firstDirectory := createUniqueRPCWorkDirectory(t, ctx, "rpc-session-state-first")
secondDirectory := createUniqueRPCWorkDirectory(t, ctx, "rpc-session-state-second")
contextDirectory := createUniqueRPCWorkDirectory(t, ctx, "rpc-session-state-context")
branch := "rpc-context-" + randomHex(t)

session, err := client.CreateSession(t.Context(), &copilot.SessionConfig{
Expand Down Expand Up @@ -534,7 +533,7 @@ func TestRPCSessionStateE2E(t *testing.T) {
headCommit := "1111111111111111111111111111111111111111"
if _, err := session.RPC.Metadata.RecordContextChange(t.Context(), &rpc.MetadataRecordContextChangeRequest{
Context: rpc.SessionWorkingDirectoryContext{
Cwd: contextDirectory,
Cwd: secondDirectory,
GitRoot: &firstDirectory,
Branch: &branch,
Repository: &repo,
Expand All @@ -548,7 +547,7 @@ func TestRPCSessionStateE2E(t *testing.T) {
}
contextChanged := awaitEvent(t, awaitContextChanged)
data := contextChanged.Data.(*copilot.SessionContextChangedData)
assertRPCPathEqual(t, contextDirectory, data.Cwd)
assertRPCPathEqual(t, secondDirectory, data.Cwd)
if data.GitRoot == nil {
t.Fatal("Expected context changed git root")
}
Expand Down
20 changes: 19 additions & 1 deletion go/internal/e2e/session_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -643,11 +643,29 @@ func TestSessionE2E(t *testing.T) {
}

// We should be able to send another message
answer, err := session.SendAndWait(t.Context(), copilot.MessageOptions{Prompt: "What is 2+2?"})
answerCh := make(chan *copilot.SessionEvent, 1)
answerErrCh := make(chan error, 1)
go func() {
evt, err := testharness.GetNextEventOfType(session, copilot.SessionEventTypeAssistantMessage, 60*time.Second)
if err != nil {
answerErrCh <- err
} else {
answerCh <- evt
}
}()

_, err = session.Send(t.Context(), copilot.MessageOptions{Prompt: "What is 2+2?"})
if err != nil {
t.Fatalf("Failed to send message after abort: %v", err)
}

var answer *copilot.SessionEvent
select {
case answer = <-answerCh:
case err := <-answerErrCh:
t.Fatalf("Failed waiting for assistant message after abort: %v", err)
}

if ad, ok := answer.Data.(*copilot.AssistantMessageData); !ok || !strings.Contains(ad.Content, "4") {
t.Errorf("Expected answer to contain '4', got %v", answer.Data)
}
Expand Down
Loading
Loading