Repository navigation
refactor: replay historical child outcomes - #686
Merged
Merged
Conversation
benbrandt
added a commit
that referenced
this pull request
Oct 26, 2026
## Summary Small replay omission found while auditing the completed #655 extraction after #686 merged. All eight planned slices are already on `main`; this is a narrowly scoped correctness follow-up, not another feature tranche. A legacy `spawnAgent` record can establish a coordinator's identity and parent without an agent path. Later replay may supply that coordinator's path and newly recorded nested child activity. Previously `announceHistory` returned immediately for the known coordinator, discarding the available path. The nested activity then could not resolve its immediate parent, so valid descendant history was omitted with a gap advisory. Fill a known child's **missing** normalized path from recorded activity before descending into its history. Do not replace an already observed path with older history. Identities, established parent links, titles, runtime ownership, capabilities, AIR behavior, and v1/v2 negotiation remain unchanged. **2 files, +39/-1 lines. No snapshot changes.** ## Regression evidence - Four v1/v2 warm/cold replay cases failed on current `main` before the fix: a live or restored pathless coordinator prevented newly recovered descendant text from replaying. - Those four cases now replay the text under the correct immediate parent without a false gap. - Two additional v1/v2 cases preserve an already observed parent path when an older spawn record disagrees. ## Validation - `npm run typecheck` - `npm test`: **2,070 passed**, 39 skipped - `npm run build` - `npm run test:integration`: **15 passed** against real Codex 0.164.0 with a local mock Responses API - `npm run bundle:all`: all six targets compiled - `git diff --check` The full live-model E2E suite and an additional live-model smoke test were not run for this fix. Cross-platform bundles were compiled, not executed on each target OS. ## Audit context The remaining old #655 diff largely reflects replaced implementations, differently organized tests/snapshots, and intervening trunk work such as native model reporting. In particular its older queue-completion helper and model implementation must not replace the corrected trunk versions. The combined PR should not be merged wholesale. Checked current specification revision `c0897908cb2305e89203218c348d69ab4acf9d61`. This fix retains the [RFD's truthful identity, parentage, and parent-before-child replay ordering](https://github.com/agentclientprotocol/agent-client-protocol/blob/c0897908cb2305e89203218c348d69ab4acf9d61/docs/rfds/subagents.mdx#L724-L755); it adds no wire fields or mutation authority.
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
Final planned extraction (step 8) from #655, directly against current
mainafter #685.idlebefore the load/resume response, using the same stop-reason/error mapping as live turn endings.limit: 1, descending, no items); an unavailable summary retains available transcript content and uses the existing history-gap advisory.V1 opt-in gating, v2 defaults, AIR behavior, current configuration reporting, child identities, ancestry, and empty capabilities remain unchanged. Dependencies and generated app-server types are untouched. Existing AIR and parent-session golden transcripts are unchanged. Two existing v2 child-replay snapshots gain the intended historical
state_update.Review size
15 files, +422/-22 lines. Most additions are tests/snapshots; runtime changes touch only the history reader, standard replay dispatcher, and standard child router. The router shares one explicit terminal-status mapping between live and historical reporting, but historical publication bypasses the live state cache.
Validation
npm run typechecknpm test: 2,064 passed, 39 skipped, including 36 new v1/v2 outcome regressions.npm run buildnpm run test:integration: 15 passed with real Codex 0.164.0 and a local mock Responses API. The v1/v2 completion cases now close the parent and cold-load it before checking the recorded ending, avoiding a cached live ending as a false positive.npm run bundle:all: all six targets compiled.npm run codex-test -- -p 'Reply with exactly historical-outcomes-ok. Do not read files or use tools.' -c <isolated-scratch-directory> -o summary: live-model smoke completed withend_turn.git diff --checkWire regressions cover both history stores, completion/cancellation/failure, unavailable or running final turns, response ordering, no mutation/interrupt authority, independent paginated summary failures, latest-turn selection, a subsequent non-replaying resume, newer live permissions and actual work completion, nested ancestry and repeated spawn records, late summaries after close, and failures without details.
The full live-model E2E suite was not run. Cross-platform bundles were compiled, not executed on each target OS.
Specification / reference check
main,5a5ab96ea8e0f6d3d5c5d7de3a7d29a87c79ddd2: the subagent RFD replay rules and freshness boundary distinguish historical pre-response state from confirmed current activity and controls, and prohibit inventing outcomes from missing history.rfd-replayed-subagent-outcomesbranch, not specification main. It permits keeping a recorded idle outcome visible without treating it as current activity or authorization. This implementation is compatible with both versions and requires no new wire fields.main,c7e07388feed7a530f8211d0dae4951cb6d26d09, checked separately as reference/type evidence. Installed SDK 2.0.2 performs real wire decoding in the regression tests; this change reuses the existing v1/v2 state publication and actual response-write freshness boundary.This finishes the eight planned extraction scopes once merged; it does not merge the old combined #655 wholesale. Child mutation controls and directed-message extensions remain outside this work.