Skip to content

Preserve Context Builder pending context through routing#566

Open
morluto wants to merge 1 commit into
repoprompt:mainfrom
morluto:fix/issue-562-pending-final-context
Open

Preserve Context Builder pending context through routing#566
morluto wants to merge 1 commit into
repoprompt:mainfrom
morluto:fix/issue-562-pending-final-context

Conversation

@morluto

@morluto morluto commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • promote exact queued Context Builder context when pending-policy routing establishes the run/connection mapping
  • preserve it through orderly peer EOF even when the child never calls a context-resolving tool
  • restore promoted context exactly once if tentative policy mapping rolls back
  • preserve read-file auto-selection handover lineage for replacement connections
  • add lifecycle, rollback, and reconnect regression coverage

Root cause

Frozen run context was queued before the child connection existed, but it was only bound during a later context-resolving tool call. A child that initialized/listed tools and exited normally therefore reached teardown with no bound context to detach, and final commit reported missingFinalContext(connection none).

Validation

  • ContextBuilderRunLifecycleTests: 12/12 passed
  • MCPAgentPolicyAdmissionRaceTests: 32/32 passed
  • TabContextRoutingTests: 49/49 passed
  • read-file auto-selection suite: 20/20 passed
  • strict Swift format/lint: passed
  • RepoPrompt coordinated build: passed
  • exact-ID ledger verification: passed
  • final Codex autoreview: clean

The full pr-ready suite was attempted and stopped on two unrelated tests outside this diff; both passed immediately when rerun in isolation.

Closes #562

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

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.

Context Builder loses pending final context when a routed child exits before resolving tab context

1 participant