fix(llm): classify arity-2 socket_error as connection failure (ZARA-016) #221

Closed
nsaspy wants to merge 0 commits from fix/zara-016-llm-provider-contracts into master
Owner

RAGE #17 — ZARA-016 reopened regression

Consumed issue: #17. RAGE start commit: a04435d2b73b44dffd52e00aff3bf478d5a48d6b. Iteration log: rage/17-zara016-provider-contracts.org.

Regression

SWI-Prolog emits arity-2 error(socket_error(eai_noname, 'Name or service not known'), _) for DNS failures. retryable_exception/1 matched only arity-1 socket_error(_), so network failures fell through to the malformed_response catch-all — the exact CLI failure quoted in the issue comment.

Change

  • Add retryable_exception(error(socket_error(_, _), _)) clause: DNS/socket failures now classify as llm_error(connection, ...) and become bounded-retryable, matching the Python client's connection policy.
  • No serializer, auth, timeout, history, session, or provider changes — research confirmed the rest of ZARA-016 already landed with green tests; only the reopened regression and required-but-missing tests were added.

Tests (TDD red→green)

  • RED: new PlUnit dns_socket_error_is_typed_connection failed with malformed_response classification before the fix; green after (17/17).
  • Added required coverage: Prolog auth-failure typed error, Prolog close_llm_client history clearing, legacy arity-1 compatibility, Python missing-API-key fail-fast.

Gate

  • Focused: scripts/test-llm-clients.sh green (pytest + PlUnit).
  • Full: nix develop -c bash scripts/test-all.sh — 10/10 phases passed at 7985353.
## RAGE #17 — ZARA-016 reopened regression Consumed issue: #17. RAGE start commit: `a04435d2b73b44dffd52e00aff3bf478d5a48d6b`. Iteration log: `rage/17-zara016-provider-contracts.org`. ### Regression SWI-Prolog emits arity-2 `error(socket_error(eai_noname, 'Name or service not known'), _)` for DNS failures. `retryable_exception/1` matched only arity-1 `socket_error(_)`, so network failures fell through to the `malformed_response` catch-all — the exact CLI failure quoted in the issue comment. ### Change - Add `retryable_exception(error(socket_error(_, _), _))` clause: DNS/socket failures now classify as `llm_error(connection, ...)` and become bounded-retryable, matching the Python client's connection policy. - No serializer, auth, timeout, history, session, or provider changes — research confirmed the rest of ZARA-016 already landed with green tests; only the reopened regression and required-but-missing tests were added. ### Tests (TDD red→green) - RED: new PlUnit `dns_socket_error_is_typed_connection` failed with `malformed_response` classification before the fix; green after (17/17). - Added required coverage: Prolog auth-failure typed error, Prolog `close_llm_client` history clearing, legacy arity-1 compatibility, Python missing-API-key fail-fast. ### Gate - Focused: `scripts/test-llm-clients.sh` green (pytest + PlUnit). - Full: `nix develop -c bash scripts/test-all.sh` — 10/10 phases passed at `7985353`.
nsaspy closed this pull request 2026-09-02 17:47:33 +00:00
Some checks failed
CI / test (pull_request) Has been cancelled

Pull request closed

Sign in to join this conversation.
No description provided.