Gateway: simplify preflight tool conflict SSE path
This commit is contained in:
parent
e8a7cea1d9
commit
f810978206
@ -159,6 +159,9 @@ export function findClientToolNameConflicts(params: {
|
|||||||
if (existingNormalized.has(normalizedName)) {
|
if (existingNormalized.has(normalizedName)) {
|
||||||
conflicts.add(rawName);
|
conflicts.add(rawName);
|
||||||
}
|
}
|
||||||
|
// Keep the first client-provided spelling for each normalized name so every
|
||||||
|
// later duplicate is reported against a stable original entry, even when
|
||||||
|
// the later name also collides with an existing built-in tool.
|
||||||
const priorClientName = seenClientNames.get(normalizedName);
|
const priorClientName = seenClientNames.get(normalizedName);
|
||||||
if (priorClientName) {
|
if (priorClientName) {
|
||||||
conflicts.add(priorClientName);
|
conflicts.add(priorClientName);
|
||||||
|
|||||||
@ -840,24 +840,6 @@ export async function handleOpenResponsesHttpRequest(
|
|||||||
|
|
||||||
finalUsage = finalUsage ?? createEmptyUsage();
|
finalUsage = finalUsage ?? createEmptyUsage();
|
||||||
startStream();
|
startStream();
|
||||||
if (isClientToolNameConflictError(err)) {
|
|
||||||
const errorResponse = createResponseResource({
|
|
||||||
id: responseId,
|
|
||||||
model,
|
|
||||||
status: "failed",
|
|
||||||
output: [],
|
|
||||||
error: { code: "invalid_request_error", message: "invalid tool configuration" },
|
|
||||||
usage: finalUsage,
|
|
||||||
});
|
|
||||||
|
|
||||||
writeSseEvent(res, { type: "response.failed", response: errorResponse });
|
|
||||||
emitAgentEvent({
|
|
||||||
runId: responseId,
|
|
||||||
stream: "lifecycle",
|
|
||||||
data: { phase: "error" },
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const errorResponse = createResponseResource({
|
const errorResponse = createResponseResource({
|
||||||
id: responseId,
|
id: responseId,
|
||||||
model,
|
model,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user