Skip to content

Commit f255158

Browse files
Chinoman10maria-rcksjuliusmarminge
authored
fix(pi): settle prompts consumed by input handlers (#28798)
Co-authored-by: maria-rcks <[email protected]> Co-authored-by: Julius Marminge <[email protected]>
1 parent 0bc993a commit f255158

3 files changed

Lines changed: 675 additions & 142 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)