diff options
| author | Kit Langton <[email protected]> | 2026-04-01 19:47:26 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-04-01 23:47:26 +0000 |
| commit | d9d4f895bcf5f95bd853fe2921de3e6a2798798f (patch) | |
| tree | a04d6bfc6f4c4bfdc7e94f4f55bb1acebeb07f7a /packages/app/e2e/prompt | |
| parent | 48db7cf07a651895341e019604d4ad485b97866d (diff) | |
| download | opencode-d9d4f895bcf5f95bd853fe2921de3e6a2798798f.tar.gz opencode-d9d4f895bcf5f95bd853fe2921de3e6a2798798f.zip | |
fix(test): auto-acknowledge tool-result follow-ups in mock LLM server (#20528)
Diffstat (limited to 'packages/app/e2e/prompt')
| -rw-r--r-- | packages/app/e2e/prompt/mock.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/packages/app/e2e/prompt/mock.ts b/packages/app/e2e/prompt/mock.ts index eb40a70cb..bd09af266 100644 --- a/packages/app/e2e/prompt/mock.ts +++ b/packages/app/e2e/prompt/mock.ts @@ -16,6 +16,16 @@ export function promptMatch(token: string) { return (hit: Hit) => bodyText(hit).includes(token) } +/** + * Match requests whose body contains the exact serialized tool input. + * The seed prompts embed JSON.stringify(input) in the prompt text, which + * gets escaped again inside the JSON body — so we double-escape to match. + */ +export function inputMatch(input: unknown) { + const escaped = JSON.stringify(JSON.stringify(input)).slice(1, -1) + return (hit: Hit) => bodyText(hit).includes(escaped) +} + export async function withMockOpenAI<T>(input: { serverUrl: string; llmUrl: string; fn: () => Promise<T> }) { const sdk = createSdk(undefined, input.serverUrl) const prev = await sdk.global.config.get().then((res) => res.data ?? {}) |
