Skip to content

Forward warning messages and compact notifications to client#175

Merged
benbrandt merged 1 commit intozed-industries:mainfrom
zerone0x:fix/forward-warning-and-compact-notification
Mar 5, 2026
Merged

Forward warning messages and compact notifications to client#175
benbrandt merged 1 commit intozed-industries:mainfrom
zerone0x:fix/forward-warning-and-compact-notification

Conversation

@zerone0x
Copy link
Contributor

@zerone0x zerone0x commented Mar 4, 2026

Summary

Fixes #164

When /compact runs, users received no feedback during the operation — the LLM-driven summarization ran silently and only a stopReason notification arrived at the end. This PR adds two complementary improvements:

  1. Context compaction notification: When a ContextCompaction turn item completes (via ItemCompleted event) or a ContextCompacted event fires, the adapter sends an agent message "Context compacted" to the client, giving users explicit confirmation.

  2. Warning forwarding: Codex emits user-facing Warning events in several situations — the post-compact advisory ("Heads up: Long threads…"), deprecated config notices, etc. Previously these were only logged server-side. Now they are also forwarded to the client as session/update agent messages.

Changes

  • src/thread.rs:
    • Import codex_protocol::items::TurnItem
    • In ItemCompleted handler: send "Context compacted" when item is ContextCompaction
    • In Warning handler: forward the message to the client as an agent text notification
    • Add explicit ContextCompacted handler (moved out of the ignored-events list)

🤖 Generated with Claude Code

After /compact runs, the client received no feedback — the LLM-driven
summarization ran silently and only a stopReason notification arrived.

This change improves the UX in two ways:

1. When a ContextCompaction TurnItem completes (or a ContextCompacted
   event fires), send an agent message "Context compacted" so users see
   explicit confirmation that the operation finished.

2. Forward Warning events as agent messages. Codex emits user-facing
   warnings in several situations (post-compact advisory, deprecated
   config notices, etc.). Previously they were only logged server-side;
   now clients receive them as session/update notifications.

Fixes zed-industries#164

Co-Authored-By: Claude <noreply@anthropic.com>
@benbrandt benbrandt merged commit a278432 into zed-industries:main Mar 5, 2026
10 checks passed
@zerone0x zerone0x deleted the fix/forward-warning-and-compact-notification branch March 5, 2026 14:17
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.

No status or completion message being shown after run /compact

2 participants