Repository navigation
feat: preserve response headers on HTTPError and RateLimitError - #55
Merged
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
ExecutionContext.fetch() exposed headers on successful responses but discarded them when raising. Integrations such as JobAdder need provider headers (for example X-Allow-Duplicates on HTTP 409) to handle failures. - Add an optional keyword-only `headers` argument and attribute to HTTPError, defaulting to an empty dict. - Pass response headers from fetch() for non-2xx responses and for 429. - Keep the exception message, positional arguments, retry_after and retry behaviour unchanged, so headers never reach str(exc). - Add release notes and regenerate API docs. Refs #54
NinosMan
force-pushed
the
na/feat/http-error-headers
branch
from
November 1, 2026 20:42
264b9be to
0bec393
Compare
TheRealAgentK
self-requested a review
November 1, 2026 21:17
Coverage —
|
| File | Stmts | Miss | Cover | Missing |
|---|---|---|---|---|
src/autohive_integrations_sdk/__init__.py |
2 | 0 | 100% | |
src/autohive_integrations_sdk/integration.py |
359 | 0 | 100% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ExecutionContext.fetch()exposes response headers on successfulFetchResponseobjects, but it discarded them when it raisedHTTPErrororRateLimitError. Integrations could not read provider headers that are needed to handle some failures. For example, JobAdder returns HTTP 409 with anX-Allow-Duplicatesoverride code (Autohive-AI/autohive-integrations#548).Refs #54
Changes
HTTPErrorhas a new optional, keyword-onlyheadersargument and aheadersattribute. It defaults to{}and stores a copy of the input.fetch()passes the response headers when it raisesHTTPErrorfor a non-2xx response, and when it raisesRateLimitErrorfor HTTP 429.HTTP {status}: {message}),retry_after, or the retry behaviour.Exposure
Headers are never added to
str(exc). The lambda wrapper serializes unhandled exceptions withtype(e).__name__,str(e)and the traceback only, so headers do not get to the platform result, the logs or the agent unless an integration returns them on purpose. A regression test uses a distinctive header value to check that it does not appear instr(exc),repr(exc)orexc.message.Testing
fetch()and pin SDK~=2.0.x(1,226 actions) ran with SDK 2.0.1 and with this branch. A local server failed each request with 409 or 429 and sent a sentinel header.HTTPError/RateLimitErrorthroughfetch(). With 2.1.0,exc.headershad the sentinel on all of them. The other 16 do not callfetch().~=1.0.2, and the private integrations repo.Notes for reviewers
release/2.1.0, which is cut from the2.0.1tag. It does not targetmaster, which is now on3.0.0.dev0and still has the User-Agent change that 2.0.1 reverted. After the release, a separate PR will cherry-pick this change ontomaster.~=2.0.0or~=2.0.1do not get 2.1.0 automatically. An integration gets it only when its pin is changed.