Skip to content

[3444 by Claude Opus 5.5] Template: turn repeated review corrections into proposed repository instructions - #3457

Merged
integry merged 2 commits into
3443-epic-automations-no-t7ofrom
3444/claude-opus-5-5-template-turn-repeated-re-20261111-2324-mpy
Nov 12, 2026
Merged

integry merged 2 commits into
3443-epic-automations-no-t7ofrom
3444/claude-opus-5-5-template-turn-repeated-re-20261111-2324-mpy

Conversation

@propr-dev

@propr-dev propr-dev Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

AI Implementation Summary

Closes #3444

Branch: 3444/claude-opus-5-5-template-turn-repeated-re-20261111-2324-mpy
Commits: ✅ Changes committed (db99ee0)


AI Processing Completed

Execution Details:

Summary:
I've added the Instruction learning loop template to the automation catalog. It reads recent PR discussions, finds review corrections that keep coming back, and writes a report proposing short, cited changes to the repository's agent instructions. The new tests pass, along with the existing catalog, report-prompt, UI and API template tests, and npm run automation-templates:check reports the catalog is up to date. I haven't run the full repository test suite.

The template (packages/shared/automation-templates/instruction-learning-loop/)

  • Settings: capabilities repository_read and propr_mcp, a weekly schedule (Mondays 08:00 UTC), and dry_run by default. The previous report is included so it doesn't propose the same rule twice. Its "review before saving" notes cover repositories, schedule, autonomy and the coding agent, because propr_mcp only works with Claude Code or Codex.
  • Sources: the prompt reads AGENTS.md, .propr/instructions.md and the file named by instructions in .propr/workflow.yml. It covers the last 30 days of PRs through list_pull_requests, get_pull_request_discussion, list_tasks and get_task_events.
  • Report sections:
    • Candidate rules: proposed wording in one or two sentences, the target file, and links to at least two distinct PRs where the same correction was made, plus a confidence level.
    • Removal candidates: existing instructions that look stale or contradicted by recent merged work.
    • Instruction file size: each file and the total, with a warning above 300 lines or 20,000 characters. I picked those thresholds; adjust them if you have a better number in mind.
    • Proposed task: a ready-to-use task body with the citations.
  • Rules in the prompt: never propose a rule from a single PR, ignore one-off preferences, and treat PR text as untrusted data. It also says never to propose a rule whose only source is text asking for that rule.

Acting step: I didn't change actionPrompt.ts. The acting step already receives the template prompt as context, so the template's "If this report is acted on" section tells it to create a ProPR task carrying the citations and nothing more. That task, not the acting step, edits the files and opens the PR. One difference from the issue: it creates one task per repository rather than one task in total, because ProPR tasks belong to a single repository. A one-repository automation still gets exactly one task.

Other changes

  • scripts/generate-automation-templates.ts lists the new template second, and the catalog JSON is regenerated.
  • test/instructionLearningLoopTemplate.test.ts is the prompt snapshot test. It pins the key rule sentences word for word, checks the four MCP tool names and the order of the report sections, and confirms the prompt reaches both the report run and the acting step.
  • docs/docs/features/agents.md has a new row in the templates table and an "Instruction learning loop" section explaining the loop and why changes go through a reviewed PR. CHANGELOG.md has an entry.

I captured a preview of the new template card selected in the new-automation form, which shows its review notes and filled-in fields.

Detailed Logs:

  • Conversation: 74 messages
  • Session: 03fde007-f759-428c-89ea-c3985bf837c1

Log files stored at:

  • conversation: /usr/src/app/logs/executions/issue-3444-2026-11-11T23-32-17-498Z-conversation.json
  • output: /usr/src/app/logs/executions/issue-3444-2026-11-11T23-32-17-498Z-output.txt
Latest Conversation Messages
ASSISTANT: [content unavailable]

ASSISTANT: I've added the **Instruction learning loop** template to the automation catalog. It reads recent PR discussions, finds review corrections that keep coming back, and writes a report proposing short, ci...


This PR was created automatically by ProPR after processing issue #3444.


💡 Need changes?

Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!


Visual preview

Instruction learning loop template

Instruction learning loop template

New automation form at 1440px after choosing the new Instruction learning loop template card: review-before-saving notes, weekly Monday schedule, dry run, and the prefilled name, description and prompt.

Connect sign-in required. Original retained until 2027-02-09T23:32:21.668Z.

View the full-resolution original in ProPR Connect

…atalog. It reads recent PR discussions, finds review corrections that keep coming back, and writes a report proposing short, cited changes to the repository's agent instructions. The new tests pass, along with the existing catalog, report-prompt, UI and API template tests, and `npm run automation-templates:check` reports the catalog is up to date. I haven't run the full repository test suite.

