Add agent stream provider conformance#4433
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR expands the agent provider conformance suite to include a streaming-focused matrix, and wires that new test into the provider-conformance harness so streaming regressions (final streamed output + capability reporting) can be exercised when provider keys are present.
Changes:
- Add
TestAgentProviderStreamConformanceMatrixto validate streamed final output and requireai.ProviderCapabilities(provider).Streamfor live providers. - Update the provider-conformance harness to run both the existing and new conformance matrices via a single
go test -runregex.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| internal/harness/provider-conformance/main.go | Runs both agent conformance matrices from the harness via an updated -run regex. |
| agent/conformance_test.go | Adds streaming conformance matrix and a streaming scenario that validates final output marker + stream capability reporting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+85
to
+105
| } else { | ||
| var sawToolSchema bool | ||
| fakeStream = func(ctx context.Context, opts ai.Options, req *ai.Request) (ai.Stream, error) { | ||
| if req.Prompt != "Stream exactly: agent-stream-conformance-ok" { | ||
| return nil, fmt.Errorf("prompt = %q", req.Prompt) | ||
| } | ||
| if len(req.Messages) == 0 || req.Messages[len(req.Messages)-1].Role != "user" || req.Messages[len(req.Messages)-1].Content != req.Prompt { | ||
| return nil, fmt.Errorf("messages = %#v, want current user turn", req.Messages) | ||
| } | ||
| for _, tool := range req.Tools { | ||
| if tool.Name == "conformance_echo" { | ||
| sawToolSchema = true | ||
| } | ||
| } | ||
| if !sawToolSchema { | ||
| return nil, errors.New("stream request omitted conformance tool schema") | ||
| } | ||
| return &sliceStream{chunks: []string{"agent-stream-", "conformance-ok"}}, nil | ||
| } | ||
| defer func() { fakeStream = nil }() | ||
| } |
Comment on lines
+128
to
+152
| stream, err := New(agentOpts...).Stream(context.Background(), "Stream exactly: agent-stream-conformance-ok") | ||
| if err != nil { | ||
| t.Fatalf("Stream: %v", err) | ||
| } | ||
| defer stream.Close() | ||
|
|
||
| var reply strings.Builder | ||
| deadline := time.After(45 * time.Second) | ||
| for { | ||
| select { | ||
| case <-deadline: | ||
| t.Fatal("timed out waiting for streamed final output") | ||
| default: | ||
| } | ||
| chunk, err := stream.Recv() | ||
| if errors.Is(err, io.EOF) { | ||
| break | ||
| } | ||
| if err != nil { | ||
| t.Fatalf("Recv: %v", err) | ||
| } | ||
| reply.WriteString(chunk.Reply) | ||
| if strings.Contains(reply.String(), "agent-stream-conformance-ok") { | ||
| return | ||
| } |
This was referenced Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Testing