88 isEmbeddedPiRunActive ,
99} from "../../agents/pi-embedded-runner/runs.js" ;
1010import { clearRuntimeConfigSnapshot } from "../../config/config.js" ;
11+ import type { OpenClawConfig } from "../../config/config.js" ;
1112import * as sessionTypesModule from "../../config/sessions.js" ;
1213import type { SessionEntry } from "../../config/sessions.js" ;
1314import { loadSessionStore , saveSessionStore } from "../../config/sessions.js" ;
@@ -292,6 +293,7 @@ describe("runReplyAgent auto-compaction token update", () => {
292293 async function runBaseReplyWithAgentMeta ( params : {
293294 agentMeta : Record < string , unknown > ;
294295 collectDiagnostics ?: boolean ;
296+ config ?: OpenClawConfig ;
295297 tmpPrefix : string ;
296298 workspaceDir ?: string ;
297299 } ) {
@@ -322,6 +324,7 @@ describe("runReplyAgent auto-compaction token update", () => {
322324 const { typing, sessionCtx, resolvedQueue, followupRun } = createBaseRun ( {
323325 storePath,
324326 sessionEntry,
327+ config : params . config ,
325328 workspaceDir : params . workspaceDir ,
326329 } ) ;
327330
@@ -507,7 +510,7 @@ describe("runReplyAgent auto-compaction token update", () => {
507510 ) ;
508511 } ) ;
509512
510- it ( "reads post-compaction context from the queued workspace instead of process cwd" , async ( ) => {
513+ it ( "reads opted-in post-compaction context from the queued workspace instead of process cwd" , async ( ) => {
511514 const workspaceDir = await fs . mkdtemp (
512515 path . join ( os . tmpdir ( ) , "openclaw-post-compaction-workspace-" ) ,
513516 ) ;
@@ -529,6 +532,13 @@ describe("runReplyAgent auto-compaction token update", () => {
529532 const { sessionKey } = await runBaseReplyWithAgentMeta ( {
530533 tmpPrefix : "openclaw-post-compaction-workspace-root-" ,
531534 workspaceDir,
535+ config : {
536+ agents : {
537+ defaults : {
538+ compaction : { postCompactionSections : [ "Session Startup" , "Red Lines" ] } ,
539+ } ,
540+ } ,
541+ } ,
532542 agentMeta : {
533543 compactionCount : 1 ,
534544 lastCallUsage : { input : 10_000 , output : 500 , total : 10_500 } ,
0 commit comments