合并最新 staging 到侧栏重画这支
校正提速已经在测试线上。更新日志、缺陷记录和任务索引两边都留下。这单自己的修复还没开始。 Co-Authored-By: Grok (agent loop)
This commit is contained in:
@@ -330,17 +330,27 @@ async function readEngineJsonTimed(
|
||||
const elapsedMs = Date.now() - started;
|
||||
const data = await response.json().catch(() => null);
|
||||
if (!response.ok) {
|
||||
const kind: EngineCallFailureKind = response.status === 429 ? "busy" : "http_error";
|
||||
const errorText = data && typeof data === "object"
|
||||
? String((data as Record<string, unknown>).error ?? (data as Record<string, unknown>).message ?? "")
|
||||
: "";
|
||||
const errorCode = data && typeof data === "object"
|
||||
? String((data as Record<string, unknown>).error_code ?? "")
|
||||
: "";
|
||||
const tooManyCandidates = response.status === 400
|
||||
&& (errorCode === "too_many_candidates" || errorText.includes("too_many_candidates"));
|
||||
const kind: EngineCallFailureKind = response.status === 429
|
||||
? "busy"
|
||||
: tooManyCandidates
|
||||
? "bad_payload"
|
||||
: "http_error";
|
||||
logEngineCallFailure({
|
||||
path,
|
||||
kind,
|
||||
elapsedMs,
|
||||
httpStatus: response.status,
|
||||
});
|
||||
const message = data && typeof data === "object"
|
||||
? String((data as Record<string, unknown>).error ?? (data as Record<string, unknown>).message ?? `Jyotish API ${response.status}`)
|
||||
: `Jyotish API ${response.status}`;
|
||||
throw new RectificationEngineError(persistenceCodeForKind(kind), message, {
|
||||
const message = errorText || `Jyotish API ${response.status}`;
|
||||
throw new RectificationEngineError(tooManyCandidates ? "too_many_candidates" : persistenceCodeForKind(kind), message, {
|
||||
kind,
|
||||
httpStatus: response.status,
|
||||
retryAfterSeconds: retryAfterFromHeaders(response.headers) ?? undefined,
|
||||
|
||||
Reference in New Issue
Block a user