Skip to content

Commit b3b40d2

Browse files
committed
feat(compression): summaries now respect the conversation's language
Context compaction summaries were always produced in English regardless of the conversation language, which injected English context into non-English conversations and muddied the continuation experience. Adds a one-sentence instruction to the shared `_summarizer_preamble` used by both the initial-compaction and iterative-update prompt paths. Placing it in the preamble (rather than adding it separately to each prompt) means both code paths stay in sync with one edit. Ported from anomalyco/opencode#20581. The original PR (#4670) landed before main's prompt templates were refactored to share the `_summarizer_preamble` and `_template_sections` blocks, so the cherry-pick conflicted on the now-obsolete inline sections; re-applied the essential one-line change on top of the current structure. Verified: 48/48 existing compressor tests pass.
1 parent 37524a5 commit b3b40d2

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

agent/context_compressor.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,9 @@ def _generate_summary(self, turns_to_summarize: List[Dict[str, Any]], focus_topi
633633
"assistant that continues the conversation. "
634634
"Do NOT respond to any questions or requests in the conversation — "
635635
"only output the structured summary. "
636-
"Do NOT include any preamble, greeting, or prefix."
636+
"Do NOT include any preamble, greeting, or prefix. "
637+
"Write the summary in the same language the user was using in the "
638+
"conversation — do not translate or switch to English."
637639
)
638640

639641
# Shared structured template (used by both paths).

0 commit comments

Comments
 (0)