fix(kanban): convert PR web URL to API URL in _fetch_pr_state - #29545
Closed
lin-hao wants to merge 1 commit into
Closed
fix(kanban): convert PR web URL to API URL in _fetch_pr_state#29545lin-hao wants to merge 1 commit into
lin-hao wants to merge 1 commit into
Conversation
lin-hao
commented
May 21, 2026
lin-hao
left a comment
Author
There was a problem hiding this comment.
Review
The fix is correct. Key points:
-
URL conversion bug (the main fix): was passing directly to — this 404s. The fix converts it to via regex substitution before calling the API.
-
Logic is sound: now calls per URL; → block, → skip (merged), → fallback block (safe-by-default on errors/no-token).
-
Tests: 18/18 respawn_guard tests pass including 3 new tests for merged PR (no guard), open PR (guard), and network error (fallback guard).
-
No behavior change when GitHub API is unreachable — falls back to legacy URL-only guard (block).
Verdict: LGTM. The fix actually makes the feature work as intended.
lin-hao
force-pushed
the
fix/kanban-active-pr-guard-api-url-v2
branch
from
May 22, 2026 21:25
c438583 to
0fe5553
Compare
Convert GitHub pull request web URLs to REST API URLs before fetching PR state, and keep respawn guard behavior safe-by-default when state cannot be resolved.
lin-hao
force-pushed
the
fix/kanban-active-pr-guard-api-url-v2
branch
from
May 22, 2026 21:26
0fe5553 to
cd66511
Compare
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.
What
The original
_fetch_pr_stateimplementation passed the GitHub web URL (https://github.com/owner/repo/pull/N) directly tourllib.urlopen, which 404s because that is not a REST API endpoint.This converts the web URL to the GitHub REST API URL (
https://api.github.com/repos/owner/repo/pulls/N) before querying, so the PR state check can distinguish open PRs from closed/merged PRs.Testing
python3 -m pytest tests/hermes_cli/test_kanban_db.py -k 'respawn_guard_merged_pr_not_guarded or respawn_guard_open_pr_still_guarded or respawn_guard_network_error_falls_back_to_guarding' -q -o 'addopts='