#9425: refactor(agents): replace console.warn with SubsystemLogger in compaction.ts
agents
size: XS
Cluster:
Refactor Console Logging in Agents
## Description
Refactors `src/agents/compaction.ts` to use the standardized `SubsystemLogger` instead of direct `console.warn` calls.
## Motivation
This improves logging consistency across the codebase.
## Changes
- Replaced `console.warn` with `log.warn`.
- - Initialized `createSubsystemLogger("agents/compaction")`.
## Tests
- Verified with existing tests: `npx vitest run src/agents/compaction.test.ts` (Passed).
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Replaces two `console.warn` calls with `log.warn` using the standardized `SubsystemLogger` in `src/agents/compaction.ts`.
- Adds import for `createSubsystemLogger` from `../logging/subsystem.js`
- Initializes logger with `createSubsystemLogger("agents/compaction")`
- Updates two error fallback paths in `summarizeWithFallback` function to use `log.warn` instead of `console.warn`
This change aligns with the codebase's logging conventions - multiple other files in `src/agents/` already follow this pattern (e.g., `tool-loop-detection.ts`, `tool-images.ts`, `cli-credentials.ts`).
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with no risk
- The change is a straightforward refactor that replaces direct `console.warn` calls with the standardized `SubsystemLogger.warn` method. The implementation follows established patterns used throughout the `src/agents/` directory, maintains identical functionality, and only affects logging output formatting. No logic changes or behavioral modifications are introduced.
- No files require special attention
<sub>Last reviewed commit: 38710fb</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#9974: refactor(agents): replace console.warn with SubsystemLogger in comp...
by dinakars777 · 2026-02-05
91.9%
#9461: refactor(cli): replace console.warn with SubsystemLogger in health.ts
by dinakars777 · 2026-02-05
84.9%
#9990: refactor(agents): replace console.warn with SubsystemLogger in veni...
by dinakars777 · 2026-02-06
84.5%
#23669: refactor(logging): migrate node-host and tailscale console calls to...
by kevinWangSheng · 2026-02-22
81.7%
#11153: refactor(hooks): replace console.warn/error with subsystem logger
by hclsys · 2026-02-07
79.0%
#11549: lint: add no-console rule and migrate 5 files to structured logger
by vaibhavtupe · 2026-02-08
77.3%
#11305: fix(logging): remove redundant subsystem prefix from log output
by janckerchen · 2026-02-07
76.6%
#11281: fix(logging): prevent subsystem loggers from bypassing file log lev...
by janckerchen · 2026-02-07
76.4%
#21804: fix: improve type safety and use project runtime logging
by hobostay · 2026-02-20
74.7%
#3392: fix(hooks): remove debug console.log statements from session-memory...
by WinJayX · 2026-01-28
74.5%