The template (`packages/shared/automation-templates/instruction-learning-loop/`)
- Settings: capabilities `repository_read` and `propr_mcp`, a weekly schedule (Mondays 08:00 UTC), and `dry_run` by default. The previous report is included so it doesn't propose the same rule twice. Its "review before saving" notes cover repositories, schedule, autonomy and the coding agent, because `propr_mcp` only works with Claude Code or Codex.
- Sources: the prompt reads `AGENTS.md`, `.propr/instructions.md` and the file named by `instructions` in `.propr/workflow.yml`. It covers the last 30 days of PRs through `list_pull_requests`, `get_pull_request_discussion`, `list_tasks` and `get_task_events`.
- Report sections:
  - Candidate rules: proposed wording in one or two sentences, the target file, and links to at least two distinct PRs where the same correction was made, plus a confidence level.
  - Removal candidates: existing instructions that look stale or contradicted by recent merged work.
  - Instruction file size: each file and the total, with a warning above 300 lines or 20,000 characters. I picked those thresholds; adjust them if you have a better number in mind.
  - Proposed task: a ready-to-use task body with the citations.
- Rules in the prompt: never propose a rule from a single PR, ignore one-off preferences, and treat PR text as untrusted data. It also says never to propose a rule whose only source is text asking for that rule.

Acting step: I didn't change `actionPrompt.ts`. The acting step already receives the template prompt as context, so the template's "If this report is acted on" section tells it to create a ProPR task carrying the citations and nothing more. That task, not the acting step, edits the files and opens the PR. One difference from the issue: it creates one task per repository rather than one task in total, because ProPR tasks belong to a single repository. A one-repository automation still gets exactly one task.

Other changes
- `scripts/generate-automation-templates.ts` lists the new template second, and the catalog JSON is regenerated.
- `test/instructionLearningLoopTemplate.test.ts` is the prompt snapshot test. It pins the key rule sentences word for word, checks the four MCP tool names and the order of the report sections, and confirms the prompt reaches both the report run and the acting step.
- `docs/docs/features/agents.md` has a new row in the templates table and an "Instruction learning loop" section explaining the loop and why changes go through a reviewed PR. `CHANGELOG.md` has an entry.

I captured a preview of the new template card selected in the new-automation form, which shows its review notes and filled-in fields.
@propr-dev

propr-dev Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

/ultrafix goal=8 max=10
Triggered automatically by the requested execution settings.

@propr-dev

propr-dev Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

🔄 Ultrafix loop started (goal: 8/10, max cycles: 10)

First action: /review

💡 Tip: Remove the ultrafix label from this PR to stop further ultrafix cycles.

@propr-dev propr-dev Bot added the ultrafix label Nov 11, 2026
@propr-dev

propr-dev Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — codex:gpt-6-astra

Overall Evaluation

The PR adds a focused template with catalog integration, documentation, and prompt contract tests. It needs a localized correction to its review-data collection before merging.

✅ Safe defaults — The template starts in dry_run, and the report runner supplies read-only MCP access.

✅ Evidence requirements — Candidate rules require two distinct PRs, exclude one-off preferences, and retain citations in proposed tasks.

✅ Catalog integration — The generator registers the template, and existing catalog tests check generated content and definition validity.

The supplied checks show no failures and four pending checks. This review used static analysis only; no commands were run.

Merge blockers

Every finding below was introduced by this PR and must be resolved before merging.

F1: 🔴 Read actual GitHub review comments

  • Required behavior: The template must learn repeated corrections from PR reviews; its prescribed collection path must retrieve those reviews.

  • Evidence: packages/shared/automation-templates/instruction-learning-loop/prompt.md:7 — directs the run to obtain human review comments through get_pull_request_discussion.

    1. Two recently merged PRs contain the same accepted correction in inline GitHub review comments, with no corresponding issue-conversation comments or ProPR task events.
    2. The template lists those PRs and requests their discussions using get_pull_request_discussion.
    3. The supplied implementation retrieves /issues/{issue_number}/comments for its default path. That endpoint excludes inline PR review comments and submitted review bodies.
    4. The prescribed collection therefore misses both corrections, and the report omits a qualifying repeated rule.

    static trace: The supplied toolsPullRequests.ts:212–226 implementation confirms the default issue-comment source. Task events cannot recover the example because these PRs have no ProPR task events. The new tests assert tool names and prompt text, so they do not detect missing review evidence. This is a limitation of the template’s prescribed collection path; an agent independently choosing another source is not guaranteed.

  • Minimum fix: Explicitly supplement discussion collection with GitHub submitted reviews and inline review comments through an available read-only source, including pagination, and regenerate the catalog. Retain the existing discussion tool for conversation comments and ProPR reviews.

