Repository navigation
Stop new Notion writes after cancellation and bound response reads - #49
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3be1818d5b
ℹ️ 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".
| cancelled = _WRITE_CANCELLED.get() | ||
| if method != "GET" and cancelled is not None and cancelled.is_set(): | ||
| raise _Budget() |
There was a problem hiding this comment.
Abort writes still waiting inside the HTTP transport
When a PATCH passes this check and then waits inside HTTPX for a connection-pool slot or connection establishment before any bytes are sent, cancelling the caller only sets the event; the shielded _send remains alive and proceeds with the write once the transport unblocks. Thus a Notion mutation can still be dispatched after cancellation despite this change's guarantee. The in-progress transport operation must observe cancellation or be aborted and reconciled as uncertain.
Useful? React with 👍 / 👎.
An approved Notion append or block edit could still dispatch after its caller was cancelled during the preflight read. HTTPX inactivity timeouts also allowed a slow response body to exceed the adapter request budget.
This change propagates cancellation into the shielded operation and checks it before every new write, including a rate-limit retry. Readback remains possible for an already dispatched write. Each HTTP exchange now has an absolute deadline; an expired write is treated as uncertain.
Five regressions cover cancelled appends, cancelled edits, cancelled rate-limit retries, verification after dispatch, and slow response bodies.
Validation: 46 focused tests passed; strict mypy and generated capability checks passed; six approval-preview tests passed. CI passed the full suite, offline qualification, type checks, and remaining gates on Python 3.12, 3.13 and 3.14 (run 36865219563). The redundant local full-suite process was stopped after remote CI passed; local full-suite completion is not claimed.
Companion to #48, changing only the adapter and its regression tests. No live Notion adapter call has been verified because no dedicated server token is configured in this session.