Repository navigation
hooks: fix PR #111 review — OnError fires for status ≤ 0 too - #112
Conversation
Codex P2 on PR #111: the OnError(hsProviderCall) dispatcher gated on `Resp.StatusCode > 0`, so DNS / TLS / socket / no-OpenSSL failures (the HTTP helper flags those as StatusCode := -1) silently slipped past the audit-hook path. Exactly the outage modes an embedder running unattended would want to alert on. Fix: drop the StatusCode > 0 guard. The condition is now "anything that isn't 2xx" — covers -1 (network/TLS), 0 (pre-HTTP unclassified failure), 4xx (auth/bad-request), and 5xx (server) in one check. before: if (Resp.StatusCode > 0) and ((Resp.StatusCode < 200) or (Resp.StatusCode >= 300)) then after: if (Resp.StatusCode < 200) or (Resp.StatusCode >= 300) then Verified with a focused probe test (built + run + removed, not committed) — fires OnError on the right stages for status codes {-1, 0, 429, 502, 401}: --- probe status=-1 --- PASS — provider returned status=-1 --- probe status=0 --- PASS — provider returned status=0 --- probe status=429 --- PASS — provider returned status=429 --- probe status=502 --- PASS — provider returned status=502 --- probe status=401 --- PASS — provider returned status=401 PASS — all non-2xx statuses now reach OnError hooks. make clean && make smoke 11/11 green. https://claude.ai/code/session_01TBcLtmpj7dqA5tyFbGnQon
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3ad3436533
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| / alerting hook most wants to see. (Codex P2 on PR #111.) } | ||
| if (Length(Cfg.Hooks) > 0) and | ||
| ((Resp.StatusCode > 0) and ((Resp.StatusCode < 200) or (Resp.StatusCode >= 300))) then | ||
| ((Resp.StatusCode < 200) or (Resp.StatusCode >= 300)) then |
There was a problem hiding this comment.
Preserve the documented unset-status behavior
When an embedder supplies an older or custom ILLMProvider that returns a successful response without populating StatusCode, this now invokes OnError(hsProviderCall) for every successful turn because the record retains the documented sentinel value 0. PasClaw.Providers.Types.pas explicitly defines 0 as “not set” for older providers, while negative values represent non-HTTP failures. Please distinguish an unset status from an actual pre-HTTP failure instead of treating every value below 200 as an error.
Useful? React with 👍 / 👎.
Stacks on PR #111. Targets
claude/pr110-review-fixesso the diff shows just this fix.Summary
Codex P2 on PR #111: the
OnError(hsProviderCall)dispatcher gated onResp.StatusCode > 0, so DNS / TLS / socket / no-OpenSSL failures (the HTTP helper flags those asStatusCode := -1) silently slipped past the audit-hook path. Exactly the outage modes an embedder running unattended would want to alert on.Fix
Drop the
StatusCode > 0guard. Condition is now "anything that isn't 2xx" — covers-1(network/TLS),0(pre-HTTP unclassified failure),4xx(auth/bad-request), and5xx(server) in one check.Verification
Probe test (built + run + removed) over five representative status codes:
make clean && make smoke11/11 green.https://claude.ai/code/session_01TBcLtmpj7dqA5tyFbGnQon
Generated by Claude Code