Skip to content

feat: mock, record and replay GPT-Live WebSocket sessions - #468

Merged
jpr5 merged 3 commits into
mainfrom
blitz/aimock-gpt-live/integration
Sep 18, 2026
Merged

jpr5 merged 3 commits into
mainfrom
blitz/aimock-gpt-live/integration

Conversation

@jpr5

@jpr5 jpr5 commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Add GPT-Live support for the primary /v1/live/sessions WebSocket in client and managed backend modes. Live fixtures previously failed registration; applications can now use onLive or file fixtures, record provider sessions, and replay them offline with audio, transcripts, delegation and managed tool continuation.

Replay preserves causal ordering, timing and equivalent PCM rechunking, with fresh identifiers per connection. Includes bounded resources, credential sanitation, cleanup, Jest/Vitest helpers, examples and provider drift canaries. Surgical fixes preserve helper limits, accept empty PCM and admitted timeout values, and prevent credential export while retaining harmless malformed URLs.

Approved plan. Primary WebSocket only; WebRTC/SDP and sideband are excluded. Audio comes from fixtures.

Local red–green proof

Identical repro inputs ran before and after each fix against real public LLMock sockets/recording exports. Counts below cover selected cases; filtered tests are not counted as passes.

Surface RED GREEN
Baseline public fixtures, client and managed Both rejected: response is not a recognized type Both passed full directional parity, fresh IDs and wrong-reference rejection
Public recording route 8 original auth/URL cases failed; 0 upstream connections 26 passed, including expanded lifecycle cases
Helper file/directory limits 4 failed, 2 controls passed 6 passed; all four affected combinations flipped
Key credential capture 1 failed, 2 passed; bare credential persisted 3 passed; unsafe exports rejected, ordinary Bearer recording retained
Empty PCM 4 failed: fixture-mismatch 4 passed with complete lifecycle parity
Harmless malformed URL fixtures:0, unsafe-export fixtures:1, byte-for-byte preservation and offline replay
Timeout configuration 3 failed: fractional/invalid timeout inputs 3 passed with recording and fresh-server replay
Journal test ownership 3 failed, 1 control passed 4 passed; owner filtering and credential sanitation preserved
Owner privacy 4 failed; HTTP journal and Journal.onAdd exposed owner secrets 4 passed; ordinary ownership controls preserved; 86 targeted tests passed
Encoded URL credentials Both path/fragment probes: fixtures:1, recoverableCredentialPersisted:true Both: fixtures:0, recoverableCredentialPersisted:false

Provider acceptance and verification

  • Actual client recording: 258 events; managed: 296 events and two backend tool calls/results with explicit continuation. Four fresh-server replays, including PCM rechunking, had zero timing failures and zero external connection attempts.
  • Actual canary: 2 passed; absent key: 2 skipped; invalid key: 2 failed, 0 skipped. Collector reports these separately under OpenAI Live.
  • Final integrated tree: 7,322 tests / 222 files, zero skips. Format, lint, all three TypeScript projects, build and exports passed. Additional native Jest: 2 passed. Focused owner-privacy confirmation resolved.

Provider usage snapshots are not a complete billing total; an earlier incomplete recording has unmeasured usage.

CI: 31 checks passed, 1 failed, 2 skipped. The live-drift check fails while collecting the existing main baseline: upstream AG-UI moved core/src/types.ts to core/src/generated/types.ts. The PR-head provider leg and delta gate are skipped. This requires a separate baseline collector compatibility fix; an unchanged rerun will remain blocked.

@pkg-pr-new

pkg-pr-new Bot commented Sep 18, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@copilotkit/aimock@468

commit: 9db5a2d

@jpr5
jpr5 merged commit 72e54f6 into main Sep 18, 2026
33 of 34 checks passed
@jpr5
jpr5 deleted the blitz/aimock-gpt-live/integration branch September 18, 2026 03:51
tylerslaton added a commit that referenced this pull request Sep 22, 2026
## [1.43.0] - 2026-09-22

