Skip to content

Add review depth, self-check and repeated-failure steps to pre-pr-review (PROF-16542) - #962

Open
rkennke wants to merge 2 commits into
rkennke/PROF-16542-writing-skillsfrom
rkennke/PROF-16542-review-policy
Open

rkennke wants to merge 2 commits into
rkennke/PROF-16542-writing-skillsfrom
rkennke/PROF-16542-review-policy

Conversation

@rkennke

@rkennke rkennke commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?:

Extends the pre-pr-review skill:

  • Reviewer by what the range changes. The first matching row applies:

    • gates and trust boundaries get Sphinx at standard effort, with at most one deep run per PR. This includes fixes to gates, this skill and the AGENTS.md review rules;
    • other production code gets Sphinx at standard effort;
    • fix ranges get /code-review medium;
    • doc-, skill- or test-only ranges get /code-review medium.

    Without Sphinx, gate ranges get /code-review high.

  • Cost. About $20–30 of agentic review per PR. Above that, the agent asks the user first. Large reviews start from a fresh session.

  • Triage.

    • A gate bypass is never downgraded below High.
    • A repeated defect class is fixed as a class.
    • Re-review stops when only Medium or Low findings remain in the fixes; the unfixed ones go into the report.
  • Self-checks. The dead-code and misspelling check moves here from AGENTS.md as its own step.

  • Repeated failures (new last step). The agent tells the user in the session each mistake it made twice and each point the user explained twice, with a proposed home. It does not edit those files itself.

AGENTS.md loses the self-check bullet and describes what the skill now does: 544 → 541 lines.

Stacked on #959.

Motivation:

Step 1 of PROF-16466 showed the review cost problem. A deep Sphinx run on a full PR cost about $112. A standard run on a 3-file fix range cost about $34, most of it the orchestrating session re-reading its long context. This PR writes down the depth policy from the proposal. The triage rules come from #959: two rounds of patching single YAML cases did not converge until the check switched to a closed line grammar.

AGENTS.md says an agent "proposes a concise correction" when it repeats a mistake. Nothing triggered that. The new step puts the trigger at a known moment, the end of the change, and leaves the decision to the engineer (PROF-16542, AC7).

Additional Notes:

  • Dropped from the proposal: "open the PR as a draft first, so the free bot round runs before the paid review". It does not work here. On Move PR, comment, commit and doc writing rules into skills (PROF-16542) #959 neither Codex nor Bits reviewed the draft; Codex started when the PR was marked ready. The gate also needs a fresh marker before gh pr create, drafts included.
  • Reviewer acknowledgment needed: the policy treats this skill and the AGENTS.md review rules as gates. A change that weakens the review policy therefore always gets the gate-tier review.
  • This PR's own review exceeded its budget: the Sphinx run cost $41.88, almost all of it this long orchestrating session re-reading its context. That is the case the fresh-session rule addresses.
  • Pre-PR review:
    • /code-review (medium) on the first commit found 10 issues: overlapping table rows that let a gate fix fall into a lighter row, no effort level for the fallback, an unclear stop rule, a self-check scoped to fix-flow code, and a changed meaning ("empty files"). The second commit fixes all 10.
    • Sphinx at standard effort on the whole range found 0 findings, confirmed by the adversary.

How to test the change?:

Check State
python3 utils/check-skills.py passed
bash utils/tests/test_quality_check_scripts.sh passed, 231 groups
AC7: a 5-turn headless session, corrected twice on Simplified Technical English, then the pre-PR review, on 3eea0c4 passed in Claude Code 2.1.319 and Pi 1.2.0: both report the repeated point with a proposed home (a sentence-style rule in doc-writing) and edit nothing
Same flow on main passed: neither harness reports a repeated failure
Gate row observed: a test branch stacked on this PR, reviewed against origin/main, was refused low-effort review because its range contains gate changes; the session asked the user

For Datadog employees:

  • If this PR touches code that signs or publishes builds or packages, or handles
    credentials of any kind, I've requested a security review (run the dd:platform-security-review
    skill, or file a request via the PSEC review form).
    bewaire also runs automatically on every PR.
  • This PR doesn't touch any of that.
  • JIRA: PROF-16542

🤖 Generated with Claude Code

rkennke and others added 2 commits November 9, 2026 19:50
…iew (PROF-16542)

- Reviewer by what the range changes: Sphinx for gates and production
  code, with at most one deep run per PR; /code-review for fix ranges
  and for doc-, skill- or test-only ranges. A budget of about $20-30 of
  agentic review per PR; the user decides above it.
- Triage: a gate bypass is never downgraded below High; a repeated
  defect class is fixed as a class; re-review stops when it finds only
  Low findings in the fixes.
- The dead-code and misspelling self-check moves here from AGENTS.md,
  next to the other judgment checks it belongs with.
- New last step: tell the user each mistake made twice and each point
  explained twice, with a proposed home, without editing those files.
  AGENTS.md says an agent should propose such corrections, but nothing
  triggered it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Rows apply top to bottom, and the gate row includes fixes to gates,
  this skill and the AGENTS.md review rules. A fix to a gate, or a change
  that weakens the review policy, no longer falls into a lighter row.
- Without Sphinx, gate ranges get /code-review at high effort.
- The self-checks are their own step for every change, not an appendix
  to the fix-flow sentence; "empty files left without callers" is back.
- Re-review stops at only Medium or Low findings in the fixes; the
  unfixed ones go into the report.
- The marker's --session names the session that ran the review.
- AGENTS.md describes what the skill now does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dd-octo-sts

dd-octo-sts Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Scan-Build Report

User:runner@runnervmwuk1x
Working Directory:/home/runner/work/java-profiler/java-profiler/ddprof-lib/src/test/make
Command Line:make -j4 all
Clang Version:Ubuntu clang version 21.1.8 (6ubuntu1)
Date:Mon Nov 9 20:03:51 2026

Bug Summary

Bug TypeQuantityDisplay?
All Bugs2
Logic error
Dereference of null pointer1
Unused code
Dead initialization1

Filter Results by File

Reports

Bug Group Bug Type ▾ File Function/Method Line Path Length
Unused codeDead initializationreferenceChains.cppapplyOomRamp4971
Logic errorDereference of null pointerperfEvents_linux.cppunregisterThread72026

@dd-octo-sts

dd-octo-sts Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

CI Test Results

Run: #42689072087 | Commit: a69f5ab | Duration: 20m 25s (longest job)

✅ All 32 test jobs passed

Status Overview

JDK glibc-aarch64/debug glibc-amd64/debug musl-aarch64/debug musl-amd64/debug
8 - ✅ - -
8-ibm - ✅ - -
8-j9 ✅ ✅ - -
8-librca - - ✅ ✅
8-orcl - ✅ - -
11 - ✅ - -
11-j9 ✅ ✅ - -
11-librca - - ✅ ✅
17 ✅ ✅ - -
17-graal ✅ ✅ - -
17-j9 ✅ ✅ - -
17-librca - - ✅ ✅
21 ✅ ✅ - -
21-graal ✅ ✅ - -
21-librca - - ✅ ✅
25 ✅ ✅ - -
25-graal ✅ ✅ - -
25-librca - - ✅ ✅

Legend: ✅ passed | ❌ failed | ⚪ skipped | 🚫 cancelled

Summary: Total: 32 | Passed: 32 | Failed: 0


Updated: 2026-11-09 20:26:09 UTC

@dd-octo-sts

dd-octo-sts Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

✅ All 40 integration tests passed

📊 Dashboard · 👷 Pipeline · 📦 3eea0c40

@rkennke
rkennke marked this pull request as ready for review November 9, 2026 20:44
@rkennke
rkennke requested a review from a team as a code owner November 9, 2026 20:44
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T20:47:28.810526Z 3eea0c4 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3eea0c40c6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

| --- | --- |
| Gates and trust boundaries, including fixes to them: hooks, `review-marker.py`, the `utils/*-policy.py` files, CI checks, this skill, the AGENTS.md review rules | Sphinx (`/sphinx review range $MB..$(git rev-parse HEAD) --report-json <path>`), standard effort; at most one `--effort=deep` run per PR, on the final candidate |
| Other production code | Sphinx, standard effort |
| Only fixes to a range already reviewed | `/code-review` medium, on the fix range only |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Review the final full range before writing its marker

When a previously reviewed branch is changed by fixes, this row reviews only the fix range, but step 5 then writes a marker for the entire final MB..HEAD diff. The earlier review applies to the pre-fix candidate, so interactions between the fixes and unchanged hunks can remain unreviewed while the hooks accept the marker as covering the final branch; require a review of the final full range or a marker mechanism that explicitly composes both reviews.

AGENTS.md reference: AGENTS.md:L500-L504

Useful? React with 👍 / 👎.

every turn, so run this skill for large reviews from a fresh session where the harness
allows; that session writes the marker.

3. **Self-checks.** In addition to the reviewer, check the diff for unused variables,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Run self-checks before the reviewer

If these post-review checks find dead code, duplicated macros, or a bad comment and the agent corrects it, the resulting candidate was never reviewed: step 4 only explicitly requires re-reviewing fixes to Critical/High reviewer findings. Move these checks before step 2 or require every self-check correction to be committed and re-reviewed before the marker is written, because changing the candidate invalidates its existing evidence.

AGENTS.md reference: AGENTS.md:L482-L485

Useful? React with 👍 / 👎.

Comment on lines +46 to +47
every turn, so run this skill for large reviews from a fresh session where the harness
allows; that session writes the marker.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve failure history when starting a fresh session

For a large review started in the recommended fresh session, that session has no transcript of mistakes or explanations from the preceding implementation work, so it cannot perform step 7 and will silently omit repeated failures. Require a handoff of the repeated-failure list or leave that reporting step to the original session so the repository's repeated-failure feedback rule still runs.

AGENTS.md reference: AGENTS.md:L50-L53

Useful? React with 👍 / 👎.

@datadog-prod-us1-4 datadog-prod-us1-4 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: PASS

More details

Gate fixes and edits to the review policy still select the gate-tier reviewer, and the existing marker freshness requirements remain intact. No reportable defect was identified.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 3eea0c4

This branch has not been deployed

No deployments
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