Skip to content

fix(publish): handle non-UTF-8 bytes in repository diffs - #50

Merged
PastaPastaPasta merged 1 commit into
mainfrom
claw/cj-20261023-071609-3f7b
Oct 23, 2026
Merged

PastaPastaPasta merged 1 commit into
mainfrom
claw/cj-20261023-071609-3f7b

Conversation

@thepastaclaw

Copy link
Copy Markdown
Owner

What and why

Fix the repeatable publishing crash affecting dashpay/platform#5515.

The saved run-6316 traceback leads through _build_review → github.pr_diff → Gh.run → _default_runner → Python subprocess text decoding. A read-only fetch of the current head (c15b778f8a1779fb62632098d12134fe8b4d4a98) reproduces byte 0xa1 at offset 933869 in a 1,060,023-byte diff. It belongs to packages/rs-drive-proof-verifier/tests/vectors/identity-discovery/key-hash.bin: Git emits this small binary blob as a text hunk, not a Binary files … differ marker.

  • Capture gh stdout/stderr as bytes and decode at the call boundary. Only PR diffs opt into replacing undecodable bytes; ordinary API/JSON remains strict UTF-8. Valid Unicode is preserved. Diff bodies are used for hunk/path mapping, not published as review prose.
  • Preserve inline placement, body-only fallback for oversized diffs, full body rendering of unmappable findings, canonical verifier verdict, and non-ASCII finding content.
  • Close unfinished steps and update the failure gate on unexpected worker exceptions too. Previously the terminal failed run could still show publish: running. Completed verifier steps/findings are untouched.

Proof and validation

  • Real-subprocess regression reproduces the blob bytes, alongside UTF-8 text and a conventional binary marker; strict API decoding and Unicode stdin/stdout have separate coverage.
  • End-to-end publication test checks a final REQUEST_CHANGES, correct head and inline location, Unicode finding text, and full body fallback for an unmappable binary finding.
  • Expected and unexpected publish errors leave the step failed with a finish time, preserve verify2: ok, and replace the progress gate with failure.
  • Confirmed three targeted regressions fail against the original code (including the same subprocess UnicodeDecodeError and stale running publish step).
  • make check: 625 passed, Ruff lint/format clean, strict mypy clean.
  • Read-only validation of the fixed decoder against the live PR diff succeeds (83 mapped paths); no GitHub publication was attempted.

Deployment and recovery (not performed)

After merge and a green check, an operator can use deploy/deploy.sh main (or the merged green commit SHA). This installs the package and restarts the Reviewsys daemon, not OpenClaw.

Then, on the deployment host, if #5515 still has the failed current head and no queued/running head:

"$HOME/.reviewsys/venv/bin/reviewsys" --config "$HOME/.reviewsys/config.toml" retry dashpay/platform 5515

Verified cmd_retry and existing CLI tests: this resets attempts and queues a new full run, not a publish-only resume. If the head moved, use the supported enqueue dashpay/platform 5515 path for the live head instead. There is no supported publish-only resume command. No production DB/artifacts were changed, no saved verifier findings were edited or reinterpreted, and no production deploy/requeue was performed. Historical failed runs remain historical evidence.

Requested by shumkov via PastaClaw. Source: publishing failure on dashpay/platform#5515.

🤖 Generated with Claude Code

Capture gh output as bytes and decode at the call boundary, allowing replacement only for PR diffs while keeping API/JSON strict. Small binary blobs can appear as text hunks; preserve Unicode and inline placement rather than dropping the review.

Close running steps and the gate on unexpected worker crashes, just as for classified failures. Add real-subprocess and worker publication regressions for the binary fixture behind dashpay/platform#5515.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@thepastaclaw

Copy link
Copy Markdown
Owner Author

Validation follow-up: both GitHub Actions check runs are green (push, pull request). Local make check also passed all 625 tests, Ruff and strict mypy. No review feedback is posted yet. Production remains untouched; the operator deployment and full-run retry requirements are documented in the PR body.

@PastaPastaPasta
PastaPastaPasta merged commit f070b73 into main Oct 23, 2026
2 checks passed
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.

2 participants