> **BREAKING** — `aimock -h` is `--help`, not `--host`: `aimock -h 0.0.0.0` exits 1 with `Error:
> Unexpected argument '0.0.0.0'. This command does not take positional arguments`. Migration:
> `--host <string>` (long form only). The `llmock` bin (the Docker ENTRYPOINT) keeps `-h, --host`
> (#453).

### Added

- OpenAI GPT-Live mock, record and offline replay on `GET /v1/live/sessions`, with `onLive` fixtures
  (#468)
- Live sessions enforce message/audio/queue/lifetime limits; recordings sanitize credentials (#468)
- Live drift canaries for lifecycle, audio/transcript, delegation and usage, attributed to
  `openai-live` (#468)
- Chaos `rateLimitRate` / `--chaos-ratelimit`: deterministic 429 with `Retry-After` (#449)
- Chaos `latencyMs` / `--chaos-latency` now actually delays responses on every path (#449)
- OpenAI Files API mock — byte-exact uploads, create-purpose enum, CORS on faults (#445)
- OpenAI fine-tuning jobs mock — deterministic lifecycle, events, cursor pages (#447)
- OpenAI Batches API mock — create/list/retrieve/cancel with real output files (#446)
- `X-Request-Id` echoed or minted on every response; `?requestId=` filters the journal (#450)
- `aimock validate` lints fixture files or directories offline, failing on broken files (#453)
- ElevenLabs Voice Design record/replay — design, save-as-voice, and voice slot management (#452)
- ElevenLabs Voice Design provenance block and strict-mode 503 coverage (#454)

### Changed

- **BREAKING:** `aimock -h` is `--help`, matching `aimock convert -h` and `aimock validate -h`; the
  host override is `--host` only. The `llmock` bin (the Docker entrypoint) keeps its own `-h,
  --host` — see the note above (#453)
- `aimock --config ""`, `--port ""` and `--host ""` are usage errors naming the option (#453)
- Realtime `OpenAI-Beta: realtime=v1` now returns the real sunset rejection, not a session (#461)
- `POST /v1/images/variations` now replays the real removal 404; OpenAI deleted it (#462)
- `ChaosAction` gains `"rateLimit"` — an exhaustive switch over it needs a case (#449)
- `applyChaosAsync()` returns `false | "handled" | "unwritable"` instead of a bare `boolean` (#449)
- Journal `headers` now ALWAYS carry `x-request-id` — exact `toEqual` asserts break (#450)

### Deprecated

- Synchronous `applyChaos()` warns once per process; it skips chaos latency. Use `await
  applyChaosAsync(...)` (#449)

### Fixed

- Reasoning-first chat streams with content and tool calls carry the assistant role in the first
  chunk (#470)
- Journals and metrics reflect delivered vs interrupted responses; one-shot errors never
  double-deliver (#466)
- Nonstreaming OpenAI chat returns block text and tools; text-only blocks finish normally on every
  provider (#467)
- AG-UI drift reads generated 1.0 schemas; `AGUIRunStartedEvent` gains optional `protocolVersion`
  (#469)
- Drift reports list `unverifiedSurfaces`; offline Bedrock/Vertex checks no longer skip silently
  (#460)
- Drift docs match actual coverage; ElevenLabs drift separates vendor observations from fixture
  checks (#465)
- Chaos no longer treats committed headers as a dead response; only status-writing actions are
  skipped (#449)
- Chaos skip logs name what happened; `aimock_chaos_triggered_total` counts only written responses
  (#449)
- A request whose chaos latency was cancelled by client hang-up is no longer served or journalled
  (#449)
- Moderations echoes the request's `model`; default is now `omni-moderation-latest` (#459)
- Image endpoints default to `gpt-image-1` — `dall-e-2`/`dall-e-3` were removed (#459)
- AG-UI record/proxy forwards the caller's headers and raw body upstream; `Accept` is forced to SSE
  (#455)
- The AG-UI recorder refuses to write a fixture from a non-stream or empty 2xx upstream reply (#455)
- A MINTED `x-request-id` is no longer forwarded upstream in record/proxy mode (#450)
MikeRyanDev added a commit that referenced this pull request Sep 22, 2026
Cuts the accumulated `[Unreleased]` work. **MINOR (1.43.0)**, kept at a
minor bump despite the
`-h` BREAKING banner (#453): the pre-2.0 precedent (1.14.2 shipped a
BREAKING note as a patch)
applies, and the version was agreed ahead of this PR. Do not re-version
to 2.0.0 at review.

**Prepared, not merged.** `publish-release.yml` fires on push-to-main,
so merging this
publishes to npm, tags `v1.43.0`, force-moves `v1`, cuts the GitHub
Release, dispatches the
Docker build, posts to Slack, and runs the PyPI job gated on
`_version.py`. Merge when you
want it live.

## What ships


> **BREAKING** — `aimock -h` is `--help`, not `--host`: `aimock -h
0.0.0.0` exits 1 with `Error: Unexpected argument '0.0.0.0'. This
command does not take positional arguments`. Migration: `--host
<string>` (long form only). The `llmock` bin (the Docker ENTRYPOINT)
keeps `-h, --host` (#453).

### Added

- OpenAI GPT-Live mock, record and offline replay on `GET
/v1/live/sessions`, with `onLive` fixtures (#468)
- Live sessions enforce message/audio/queue/lifetime limits; recordings
sanitize credentials (#468)
- Live drift canaries for lifecycle, audio/transcript, delegation and
usage, attributed to `openai-live` (#468)
- Chaos `rateLimitRate` / `--chaos-ratelimit`: deterministic 429 with
`Retry-After` (#449)
- Chaos `latencyMs` / `--chaos-latency` now actually delays responses on
every path (#449)
- OpenAI Files API mock — byte-exact uploads, create-purpose enum, CORS
on faults (#445)
- OpenAI fine-tuning jobs mock — deterministic lifecycle, events, cursor
pages (#447)
- OpenAI Batches API mock — create/list/retrieve/cancel with real output
files (#446)
- `X-Request-Id` echoed or minted on every response; `?requestId=`
filters the journal (#450)
- `aimock validate` lints fixture files or directories offline, failing
on broken files (#453)
- ElevenLabs Voice Design record/replay — design, save-as-voice, and
voice slot management (#452)
- ElevenLabs Voice Design provenance block and strict-mode 503 coverage
(#454)

### Changed

- **BREAKING:** `aimock -h` is `--help`, matching `aimock convert -h`
and `aimock validate -h`; the host override is `--host` only. The
`llmock` bin (the Docker entrypoint) keeps its own `-h, --host` — see
the note above (#453)
- `aimock --config ""`, `--port ""` and `--host ""` are usage errors
naming the option (#453)
- Realtime `OpenAI-Beta: realtime=v1` now returns the real sunset
rejection, not a session (#461)
- `POST /v1/images/variations` now replays the real removal 404; OpenAI
deleted it (#462)
- `ChaosAction` gains `"rateLimit"` — an exhaustive switch over it needs
a case (#449)
- `applyChaosAsync()` returns `false | "handled" | "unwritable"` instead
of a bare `boolean` (#449)
- Journal `headers` now ALWAYS carry `x-request-id` — exact `toEqual`
asserts break (#450)

### Deprecated

- Synchronous `applyChaos()` warns once per process; it skips chaos
latency. Use `await applyChaosAsync(...)` (#449)

### Fixed

- Reasoning-first chat streams with content and tool calls carry the
assistant role in the first chunk (#470)
- Journals and metrics reflect delivered vs interrupted responses;
one-shot errors never double-deliver (#466)
- Nonstreaming OpenAI chat returns block text and tools; text-only
blocks finish normally on every provider (#467)
- AG-UI drift reads generated 1.0 schemas; `AGUIRunStartedEvent` gains
optional `protocolVersion` (#469)
- Drift reports list `unverifiedSurfaces`; offline Bedrock/Vertex checks
no longer skip silently (#460)
- Drift docs match actual coverage; ElevenLabs drift separates vendor
observations from fixture checks (#465)
- Chaos no longer treats committed headers as a dead response; only
status-writing actions are skipped (#449)
- Chaos skip logs name what happened; `aimock_chaos_triggered_total`
counts only written responses (#449)
- A request whose chaos latency was cancelled by client hang-up is no
longer served or journalled (#449)
- Moderations echoes the request's `model`; default is now
`omni-moderation-latest` (#459)
- Image endpoints default to `gpt-image-1` — `dall-e-2`/`dall-e-3` were
removed (#459)
- AG-UI record/proxy forwards the caller's headers and raw body
upstream; `Accept` is forced to SSE (#455)
- The AG-UI recorder refuses to write a fixture from a non-stream or
empty 2xx upstream reply (#455)
- A MINTED `x-request-id` is no longer forwarded upstream in
record/proxy mode (#450)

The 35 `[Unreleased]` bullets were condensed to 34 one-liners, most ≤100
chars, because
this text is fed verbatim into the GitHub Release body and summarized
into `#oss-alerts`.
Every `(#N)` reference is preserved; the three un-numbered GPT-Live
bullets now cite #468.
Detail lives in the PRs.

## Behaviour changes to read before you merge

- **#453** — `aimock -h` is now `--help`. `aimock -h 0.0.0.0` exits 1.
Migrate to `--host 0.0.0.0`.
The `llmock` bin (Docker `ENTRYPOINT`) is unchanged and still accepts
`-h, --host`.
`--config ""`, `--port ""`, `--host ""` are now usage errors instead of
"not given".
- **#450** — journal `headers` always carry `x-request-id`; exact
`toEqual` asserts on headers break.
- **#449** — `ChaosAction` gains `"rateLimit"` (exhaustive switches need
a case);
`applyChaosAsync()` returns `false | "handled" | "unwritable"`
(truthiness unchanged, explicit
`boolean` bindings need updating); sync `applyChaos()` warns once per
process.
- **#459 / #461 / #462** — defaults track upstream: images default to
`gpt-image-1`, moderations
to `omni-moderation-latest`; `OpenAI-Beta: realtime=v1` returns the real
sunset rejection;
  `POST /v1/images/variations` returns the real removal 404.
- **#466 / #467** — journal and metrics now count interrupted responses
and text-only block
fixtures finish with a normal terminal reason; suites asserting the old
counts or
`finish_reason: "tool_calls"` on text-only blocks will see different
values.

## Version surfaces

Enumerated with `git grep -F 1.42.0`, not from a list. Seven carriers
bumped:

| Surface | Field |
| --- | --- |
| `package.json` | `version` |
| `charts/aimock/Chart.yaml` | `appVersion` |
| `.claude-plugin/plugin.json` | `version` |
| `.claude-plugin/marketplace.json` | `plugins[0].source.version`
(`^1.43.0`) |
| `docs/index.html` | the `aimock v…` banner |
| `packages/aimock-pytest/src/aimock_pytest/_version.py` |
`AIMOCK_VERSION` |
| `packages/aimock-pytest/README.md` | the `--aimock-version` default |

Deliberately untouched: `packages/aimock-pytest/pyproject.toml` (own
PyPI cadence, stays
`0.5.3`), `charts/aimock/Chart.yaml` `version: 0.1.0` (the chart's own
version), the
historical `1.41.0` mentions in `publish-release.yml` and
`npm-publish-verify-workflow.test.ts`, and CHANGELOG history.

`_version.py` is bumped because #466 and #450 change `/__aimock/journal`
and one-shot
`/__aimock/error` delivery — routes the pytest client calls — same rule
as 1.42.0.

## 1.42.1

npm `latest` is currently **1.42.1**, cut from
`maintenance/v1.42.1-lgts-mcp` (#471) and never
merged to main, so main's CHANGELOG had no `[1.42.1]` entry. Its fix
(#470) is on main and ships
here. This PR adds the one-line `## [1.42.1] - 2026-09-18` history entry
so every published
version appears in the file; every prior patch release (1.37.1–1.37.4)
already did.

## README coverage

The Features list had no mention of the OpenAI Files API (#445),
fine-tuning jobs (#447) or
Batches (#446), all shipped in this release — the same gap #443 closed
for the control API.
Added one **OpenAI platform APIs** bullet under Multimedia APIs linking
the Files and fine-tuning
docs pages; Batches has no docs page yet so it is described inline.
`aimock validate`, `--host`,
chaos latency/rate-limit, `X-Request-Id` and GPT-Live were already
covered. The "11 providers
across 22 API surfaces" headline was left as-is: that line enumerates
providers, and re-counting
it is a docs decision rather than a release step.

## npm description sync

Ran the workflow's inline extractor against this branch's README (after
the edit); output is
byte-identical to `package.json.description`, so the on-merge sync is a
no-op.

## Gates

Exit codes captured by redirect to separate files, never through a pipe.
Fresh worktree,
`pnpm install --frozen-lockfile`.

| Gate | Exit |
| --- | --- |
| `pnpm format:check` | 0 |
| `pnpm lint` | 0 |
| `pnpm typecheck` | 0 |
| `pnpm build` | 0 |
| `pnpm test:exports` | 0 |
| `pnpm test` | 0 — 225 files passed; 7341 tests passed |
| `npx commitlint --from origin/main --to HEAD` | 0 (1 cosmetic
`footer-leading-blank` warning) |

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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