Skip to content

feat(hitl): render PR reviews via a dedicated hax template#39

Merged
AbirAbbas merged 2 commits into
mainfrom
feat/pr-af-review-template
Jun 4, 2026
Merged

feat(hitl): render PR reviews via a dedicated hax template#39
AbirAbbas merged 2 commits into
mainfrom
feat/pr-af-review-template

Conversation

@AbirAbbas
Copy link
Copy Markdown
Contributor

Summary

Follow-up to #38. The HITL review approval was rendered with hax's generic form-builder, which dumped the raw PR body (e.g. a Dependabot HTML changelog) into a plain-text description field — unreadable. This switches the gate to a purpose-built pr-af-review-v1 hax template (added in the hax-sdk repo) and cleans up what we send.

What changed (pr-af)

  • Dedicated template: the gate now sends type="pr-af-review-v1" with a structured payload — PR metadata (repo, number, url, author, diff stats) + a findings list (severity, file:line, body, suggestion, dimension) — instead of a flat FormBuilder.
  • Clean intent: clean_intent() strips HTML tags and truncates the PR body, so bot-authored changelogs no longer leak raw markup into the form.
  • Zero-finding skip: when a review produces no findings and HITL is enabled, the human gate is skipped and nothing is posted — no point bugging a reviewer, and an empty auto-approve would be noise on a public repo.
  • The template reuses form-builder's {template, values} response envelope, so the decision parser is unchanged.

Companion change

Requires the pr-af-review-v1 template in hax-sdk (separate PR). The hax service validates the request payload against the registered template and rejects unknown types, so hax-sdk must deploy before this does.

Test plan

  • ruff check src/ scripts/ tests/ — clean
  • pytest — 21 passed (payload shape, decision parsing unchanged, zero-finding skip, watchdog fast-fail)
  • docker build — passes
  • End-to-end on the Railway stack once hax-sdk ships the template

🤖 Generated with Claude Code

AbirAbbas and others added 2 commits June 3, 2026 17:44
…late

Replace the generic form-builder request with the purpose-built
`pr-af-review-v1` hax template. The gate now sends a structured payload
(PR metadata + a findings list) instead of a flat FormBuilder, and
`clean_intent` strips HTML and truncates the PR body so a Dependabot-style
changelog no longer dumps raw markup into the form.

The template emits the same `{template, values}` response envelope as
form-builder, so the decision parser is unchanged. `create_hax_*` is
generalized to take an arbitrary payload + request_type.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… no findings

Thread PR metadata (repo, number, url, author, diff stats) into the review
template via `_pr_meta`. When the review produces zero findings and HITL is
enabled, skip the human gate entirely and post nothing — no point bugging a
reviewer, and an empty auto-approve would be noise on a public repo.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@AbirAbbas AbirAbbas merged commit cb8c99d into main Jun 4, 2026
2 checks passed
@AbirAbbas AbirAbbas deleted the feat/pr-af-review-template branch June 4, 2026 00:45
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