fix(codex): keep background memory out of chats - #5468
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Needs human review This PR introduces runtime behavior that filters memory_consolidation thread notifications from chat, preventing them from appearing in the UI. While well-tested, this is a meaningful change to notification visibility that warrants human review. You can customize Macroscope's approvability policy. Learn more. |
8f751f0 to
dc5b475
Compare
|
#5219 routes registered This PR specifically recognizes |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 78cec14. Configure here.
Dismissing prior approval to re-evaluate 48b0235

What Changed
Codex memory consolidation runs in background threads, but T3 treated their notifications as part of the active chat. Internal messages and tool activity could therefore appear in the user's conversation.
T3 now recognizes both current and legacy memory-thread metadata and filters notifications from those threads before provider events are emitted. Tracking is removed when the internal thread closes.
Why
This keeps background memory maintenance isolated without hiding normal commentary, review or compaction work, or user-created subagents.
Fixes #4683
Validation
vp test run apps/server/src/provider/Layers/CodexSessionRuntime.test.tsvp lint apps/server/src/provider/Layers/CodexSessionRuntime.ts apps/server/src/provider/Layers/CodexSessionRuntime.test.tsvp run --filter t3 typecheckvp fmt --check apps/server/src/provider/Layers/CodexSessionRuntime.ts apps/server/src/provider/Layers/CodexSessionRuntime.test.tsChecklist
Built with gpt-5.6-sol using the Codex harness in T3 Code.
Note
Filter memory consolidation thread notifications out of Codex session events
makeMemoryConsolidationNotificationFilterinCodexSessionRuntime.tsthat tracks threads withthreadSource === 'memory_consolidation'(or legacy{ subAgent: 'memory_consolidation' }source) and returns a predicate to suppress their notifications.makeCodexSessionRuntimeso thatCodexSessionRuntime.eventsnever emits notifications for memory consolidation threads; suppression ends afterthread/closedis received.CodexSessionRuntime.eventswill no longer see any events from memory consolidation sub-agent threads.Macroscope summarized a13c20c.
Note
Low Risk
Scoped to Codex notification routing with unit and integration coverage; does not change auth, persistence, or visible collab subagent behavior.
Overview
Codex memory consolidation background threads were surfacing in the user chat because their app-server notifications flowed through
CodexSessionRuntimelike normal conversation traffic.This PR adds
makeMemoryConsolidationNotificationFilter, which registers threads markedthreadSource === "memory_consolidation"or legacysource.subAgent === "memory_consolidation", suppresses all subsequent notifications for those thread IDs, and clears tracking onthread/closed.handleRawNotificationreturns early for suppressed notifications so they never become provider events, while other subagent types (review, compact, collab spawns) stay visible.The collab Stop integration test now replays a memory-consolidation thread and asserts it is interrupted with collab children but does not appear as chat output.
Reviewed by Cursor Bugbot for commit a13c20c. Bugbot is set up for automated code reviews on this repo. Configure here.