Skip to content

Commit 2e35106

Browse files
committed
fix(agent-core-v2): simplify the continuation anchor to a single statement
1 parent 915d462 commit 2e35106

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

packages/agent-core-v2/src/agent/contextMemory/compactionHandoff.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export function createCompactionContinuationMessage(): ContextMessage {
163163

164164
export function buildCompactionContinuationText(): string {
165165
return wrapSystemReminder(
166-
'Context compaction is complete — resume from the latest user message; if a turn was in flight when compaction began, finish that turn first.',
166+
'Context compaction is complete — continue the work for the latest user message from where it stopped.',
167167
);
168168
}
169169

packages/agent-core-v2/test/agent/fullCompaction/fullCompaction.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,7 +1545,7 @@ describe('FullCompaction', () => {
15451545
{
15461546
"role": "user",
15471547
"text": "<system-reminder>
1548-
Context compaction is complete — resume from the latest user message; if a turn was in flight when compaction began, finish that turn first.
1548+
Context compaction is complete — continue the work for the latest user message from where it stopped.
15491549
</system-reminder>",
15501550
},
15511551
]
@@ -1775,14 +1775,14 @@ describe('FullCompaction', () => {
17751775
messages:
17761776
user: text "old user one\\n\\nold user two\\n\\nrecent user three\\n\\nAnswer after compacting"
17771777
user: text "The conversation so far has been compacted to free up context. What follows is your own working summary of this task — use it to continue your train of thought rather than starting over. Treat it as notes, not proof: where it says a step was done, tests passed, or a fix worked, verify that yourself before relying on it. Any user messages earlier in this context are preserved verbatim from the compacted conversation; where a system-reminder note among them marks an omitted middle section, the user messages it replaced are covered by this summary. Respond to the latest genuine user message — earlier requests recorded in the summary were already addressed.\\nAuto compacted summary."
1778-
user: text "<system-reminder>\\nContext compaction is complete — resume from the latest user message; if a turn was in flight when compaction began, finish that turn first.\\n</system-reminder>"
1778+
user: text "<system-reminder>\\nContext compaction is complete — continue the work for the latest user message from where it stopped.\\n</system-reminder>"
17791779
`);
17801780
expect(records).toContainEqual({
17811781
event: 'compaction_finished',
17821782
properties: expect.objectContaining({
17831783
source: 'auto',
17841784
tokens_before: 6_169,
1785-
tokens_after: 6_199,
1785+
tokens_after: 6_190,
17861786
compacted_count: 7,
17871787
retry_count: 0,
17881788
}),
@@ -2390,7 +2390,7 @@ describe('FullCompaction', () => {
23902390
"user: The conversation so far has been compacted to free up context. What follows is your own working summary of this task — use it to continue your train of thought rather than starting over. Treat it as notes, not proof: where it says a step was done, tests passed, or a fix worked, verify that yourself before relying on it. Any user messages earlier in this context are preserved verbatim from the compacted conversation; where a system-reminder note among them marks an omitted middle section, the user messages it replaced are covered by this summary. Respond to the latest genuine user message — earlier requests recorded in the summary were already addressed.
23912391
Overflow compacted summary.",
23922392
"user: <system-reminder>
2393-
Context compaction is complete — resume from the latest user message; if a turn was in flight when compaction began, finish that turn first.
2393+
Context compaction is complete — continue the work for the latest user message from where it stopped.
23942394
</system-reminder>",
23952395
],
23962396
]
@@ -3258,7 +3258,7 @@ describe('FullCompaction', () => {
32583258
"user: The conversation so far has been compacted to free up context. What follows is your own working summary of this task — use it to continue your train of thought rather than starting over. Treat it as notes, not proof: where it says a step was done, tests passed, or a fix worked, verify that yourself before relying on it. Any user messages earlier in this context are preserved verbatim from the compacted conversation; where a system-reminder note among them marks an omitted middle section, the user messages it replaced are covered by this summary. Respond to the latest genuine user message — earlier requests recorded in the summary were already addressed.
32593259
Placeholder compacted summary.",
32603260
"user: <system-reminder>
3261-
Context compaction is complete — resume from the latest user message; if a turn was in flight when compaction began, finish that turn first.
3261+
Context compaction is complete — continue the work for the latest user message from where it stopped.
32623262
</system-reminder>",
32633263
],
32643264
]

0 commit comments

Comments
 (0)