fix(webhook): re-read PR labels at review start so a late AI-USAGE counts #10
Reference in New Issue
Block a user
Delete Branch "fix/ai-usage-label-reread"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Labelling a PR is two webhook events. The review claims on the AI-REVIEW event and starts; the AI-USAGE event that follows is dropped by the in-flight dedupe, so
report_usagestayed False and the review posted without its usage block (observed on #9).This re-reads the labels from the API at review start and upgrades the flag. Best-effort: any failure logs and leaves the payload verdict intact.
Opened to exercise the freshly deployed fixes from #9 end to end — inline-comment anchoring against the raw diff, and this label re-read.
🤖 AI Review · pragent pilot · glm-5.2:cloud ·
4ef62f28Summary of Changes
Key Risks & Concerns
None identified.
🤖 AI Review · pragent pilot · glm-5.2:cloud ·
aedea973Summary of Changes
_fetch_current_labels(repo, index)which GETs the Gitea labels API with the bot token and returns [] on any failure._run_review, whenreport_usageis False, re-read current labels and upgrade the flag if AI-USAGE is now present (best-effort, logged).Key Risks & Concerns
repoandindexare interpolated into the URL path without explicit URL-encoding; fail-safe (malformed values raise and return []) and input is HMAC-verified, but a defensiveurllib.parse.quoteon the path segments would be cleaner.🔋 AI Usage & Run Details
glm-5.2:cloud· opencode · 7 steps · 69.2s🤖 AI Review · pragent pilot · glm-5.2:cloud ·
c58c0018Summary of Changes
No summary provided.
Key Risks & Concerns
None identified.
⚠️ The reviewer did not emit a parseable findings block, so there are no inline comments. Its raw notes are below — treat them as unverified: line numbers were not validated against the diff.
The diff touches
gitea_get(network egress / API token handling) and the review render path, so this is at leastfulltier per the attention-tiering rules. Let me inspect the surrounding code and run linters.🔋 AI Usage & Run Details
glm-5.2:cloud· opencode · 7 steps · 77.1s