Repository navigation
test: support concurrent mock Responses requests - #680
Merged
Merged
Conversation
benbrandt
added a commit
that referenced
this pull request
Oct 26, 2026
## Summary Fourth standalone extraction from #655, after #676, #677, and #680 landed. **Two source files, +34/-27 lines.** Based directly on current `main` (`1685cde`), preserving native child model reporting from #678. Group the existing command/fuzzy-search/guardian reporters, image bookkeeping, reasoning deduplication, and message-phase map into `CodexItemStreamState`. - Each event handler still allocates exactly one private instance, with the same seven field types and initializers. - Every existing access goes through that instance. No state sharing, injection, lifetime extension, routing changes, or new standard-subagent code is introduced. - Plans, errors, tool-call tracking, session state, and subagent ownership are untouched. This makes the existing rendering-state boundary explicit and usable today without landing the later lifecycle changes. It is not the change that makes child rendering survive parent handler replacement; that belongs in the complete live-subagent core. ## Behavior-preservation evidence A source comparison against `main` verified that the constructor and all method bodies are byte-identical after removing the added `this.itemStreams.` prefix, and that all seven initializers match their original declarations. The three reporter classes have no constructor side effects. No tests or snapshots were added, updated, or removed. Existing event-driven suites provide the output-regression coverage, including AIR and v1/v2 paths. ## Validation - `npm ci --ignore-scripts` - `npm run typecheck` - `npm run build` - `npm test`: **1,915 passed**, 36 skipped - `npm run test:integration`: **7 passed**, with the real Codex 0.164.0 app-server and a local mock model - `npm run bundle:all`: all six targets compile - Live-model no-tool smoke: ACP text chunks formed `item-state-refactor-ok` - `git diff --check` The full live-model E2E suite and execution of every cross-platform binary were not run. Existing dependency audit findings are outside this refactor.
benbrandt
added a commit
that referenced
this pull request
Oct 26, 2026
## Scope: standalone live core Fifth incremental extraction from #655, on current `main` (`091f9b2`), after #676, #677, #680, and #681 landed. This is the larger atomic feature slice discussed in the split plan: **43 files, +2,898/-181**, including 1,573 added test/snapshot lines and 1,301 added runtime lines. No dependency or generated app-server files change. ### Included - Standard associations for opted-in non-AIR v1 clients and non-AIR v2 clients. AIR retains its existing opt-ins, private updates, generation identities, and fallback. - One opaque conversation ID across assignments, idle work, and handler replacement. Announce immediate parents before children; buffer unresolved ancestry rather than flattening it. - Child-owned streamed-item/tool state, plans, titles, permissions, and elicitation. Accepted URL completion state survives parent attachment changes; late approval replies are rejected locally when actual work ends. - Empty child capabilities and an allowlist boundary for all client mutations, including private extensions and raw provider IDs. Known raw IDs are restricted even while announcement publication is backpressured. Parent cancellation cascades to observed live children; an actual ending produces idle, observability loss produces unknown. - Association-only replay and safe reattachment: current provider parentage must match through known ancestors, inactive owned children receive future events without loading them, and copied forks cannot steal the original runtime. Parent history still replays normally; an explicit advisory says recorded child transcripts are not included. - Current child snapshots follow the real successful wire write, including complete JSON-RPC batches. Same-parent setup execution is serialized without waiting on each other's shared batch delivery. Closing a parent fences queued reopen attempts. - Preserve the model reporting already landed in #678: reuse its source priority and read-only model option helper. Model observations are not guessed from spawn arguments or parent values; buffered older settings cannot replace newer observations. ### Explicitly deferred No recursive child transcript replay, history/live item reconciliation, recorded historical work outcomes, new configuration readback/effort reporting, directed-session messages, or child mutation controls. Those remain separate changes after this live core is reviewed and landed. The current RFD explicitly allows live support without complete child history. Recoverable associations are replayed truthfully; omitted transcripts are not silently presented as complete. ## Review order 1. Contract selection, connection-owned identities/restrictions, and ACP mutation dispatch. 2. Live router admission, child-owned rendering/work/request state, and existing model reporting. 3. Provider subscriptions and ownership verification; no parent cwd/MCP/instruction overrides when rejoining a child. 4. Conversation-owned interaction handlers and request cancellation scopes. 5. Session setup lane, batch-write freshness boundary, and association-only replay. 6. Behavior-focused tests and wire snapshots for both versions. The async queue-completion gap found while planning the split is fixed here: a session transition waits for async callbacks and propagates rejection without breaking the notification lane. A regression reproduces both ordering and rejection behavior. The old #655 reference helper must not be copied back over this implementation. ## Validation Final validation used main's latest lockfile (including #679): - `npm run typecheck` - `npm run build` - `npm test`: **1,959 passed**, 38 skipped - Focused live/wire/queue suites: **44 passed**, 2 v2-only cases skipped on v1 - `npm run test:integration`: **15 passed** — eight new real-Codex 0.164.0 cases cover active-child reattachment, fork identity/ownership isolation, parent cancel/close, and child terminal output/exit across later parent prompts, on v1 and v2, using a local scripted model - `npm run bundle:all`: all six targets compile - Real live-model no-tool smoke completed with `end_turn` - `git diff --check` Existing AIR and parent-session golden files are unchanged. The fixed-command terminal fixture alone uses full-access mode to avoid CI hosts without sandbox namespace support; production sandbox settings are unchanged. The full live-model E2E suite and execution of every OS bundle were not run. ## References - ACP specification at `8aa92106feba5cdd0da210a87a39dfee4dc24f13`: [identity, announcement, and automatic routing](https://github.com/agentclientprotocol/agent-client-protocol/blob/8aa92106feba5cdd0da210a87a39dfee4dc24f13/docs/rfds/subagents.mdx#L166-L246), [best-effort replay and response freshness](https://github.com/agentclientprotocol/agent-client-protocol/blob/8aa92106feba5cdd0da210a87a39dfee4dc24f13/docs/rfds/subagents.mdx#L713-L840). - Official TypeScript SDK checkout `c7e07388feed7a530f8211d0dae4951cb6d26d09` and published 2.0.2 for transport/runtime evidence; normative behavior comes from the spec, not the SDK implementation.
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
Third standalone extraction from #655, after #676 and #677 landed. Based directly on current
main(12e2d16), including #678; no subagent runtime or production files change.Standalone coverage
Seven direct tests cover FIFO compatibility, concurrent out-of-order completion, error/path precedence, unhandled requests, synchronous/asynchronous failure and recovery, and named/namespaced function serialization. Snapshots contain stable payloads rather than changing response IDs.
The original #655 only tested handler failures directly; this extraction adds coverage for the fixture's useful behavior without needing the later subagent feature.
Validation
npm ci --ignore-scriptsnpm run typechecknpm test: 1,915 passed, 36 skippednpm run test:integration: 7 passed, using the real Codex 0.164.0 app-server and local mock model, including existing shell-tool flowsnpm run buildgit diff --checkOnly test infrastructure is changed. The full live-model E2E suite and local cross-platform bundling were not run for this test-only extraction. Existing dependency audit findings are outside this scope.