Skip to content

fix(coverage): set a stable User-Agent for trusted uv bootstrap - #943

Closed
seonghobae wants to merge 5 commits into
mainfrom
fix/opencode-uv-archive-user-agent-20260812
Closed

fix(coverage): set a stable User-Agent for trusted uv bootstrap#943
seonghobae wants to merge 5 commits into
mainfrom
fix/opencode-uv-archive-user-agent-20260812

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Root cause

The central OpenCode coverage-evidence job failed while materializing a trusted base Python lock:

  • run: 31559467740
  • failure: trusted uv archive download failed: HTTPError
  • the fixed Astral URL returns HTTP 403 to Python urllib with its default User-Agent, while the same direct URL succeeds with an explicit static User-Agent

Fix

  • send a fixed, repository-owned User-Agent on the immutable HTTPS request
  • retain no-proxy, no-redirect, fixed-origin, size, checksum, and archive-member verification
  • add a regression assertion for the exact URL and User-Agent

Validation

The failure was reproduced locally with Python direct networking and resolved by the static User-Agent. Hosted checks must rerun on this current head before merge.

Summary by CodeRabbit

  • 개선 사항

    • 신뢰된 uv 아카이브 다운로드에 고정된 저장소 소유 User-Agent가 적용되어 일부 릴리스 호스트의 HTTP 403 응답을 방지합니다.
    • 다운로드 URL, 출처, 프록시, 리디렉션, 페이로드 및 타임아웃 동작은 변경되지 않았습니다.
  • 문서

    • 고정된 User-Agent 사용과 관련 검증 기준을 문서화하고 RFC 9110 참고문헌을 추가했습니다.
  • 테스트

    • HTTPS 다운로드 주소와 고정 헤더 사용을 검증하는 테스트를 강화했습니다.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@seonghobae, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 50 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 93486aaa-be74-4cd5-86e3-76f9c96d9b63

📥 Commits

Reviewing files that changed from the base of the PR and between 601b254 and aae09fd.

📒 Files selected for processing (1)
  • docs/doctoring/trusted-uv-lock-materialization.md
📝 Walkthrough

Walkthrough

신뢰된 uv 아카이브 다운로드에 고정된 저장소 소유 User-Agent가 추가되었습니다. 다운로드 구현은 Request 객체를 사용하며, 테스트와 문서는 고정 URL, 헤더, 정적 요청 구성을 검증합니다.

Changes

신뢰된 uv 다운로드

Layer / File(s) Summary
정적 다운로드 Request 구성
scripts/ci/materialize_base_python_requirements.py
고정 TRUSTED_UV_USER_AGENT 상수를 추가했습니다. 아카이브 다운로드가 고정 URL과 User-Agent 헤더를 포함한 urllib.request.Request를 사용하도록 변경했습니다.
Request 계약 및 문서 검증
tests/test_materialize_base_python_requirements.py, tests/test_trusted_uv_download_contract.py, docs/doctoring/trusted-uv-lock-materialization.md
다운로드 Request의 타입, URL, 헤더, 생성 횟수를 검증하도록 테스트를 갱신했습니다. 문서에 고정 User-Agent 동작과 RFC 9110 참고문헌을 추가했습니다.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 신뢰된 uv 부트스트랩에 고정 User-Agent를 설정하는 주요 변경 사항을 정확하고 간결하게 설명합니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/opencode-uv-archive-user-agent-20260812

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Contributor Author

Current-head verification record (2026-08-12):

  • head: 233df92
  • base: main at 6eb06cd
  • changed files: scripts/ci/materialize_base_python_requirements.py and its focused test only
  • reproduced root cause: direct Python urllib without a User-Agent receives HTTP 403; the fixed static User-Agent succeeds
  • security boundary preserved: no proxy, no redirects, fixed HTTPS origin, bounded bytes, SHA-256 archive pin, and exact regular archive member
  • all current-head checks are queued; merge remains blocked until they complete and required approval is present

Copy link
Copy Markdown
Contributor Author

Current-head verification record (updated 2026-08-12):

  • head: 4b7dde4
  • base: main at 6eb06cd
  • changed files: trusted uv materializer, focused tests, and its doctoring record
  • fix: fixed static User-Agent on the immutable request; no-proxy/no-redirect/origin/size/digest/member checks remain unchanged
  • the doctoring record cites RFC 9110 Section 10.1.5 in APA 7 form and records the operational failure mode
  • all current-head checks restarted and are queued; merge remains blocked until terminal green checks and required approval

