Skip to content

Add agent stream provider conformance#4433

Merged
asim merged 1 commit into
masterfrom
codex/increment-4432
Jul 9, 2026
Merged

Add agent stream provider conformance#4433
asim merged 1 commit into
masterfrom
codex/increment-4432

Conversation

@asim

@asim asim commented Jul 9, 2026

Copy link
Copy Markdown
Member

Summary

  • Add provider-gated agent streaming conformance covering streamed final output and stream capability reporting.
  • Include the new stream conformance test in the provider-conformance agent harness.

Testing

  • go test ./agent -run 'TestAgentProvider(ConformanceMatrix|StreamConformanceMatrix)' -count=1 -v\n- go run ./internal/harness/provider-conformance -providers mock -harnesses agent -capabilities=false\n- go build ./...\n- go test ./... (fails in this environment due configured ATLASCLOUD_API_KEY returning 400 and loopback gRPC blocked by envoy)\n- golangci-lint run ./...\n\nCloses Broaden provider streaming conformance #4386\nCloses Loop: build increment #153 #4432

@asim asim added the codex label Jul 9, 2026
Copilot AI review requested due to automatic review settings July 9, 2026 03:56
@asim
asim merged commit 776fe1a into master Jul 9, 2026
9 checks passed
@asim
asim deleted the codex/increment-4432 branch July 9, 2026 03:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 TestAgentProviderStreamConformanceMatrix to validate streamed final output and require ai.ProviderCapabilities(provider).Stream for live providers.
  • Update the provider-conformance harness to run both the existing and new conformance matrices via a single go test -run regex.

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 thread agent/conformance_test.go
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 thread agent/conformance_test.go
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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants