Skip to content

feat(docs-pr-review): use a decision model to filter findings and raise funds risk - #2167

Merged
soheimam merged 2 commits into
masterfrom
feat/docs-pr-review-decisions
Oct 21, 2026
Merged

soheimam merged 2 commits into
masterfrom
feat/docs-pr-review-decisions

Conversation

@soheimam

@soheimam soheimam commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

What changed? Why?

Step 2 of the reviewer fixes from the BKB feedback: a decision model for the calls the reviewer gets wrong most often. Stacked on #2166, so this diff shows step 2 only. It will retarget to master when #2166 merges.

New scripts/docs-pr-review/decisions.mjs calls the LLM Gateway Decisions API (POST /v1/decisions, gpt-6-luna). It's a classifier that returns probabilities, at about 300 ms and about $0.0001 per call. It makes two checks:

  • Findings that would not mislead a reader. Each non-blocking finding is scored with one yes/no question: would the text it's about give a reader a wrong or unsupported fact, a wrong step, or a claim that could cause a mistake? Below 0.5, the finding stays in the summary under a collapsed "Minor suggestions" list and is not posted inline. Nothing is deleted. Blocking findings are never scored. This targets the style nits reviewers rejected on low-risk PRs.
  • Values that could cost funds. Each PR is scored on whether a wrong value in the added lines (address, endpoint, chain ID, fee, amount, key handling) could cost readers funds. At 0.8 or above the level is raised to high, with the reason and a "What to check" line. It can only raise the level, never lower it, so untrusted PR text can't talk a PR down.

Both checks fail open. A missing key, HTTP error, refusal, bad answer or 15 s timeout logs a warning, and the review posts as it does today. The run notice now includes minor= and funds_risk=.

Notes to reviewers

How has it been tested?

Screenshots

N/A (no user-facing changes)

Generated with Toshi

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Docs review

Risk: Medium (one AI review with a larger model) · risk: medium · shadow mode, not enforced

  • changes code in scripts/docs-pr-review/__tests__/decisions.test.mjs
  • changes code in scripts/docs-pr-review/decisions.mjs
  • changes code in scripts/docs-pr-review/index.mjs
  • changes code in scripts/docs-pr-review/render.mjs
  • changes code in scripts/docs-pr-review/risk.mjs
  • changes 396 lines across 5 files, not counting generated index files (low allows up to 20 lines and 3 files)

What to check:

  • Run the changed code or check its output.
  • Large changes are easier to get wrong. Check the facts in every changed section.
Lower-level signals
  • Low: repeats a contract address already in the docs (not a risk signal)

No documentation pages changed in 2f1e433, so there is no content review.

Advisory review from the Docs PR review workflow (run). It does not approve, block, or edit this PR. Add the skip-ai-review label to turn it off for this PR.

@soheimam
soheimam added this pull request to stack #2168 October 21, 2026 09:56
@cb-heimdall

cb-heimdall commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Heimdall Review Status

Requirement Status More Info
Reviews ✅ 1/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

Base automatically changed from feat/docs-pr-review-risk-reasons to master October 21, 2026 10:55
…se funds risk

Adds decisions.mjs, a client for the LLM Gateway Decisions API (gpt-6-luna),
with two narrow checks:

- misleads: each non-blocking finding is scored on whether the text it is
  about would mislead a reader. Below 0.5 it stays in the summary under a
  collapsed "Minor suggestions" list and is not posted inline. Blocking
  findings are never scored.
- funds_risk: each PR is scored on whether a wrong value in the added lines
  could cost readers funds. At 0.8 or above the risk level is raised to high.
  It never lowers a level.

Both fail open: on any error or timeout the review posts as before.
…OpenAI guide

A failed or refused call now leaves only that finding unscored (kept as it is) instead of skipping the filter for every finding. Adds the guide link and host note to the module header.
@youssefea
youssefea force-pushed the feat/docs-pr-review-decisions branch from d86af01 to 2f1e433 Compare October 21, 2026 10:55
@soheimam
soheimam merged commit 8891cde into master Oct 21, 2026
14 checks passed
@soheimam
soheimam deleted the feat/docs-pr-review-decisions branch October 21, 2026 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants