Skip to content

agentHost: keep replacement Codex backings out of discovery - #341936

Merged
roblourens merged 1 commit into
mainfrom
roblou/agents/investigate-broken-test-484970
Oct 16, 2026
Merged

roblourens merged 1 commit into
mainfrom
roblou/agents/investigate-broken-test-484970

Conversation

@roblourens

Copy link
Copy Markdown
Member

Summary

Fixes the Codex creates a new text file failure 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.

  • Refresh an already-published backing receipt after a pre-turn replacement, while keeping unsent drafts provisional and allowing a failed replacement to publish its backing on retry.
  • Keep session/ready idempotent when the host receives another materialization receipt.
  • Strengthen replacement/retry and lifecycle regression assertions, and document the discovery failure mode.

The backing regression assertion failed before the fix: the receipt named prewarm-thread while turn/start used trusted-thread. The lifecycle regression also failed before its guard, emitting session/ready twice. 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)

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]>
Copilot AI balanced review requested due to automatic review settings October 16, 2026 03:32
@github-actions

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: 5e6c9cde Current: 45fe9998

Changed (1)

sessions/chatCompositeBar/OverflowingTabs/Light
Before After
before after

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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.

@roblourens
roblourens marked this pull request as ready for review October 16, 2026 16:24
@roblourens
roblourens merged commit cec60b7 into main Oct 16, 2026
58 of 59 checks passed
@roblourens
roblourens deleted the roblou/agents/investigate-broken-test-484970 branch October 16, 2026 16:24
@vs-code-engineering vs-code-engineering Bot added this to the 1.143.0 milestone Oct 16, 2026
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.

3 participants