Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
5228b2a
fix(agui): export the subagent event types from the public barrels
jpr5 Aug 30, 2026
e5f8da6
fix(agui): mirror canonical subagentRunId onto messages and interrupts
jpr5 Aug 30, 2026
e34567d
Merge branch 'cr/a1-barrel-exports' into fix/agui-subagent-drift
jpr5 Aug 30, 2026
0bc3909
Merge branch 'cr/a2-subagentrunid' into fix/agui-subagent-drift
jpr5 Aug 30, 2026
5a33cbc
test: parse barrel re-exports with the TypeScript parser, not regexes
jpr5 Aug 30, 2026
47ea0f0
docs(changelog): record the AG-UI subagent event and subagentRunId mi…
jpr5 Aug 30, 2026
7ddef26
ci: run the whole AG-UI drift surface, not one hardcoded file
jpr5 Aug 30, 2026
6dd17f3
fix(drift): make the non-event drift guard fail loudly instead of ski…
jpr5 Aug 30, 2026
fddef1f
Merge branch 'cr/m5-changelog' into fix/agui-subagent-drift
jpr5 Aug 30, 2026
af54511
Merge branch 'cr/m6-barrel-guard' into fix/agui-subagent-drift
jpr5 Aug 30, 2026
afaf633
Merge branch 'cr/m1-ci-lane' into fix/agui-subagent-drift
jpr5 Aug 30, 2026
a9abd6b
Merge branch 'cr/m2-guard-credible' into fix/agui-subagent-drift
jpr5 Aug 30, 2026
471fa8a
Merge remote-tracking branch 'origin/main' into fix/agui-subagent-drift
jpr5 Aug 30, 2026
b1d9cbf
docs(changelog): correct subagent entry scope, subagentRunId citation…
jpr5 Aug 30, 2026
efba4de
test(drift): read AG-UI non-event schemas with the TypeScript parser
jpr5 Aug 30, 2026
a0550c5
fix(drift): fail closed when the AG-UI collector cannot interpret a f…
jpr5 Aug 30, 2026
f1e840c
Merge branch 'cr/n4-changelog' into fix/agui-subagent-drift
jpr5 Aug 30, 2026
07e9837
Merge branch 'cr/n2-ast-guard' into fix/agui-subagent-drift
jpr5 Aug 30, 2026
8a4182e
Merge branch 'cr/n1-collector-failopen' into fix/agui-subagent-drift
jpr5 Aug 30, 2026
cf87142
fix(drift): withdraw the AG-UI non-event guard and close two collecto…
jpr5 Aug 30, 2026
dc92c3d
Merge branch 'cr/r7-withdraw-guard' into fix/agui-subagent-drift
jpr5 Aug 30, 2026
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
20 changes: 17 additions & 3 deletions .github/workflows/test-drift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
# guards": check the unit lane first — that is where the value pin lives.
paths:
- "src/agui-types.ts"
- "src/__tests__/drift/agui-schema.drift.ts"
- "src/__tests__/drift/agui-*.drift.ts"
# PR-scoped live drift leg (drift-live-pr job): trigger when the drift
# scripts, any drift test, or a drift workflow itself changes.
- "scripts/drift-*.ts"
Expand Down Expand Up @@ -47,8 +47,22 @@ jobs:
- name: Clone ag-ui repo
run: git clone --depth 1 https://github.com/ag-ui-protocol/ag-ui.git ../ag-ui

- name: Run AG-UI schema drift test
run: npx vitest run src/__tests__/drift/agui-schema.drift.ts --config vitest.config.drift.ts
# The positional argument is a vitest FILENAME FILTER (substring match on
# the test file path), NOT a single file — so this runs EVERY AG-UI drift
# file, and a future `agui-*.drift.ts` guard is picked up automatically
# instead of silently never running. `vitest.config.drift.ts` already
# scopes `include` to `src/__tests__/drift/**/*.drift.ts`, so the filter
# cannot pull in `*.test.ts` helpers from the same directory.
#
# NAMING CONTRACT: an AG-UI drift guard MUST be named
# `src/__tests__/drift/agui-<something>.drift.ts` to land in this lane.
#
# This lane needs NO provider API keys — the AG-UI drift files compare
# `src/agui-types.ts` against the cloned canonical ag-ui repo only. Do not
# widen the filter to the whole drift config: that is `runDriftTests()`'s
# job in the credit-burning `drift` leg below, which does need keys.
- name: Run AG-UI schema drift tests
run: npx vitest run src/__tests__/drift/agui- --config vitest.config.drift.ts

drift:
if: github.event_name != 'pull_request'
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,21 @@

## [Unreleased]

### Added

