Skip to content

fix(media-proof): fetch GitHub attachment URLs for review evidence - #1484

Merged
steipete merged 1 commit into
mainfrom
media-proof/github-user-attachments
Sep 8, 2026
Merged

steipete merged 1 commit into
mainfrom
media-proof/github-user-attachments

Conversation

@steipete

@steipete steipete commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where ClawSweeper reviews of pull requests with embedded screenshots reported "attachment retrieval failed" or "screenshots were inaccessible in this review environment", and scored visual verification as incomplete, whenever the images were uploaded through GitHub (drag-drop or the user-attachments API). This hit three openclaw/openclaw PRs on 2026-09-07 (openclaw/openclaw#141428, openclaw/openclaw#141429, openclaw/openclaw#141431) whose bodies carried before/after captures.

Why This Change Was Made

Media proof preparation discovered download candidates only by filename extension. GitHub attachment URLs (https://github.com/user-attachments/assets/<uuid> and the legacy https://github.com/<owner>/<repo>/assets/<id>/<uuid>) have no extension, so nothing was downloaded for the network-isolated reviewer and the adaptive media time budget stayed at zero. A single shared recognizer now accepts exactly those two github.com path shapes, both for discovery and for the review budget. Attachments are fetched with the existing curl GET flags plus the response content type and effective URL, classified as image or video from the content type (anything else is recorded as a failed artifact), renamed with a matching extension, and then follow the unchanged image and video proof paths. Discovery still scans only the same context fields: PR patches and supplemental body excerpts never supply download URLs, and no other extension-less host is fetched.

User Impact

Reviewers see the PR's actual screenshots and video contact sheets again, so visual verification and proof scoring reflect the evidence authors attached. Nothing changes for media linked with explicit file extensions.

OpenClaw Bay Impact

Unaffected. This changes reviewer-local media preparation and its existing time allowance, not publication payloads, queue semantics, status or telemetry fields, or any dashboard data contract.

Documentation Impact

README.md (active) gains a paragraph describing media proof discovery, including GitHub attachment URLs and content-type classification, next to the existing input-boundary statement. CHANGELOG.md gets an Unreleased/Fixed entry. No runbook or volatile reference changes.

Evidence

  • node --test test/review-prompt-policy.test.ts test/repair/adaptive-review-budget.test.ts: 78/78 passed. New coverage: both attachment URL shapes are discovered and non-github.com or malformed paths are not; image/png → prepared image saved as .png; video/mp4 → ffprobe and contact sheet; text/html → failed with unsupported content type; filename fallback from the effective URL; the existing "never causes host fetches" boundaries hold with attachment URLs placed in patch text and supplemental excerpts; the review budget adds 120 s per attachment, deduplicates, ignores known image extensions, and caps at 480 s.
  • corepack pnpm run build, build:repair, format, git diff --check: pass.
  • corepack pnpm run check: every static check, build, lint target, and the focused coverage gate passed; the full unit suite finished with 21 failures, in live-proof terminal/tmux environment tests and workflow subprocess tests on a host at load average ~97, none touching the changed modules. Several stalled task-owned subprocesses required termination; these failures have not been proven against a clean baseline, and aggregate coverage thresholds remain unverified. CI on this PR is the authoritative run for those suites.
  • Independent code review: clean at P2.

Real Behavior Proof

  • Claim: a GitHub user attachment embedded in a PR body is downloaded before review and handed to the reviewer as a locally readable image.
  • Surface: the built prepareMediaProofArtifacts with the real command runner (curl GET following the GitHub → S3 redirect), local file and manifest generation.
  • Fixture: a public PNG from feat(ui): link bare GitHub issue and PR references in chat openclaw#141431, https://github.com/user-attachments/assets/0ba4960d-7c53-4ce4-b737-f6e0b4c8f776, in a minimal PR-body context.
  • Command and environment: corepack pnpm run build, then a Node harness invoking the built prepareMediaProofArtifacts with the real command runner on macOS arm64, Node v24.20.0, local process, no container lease.
  • Observed result: detected=["…/0ba4960d-…"], one artifact kind: image, status: prepared, proof-image-1.png of 10,960 bytes, file reports PNG image data, 760 x 440, 8-bit/color RGB; the manifest and summary files are written.
  • Baseline: the same context against the origin/main module yields detected=[] and an empty manifest, which reproduces the reported failure.
  • Limits: one public current-format PNG over real transport; legacy paths, video routing, unsupported types, caps, and excluded context fields are covered by controlled-runner tests; no private-asset authentication or full sandboxed Codex review was exercised.

Extension-only discovery missed github.com/user-attachments assets, so reviewers received no screenshots and the media budget stayed at zero. Use a shared recognizer for both github.com attachment URL shapes and classify downloaded media from the GET response content type. Apply the same bounded media budget rule to those attachments. Existing input, host, and processing boundaries remain unchanged.
@clawsweeper

clawsweeper Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review September 8, 2026 00:58
@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 8, 2026
@clawsweeper

clawsweeper Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 7, 2026, 9:02 PM ET / September 8, 2026, 01:02 UTC.

ClawSweeper review

What this changes

Recognize GitHub attachment links, classify downloaded images and videos by response content type, and reserve bounded preparation time for them.

Merge readiness

✅ Ready for maintainer review

This remains a useful fix: pinned main skips extensionless GitHub attachments. The implementation preserves existing preparation boundaries, and the supplied real-transport proof demonstrates the central repair. No actionable patch defect was found.

Priority: P2
Reviewed head: 4d5e83421a54abf7a059b569f7d0eb24847d57b4

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with credible real-transport before/after evidence and targeted boundary coverage.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The captured body records the production preparation function using real curl against a public GitHub PNG on macOS: main found nothing, while the patched run produced a readable image and manifest. This proves the central download repair; legacy and video cases have supplemental test coverage.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured body records the production preparation function using real curl against a public GitHub PNG on macOS: main found nothing, while the patched run produced a readable image and manifest. This proves the central download repair; legacy and video cases have supplemental test coverage.
Evidence reviewed 7 items Applicable repository policy: Read the complete root AGENTS.md; no nested AGENTS.md or matching maintainer-note files were found. Applied narrow-change, real-behavior-proof, and Bay-impact guidance. The supplied proof ran on macOS, so the policy's Windows-host-specific container instruction does not establish a defect.
Current main still misses these links: Pinned main discovers candidates solely through image/video filename extensions. Its production preparation function therefore receives no candidate for either extensionless GitHub attachment shape.
Introduced behavior and input boundaries: The shared recognizer restricts extensionless candidates to HTTPS github.com attachment paths without credentials. Discovery continues excluding PR patches and supplemental body coverage. Downloads use the existing command runner and deadline; response metadata determines image/video routing and unsupported types produce failed artifacts.
Findings None None.
Security None None.

How this fits together

ClawSweeper prepares media linked in review context before starting the reviewer. It downloads images and converts videos into contact sheets, then supplies local paths and preparation results to the review prompt.

flowchart TD
  A[Review bodies and comments] --> B[Discover media links]
  B --> C[Bounded download]
  C --> D{Response media type}
  D --> E[Local image]
  D --> F[Video contact sheet]
  D --> G[Failure record]
  E --> H[Reviewer evidence manifest]
  F --> H
  G --> H
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test delta Production +79/-9; tests and fixtures +182/-30 Production growth implements attachment recognition and response classification, with focused coverage for routing and input boundaries.
Attachment preparation allowance 120 seconds per candidate; maximum 4 candidates / 480 seconds Unknown attachment types reserve preparation time without increasing the existing processing ceiling.

Technical review

Best possible solution:

Use the existing bounded media preparation pipeline for GitHub attachments, with shared discovery rules and explicit unsupported-content results.

Do we have a high-confidence way to reproduce the issue?

Yes: an extensionless GitHub attachment in the review body fails main's filename-extension filter. Source inspection establishes the path, and the contributor records matching before/after output; this review did not execute it.

Is this the best way to solve the issue?

Yes: extending discovery and reusing the existing downloader and media handlers is a focused repair, with one shared recognizer keeping preparation and budgeting aligned.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against b6297c4b6272.

Labels

Label changes:

  • add P2: Repairs a bounded review-evidence discovery failure that can cause attached screenshots to be overlooked.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The captured body records the production preparation function using real curl against a public GitHub PNG on macOS: main found nothing, while the patched run produced a readable image and manifest. This proves the central download repair; legacy and video cases have supplemental test coverage.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured body records the production preparation function using real curl against a public GitHub PNG on macOS: main found nothing, while the patched run produced a readable image and manifest. This proves the central download repair; legacy and video cases have supplemental test coverage.

Label justifications:

  • P2: Repairs a bounded review-evidence discovery failure that can cause attached screenshots to be overlooked.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured body records the production preparation function using real curl against a public GitHub PNG on macOS: main found nothing, while the patched run produced a readable image and manifest. This proves the central download repair; legacy and video cases have supplemental test coverage.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured body records the production preparation function using real curl against a public GitHub PNG on macOS: main found nothing, while the patched run produced a readable image and manifest. This proves the central download repair; legacy and video cases have supplemental test coverage.

Evidence

What I checked:

  • Applicable repository policy: Read the complete root AGENTS.md; no nested AGENTS.md or matching maintainer-note files were found. Applied narrow-change, real-behavior-proof, and Bay-impact guidance. The supplied proof ran on macOS, so the policy's Windows-host-specific container instruction does not establish a defect. (AGENTS.md:1, 4d5e83421a54)
  • Current main still misses these links: Pinned main discovers candidates solely through image/video filename extensions. Its production preparation function therefore receives no candidate for either extensionless GitHub attachment shape. (src/clawsweeper-media-proof.ts:69, b6297c4b6272)
  • Introduced behavior and input boundaries: The shared recognizer restricts extensionless candidates to HTTPS github.com attachment paths without credentials. Discovery continues excluding PR patches and supplemental body coverage. Downloads use the existing command runner and deadline; response metadata determines image/video routing and unsupported types produce failed artifacts. (src/clawsweeper-media-proof.ts:46, 4d5e83421a54)
  • Production callers and budget integration: Both review entrypoints prepare media before constructing the reviewer prompt. The adaptive budget uses the same attachment recognizer and retains the four-candidate, 480-second ceiling. Existing local-range reviews still skip preparation. The PR body explains why no Bay contract changes are needed. (src/repair/adaptive-review-budget.ts:73, 4d5e83421a54)
  • Captured real behavior proof: The complete supplied body at sourceRevision 2db00da506e9efcee79889e85d165537e34d2dc6b685d113a5e13248765de283 records the built production preparation function using real curl on macOS arm64 with Node 24.20.0. Main detected no candidate; the patched run prepared a 10,960-byte PNG identified as 760×440 and wrote the manifest and summary. Coverage is one public current-format image; legacy paths, video routing, rejection cases, and caps have supplemental controlled-runner coverage. (4d5e83421a54)
  • Validation scope: Inspected the introduced test cases for both URL shapes, rejected hosts and paths, content-type handling, patch/excerpt exclusion, and deadline sharing. The body reports 78 focused tests passing, while acknowledging 21 unrelated full-suite failures without a clean baseline. This read-only review did not execute tests; git diff --check passed and the checkout remained clean. (test/review-prompt-policy.test.ts:454, 4d5e83421a54)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Sebastien Tardif: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 175d755 into main Sep 8, 2026
28 of 29 checks passed
@steipete
steipete deleted the media-proof/github-user-attachments branch September 8, 2026 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant