Skip to content

Commit c52a2d3

Browse files
Radu028claude
andcommitted
fix(acp): /compact with preservation instructions also resends T3 notes
Only a bare /compact counted as a native compaction, so after '/compact keep the plan' the next prompts kept omitting the runtime notes the compaction may have removed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 4359e8c commit c52a2d3

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

‎apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,6 +1249,14 @@ describe("AcpAdapterV2", () => {
12491249
assert.deepEqual(yield* runTurn("/repro-skill"), [{ type: "text", text: "/repro-skill" }]);
12501250
assertReinjectedInstructions(yield* runTurn("Continue work."), "Continue work.");
12511251
assert.deepEqual(yield* runTurn("Finish work."), [{ type: "text", text: "Finish work." }]);
1252+
// Agents such as Grok accept preservation instructions after the command.
1253+
assert.deepEqual(yield* runTurn("/compact keep the plan"), [
1254+
{ type: "text", text: "/compact keep the plan" },
1255+
]);
1256+
assertReinjectedInstructions(
1257+
yield* runTurn("Continue after the focused compact."),
1258+
"Continue after the focused compact.",
1259+
);
12521260
}).pipe(Effect.provide(layerTest), Effect.scoped),
12531261
);
12541262

‎packages/provider-acp/src/server/adapter.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7052,7 +7052,8 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
70527052
const now = yield* DateTime.now;
70537053
if (
70547054
flavor.supportsCompaction === true &&
7055-
context.input.message.text.trim() === "/compact" &&
7055+
// Some agents accept preservation instructions after the command.
7056+
/^\/compact(?:\s|$)/.test(context.input.message.text.trim()) &&
70567057
context.input.message.attachments.length === 0 &&
70577058
settledStatus === "completed"
70587059
) {

0 commit comments

Comments
 (0)