openpencil/scripts/ab-corpus
Fini 87c56f7284 feat(ab-corpus): retry transient errors on ark + deepseek
ab-v2 (2026-04-28) saw kimi-k2.6 garbage rate hit 17.5% — every
failure was Ark returning empty `choices[0].message.content` or
hitting the 120s wall clock, not a model-quality issue (the model
itself routed to the right element tool 80% of the time when it
did respond). Same pattern at 7.5% on deepseek-v4-pro.

Adds optional `retries` to `callOpenAICompat` with a transient-error
allowlist: empty content, abort/timeout, HTTP 5xx, HTTP 429. Linear
250ms × (attempt+1) backoff. HTTP 4xx other than 429 stays fatal so
auth/bad-request failures don't burn retry budget.

Wires `retries: 1` through clients/ark.ts and clients/deepseek.ts.
MiniMax + Bailian + Codex stay untouched — their ab-v2 failures
were model-quality (DSL escape errors, output truncation), where
retry wastes a call without changing the outcome.

Adds an 8-case fixture in scripts/ab-corpus/clients/__tests__/ that
mocks fetch to verify: first-try success, empty-then-success,
5xx-then-success, 429-then-success, 401 fatal, retries-default-zero,
retries exhausted, and retries=2 (3 attempts total). Extends the
apps/web vitest include glob to pick up scripts/**/__tests__/.
2026-04-29 07:15:00 +08:00
..
clients feat(ab-corpus): retry transient errors on ark + deepseek 2026-04-29 07:15:00 +08:00
apply.ts Merge branch 'main' of github.com:ZSeven-W/openpencil into v0.8.0 2026-04-26 19:39:14 +08:00
build-prompt.ts fix(ai-skills): restore element-tool arg-shape examples in elements-cookbook.md 2026-04-27 09:20:00 +08:00
real-model.ts feat(ab-corpus): add deepseek-v4-pro client + route 2026-04-28 09:05:00 +08:00
run.ts chore(merge): integrate origin/v0.8.0 — main pre-release sync + CI fixes 2026-04-27 08:15:00 +08:00
stub-model.ts Merge branch 'main' of github.com:ZSeven-W/openpencil into v0.8.0 2026-04-26 19:39:14 +08:00
write-report.ts Merge branch 'main' of github.com:ZSeven-W/openpencil into v0.8.0 2026-04-26 19:39:14 +08:00