← Back to PRs

#21547: feat: add compaction.announce config to notify users of compaction start/end

by jlwestsr open 2026-02-20 02:50 View on GitHub →
docs agents size: M
## Summary Add a new `agents.defaults.compaction.announce` (boolean) config option that sends user-visible messages when auto-compaction starts and ends, **independently of verbose mode**. ## Motivation In multi-user setups (Discord servers, group chats), compaction can take 30+ seconds to several minutes. During this time, users see no response and may think the agent is broken or ignoring them. The existing compaction message only appears when verbose mode is enabled, which also enables other noisy output most users don't want. This feature was inspired by a user comparing it to game servers announcing "World save in 2 minutes" — a simple status message that sets expectations. ## Changes | File | Change | |------|--------| | `types.agent-defaults.ts` | Add `announce?: boolean` to `AgentCompactionConfig` | | `zod-schema.agent-defaults.ts` | Add `announce` to Zod validation | | `agent-runner-execution.ts` | Emit start message via `onBlockReply` when compaction begins | | `agent-runner.ts` | Emit end message when `announce` is enabled (not just verbose) | | `followup-runner.ts` | Same for followup runner path | ## Config ```json { "agents": { "defaults": { "compaction": { "announce": true } } } } ``` ## Behavior - **Start**: `🧹 Compacting memory — back in a moment…` (sent mid-stream via block reply) - **End**: `🧹 Auto-compaction complete (count N).` (prepended to final reply) - Default: `false` (no behavior change for existing users) - Works alongside verbose mode — if both are enabled, no duplicate messages ## Testing - Existing `wired-hooks-compaction.test.ts` passes (3/3) - Existing `agent-runner.runreplyagent.test.ts` "announces auto-compaction" test passes - TypeScript compiles cleanly (no new errors) - Zero impact when `announce` is not set (default `false`) <!-- greptile_comment --> <h3>Greptile Summary</h3> This PR adds a new config option `agents.defaults.compaction.announce` that allows users to receive compaction status messages independently of verbose mode. This addresses a UX gap in multi-user environments where compaction can take 30+ seconds and users see no feedback. **Key changes:** - Adds `announce?: boolean` to `AgentCompactionConfig` type and Zod schema (defaults to `false` for backwards compatibility) - Updates `agent-runner-execution.ts` to emit "🧹 Compacting memory — back in a moment…" via `onBlockReply` when compaction starts - Updates `agent-runner.ts` and `followup-runner.ts` to prepend "🧹 Auto-compaction complete (count N)." to final payloads when compaction ends The implementation correctly checks for the config flag and uses the existing `onBlockReply` mechanism for mid-stream notifications. The changes are minimal, focused, and follow existing patterns in the codebase. <h3>Confidence Score: 3/5</h3> - This PR is mostly safe to merge but has one implementation gap that should be addressed - The config schema changes and agent-runner implementation are correct, but followup-runner is missing the compaction start announcement that agent-runner-execution has. This creates an inconsistency where some code paths will show the start message and others won't. The feature will partially work but not uniformly across all execution paths. - Pay special attention to `src/auto-reply/reply/followup-runner.ts` which needs the start phase handling <sub>Last reviewed commit: 79ccf46</sub> <!-- greptile_other_comments_section --> <sub>(4/5) You can add custom instructions or style guidelines for the agent [here](https://app.greptile.com/review/github)!</sub> <!-- /greptile_comment -->

Most Similar PRs