-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
Safeguard compaction ignores compaction.model config — uses session model instead #57901
Copy link
Copy link
Open
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
Bug
When
compaction.mode: "safeguard"is enabled with a customcompaction.model(e.g.,anthropic/claude-sonnet-4-6), the safeguard extension ignores it and uses the session's main model instead.Root Cause
In the safeguard extension's
session_before_compacthandler, the model is resolved as:This prefers
ctx.model(the session's main model, e.g., Opus) overruntime?.model(the configured compaction model fromagents.defaults.compaction.model). Sincectx.modelis always set for active sessions, the configured compaction model is never used.Expected Behavior
The configured
compaction.modelshould take precedence over the session model:Impact
compaction.modelconfig option is effectively broken in safeguard modeEnvironment
compaction.mode: "safeguard"compaction.model: "anthropic/claude-sonnet-4-6"Workaround
Patch the dist file directly: swap
ctx.model ?? runtime?.modeltoruntime?.model ?? ctx.modelin the safeguard extension.