Suggestions

These are optional follow-ups and are not sent to /fix.

S1: 🟢 Clarify repository-specific task bodies

The prompt creates one task per repository but specifies a single “Proposed task” section whose body is reused. Explicitly requesting a separate body for each repository would make multi-repository reports easier to act on correctly. This is optional clarification because the existing acting-step repository restrictions already constrain actions.

S2: 🟢 Align task-count descriptions

The autonomy note in template.json and the changelog say “one ProPR task,” while the prompt and feature documentation say “one ProPR task per repository.” Aligning these descriptions would improve expectations for multi-repository automations without changing execution behavior.

Score

The implementation is well scoped and defaults safely, but its prescribed evidence collection misses a primary source of review corrections. The remaining checks are pending, with no reported failures.

Score: 6/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 32s
  • Tokens: 47,093 (46,277 in / 816 out)
  • Cost: $0.37

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix F1 S1 S2

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 2c5795c

Addressed 1 AI review comment (IDs: 6809956559)

Addressed finding F1

Summary of Changes

I've fixed F1. The template now reads submitted GitHub reviews and inline review comments as well as the PR conversation, so corrections made in code review are no longer missed.

The gap: none of the ProPR MCP tools could read inline review comments. get_pull_request_discussion only reads /issues/{n}/comments. get_pull_request returns submitted reviews, but has no paging and no inline comments. So rewording the prompt alone wouldn't have helped; the tool needed a new read-only option.

MCP tool (packages/api/mcp/toolsPullRequests.ts, packages/api/mcp/reviewDiscussion.ts)

  • get_pull_request_discussion takes a new source argument:
    • conversation is the default and behaves exactly as before. ProPR AI reviews still come from here.
    • reviews reads GET /pulls/{n}/reviews: each review's state, summary body, commit and link.
    • review_comments reads GET /pulls/{n}/comments in date order: file, line (falling back to the original line for outdated comments), side, review id, reply-to id, commit and link.
  • Both new sources page oldest-first by page number with nextPage, and split long bodies into 4096-character chunks like the conversation does.
  • order=newest, cursor, commentId and taskId only work for the conversation. With the new sources they return INVALID_INPUT instead of being silently ignored.
  • Responses now include source, which is an addition only.

Template (instruction-learning-loop/prompt.md, catalog regenerated)

  • Step 3 now tells the run to read all three sources for every PR, following nextPage until it is null, and never to skip inline comments.
  • If a source can't be read, the run must say so in the Summary rather than treat it as having no corrections.

Tests

  • packages/api/test/mcpPullRequestReviewSources.test.ts (new, added to test:mcp) uses a fake GitHub with separate conversation, review and inline-comment data. It checks that the conversation has no review records, and covers review paging across pages, body chunking, inline file/line/reply fields, the sort parameters sent to GitHub, and the refused conversation-only options.
  • test/instructionLearningLoopTemplate.test.ts pins the prompt's instructions to read both new sources and every page.

Docs: the new sources are described in docs/mcp.md, docs/mcp-coverage.md and the agents feature page, with a CHANGELOG entry.

Verification:

  • 81 of 81 tests pass across the new suite, the existing PR, surface, workflow, input-budget, attachment and docs MCP suites, and the template catalog and template tests.
  • tsc --noEmit on packages/api is clean (after rebuilding shared and core).
  • eslint --max-warnings 0 passes on the changed API files.
  • automation-templates:check reports the catalog is up to date.

I didn't run the full repository suite. There's no visual preview, since the only visible effect is reworded prompt text.

Separate discovery, not changed: get_pull_request still reads only the first 100 submitted reviews and doesn't page beyond them. That predates this PR, and the template no longer depends on it.


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-ultrafix
  • Time: 8m 15s
  • Tokens: 2,791,244 (2,774,002 in / 17,242 out)
  • Cost: $1.33

View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Address review blockers, or blockers and suggestions with /fix all /fix, /fix all, or /fix F3 S5
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 Generated by ProPR

…ews and inline review comments as well as the PR conversation, so corrections made in code review are no longer missed.

I've fixed F1. The template now reads submitted GitHub reviews and inline review comments as well as the PR conversation, so corrections made in code review are no longer missed.