Copy link
Copy Markdown
Contributor Author

Current-head verification record (updated 2026-08-12):

  • head: 601b254
  • root cause fix remains the fixed static User-Agent
  • the existing AST security contract was updated to require exactly one static Request with the literal release URL and literal repository-owned User-Agent; it still rejects dynamic URL selection
  • doctoring records the boundary and RFC 9110 Section 10.1.5 reference
  • all checks restarted for this exact head; merge remains blocked pending terminal results and required approval

Copy link
Copy Markdown
Contributor Author

@opencode-agent review

Review exact current head 601b254f3a8ea4cc593e7089d6baeadd9d8d3ee4 against independently resolved live main 6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba. Nine exact-head hosted workflows are terminal-success and no review thread is unresolved. Evaluate the literal fixed User-Agent request and its unchanged no-proxy/no-redirect/origin/size/digest/member trust boundary. This automated semantic judgment is not qualifying independent human approval or merge authorization.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review
@opencode-agent review
@cwl-noema-review review

Review exact current head 601b254f3a8ea4cc593e7089d6baeadd9d8d3ee4 only. All nine exact-head quality, security, and supply-chain workflows are terminal-success. Validate the fixed repository-owned User-Agent, immutable Astral HTTPS URL, no-proxy/no-redirect behavior, bounded download, archive SHA-256/member checks, focused regressions, and four-file scope. Treat all predecessor heads as stale. Review only: do not mutate, merge, release, or alter protection.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

expected_head='601b254f3a8ea4cc593e7089d6baeadd9d8d3ee4'
base='6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba'
repo='ContextualWisdomLab/.github'
pr='943'

echo '== Checkout commit =='
git rev-parse HEAD
git status --short
git cat-file -e "${expected_head}^{commit}"
git cat-file -e "${base}^{commit}"

echo '== Changed files against specified base =='
git diff --name-status "$base" "$expected_head"

echo '== Diff stat =='
git diff --stat "$base" "$expected_head"

echo '== Full scoped diff =='
git diff --find-renames --find-copies --unified=80 "$base" "$expected_head" -- \
  scripts/ci/materialize_base_python_requirements.py \
  scripts/ci/test_materialize_base_python_requirements.py \
  scripts/ci

echo '== Candidate source and test files =='
fd -t f 'materialize_base_python_requirements' .

echo '== Source outline =='
ast-grep outline scripts/ci/materialize_base_python_requirements.py --items all || true

echo '== Source and focused test contents =='
for f in $(fd -t f 'materialize_base_python_requirements' .); do
  echo "--- $f ---"
  cat -n "$f"
done

echo '== PR metadata, files, reviews, and workflow runs =='
gh pr view "$pr" --repo "$repo" --json number,headRefOid,baseRefOid,changedFiles,files,reviews,reviewDecision,statusCheckRollup,url
gh api "repos/$repo/pulls/$pr/comments?per_page=100"
gh api "repos/$repo/issues/$pr/comments?per_page=100"
gh api "repos/$repo/commits/$expected_head/check-runs?per_page=100"

Length of output: 201980


🏁 Script executed:

#!/bin/bash
set -euo pipefail

head='601b254f3a8ea4cc593e7089d6baeadd9d8d3ee4'
base='6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba'
repo='ContextualWisdomLab/.github'
pr='943'

echo '== Exact head and base =='
printf 'HEAD checkout: '; git rev-parse HEAD
printf 'Requested head: '; git rev-parse "$head"
printf 'Specified base: '; git rev-parse "$base"

echo '== Exact changed-file scope =='
git diff --name-status "$base" "$head"

echo '== Changed hunks only =='
git diff --unified=12 "$base" "$head"

echo '== Materializer: constants, request construction, transport, and verification controls =='
rg -n -C 8 \
  'URL|USER_AGENT|Request|build_opener|ProxyHandler|HTTPRedirectHandler|urlopen|read\(|Content-Length|MAX|sha256|tarfile|isfile|extractfile|member' \
  scripts/ci/materialize_base_python_requirements.py

echo '== Focused regression tests =='
cat -n tests/test_materialize_base_python_requirements.py

echo '== Doctoring record =='
cat -n docs/doctoring/trusted-uv-lock-materialization.md

echo '== Unresolved review threads only =='
gh api graphql \
  -F owner='ContextualWisdomLab' \
  -F name='.github' \
  -F number="$pr" \
  -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes {
          isResolved
          path
          line
          comments(first: 1) { nodes { author { login } body } }
        }
      }
    }
  }
}' \
  --jq '.data.repository.pullRequest.reviewThreads.nodes
         | map(select(.isResolved == false))
         | map({path, line, author: .comments.nodes[0].author.login, body: .comments.nodes[0].body})'

Length of output: 73624


@seonghobae, no findings.

I reviewed exact head 601b254f3a8ea4cc593e7089d6baeadd9d8d3ee4 against base 6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba.

The scope contains four files only. The request uses one literal Astral HTTPS URL and the fixed repository-owned User-Agent, ContextualWisdomLab-OpenCode-Coverage/1.

The no-proxy and no-redirect controls remain active. The response-origin validation, bounded download, SHA-256 pin, exact regular archive-member check, and member-size validation remain active.

The focused behavioral regression validates the URL and User-Agent. The AST contract requires one static Request with the literal URL and fixed User-Agent.

GitHub returned no unresolved review threads. I applied the existing exact-current-head evidence criterion. I did not count skipped or neutral results as passing evidence. The relevant current-head quality, security, and supply-chain checks shown in the returned data succeeded.

This review does not approve, merge, release, or change protection.


🧠 Learnings used
Learnt from: seonghobae
Repo: ContextualWisdomLab/.github PR: 0
File: :0-0
Timestamp: 2026-08-05T13:44:10.007Z
Learning: For PR `#782`, only successful checks associated with the exact current head are valid merge evidence. Do not treat queued, in-progress, cancelled, predecessor-head, temporary-workflow, or administrative-bypass results as passing evidence. Before a formal approval, verify that the direct security and supply-chain workflows, the permanent hourly NVIDIA NIM contract, current-head reviews, unresolved-thread checks, and an independent approval have completed successfully.
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/doctoring/trusted-uv-lock-materialization.md`:
- Around line 117-118: Update the documentation sentence describing the download
opener so the fixed repository-owned User-Agent is attributed to
urllib.request.Request, while the opener is described only as cached,
proxy-disabled, and redirect-rejecting. Preserve the existing responsibilities
and wording for proxy and redirect handling.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 370ae23f-af3e-4030-92ec-63a4539f9c07

📥 Commits

Reviewing files that changed from the base of the PR and between 6eb06cd and 601b254.

📒 Files selected for processing (4)
  • docs/doctoring/trusted-uv-lock-materialization.md
  • scripts/ci/materialize_base_python_requirements.py
  • tests/test_materialize_base_python_requirements.py
  • tests/test_trusted_uv_download_contract.py

Comment thread docs/doctoring/trusted-uv-lock-materialization.md Outdated
@seonghobae
seonghobae enabled auto-merge (squash) August 12, 2026 10:38

Copy link
Copy Markdown
Contributor Author

@opencode-agent review
@cwl-noema-review review

Review exact current head aae09fd95d9c5df7c72b8a19bbcf0a842810bbaa against protected main 6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba. Assess only the four-file trusted-uv bootstrap repair: a fixed repository-owned User-Agent on the immutable Astral HTTPS request, while preserving no-proxy/no-redirect, fixed-origin, bounded-size, checksum, archive-member, and version verification. The fresh hosted cycle is queued and is not passing until terminal. Submit semantic verdicts only; do not modify the branch, merge, retarget, alter credentials, or synthesize human approval.

Copy link
Copy Markdown
Contributor Author

Closing as superseded by #939. The canonical branch already contains the same fixed-origin static User-Agent repair and immutable-request regression, and additionally repairs the cross-repository OpenCode evidence publication boundary and restores fail-closed Strix provider behavior. Keeping both branches open would duplicate the same materializer edit with conflicting constant names and force redundant exact-head review cycles. The narrower branch remains available as historical evidence; no claim is made that predecessor checks transfer to #939.

@seonghobae seonghobae closed this Aug 12, 2026
auto-merge was automatically disabled August 12, 2026 10:45

Pull request was closed

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.

1 participant