Skip to content

autodev: conditional GitHub requests (ETags) when polling PRs (#26) - #32

Merged
krokicki merged 2 commits into
mainfrom
autodev-rokickik/issue-26
Oct 13, 2026
Merged

krokicki merged 2 commits into
mainfrom
autodev-rokickik/issue-26

Conversation

@krokicki

Copy link
Copy Markdown
Member

Closes #26

Implemented by autodev-rokickik: Claude Code running in a sandboxed job on the cluster. The agent's own
summary is the first comment.

  • Merge: approve this PR, or comment /approve <head sha> (needed when running under a personal token).
    autodev-rokickik merges once an approval matches the current head and checks are not failing.
  • Request changes: submit a review with Request changes, or comment /revise <what to change>.
    Up to 3 revision rounds.
  • Stop: close this PR.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@krokicki

Copy link
Copy Markdown
Member Author

autodev-rokickik: round 1 pushed 08e14173cb98 to autodev-rokickik/issue-26 · $0.21

The PR reads in observe_pr are now conditional, but I couldn't run the test suite, so none of it is tested. pixi isn't installed in this sandbox and the system Python has no httpx, respx or pytest. I only confirmed the changed files compile with py_compile. Please run pixi run test before merging.

What changed

  • zarr_doctor/github_api.py:
    • GitHub.request() takes a new conditional=False option. When set on a GET, it sends If-None-Match using the ETag saved from the last 200 for that URL and params.
    • On a 304 it returns the cached response. On a 200 with an ETag it replaces the cached entry, and on a 200 without one it drops the entry.
    • The cache is per client, so it lives in the worker process. A restart costs one full read per PR.
    • _paged() passes conditional through. Each page has its own URL and params, so each page is cached separately.
  • autodev/github.py: these reads now use conditional=True:
    • get_pr
    • pr_reviews
    • pr_review_comments
    • issue_comments
    • the check-runs and status reads in check_state
  • Writes and the other reads (including permission) are unchanged, so existing callers behave as before.
  • merge_pr is affected too: the activity's get_pr re-check now sends If-None-Match as well.

Tests added in tests/test_autodev_activities.py

  • A second observe_pr on an unchanged PR sends If-None-Match on all six reads (the six respx routes answer 304) and returns an identical snapshot.
  • A 200 with a new ETag replaces the cached entry, and the next request sends the new ETag.

…hub.py

The GitHub client moved from zarr_doctor to autodev since this PR was
opened, and main was renamed and formatted. Re-implements the change
there: `request(conditional=True)` sends If-None-Match from the last
200's ETag and returns the cached response on 304; `_paged` passes it
through so each page keeps its own ETag; the six per-poll PR reads use
it. Tests now run: a second observe_pr on a quiet PR sends If-None-Match
on every read and gets the same snapshot, and a changed resource
replaces its cached ETag.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@krokicki

Copy link
Copy Markdown
Member Author

Brought up to date with main in 5d2ec73. The GitHub client has since moved from zarr_doctor/github_api.py to autodev/github.py, so the change is re-implemented there with the same design: request(conditional=True) sends If-None-Match from the last 200's ETag and returns the cached response on a 304, _paged passes it through (one ETag per page), and the six per-poll reads in observe_pr use it. The two tests described above now exist and run: 328 pass locally and in CI.

🤖 Generated with Claude Code

@krokicki
krokicki merged commit 8c4b4fc into main Oct 13, 2026
1 check passed
@krokicki
krokicki deleted the autodev-rokickik/issue-26 branch October 13, 2026 16:21
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.

autodev: conditional GitHub requests (ETags) when polling PRs

1 participant