@@ -510,15 +510,15 @@ describe("chatDirector compaction", () => {
510510 } as unknown as ReactorInboundEvent ;
511511 }
512512
513- function chatDirectorWithContinuation ( onContinuation ?: ( ) => void ) {
514- return createChatDirector ( "" , [ ] , {
513+ function chatDirectorWithContinuation ( systemPrompt : string , onContinuation ?: ( ) => void ) {
514+ return createChatDirector ( systemPrompt , [ ] , {
515515 onTasksChange : ( ) => { } ,
516516 requestContinuation : onContinuation ?? ( ( ) => { } ) ,
517517 } ) ;
518518 }
519519
520520 test ( "compacts at the tool.done pause once over threshold" , async ( ) => {
521- const director = chatDirectorWithContinuation ( ) ;
521+ const director = chatDirectorWithContinuation ( "Corbits operating prompt" ) ;
522522 await director . decide ( overThresholdToolTurn ( ) , longState , mockCapabilities ) ;
523523 const actions = actionsArray (
524524 await director . decide ( makeToolDoneEvent ( "t1" ) , longState , mockCapabilities ) ,
@@ -535,6 +535,10 @@ describe("chatDirector compaction", () => {
535535 await director . decide ( messageReceived ( "" ) , longState , mockCapabilities ) ,
536536 ) ;
537537 expect ( resumed . some ( ( a ) => a . type === "infer" ) ) . toBe ( true ) ;
538+ const infer = resumed . find ( ( a ) => a . type === "infer" ) ;
539+ const options : ExtendedInferenceOptions | undefined =
540+ infer ?. type === "infer" ? infer . options : undefined ;
541+ expect ( options ?. systemPrompt ) . toBe ( "Corbits operating prompt" ) ;
538542 } ) ;
539543
540544 // CL-6910: `timeout`/`retryable` are owned entirely by the harness's own
@@ -545,7 +549,7 @@ describe("chatDirector compaction", () => {
545549 // turn); it now falls through to the base director's terminal
546550 // checkpoint + reply instead of recovering.
547551 test ( "does not re-issue inference for a timeout already exhausted by the harness" , async ( ) => {
548- const director = chatDirectorWithContinuation ( ) ;
552+ const director = chatDirectorWithContinuation ( "" ) ;
549553 const timeout = {
550554 type : "inference.error" ,
551555 error : { category : "timeout" , message : "request timed out" } ,
@@ -557,7 +561,7 @@ describe("chatDirector compaction", () => {
557561 } ) ;
558562
559563 test ( "recovers an internally aborted inference but keeps explicit abort terminal" , async ( ) => {
560- const director = chatDirectorWithContinuation ( ) ;
564+ const director = chatDirectorWithContinuation ( "Corbits operating prompt" ) ;
561565 const internalAbort = {
562566 type : "inference.error" ,
563567 error : {
@@ -570,6 +574,10 @@ describe("chatDirector compaction", () => {
570574 await director . decide ( internalAbort , longState , mockCapabilities ) ,
571575 ) ;
572576 expect ( recovered . some ( ( action ) => action . type === "infer" ) ) . toBe ( true ) ;
577+ const infer = recovered . find ( ( action ) => action . type === "infer" ) ;
578+ const options : ExtendedInferenceOptions | undefined =
579+ infer ?. type === "infer" ? infer . options : undefined ;
580+ expect ( options ?. systemPrompt ) . toBe ( "Corbits operating prompt" ) ;
573581
574582 const explicitAbort = {
575583 type : "abort" ,
@@ -581,7 +589,7 @@ describe("chatDirector compaction", () => {
581589 } ) ;
582590
583591 test ( "does not auto-recover user-stop aborted inference errors" , async ( ) => {
584- const director = chatDirectorWithContinuation ( ) ;
592+ const director = chatDirectorWithContinuation ( "" ) ;
585593 const userStopAbort = {
586594 type : "inference.error" ,
587595 error : {
@@ -602,7 +610,10 @@ describe("chatDirector compaction", () => {
602610
603611 test ( "a context_overflow inference error triggers compact-and-retry, not a terminal reply" , async ( ) => {
604612 let continuations = 0 ;
605- const director = chatDirectorWithContinuation ( ( ) => continuations ++ ) ;
613+ const director = chatDirectorWithContinuation (
614+ "Corbits operating prompt" ,
615+ ( ) => continuations ++ ,
616+ ) ;
606617 const actions = actionsArray (
607618 await director . decide ( overflowError ( ) , longState , mockCapabilities ) ,
608619 ) ;
@@ -615,10 +626,14 @@ describe("chatDirector compaction", () => {
615626 await director . decide ( messageReceived ( "" ) , longState , mockCapabilities ) ,
616627 ) ;
617628 expect ( resumed . some ( ( a ) => a . type === "infer" ) ) . toBe ( true ) ;
629+ const infer = resumed . find ( ( a ) => a . type === "infer" ) ;
630+ const options : ExtendedInferenceOptions | undefined =
631+ infer ?. type === "infer" ? infer . options : undefined ;
632+ expect ( options ?. systemPrompt ) . toBe ( "Corbits operating prompt" ) ;
618633 } ) ;
619634
620635 test ( "overflow recovery is bounded so an incompressible history cannot loop forever" , async ( ) => {
621- const director = chatDirectorWithContinuation ( ) ;
636+ const director = chatDirectorWithContinuation ( "" ) ;
622637 for ( let i = 0 ; i < 2 ; i ++ ) {
623638 const actions = actionsArray (
624639 await director . decide ( overflowError ( ) , longState , mockCapabilities ) ,
@@ -633,7 +648,7 @@ describe("chatDirector compaction", () => {
633648 } ) ;
634649
635650 test ( "chat posture is preserved: an idle turn never terminates the session" , async ( ) => {
636- const director = chatDirectorWithContinuation ( ) ;
651+ const director = chatDirectorWithContinuation ( "" ) ;
637652 const idle = actionsArray (
638653 await director . decide ( textInferenceDone ( 10 ) , longState , mockCapabilities ) ,
639654 ) ;
@@ -1038,7 +1053,7 @@ describe("transient nudges", () => {
10381053 source : "test" ,
10391054 } ) as unknown as ReactorInboundEvent ;
10401055
1041- test ( "open-task nudge uses ephemeralTurns, not systemPrompt " , async ( ) => {
1056+ test ( "open-task nudge uses ephemeralTurns and keeps the stable system prompt " , async ( ) => {
10421057 const director = createChatDirector ( "stable-base" , [ ] , { onTasksChange : ( ) => { } } ) ;
10431058 await director . decide ( manageTasksEvent ( "doing" ) , mockState , mockCapabilities ) ;
10441059 const actions = actionsArray ( await director . decide ( textTurn ( ) , mockState , mockCapabilities ) ) ;
@@ -1050,6 +1065,6 @@ describe("transient nudges", () => {
10501065 expect ( options ?. ephemeralTurns ?. length ?? 0 ) . toBeGreaterThan ( 0 ) ;
10511066 const nudgeText = options ?. ephemeralTurns ?. [ 0 ] ?. content ?. find ( ( b ) => b . type === "text" ) ;
10521067 expect ( nudgeText ?. type === "text" ? nudgeText . text : "" ) . toContain ( "tasks are still open" ) ;
1053- expect ( options ?. systemPrompt ) . toBeUndefined ( ) ;
1068+ expect ( options ?. systemPrompt ) . toBe ( "stable-base" ) ;
10541069 } ) ;
10551070} ) ;
0 commit comments