refactor(coderd/x/chatd): drop the unreachable override window gate

With the fixed 80% trigger, an override trigger is disabled only for a zero window, which the context_limit > 0 check rejects, so a set override always becomes the organization trigger and summarizer. The 80% comment now calls the rest of the window headroom rather than a guarantee, and a test chat title matches its subtest.
This commit is contained in:
Michael Suchacz committed 2026-10-09 17:29:00 +00:00
1 parent 987cefe399
commit 6e8efb9054
2 files changed
+10 -13

No files matched your search

+1 -1
View File
@@ -7281,7 +7281,7 @@ func TestActiveServer_CompactionModelOverride(t *testing.T) {
OwnerID: user.ID,
WorkspaceID: uuid.NullUUID{UUID: ws.ID, Valid: true},
AgentID: uuid.NullUUID{UUID: dbAgent.ID, Valid: true},
Title: "compaction-override-threshold-lowered",
Title: "compaction-override-added-lower-trigger",
ModelConfigID: model.ID,
InitialUserContent: []codersdk.ChatMessagePart{
codersdk.ChatMessageText("read the file and continue"),
+9 -12
View File
@@ -850,16 +850,12 @@ func (server *Server) prepareGeneration(
thresholdPercent: compactionOverrideWindowPercent,
contextLimit: resolvedCompactionOverride.Config.ContextLimit,
}
// With an unknown window, nothing bounds the history by the
// override's window, so the chat model summarizes instead.
if overrideTrigger.enabled() {
compactionOverride = &resolvedCompactionOverride
otherTrigger = overrideTrigger
bindingSource = bindingCompactionTriggerSource(chatTrigger, overrideTrigger)
if bindingSource == compactionTriggerSourceOrganization {
binding = overrideTrigger
otherTrigger = chatTrigger
}
compactionOverride = &resolvedCompactionOverride
otherTrigger = overrideTrigger
bindingSource = bindingCompactionTriggerSource(chatTrigger, overrideTrigger)
if bindingSource == compactionTriggerSourceOrganization {
binding = overrideTrigger
otherTrigger = chatTrigger
}
}
compactionStepUsage := latestPromptUsage(promptRows)
@@ -959,8 +955,9 @@ func latestPromptUsage(messages []database.ChatMessage) fantasy.Usage {
return fantasy.Usage{}
}
// compactionOverrideWindowPercent leaves room in the override's window for
// the summary prompt and the summary.
// compactionOverrideWindowPercent leaves the rest of the override's window as
// headroom for the summary prompt and summary. It is a target margin, not a
// guarantee: the trigger reads the previous step's prompt usage.
const compactionOverrideWindowPercent = int32(80)
type compactionTrigger struct {