Skip to content

test: record A2UI wire fixtures from runtimes 1.79.0 and 1.91.0 - #257

Open
pietroid wants to merge 3 commits into
feat/a2ui-actionsfrom
test/a2ui-recorded-fixtures
Open

pietroid wants to merge 3 commits into
feat/a2ui-actionsfrom
test/a2ui-recorded-fixtures

Conversation

@pietroid

@pietroid pietroid commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

Status

READY

Description

Closes #247. Part of the A2UI stack (#71). Builds on #256.

This PR records real A2UI wire traffic from Copilot Runtime 1.79.0 (A2UI middleware 0.0.10) and 1.91.0 (middleware 0.0.16). It then replays each recording through the SDK.

Recorder. example/tool/runtime/record-a2ui.ts runs npm run record:a2ui, with --runtime-dir ../runtime-1.91 for 1.91.0. There's no model and no key. Each case runs a scripted AG-UI agent, a subclass of the runtime's own AbstractAgent, that emits fixed tool calls. That way the middleware's validation, retries, statuses and activities come from the runtime itself. The recorder starts the runtime on a local port and posts the same request bodies the Flutter client posts.

To keep re-recordings stable, every UUID becomes uuid-<n> in order of first appearance, and event timestamps are dropped. Re-recording is byte-identical. The example runtime now pins @copilotkit/runtime to exactly 1.79.0. example/tool/runtime-1.91 pins 1.91.0.

Fixtures. There are 18 files in packages/copilotkit/test/fixtures/a2ui/<version>/, nine cases per version:

  • progressive_data
  • action_round_trip
  • update_turn
  • retry_then_success
  • failed_render
  • invalid_render (extra)
  • delete_surface
  • history_snapshot
  • tool_result, including a double-encoded result

Gap: 1.79.0's connect replays the compacted events and sends no MESSAGES_SNAPSHOT. So its history_snapshot case records the replay without one. 1.91.0 sends an empty snapshot, then the full one.

Harness. copilotkit_flutter/test/a2ui_recorded_fixtures_test.dart runs every file through:

  • a real http client (MockClient.streaming via http.runWithClient)
  • AgUiTransport, the ag_ui SSE decoder and the event mapper
  • A2uiSurfaceRegistry and A2uiSurface widgets

It also checks the requests the client sends against the recorded ones. It runs in tester.runAsync, because a run never ends under the widget test's fake async. http is a new dev dependency. copilotkit's fixtures_test pins the shapes that differ between versions.

Fix found by the recordings. Middleware 0.0.10 doesn't check the client's catalog, so an unknown component reaches the client. There, createSurface applied but updateComponents was rejected, which left a Ready surface with a blank tree. The registry now drops a surface those same operations created, so the status is Rejected. There's a unit test and a recorded replay for it.

Synthetic fixtures. These are kept for the shapes the recordings don't cover: routing surfaceId, ACTIVITY_DELTA, debugExposure, multiple surfaces, an unknown catalog, v1.0 and invalid-after-good. Their notes are corrected:

  • Single-surface tool-result activities are named a2ui-surface-<toolCallId>. The ids are fixed to match.
  • building arrives before TOOL_CALL_START.
  • 0.0.10 doesn't fail on unknown components.
  • The 0.0.10 action echo depends on the agent.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

🤖 Generated with Claude Code

pietroid and others added 3 commits December 2, 2026 22:07
Pin the example runtime's @copilotkit/runtime to 1.79.0 and add
runtime-1.91 for the second generation. record-a2ui.ts drives each
runtime's A2UI middleware with a scripted AG-UI agent, so no model or key
is needed, and normalizes UUIDs and timestamps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…c ones

Eighteen fixtures, nine cases per runtime version, checked by
fixtures_test. The synthetic fixtures stay for the shapes the recordings
don't cover; their notes now name their recorded counterparts, and
single-surface tool-result activities use the recorded
a2ui-surface-<toolCallId> id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A createSurface that applied followed by rejected components left a ready,
blank surface, which runtime 1.79.0 produces for a component the catalog
lacks. Replay every recorded fixture through the transport, the mapper,
the registry and the widgets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant