Repository navigation
fix(mortsom): download artifacts without forwarding the token - #930
Conversation
…ects to Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016wLvLzSnK7q59N5GdFz9MJ
The artifact API redirects to signed blob storage, and urllib forwarded the Authorization header along, which the storage refuses with HTTP 401. Every PR and baseline artifact read failed, so every verdict came out inconclusive (incomplete-run, baseline none). The redirect is now followed by hand, without the token. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016wLvLzSnK7q59N5GdFz9MJ
Codex Review Summary: ✅ CompletedThis 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. |
|
No actionable comments were generated in the recent review. WalkthroughArtifact downloads now use a separate redirect flow. The initial API request is authenticated, but the request to redirected blob storage does not forward the GitHub token. Tests verify the request headers and parsed archive contents. ChangesArtifact download flow
Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Possibly related PRs
Merge Risk:
|
Linked issue
None — found while looking at why #919's Mortsom verdict is
inconclusive. Maintainer change.Type
fix
What changes and why
The Mortsom verdict job could never read a run's artifacts.
archive_download_urlanswers with a 302 to signed blob storage, andurllibfollows it forwarding theAuthorization: Bearerheader, which the storage refuses withHTTP 401: Server failed to authenticate the request. With no summaries read, every verdict becameinconclusive: incomplete-run, and the baselines were unreadable too (baseline none) — e.g. #919 and #929.GitHub._downloadnow asks the API without following redirects and fetches theLocationwithout the token.Affected flow
No app flow. Only
.github/mortsom/run_verdict.py(GitHub.artifact_json→ newGitHub._download), run bymortsom-verdict.ymlonworkflow_run.Blast radius
Only artifact downloads change; every other API call still goes through
_openunchanged. The token is now sent toapi.github.comonly, never to the storage host. Artifacts are still parsed as size-limited data, never executed. Because this PR modifies the gate, its own Mortsom verdict is expected to beinconclusive: gate-modified; the fix shows on the next PR after merge (workflow_runruns the scripts frommain).Platforms tested
Linux (Python 3, stdlib only), against the real GitHub API.
Manual testing
Setup
A
ghlogin with read access to the repo.Steps
main:cd .github/mortsom && GITHUB_TOKEN=$(gh auth token) python3 -c "import os, run_verdict as rv; gh = rv.GitHub('MostroP2P/app', os.environ['GITHUB_TOKEN']); a = gh.run_artifacts(42689719809); print(len(gh.artifact_json(a['mortsom-pr-plain'])))"— prints::warning::cannot read artifact mortsom-pr-plain: HTTP Error 401and0.16(bond:15, meta:1), the summaries of fix: announce an expiry and a taker who left #919's run.Not covered
A full verdict run in Actions: it only happens from
main, after merge.Screenshots
No visible change.
Automated tests
TestArtifactDownload.test_the_token_is_not_sent_to_the_storage_the_api_redirects_to(fc5b7bd, fails onmain): two real local HTTP servers, an API that answers 302 and a storage that answers 401 when it sees anAuthorizationheader, like Azure. It asserts the storage receives no token and the zip's JSON is read.python3 -m unittest discover -s .github/mortsom/tests→Ran 46 tests … OK.Checklist
cd rust && cargo fmt --check && cargo clippy -- -D warnings && cargo testpass locally — no Rust changedart format --set-exit-if-changed .,flutter analyzeandflutter testpass locally — no Dart changerust/src/api/or an.arb: n/adocs/MORTSOM_PR_E2E_SPEC.mdunchanged)AI assistance
Diagnosis, fix and test written with Claude Code; verified against the real API.
🤖 Generated with Claude Code
https://claude.ai/code/session_016wLvLzSnK7q59N5GdFz9MJ
Summary by CodeRabbit