Repository navigation
agentHost: keep replacement Codex backings out of discovery - #341936
Merged
Merged
Conversation
Publish replacement backing identities after a pre-turn Codex restart without publishing unsent drafts. Keep repeated materialization receipts from emitting another readiness transition, and cover replacement, retry, and lifecycle behavior. Co-authored-by: Copilot <[email protected]>
Contributor
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused fixes have targeted regression coverage and no blocking findings; Azure cross-platform validation remains outstanding.
0 open findings
What changed in this PR
Prevents replacement Codex threads from appearing as unrelated sessions in Agent Host discovery.
Changes:
- Refreshes published backing receipts while preserving provisional drafts and retries.
- Makes session readiness notifications idempotent.
- Strengthens regression assertions and documents the discovery failure mode.
| File | Description |
|---|---|
| src/vs/platform/agentHost/test/node/e2e/README.md | Documents unexpected session discovery troubleshooting. |
| src/vs/platform/agentHost/test/node/codex/codexCreateChat.test.ts | Checks replacement and retry backing receipts. |
| src/vs/platform/agentHost/test/node/agentService.test.ts | Verifies readiness is published only once. |
| src/vs/platform/agentHost/node/codex/codexAgent.ts | Refreshes receipts after thread replacement. |
| src/vs/platform/agentHost/node/agentService.ts | Guards against duplicate readiness actions. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Giuseppe Cianci (Giuspepe)
approved these changes
Oct 16, 2026
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
Fixes the Codex
creates a new text filefailure in Azure build 484970.Codex can replace a prewarmed thread during the first send after its original materialization receipt has already been published. The replacement did not refresh that receipt, so the host suppressed the old native backing but not the thread that actually received the turn. After session disposal, background discovery could announce the retained replacement thread as an unrelated top-level session during a later test.
session/readyidempotent when the host receives another materialization receipt.The backing regression assertion failed before the fix: the receipt named
prewarm-threadwhileturn/startusedtrusted-thread. The lifecycle regression also failed before its guard, emittingsession/readytwice. The original E2E assertions and committed fixtures/snapshots are unchanged; per-test data-directory isolation would hide the production bug.Validation
Local macOS validation:
npm run build-fast -- --client-only— passed.npm run typecheck-client— passed../scripts/test.sh --run src/vs/platform/agentHost/test/node/codex/codexCreateChat.test.ts --run src/vs/platform/agentHost/test/node/codex/codexPrewarmEviction.test.ts --run src/vs/platform/agentHost/test/node/codex/codexChatDiscovery.test.ts --run src/vs/platform/agentHost/test/node/agentService.test.ts --reporter dot— 1,272 passed, 16 pending../scripts/test-integration.sh --run src/vs/platform/agentHost/test/node/e2e/providers/codexAgentHostE2E.integrationTest.ts --reporter dot— 152 passed, 35 pending../scripts/test-integration.sh --run src/vs/platform/agentHost/test/node/e2e/providers/claudeAgentHostE2E.integrationTest.ts --run src/vs/platform/agentHost/test/node/e2e/providers/copilotAgentHostE2E.integrationTest.ts --grep 'creates a new text file|edits an existing text file|deletes a workspace file|session metadata history and provider context survive a host restart' --reporter dot— 8 passed.npm run eslint -- src/vs/platform/agentHost/node/codex/codexAgent.ts src/vs/platform/agentHost/node/agentService.ts src/vs/platform/agentHost/test/node/codex/codexCreateChat.test.ts src/vs/platform/agentHost/test/node/agentService.test.ts— passed.git diff --check— passed.Azure cross-platform validation has not been rerun.
(Written by Copilot)