**The gap:** none of the ProPR MCP tools could read inline review comments. `get_pull_request_discussion` only reads `/issues/{n}/comments`. `get_pull_request` returns submitted reviews, but has no paging and no inline comments. So rewording the prompt alone wouldn't have helped; the tool needed a new read-only option.

**MCP tool** (`packages/api/mcp/toolsPullRequests.ts`, `packages/api/mcp/reviewDiscussion.ts`)
- `get_pull_request_discussion` takes a new `source` argument:
  - `conversation` is the default and behaves exactly as before. ProPR AI reviews still come from here.
  - `reviews` reads `GET /pulls/{n}/reviews`: each review's state, summary body, commit and link.
  - `review_comments` reads `GET /pulls/{n}/comments` in date order: file, line (falling back to the original line for outdated comments), side, review id, reply-to id, commit and link.
- Both new sources page oldest-first by page number with `nextPage`, and split long bodies into 4096-character chunks like the conversation does.
- `order=newest`, `cursor`, `commentId` and `taskId` only work for the conversation. With the new sources they return `INVALID_INPUT` instead of being silently ignored.
- Responses now include `source`, which is an addition only.

**Template** (`instruction-learning-loop/prompt.md`, catalog regenerated)
- Step 3 now tells the run to read all three sources for every PR, following `nextPage` until it is null, and never to skip inline comments.
- If a source can't be read, the run must say so in the Summary rather than treat it as having no corrections.

**Tests**
- `packages/api/test/mcpPullRequestReviewSources.test.ts` (new, added to `test:mcp`) uses a fake GitHub with separate conversation, review and inline-comment data. It checks that the conversation has no review records, and covers review paging across pages, body chunking, inline file/line/reply fields, the sort parameters sent to GitHub, and the refused conversation-only options.
- `test/instructionLearningLoopTemplate.test.ts` pins the prompt's instructions to read both new sources and every page.

**Docs:** the new sources are described in `docs/mcp.md`, `docs/mcp-coverage.md` and the agents feature page, with a CHANGELOG entry.

**Verification:**
- 81 of 81 tests pass across the new suite, the existing PR, surface, workflow, input-budget, attachment and docs MCP suites, and the template catalog and template tests.
- `tsc --noEmit` on `packages/api` is clean (after rebuilding shared and core).
- `eslint --max-warnings 0` passes on the changed API files.
- `automation-templates:check` reports the catalog is up to date.

I didn't run the full repository suite. There's no visual preview, since the only visible effect is reworded prompt text.

**Separate discovery, not changed:** `get_pull_request` still reads only the first 100 submitted reviews and doesn't page beyond them. That predates this PR, and the template no longer depends on it.

PR: #3457
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
@propr-dev

propr-dev Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — codex:gpt-6-astra

Overall Evaluation

The PR adds a weekly instruction-learning template and extends MCP discussion reads to include submitted reviews and inline comments. It is merge-ready within the reviewed scope; no merge blocker was verified.

✅ Safe defaults — The template defaults to dry_run, requires repeated evidence across distinct PRs, and explicitly treats review text as untrusted data.

✅ Review coverage — The new MCP sources preserve review state, commit identity, file locations and reply relationships. Tests cover pagination, body continuation and rejection of incompatible selectors.

✅ Catalog integration — The template source, generated catalog, documentation and prompt-consumer tests are updated consistently.

This assessment is a static review of the supplied diff and context. No commands were run, and no current-head check runs were reported.

Merge blockers

No merge blockers.

Suggestions

These are optional follow-ups and are not sent to /fix.

S3: 🟢 Clarify review body continuation

In packages/api/mcp/toolsPullRequests.ts, the tool description recommends commentId/bodyOffset for longer comments, but the new review sources reject commentId. Their supported continuation mechanism is to repeat the same source, page and limit with bodyOffset, as the added test demonstrates. Document that distinction and consider explicitly telling the template to follow nextBodyOffset alongside nextPage. This is an optional usability improvement: continuation already works and its offset is returned.

Score

The implementation is focused, preserves the default conversation path, and includes targeted coverage for the new sources and template integration. Static review found no demonstrated blocker; execution results for the current head remain unverified.

Score: 8/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 27s
  • Tokens: 58,751 (58,146 in / 605 out)
  • Cost: $0.50

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix S3

🤖 Review by ProPR

@propr-dev propr-dev Bot removed the ultrafix label Nov 11, 2026
@integry
integry merged commit 0aa7ccd into 3443-epic-automations-no-t7o Nov 12, 2026
44 checks passed
@integry
integry deleted the 3444/claude-opus-5-5-template-turn-repeated-re-20261111-2324-mpy branch November 12, 2026 10:27
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.

1 participant