Skip to content

Commit 42bf3ff

Browse files
committed
test(pi): accept generated prompt IDs in historical replays
Extend the existing adapter request-ID rebinding to the prompt namespace and historical idless prompt frames. Keep all payload and provider/UI ID checks strict; retain original recordings. Reproduced the CI mismatch before the fix. All eight replay integration cases and the scoped check now pass.
1 parent 1c46529 commit 42bf3ff

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎apps/server/src/orchestration-v2/Adapters/PiAdapterV2.testkit.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ function replayValueMatches(expected: unknown, actual: unknown): boolean {
113113
return Object.is(expected, actual);
114114
}
115115

116-
const ADAPTER_REQUEST_ID = /^t3-\d+$/u;
116+
const ADAPTER_REQUEST_ID = /^t3-(?:prompt-)?\d+$/u;
117117

118118
function adapterRequestId(frame: unknown): string | undefined {
119119
const id = isRecord(frame) ? frame.id : undefined;
@@ -123,7 +123,10 @@ function adapterRequestId(frame: unknown): string | undefined {
123123
/** Rebind adapter request ids without pinning counters; provider ids that responses must echo stay exact. */
124124
function withRequestId(expected: unknown, actual: unknown): unknown {
125125
const actualId = adapterRequestId(actual);
126-
return isRecord(expected) && adapterRequestId(expected) !== undefined && actualId !== undefined
126+
return isRecord(expected) &&
127+
actualId !== undefined &&
128+
(adapterRequestId(expected) !== undefined ||
129+
(expected.type === "prompt" && expected.id === undefined))
127130
? { ...expected, id: actualId }
128131
: expected;
129132
}

0 commit comments

Comments
 (0)