- **AG-UI subagent lifecycle events, and `subagentRunId` attribution mirrored where canonical declares it.** Upstream `@ag-ui/core` added `SUBAGENT_STARTED` / `SUBAGENT_FINISHED` / `SUBAGENT_ERROR` and threaded an optional `subagentRunId` through the events a subagent can emit; aimock's AG-UI types carried none of it. The three literals now join `AGUIEventType` and the `AGUIEvent` union, backed by `AGUISubagentStartedEvent` (required `subagentRunId` and `name`, optional `description` / `parentSubagentRunId`, plus `parentToolCallId` / `parentMessageId` so an agents-as-tools subagent can be correlated to the call that spawned it without inspecting `rawEvent.metadata`), `AGUISubagentFinishedEvent` (optional `result`, plus an `AGUISubagentFinishedOutcome` of `{ type: "success" }` or `{ type: "suspended"; interruptIds?: string[] }` — `AGUIRunFinishedOutcome` one level down, where absent still means success, `interruptIds` names only the run-level interrupts that subagent directly owns, and unlike `RUN_FINISHED.outcome` the field postdates the valueless-field cleanup so it never tolerates `null`), and `AGUISubagentErrorEvent` (`message`, optional `code`). `subagentRunId` itself is declared **per event, not on a shared base type**, because that is how canonical declares it: optional on 24 event interfaces, required on the three subagent events, and deliberately absent from `RUN_STARTED` / `RUN_FINISHED` / `RUN_ERROR`, `MESSAGES_SNAPSHOT` and the deprecated `THINKING_*` family. Putting it once on `AGUIBaseEvent` would have cleared the drift report while granting the field to events canonical does not give it. The same optional field is mirrored onto `AGUIMessage` and `AGUIInterrupt`. Canonical `types.ts` declares it INDEPENDENTLY on `BaseMessageSchema`, `ToolMessageSchema`, `ActivityMessageSchema` and `ReasoningMessageSchema` — the latter three are standalone `z.object`s that do NOT extend the base, so there is no inheritance carrying the field to them — and on `InterruptSchema`; aimock deliberately flattens the canonical message union into one `role`-discriminated `AGUIMessage`, which is why two edits cover all four message declarations. So a replayed message or approval request keeps the attribution that lets a client group it under the subagent that produced it instead of reading as root-raised. All four new names — the three event interfaces and `AGUISubagentFinishedOutcome` — are exported from both the package root and the `agui-stub` entrypoint, guarded by a public-surface test that fails whenever any `agui-types.ts` type is missing from either barrel. The `AGUIMessage` / `AGUIInterrupt` mirroring is NOT guarded: the existing drift suite walks `*EventSchema` declarations only and cannot see the non-event schemas, so nothing fails if that field is later dropped — closing that gap is deferred to the drift-harness rewrite rather than bolted on here. **Scope: this is a type surface only.** Unlike 1.39.0's `AGUITokenUsage`, which was reachable through `AGUIBuildOpts`, no RUNTIME code CONSUMES these types — they are exported and guarded, but `agui-handler.ts` gained no builder and no build option, so aimock can TYPE a subagent event but cannot yet EMIT one. Every added field is optional or sits on a new type, so existing fixtures and callers are byte-identical (#391)

### Changed

- **The AG-UI drift CI lane runs every `agui-*.drift.ts` guard, not one hardcoded file.** The `agui-schema-drift` job in `.github/workflows/test-drift.yml` and `runAgUiDriftTests` in `scripts/drift-report-collector.ts` both invoked `npx vitest run src/__tests__/drift/agui-schema.drift.ts`. That positional argument is a vitest FILENAME FILTER (substring match on the test file path), not a single file, so both now pass the path prefix `src/__tests__/drift/agui-` and every AG-UI drift file runs — one today, and any future guard automatically — under a documented naming contract: an AG-UI drift guard MUST be named `src/__tests__/drift/agui-<something>.drift.ts` to land in this lane. The workflow's `paths:` trigger widens to `src/__tests__/drift/agui-*.drift.ts` to match. `vitest.config.drift.ts` already scopes `include` to `src/__tests__/drift/**/*.drift.ts`, so the prefix cannot pull in `*.test.ts` helpers from the same directory, and the lane still needs no provider API keys — these files read `src/agui-types.ts` and the cloned canonical `../ag-ui` checkout only, unlike the credit-burning `drift` leg. The collector retains the single filename as report metadata (the file a human opens when drift is reported), no longer as a run target.
- `aimock-pytest` 0.5.3 now defaults to `@copilotkit/aimock` 1.39.0.

### Fixed

- **The AG-UI drift collector no longer reports "clean" for a failure it could not read.** `collectAgUiDriftEntries` recognizes three failure-message shapes; any FAILED assertion matching none of them was dropped outright — no entry, no counter, no warning — and a FAILED assertion carrying no message at all was skipped before it was even looked at. Both paths produced zero entries, exit 0 and `conclusion: "clean"`, so a genuinely failing `agui-schema.drift.ts` assertion (`should parse aimock event types` fails with a bare `expect` message that matches no shape) certified AG-UI as drift-free. Every such failure now takes the collector's EXISTING quarantine lane — held for review at exit 5, the same "never silently swallowed" contract the HTTP leg already used — per-assertion and unconditional, so an unreadable failure survives a mixed run in which other failures DID parse. Separately, a ZERO-exit AG-UI run whose stdout is not vitest JSON now THROWS instead of returning an empty (`"no failures"`) result, matching what the HTTP twin `runDriftTests()` has always done on the same condition: the two legs no longer disagree about whether garbage output is clean. Drift-harness tooling, not runtime behavior — no published surface changes (#391)

- **The AG-UI drift suite's canonical-schema parser no longer drops the field declared after a trailing comment.** `extractExtendFields` stripped whole-line comments only (`/^\s*\/\/.*$/gm`). Upstream's `STATE_DELTA` declares `delta: z.array(z.any()), // JSON Patch (RFC 6902)`, and after the top-level comma split that trailing comment heads the NEXT entry, so the field-name match failed and the entry was discarded silently — which is why the drift report read canonical as declaring `subagentRunId` on 23 events rather than 24, and flagged `STATE_DELTA.subagentRunId` as aimock-only. Comments are now stripped wherever they appear; no canonical schema literal contains `//`, so the unconditional strip is safe. This is drift-harness tooling, not runtime behavior — no published surface changes (#391)

## [1.39.0] - 2026-08-18

### Added
Expand Down
Loading
Loading