|
|
@@ -43,4 +43,48 @@ describe('internal initiator markers', () => {
|
|
|
}),
|
|
|
).toBe(false);
|
|
|
});
|
|
|
+
|
|
|
+ test('recognizes OpenCode compaction continuation as internal initiator', () => {
|
|
|
+ // OpenCode's compaction sends a synthetic continuation prompt with
|
|
|
+ // metadata.compaction_continue = true but no INTERNAL_INITIATOR_METADATA_KEY.
|
|
|
+ // This should be treated as internal to prevent board injection on
|
|
|
+ // the continuation turn (issue #922).
|
|
|
+ const compactionContinuation = {
|
|
|
+ type: 'text',
|
|
|
+ synthetic: true,
|
|
|
+ text: 'Continue if you have next steps.',
|
|
|
+ metadata: { compaction_continue: true },
|
|
|
+ };
|
|
|
+ expect(isInternalInitiatorPart(compactionContinuation)).toBe(true);
|
|
|
+ });
|
|
|
+
|
|
|
+ test('compaction_continue without synthetic is not internal', () => {
|
|
|
+ expect(
|
|
|
+ isInternalInitiatorPart({
|
|
|
+ type: 'text',
|
|
|
+ text: 'Continue if you have next steps.',
|
|
|
+ metadata: { compaction_continue: true },
|
|
|
+ }),
|
|
|
+ ).toBe(false);
|
|
|
+ });
|
|
|
+
|
|
|
+ test('compaction_continue false or string is not internal', () => {
|
|
|
+ expect(
|
|
|
+ isInternalInitiatorPart({
|
|
|
+ type: 'text',
|
|
|
+ synthetic: true,
|
|
|
+ text: 'Continue if you have next steps.',
|
|
|
+ metadata: { compaction_continue: false },
|
|
|
+ }),
|
|
|
+ ).toBe(false);
|
|
|
+
|
|
|
+ expect(
|
|
|
+ isInternalInitiatorPart({
|
|
|
+ type: 'text',
|
|
|
+ synthetic: true,
|
|
|
+ text: 'Continue if you have next steps.',
|
|
|
+ metadata: { compaction_continue: 'true' },
|
|
|
+ }),
|
|
|
+ ).toBe(false);
|
|
|
+ });
|
|
|
});
|