refactor(agents): replace console.warn with SubsystemLogger in compaction-safeguard.ts (#9974)

Merged via squash.

Prepared head SHA: 35dcc5ba354ad7f058d796846bda9d1f8a416e04
Co-authored-by: dinakars777 <250428393+dinakars777@users.noreply.github.com>
Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com>
Reviewed-by: @jalehman
This commit is contained in:
Dinakar Sarbada
2026-03-12 19:34:55 -07:00
committed by GitHub
parent c8439f6587
commit 23c7fc745f
2 changed files with 3 additions and 2 deletions

View File

@@ -80,6 +80,7 @@ Docs: https://docs.openclaw.ai
- Gateway/hooks: bucket hook auth failures by forwarded client IP behind trusted proxies and warn when `hooks.allowedAgentIds` leaves hook routing unrestricted.
- Agents/compaction: skip the post-compaction `cache-ttl` marker write when a compaction completed in the same attempt, preventing the next turn from immediately triggering a second tiny compaction. (#28548) thanks @MoerAI.
- Native chat/macOS: add `/new`, `/reset`, and `/clear` reset triggers, keep shared main-session aliases aligned, and ignore stale model-selection completions so native chat state stays in sync across reset and fast model changes. (#10898) Thanks @Nachx639.
- Agents/compaction safeguard: route missing-model and missing-API-key cancellation warnings through the shared subsystem logger so they land in structured and file logs. (#9974) Thanks @dinakars777.
## 2026.3.11

View File

@@ -726,7 +726,7 @@ export default function compactionSafeguardExtension(api: ExtensionAPI): void {
// Use a WeakSet to track which session managers have already logged the warning.
if (!ctx.model && !runtime?.model && !missedModelWarningSessions.has(ctx.sessionManager)) {
missedModelWarningSessions.add(ctx.sessionManager);
console.warn(
log.warn(
"[compaction-safeguard] Both ctx.model and runtime.model are undefined. " +
"Compaction summarization will not run. This indicates extensionRunner.initialize() " +
"was not called and model was not passed through runtime registry.",
@@ -737,7 +737,7 @@ export default function compactionSafeguardExtension(api: ExtensionAPI): void {
const apiKey = await ctx.modelRegistry.getApiKey(model);
if (!apiKey) {
console.warn(
log.warn(
"Compaction safeguard: no API key available; cancelling compaction to preserve history.",
);
return { cancel: true };