Skip to content

hooks: fix PR #111 review — OnError fires for status ≤ 0 too - #112

Merged
FMXExpress merged 1 commit into
claude/pr110-review-fixesfrom
claude/pr111-review-fix
Jun 1, 2026
Merged

FMXExpress merged 1 commit into
claude/pr110-review-fixesfrom
claude/pr111-review-fix

Conversation

@FMXExpress

Copy link
Copy Markdown
Owner

Stacks on PR #111. Targets claude/pr110-review-fixes so the diff shows just this fix.

Summary

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. 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.

- if (Resp.StatusCode > 0) and
-    ((Resp.StatusCode < 200) or (Resp.StatusCode >= 300)) then
+ if (Resp.StatusCode < 200) or (Resp.StatusCode >= 300) then

Verification

Probe test (built + run + removed) over five representative status codes:

--- 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


Generated by Claude Code

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
@FMXExpress
FMXExpress merged commit 8cad3b0 into claude/pr110-review-fixes Jun 1, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants