Skip to content

Commit 7078fc0

Browse files
fix(transcript): consume the steer count for marker-only activations
1 parent 902acc4 commit 7078fc0

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

packages/transcript/src/history/groupTurns.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@ export function groupMessagesIntoSnapshot(
220220
const markerKey = originKind !== undefined ? MARKER_USER_ORIGINS[originKind] : undefined;
221221
if (markerKey !== undefined && !isUserSlashPrompt(message)) {
222222
pushMarker(markerKey, { text: textOf(message), origin: message.origin });
223+
const markerContentKey = JSON.stringify(message.content ?? []);
224+
const markerSteerRemaining = steeredContents.get(markerContentKey) ?? 0;
225+
if (markerSteerRemaining > 0) steeredContents.set(markerContentKey, markerSteerRemaining - 1);
223226
continue;
224227
}
225228
const contentKey = JSON.stringify(message.content ?? []);

packages/transcript/test/layers.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,6 +1182,29 @@ describe('groupMessagesIntoSnapshot (cold path)', () => {
11821182
});
11831183
});
11841184

1185+
it('consumes the steer count for marker-only activations so a later identical prompt opens its own turn', () => {
1186+
const shared = [{ type: 'text', text: 'same text' }];
1187+
const snapshot = groupMessagesIntoSnapshot(
1188+
[
1189+
{ role: 'user', content: [{ type: 'text', text: 'active' }], toolCalls: [], origin: { kind: 'user' } },
1190+
{ role: 'assistant', content: [{ type: 'text', text: 'working' }], toolCalls: [] },
1191+
{
1192+
role: 'user',
1193+
content: shared,
1194+
toolCalls: [],
1195+
origin: { kind: 'skill_activation', trigger: 'model-tool', skillName: 'x' } as {
1196+
kind: string;
1197+
},
1198+
},
1199+
{ role: 'user', content: shared, toolCalls: [], origin: { kind: 'user' } },
1200+
{ role: 'assistant', content: [{ type: 'text', text: 'noted' }], toolCalls: [] },
1201+
],
1202+
{ steeredContents: new Map([[JSON.stringify(shared), 1]]) },
1203+
);
1204+
1205+
expect(snapshot.items.map((item) => item.kind)).toEqual(['turn', 'marker', 'turn']);
1206+
});
1207+
11851208
it('starts a promptless turn for turn-opening system triggers (goal continuation)', () => {
11861209
const snapshot = groupMessagesIntoSnapshot([
11871210
{ role: 'user', content: [{ type: 'text', text: 'hi' }], toolCalls: [], origin: { kind: 'user' } },

0 commit comments

Comments
 (0)