fix(codex): keep foreign memory out of chats - #8989
Conversation
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a focused Codex bug fix that prevents foreign-thread memory output from being emitted into the active chat while preserving root events, child routing, and approval correlation. The runtime change is narrowly scoped and accompanied by unit and integration regression coverage. You can add or adjust custom eligibility rules. Learn more. |
|
Confirmed another occurrence on 2026-09-05 with T3 desktop 0.0.38 on NixOS, source checkout Observed reproduction:
Read-only inspection confirmed persistence, not just a rendering problem. Sanitized identities: The reports only entered conversation A's Codex transcript when I pasted the mixed UI transcript back to the assistant. This is the same user-visible failure as #4683 despite the earlier fix. I checked this PR's actual The follow-up filter remains absent from upstream |
Codex background memory work can begin emitting item notifications on an existing app-server subscription without sending a new thread/started notification. The stateful memory filter never learns that provider thread ID, so its assistant text can be projected into the active T3 chat.
This treats the active Codex provider thread ID as the chat ownership boundary. Known notifications addressed to another thread are suppressed even when their lifecycle start was missed. Registered multi-agent children still use their dedicated routing, and serverRequest/resolved still passes through for approval correlation cleanup.
The regression replay matches the observed ordering: agent message delta and item completion for a memory thread with no preceding thread/started.
Verification:
Generated with GPT-5.6 Sol in T3 Code via the Codex harness.
Note
Medium Risk
Changes Codex notification routing for all non-root threads; incorrect suppression could hide legitimate cross-thread traffic, though collab interception and serverRequest/resolved exceptions limit blast radius.
Overview
Fixes background Codex memory work showing up in the active T3 chat when item deltas arrive on an existing app-server subscription without a preceding
thread/started, so the stateful memory filter never learns that thread id.The runtime now treats the active provider thread id as the chat boundary: exported
shouldSuppressForeignConversationNotificationdrops any known notification whosethreadIddiffers from the root, includingitem/agentMessage/deltaanditem/completed, independent of lifecycle registration. Registered collab children still go through interception first;serverRequest/resolvedstill passes through for approval correlation.Suppression logic is split so v1 receiver-map children keep lifecycle-only routing via
shouldSuppressChildConversationNotification, while the new helper handles the broader foreign-thread case (including the memory leak ordering).Tests cover the helper directly and extend the collab integration replay to assert no events leak for the memory thread.
Reviewed by Cursor Bugbot for commit 509d07f. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Suppress foreign memory-thread notifications in
makeCodexSessionRuntimeshouldSuppressForeignConversationNotificationto classify non-root-thread notifications as suppressible, exceptserverRequest/resolved.thread/started.makeCodexSessionRuntimenow drops all non-root-threaditem/*notifications; any consumer relying on foreign thread deltas appearing in the session stream will no longer receive them.Macroscope summarized 509d07f.