@@ -518,7 +518,10 @@ describe("chatDirector compaction", () => {
518518 }
519519
520520 test ( "compacts at the tool.done pause once over threshold" , async ( ) => {
521- const director = chatDirectorWithContinuation ( ) ;
521+ const director = createChatDirector ( "Corbits operating prompt" , [ ] , {
522+ onTasksChange : ( ) => { } ,
523+ requestContinuation : ( ) => { } ,
524+ } ) ;
522525 await director . decide ( overThresholdToolTurn ( ) , longState , mockCapabilities ) ;
523526 const actions = actionsArray (
524527 await director . decide ( makeToolDoneEvent ( "t1" ) , longState , mockCapabilities ) ,
@@ -535,6 +538,10 @@ describe("chatDirector compaction", () => {
535538 await director . decide ( messageReceived ( "" ) , longState , mockCapabilities ) ,
536539 ) ;
537540 expect ( resumed . some ( ( a ) => a . type === "infer" ) ) . toBe ( true ) ;
541+ const infer = resumed . find ( ( a ) => a . type === "infer" ) ;
542+ const options : ExtendedInferenceOptions | undefined =
543+ infer ?. type === "infer" ? infer . options : undefined ;
544+ expect ( options ?. systemPrompt ) . toBe ( "Corbits operating prompt" ) ;
538545 } ) ;
539546
540547 // CL-6910: `timeout`/`retryable` are owned entirely by the harness's own
@@ -602,7 +609,10 @@ describe("chatDirector compaction", () => {
602609
603610 test ( "a context_overflow inference error triggers compact-and-retry, not a terminal reply" , async ( ) => {
604611 let continuations = 0 ;
605- const director = chatDirectorWithContinuation ( ( ) => continuations ++ ) ;
612+ const director = createChatDirector ( "Corbits operating prompt" , [ ] , {
613+ onTasksChange : ( ) => { } ,
614+ requestContinuation : ( ) => continuations ++ ,
615+ } ) ;
606616 const actions = actionsArray (
607617 await director . decide ( overflowError ( ) , longState , mockCapabilities ) ,
608618 ) ;
@@ -615,6 +625,10 @@ describe("chatDirector compaction", () => {
615625 await director . decide ( messageReceived ( "" ) , longState , mockCapabilities ) ,
616626 ) ;
617627 expect ( resumed . some ( ( a ) => a . type === "infer" ) ) . toBe ( true ) ;
628+ const infer = resumed . find ( ( a ) => a . type === "infer" ) ;
629+ const options : ExtendedInferenceOptions | undefined =
630+ infer ?. type === "infer" ? infer . options : undefined ;
631+ expect ( options ?. systemPrompt ) . toBe ( "Corbits operating prompt" ) ;
618632 } ) ;
619633
620634 test ( "overflow recovery is bounded so an incompressible history cannot loop forever" , async ( ) => {
@@ -1038,7 +1052,7 @@ describe("transient nudges", () => {
10381052 source : "test" ,
10391053 } ) as unknown as ReactorInboundEvent ;
10401054
1041- test ( "open-task nudge uses ephemeralTurns, not systemPrompt " , async ( ) => {
1055+ test ( "open-task nudge uses ephemeralTurns and keeps the stable system prompt " , async ( ) => {
10421056 const director = createChatDirector ( "stable-base" , [ ] , { onTasksChange : ( ) => { } } ) ;
10431057 await director . decide ( manageTasksEvent ( "doing" ) , mockState , mockCapabilities ) ;
10441058 const actions = actionsArray ( await director . decide ( textTurn ( ) , mockState , mockCapabilities ) ) ;
@@ -1050,6 +1064,6 @@ describe("transient nudges", () => {
10501064 expect ( options ?. ephemeralTurns ?. length ?? 0 ) . toBeGreaterThan ( 0 ) ;
10511065 const nudgeText = options ?. ephemeralTurns ?. [ 0 ] ?. content ?. find ( ( b ) => b . type === "text" ) ;
10521066 expect ( nudgeText ?. type === "text" ? nudgeText . text : "" ) . toContain ( "tasks are still open" ) ;
1053- expect ( options ?. systemPrompt ) . toBeUndefined ( ) ;
1067+ expect ( options ?. systemPrompt ) . toBe ( "stable-base" ) ;
10541068 } ) ;
10551069} ) ;
0 commit comments