mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-15 07:42:23 +00:00
fix(routes): keep the 12 s budget from arrival and name the outage to voice
Starting the upstream timeout after the outbound queue let a request run up to about 19 s, past the Directions layer's 15 s; the budget again runs from arrival, queue wait included, and a budget spent before the request leaves the queue answers 429 "routing busy" rather than an outage. plan_route threw "Routing HTTP 502" for an outage, and voice passes only the message on; it now throws "Routing service unavailable (HTTP 502)". Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
536f371dde
commit
1bff1961b4
6 files changed
+53
-25
No files matched your search
+7
-3
@@ -190,9 +190,13 @@ export function createRouteService({
|
||||
/* the status below is authoritative */
|
||||
}
|
||||
// A rate limit or an outage (5xx) is the routing service's failure, not
|
||||
// a missing route, whatever the body says.
|
||||
if (response.status === 429 || response.status >= 500)
|
||||
throw httpFailure(response, 'Routing');
|
||||
// a missing route, whatever the body says. Voice hears this message.
|
||||
if (response.status === 429) throw httpFailure(response, 'Routing');
|
||||
if (response.status >= 500)
|
||||
throw new ToolError(
|
||||
'unavailable',
|
||||
`Routing service unavailable (HTTP ${response.status})`,
|
||||
);
|
||||
if (payload?.ok === false || response.status === 400)
|
||||
return { ok: false, error: payload?.error || 'no route found' };
|
||||
if (!response.ok) throw httpFailure(response, 'Routing');
|
||||
|
||||
@@ -283,6 +283,24 @@ test('a routing outage is reported as unavailable, not as invalid arguments', as
|
||||
assert.equal(result.structuredContent.error, 'unavailable');
|
||||
assert.doesNotMatch(result.content[0].text, /No walk route/);
|
||||
}
|
||||
// Voice passes only the message on, so it names the outage itself.
|
||||
const outage = createRouteService({
|
||||
fetchImpl: async () =>
|
||||
Response.json(
|
||||
{ ok: false, error: 'routing service unavailable' },
|
||||
{ status: 502 },
|
||||
),
|
||||
});
|
||||
await assert.rejects(
|
||||
outage.route(
|
||||
[
|
||||
{ lat: 30, lon: -97 },
|
||||
{ lat: 30.01, lon: -97.01 },
|
||||
],
|
||||
'foot',
|
||||
),
|
||||
{ message: 'Routing service unavailable (HTTP 502)' },
|
||||
);
|
||||
});
|
||||
|
||||
test('place answers say when the search limits may have left places out', async () => {
|
||||
|
||||
Reference in new issue
Block a user