Skip to content

[Epic] Automations: no-op run detection and a shipped template catalog - #3456

Merged
integry merged 11 commits into
mainfrom
3443-epic-automations-no-t7o
Nov 13, 2026
Merged

integry merged 11 commits into
mainfrom
3443-epic-automations-no-t7o

Conversation

@propr-dev

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

Copy link
Copy Markdown
Contributor

Automations: no-op run detection and a shipped template catalog

This Epic PR aggregates all changes for the plan: Automations: no-op run detection and a shipped template catalog

Issues in this Epic

Auto-close

When this PR is merged, the following issues will be automatically closed:

Fixes #3443
Fixes #3444
Fixes #3445


Created automatically by ProPR

propr-dev[bot] and others added 2 commits November 11, 2026 22:26
…" as the first entry. It's available in the shared package, the API, MCP, the CLI and the web UI. All the tests I ran pass. Typecheck is clean, lint passes on the changed files, and the OpenAPI check is up to date.

Catalog (`packages/shared`)
- Each template has a source folder, `packages/shared/automation-templates/<id>/`, holding `template.json` and `prompt.md`.
- `scripts/generate-automation-templates.ts` builds the versioned `automationTemplates.catalog.json` from those folders. It runs as `npm run automation-templates:generate`, and `npm run automation-templates:check` fails if the committed catalog is out of date.
- Every template is checked against the automation definition contract, including the schedule rules. It must also default to `dry_run` and list repositories, schedule and autonomy as things to review before saving.
- The typed loader, `automationTemplates.ts`, re-validates the catalog when it is imported. I put the validation in a separate file so the generator can check a catalog that isn't committed yet.
- CI runs the check through a new test, `test/automationTemplatesCatalog.test.ts`, added to `test:unit` the same way the usage-tips check runs.

Daily issue triage
- It reads open issues, plus issues closed in the last 30 days, using the run's read-only GitHub token.
- The report has these sections: summary, needs a human, likely duplicates, proposed severity labels, proposed security labels, and stale issues.
- The prompt forbids changing any issue and says to treat issue text as untrusted.
- Suggested schedule is `0 7 * * 1-5` (weekdays 07:00 UTC). It feeds the previous report into the next run so each one focuses on what changed.

Where the catalog is available
- API: `GET /api/automation-definitions/templates`. I didn't add a deprecated `/api/agent-definitions/...` alias for it, since no old client can depend on a new route. Two existing tests assumed every route has an alias, so I updated them to allow this one exception.
- MCP: a read-only tool, `list_automation_templates`.
- CLI: `propr automation templates`, which prints a table or a versioned JSON document with `--json`.
- Web UI:
  - The new-automation form has a "Start from a template" picker and a "Review before saving" note.
  - When there are no automations, the empty list shows the templates. Each one links to `/automations/new?template=<id>`, which opens the form already filled in.
  - Choosing a template keeps any repositories and coding agent the user already picked, and always sets autonomy to Dry run. Nothing is created until the user saves.

Docs: `agents.md` has a new Templates section. I also updated `propr-cli.md`, `docs/mcp.md`, `docs/mcp-coverage.md` and the CHANGELOG, and regenerated the OpenAPI spec.

Tests: new or extended tests cover catalog validation, the route, the MCP tool, the CLI command, the form prefill and the empty-state link. The MCP suite's 15 tests all pass, but the process didn't exit on its own afterwards; it stalled on a database-connection timeout during cleanup and I stopped it. That looks like a teardown problem in that suite rather than this change, but I didn't confirm it.

I captured three screenshots: the empty list with templates, the prefilled form on desktop, and the template link on a phone.
…tomation-templa-20261111-2201-h3q

[3443 by Claude Opus 5.5] Ship an automation template catalog with an issue-triage template
@propr-dev

propr-dev Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Epic progress: Automations: no-op run detection and a shipped template catalog

3 out of 4 PRs merged ⏳

████████░░ 75%

Merged child PRs: #3451, #3457, #3465

✅ This epic PR has been merged into main.


This comment is updated automatically by ProPR as child PRs merge.

@propr-dev propr-dev Bot added the AI label Nov 11, 2026
propr-dev[bot] and others added 5 commits November 11, 2026 23:32
…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.
…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
…urn-repeated-re-20261111-2324-mpy

[3444 by Claude Opus 5.5] Template: turn repeated review corrections into proposed repository instructions
…ion catalog. I also added the sentence about duplicate helpers to the default review guidance. The new prompt snapshot test passes, and so do the existing catalog, instruction-learning-loop and review-prompt tests (39 of 39). The two UI template test files also pass (28 tests), and `npm run automation-templates:check` says the catalog is up to date. I haven't run the full repository suite.

The template (`packages/shared/automation-templates/weekly-codebase-drift-report/`)
- Settings: capabilities `repository_read` and `propr_mcp`, runs Mondays at 09:00 UTC, starts in `dry_run`, and includes the previous report. The "review before saving" notes cover repositories, schedule, autonomy and the coding agent, since `propr_mcp` only works with Claude Code or Codex.
- Sources: the last 7 days of merges come from `git log` and `git diff --numstat` on the checkout. The reason for each change comes from the pull requests, through the ProPR MCP tools `list_pull_requests` and `get_pull_request`.
- Extra repositories: these are cloned with only the latest commit, so `git log` can't see the past week. The prompt says to fetch more history first, or else take the figures from `gh pr list` and say so in the report.
- Report sections, in order:
  - Summary.
  - What changed and why, grouped by area.
  - Possible duplicates, each with the new and existing location and a confidence level.
  - Growth: files and lines added and removed per top-level area, plus the five largest new files.
  - Suggested consolidations: at most five, each tied to an entry above.
- Finding duplicates: the run searches by name with `search_repository_files` in `literal` mode and by behaviour in `semantic` mode. It must read both candidates before claiming a duplicate, and reports only pairs it has read; a matching name or search hit isn't enough.
- Acting step: with autonomy raised, it saves each suggested consolidation as one repository To-Do with `create_todo`. It skips any that an open To-Do already covers and creates nothing else. I didn't change the acting-step code; like the previous template, the instructions are in the prompt.

Review guidance (`packages/shared/src/reviewPrompt.ts`): `DEFAULT_REVIEW_GUIDANCE` now asks reviewers to check whether new helpers, functions or modules duplicate existing code. It also asks them to flag duplicates under the `complexity` category when the review uses that category. There is no such category in the review format today, so for now the sentence only asks reviewers to look; it doesn't add a category.

Other changes
- `scripts/generate-automation-templates.ts` lists the new template third, and the catalog JSON is regenerated.
- `test/weeklyCodebaseDriftReportTemplate.test.ts` is the prompt snapshot test. It pins the key rules word for word, checks the MCP tool names and the order of the report sections, and confirms the prompt reaches both the report run and the acting step. It also checks the new review-guidance sentence.
- Docs: a "Weekly Codebase Drift Report" section in `docs/docs/features/repository-knowledge.md`, a row in the templates table in `docs/docs/features/agents.md`, and a CHANGELOG entry.

I captured a preview of the new-automation form with the new template card selected, showing its review notes and filled-in fields.
…eekly-codebase--20261112-1027-1kp

[3445 by Claude Opus 5.5] Template: weekly codebase drift report (duplicate helpers, growth, what changed and why)
@integry

integry commented Nov 12, 2026

Copy link
Copy Markdown
Owner

/merge

@propr-dev

propr-dev Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

🔀 Resolved merge conflicts from main into 3443-epic-automations-no-t7o in commit 99351db

Conflicting Files

  • CHANGELOG.md

Resolution Summary

I resolved the merge conflict in CHANGELOG.md, which was the only file with one. A search of the whole repository (excluding node_modules and .git) finds no conflict markers left.

What the conflict was about: both branches added new entries at the same spot, under ## [Unreleased] → ### Added.

  • This PR's side: four Added entries: Automation templates (the catalog plus the Daily issue triage template), the Instruction learning loop template, the MCP get_pull_request_discussion review sources, and the Weekly codebase drift report template.
  • main's side: one Added entry, "Auto-merge: up-to-date branches" (auto_merge.require_up_to_date). It also added a new ### Changed section for the Bundled Antigravity CLI 1.5.6 update and its sub-points.

How I resolved it: I kept both sides in full.

  • The PR's four Added entries come first, then main's auto-merge entry.
  • main's ### Changed section follows, and the existing ### Fixed section is unchanged after it.
  • No entry was reworded or dropped.

Why: the two sides record unrelated changes, and a changelog should list everything that landed. A plain union keeps the PR's entries and brings in main's, and the result still follows the Keep a Changelog order (Added, Changed, Fixed).

Checks:

  • Diffing the result against each side's version shows only added lines, so nothing from either side was lost.
  • git diff --check reports no whitespace problems.
  • The section headings under [Unreleased] are well formed.

🤖 Resolution Details

  • Model: Claude Opus 5.5
  • Time: 3m 18s

View Task Execution


System-triggered merge conflict resolution

Automatically resolved merge conflicts after merging target branch into PR branch.
Resolved conflicts in:
- CHANGELOG.md

PR: #3456
Model: Claude Opus 5.5
@integry

integry commented Nov 12, 2026

Copy link
Copy Markdown
Owner

/review

@propr-dev

propr-dev Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @integry

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

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

Overall Evaluation

The PR is merge-ready within the visible scope. It adds a shared, validated template catalog, exposes it through REST/MCP/CLI, and integrates template selection into the automation editor. The new review sources support the instruction-learning template’s need to inspect human code review.

✅ Shared contract validation — Catalog generation and loading validate template inputs against the existing automation definition contract, enforce unique IDs, and require review notes.

✅ Safe form prefilling — Applying a template preserves selected repositories and agent settings, resets autonomy to dry_run, and creates nothing until the user saves.

✅ Review-source coverage — Submitted reviews and inline comments retain useful evidence metadata, with pagination and body continuation covered by focused tests.

The supplied status reports 30 passed checks, no failures, and no pending checks. This review used static analysis only; no commands were run. The linked issue descriptions contain truncation notices, so requirements beyond their visible excerpts could not be assessed; the supplied diff was reviewed as complete.

Merge blockers

No merge blockers.

Suggestions

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

S1: 🟢 Clarify triage pagination

In packages/shared/automation-templates/daily-issue-triage/prompt.md:3, the example limits issue retrieval to 200 while the report requests repository-wide counts and stale issues. Explicitly instructing the agent to retrieve all relevant pages, or disclose incomplete coverage, would improve reports for larger repositories. This is optional because the command is an example and the surrounding instruction already asks for the open issues generally.

S2: 🟢 Explain review body continuation

The instruction-learning prompt explicitly follows nextPage but does not mention nextBodyOffset. Add guidance to reread the same source and page with the returned body offset before advancing. The new reader already supports this, so this is a usability improvement that would help agents reliably inspect long review bodies.

Score

The implementation is coherent, includes focused coverage across its public surfaces, and has no verified merge blockers or current check failures. The remaining suggestions improve prompt clarity without requiring architectural changes.

Score: 9/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 36s
  • Tokens: 86,189 (85,512 in / 677 out)
  • Cost: $0.78

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 S1 S2

🤖 Review by ProPR

@integry

integry commented Nov 12, 2026

Copy link
Copy Markdown
Owner

/merge

@integry
integry marked this pull request as ready for review November 12, 2026 18:54
@propr-dev

propr-dev Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

🔀 Resolved merge conflicts from main into 3443-epic-automations-no-t7o in commit aaaaf6a

Conflicting Files

  • CHANGELOG.md

Resolution Summary

I resolved the one conflict, in CHANGELOG.md, by keeping both sides' entries. A search of the whole repository finds no conflict markers left.

What the conflict was: Both branches added new entries at the top of ## [Unreleased] → ### Added, at the same spot, so git couldn't order them.

  • This PR (HEAD) added four entries for the automations epic:
    • Automation templates (the catalog, the "Start from a template" form option, the API endpoint, the MCP tool and the CLI command)
    • The Instruction learning loop template
    • The MCP get_pull_request_discussion review sources (reviews and review_comments)
    • The Weekly codebase drift report template
  • main added one entry: Claude Fable 5.2 and GPT-6.1 Terra (new model IDs, labels, prices, the alias change and the minimum CLI versions).

How I resolved it: I kept all of them with no wording changes. The PR's four entries come first, then main's model entry, then the existing Auto-merge: up-to-date branches entry and the rest of the list as before. I also removed the stray blank line that main's side left before the next bullet, so the list stays continuous.

Why: The entries describe separate features and don't overlap, so dropping either side would lose a real changelog item. Putting the PR's entries first keeps the PR's version of the section intact and adds main's update.

Check: No conflict markers remain anywhere in the repository, and each new entry appears exactly once in CHANGELOG.md.


🤖 Resolution Details

  • Model: Claude Opus 5.5
  • Time: 3m 23s

View Task Execution


System-triggered merge conflict resolution

Automatically resolved merge conflicts after merging target branch into PR branch.
Resolved conflicts in:
- CHANGELOG.md

PR: #3456
Model: Claude Opus 5.5
@propr-dev

propr-dev Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

🔀 Resolved merge conflicts from main into 3443-epic-automations-no-t7o in commit 703dd5e

Conflicting Files

  • packages/api/mcp/toolsAutomations.ts
  • packages/api/routes/automationDefinitionRoutes.ts
  • packages/cli/src/api/automations.ts
  • packages/shared/src/index.ts

Resolution Summary

I resolved all four conflicted files, and no conflict markers are left anywhere in the repository. In every case both branches had added something new next to the same lines, so I kept both additions. Nothing from either side was dropped or rewritten.

What each conflict was and how I resolved it

  1. packages/shared/src/index.ts: The PR added export * from './automationTemplates.js' and main added export * from './automationRunProductivity.js' on the same line. I kept both exports. The two modules export different things, so they don't clash, and both files exist.

  2. packages/api/routes/automationDefinitionRoutes.ts: The PR imported AUTOMATION_TEMPLATE_CATALOG from @propr/shared and main imported automationRunNoChangeReason at the same spot. I kept both imports, because the file uses both: the catalog is returned by the /templates endpoint (line 369) and the no-change reason is set on runs (line 218).

  3. packages/cli/src/api/automations.ts: The PR added AutomationTemplateCatalog to the type import, which was on one line. main split that import over several lines and added AutomationReportNovelty and AutomationRunNoChangeReason. I used main's layout and added AutomationTemplateCatalog to it, since the PR's listAutomationTemplates() needs it.

  4. packages/api/mcp/toolsAutomations.ts: The PR added a new MCP tool, list_automation_templates, just before list_automation_runs. main changed the list_automation_runs description to end with ${NO_CHANGE_NOTE}, which explains the new unproductive-run fields. I kept the PR's new tool and used main's description. The imports and the NO_CHANGE_NOTE constant were already merged cleanly, so both are defined.

Checks

  • packages/shared typechecks, and both shared and core build.
  • packages/api typechecks except for one error: the module @propr/local-setup can't be found, because that package isn't built here. It comes from publicInstanceIdentity.ts, which isn't one of the conflicted files.
  • packages/cli reports errors too, but only in setup and identity files (src/tui/*, connectIdentity.ts). None of them mention automations, and they come from the same unbuilt-package problem.
  • I didn't run any test suites.

🤖 Resolution Details

  • Model: Claude Opus 5.5
  • Time: 2m 45s

View Task Execution


System-triggered merge conflict resolution

Automatically resolved merge conflicts after merging target branch into PR branch.
Resolved conflicts in:
- packages/api/mcp/toolsAutomations.ts
- packages/api/routes/automationDefinitionRoutes.ts
- packages/cli/src/api/automations.ts
- packages/shared/src/index.ts

PR: #3456
Model: Claude Opus 5.5
@propr-dev

propr-dev Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

🔀 Auto-merged main into 3443-epic-automations-no-t7o (clean merge) in commit 48444b0

No conflicts were found — the merge was verified by an AI agent.


🤖 Verification Details

  • Model: Claude Opus 5.5
  • Time: 3m 25s

View Task Execution


System-triggered merge conflict resolution

@integry

integry commented Nov 13, 2026

Copy link
Copy Markdown
Owner

/review

@propr-dev

propr-dev Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @integry

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

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

Overall Evaluation

Ready to merge within the visible scope. The PR adds a shared, validated template catalog and exposes it consistently through the UI, REST, MCP and CLI.

✅ Safe template defaults — Catalog validation requires dry_run; applying a template preserves repository and agent selections and creates nothing until saving.

✅ Complete review-source access — The MCP extension exposes submitted reviews and inline comments separately, preserves thread metadata, and tests pagination and incompatible selectors.

✅ Shared contract validation — Generator tests check catalog freshness and validate template inputs against the existing automation definition contract.

The supplied issue specifications contain truncated acceptance criteria, so unseen requirements could not be assessed. This review used static analysis only, as requested. Current checks report 38 passed, none failed or pending.

Merge blockers

No merge blockers.

Suggestions

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

S3: 🟢 Explain review-body continuation

In packages/shared/automation-templates/instruction-learning-loop/prompt.md:7, consider explicitly instructing the agent to follow each record’s nextBodyOffset as well as nextPage. The new review reader chunks bodies at 4,096 characters, while the template explicitly describes only page continuation. This would improve collection guidance for long reviews; the tool already provides working continuation support, so this is an optional clarification.

Score

The implementation is cohesive, has focused coverage across its public surfaces, and has no verified merge blockers in the supplied code. Current-head checks are green.

Score: 9/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 40s
  • Tokens: 86,196 (85,657 in / 539 out)
  • Cost: $0.77

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

@integry
integry merged commit 45487c2 into main Nov 13, 2026
50 checks passed
@integry
integry deleted the 3443-epic-automations-no-t7o branch November 13, 2026 07:24
@propr-dev

propr-dev Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

✅ Epic merged: Automations: no-op run detection and a shipped template catalog

Epic PR #3456 has been merged into main.

3 out of 4 PRs merged into main through this epic PR.

Posted automatically by ProPR

propr-dev Bot pushed a commit that referenced this pull request Nov 17, 2026
…ready comment, the final-merge comment, the status line and the title all use one computation, so they show the same N and M. All the affected test files pass, and lint and typecheck pass on the changed source files.

The count (`computeEpicMergeProgress`, now in `packages/core/src/webhook/epicProgressCount.ts`)
- M is the plan issues that weren't closed without a merge. N is how many of them are merged into the epic branch.
- An issue counts as merged if its status is merged, its linked PR merged, or a PR from a branch named after it (`3594/…` or `3594-…`) merged.
- A PR without a plan issue changes neither number but is still listed under "Merged child PRs". Two PRs for one issue count it once. A branch from another epic (`3589-epic-…`) isn't counted as a PR for the issue its name starts with.
- An issue closed as not planned (status closed) drops out of M, as closed issues already did.
- An epic with no plan still counts its PRs, and its comments say "pull requests" instead of "issues".

Behaviour changes to be aware of
- An open human PR into the epic branch no longer holds back the "ready for final merge" comment.
- To match branches to issues, the PR list now records the source branch for merged and closed PRs too, not only open ones.

Comments
- The progress comment now reads `N of M issues merged` instead of "N out of M PRs merged".
- The ready comment shows the same line and says `All N issues have been merged…`. The final-merge comment uses the same wording.
- Once the epic PR is merged, the progress comment drops the bar and percentage. It shows ✅ if every issue merged; otherwise it says how many issues weren't merged before the epic PR merged. This removes the "⏳ 75%" next to "merged" seen on #3456.

Epic body
- The issue list and `Fixes #` lines leave out issues whose plan status is closed, and issues GitHub reports as closed `not_planned` or `duplicate`.
- This takes effect the next time the body is rewritten, which happens when a child PR merges; closing an issue alone doesn't trigger it. That logic moved to the new `packages/core/src/webhook/epicPRBody.ts`. Both changed files had gone past the 400-line lint limit, which is why this and the count module were split out.

Tests (regression tests as the issue asked)
- `test/epicMergeProgress.test.ts` (71 pass), `test/epicMergeProgressHandler.test.ts` (53 pass) and `packages/core/test/pullRequestStatusEpicSync.test.ts` (35 pass).
- New tests cover:
  - an extra human PR, both merged and open, in the count, the ready comment and the status line
  - two PRs for one issue, including the case where the merged one isn't the linked one
  - an issue closed as not planned, in the count and in the body's `Fixes` lines
  - the merged epic's final progress comment and final report
- Existing assertions were updated to the new wording. In the status sync tests, open PRs from non-plan branches used to raise the total (for example "1 of 14"); those now expect "1 of 3".

I also updated `docs/docs/features/work-splitting.md`, `docs/docs/features/pr-status.md` and added a Fixed entry to `CHANGELOG.md`. No preview was made: the change is GitHub comment and title text, not app UI.
integry pushed a commit that referenced this pull request Nov 17, 2026
…the progress comment, the ready comment and the title agree (#3612)

* Epic progress now counts plan issues only. The progress comment, the ready comment, the final-merge comment, the status line and the title all use one computation, so they show the same N and M. All the affected test files pass, and lint and typecheck pass on the changed source files.

The count (`computeEpicMergeProgress`, now in `packages/core/src/webhook/epicProgressCount.ts`)
- M is the plan issues that weren't closed without a merge. N is how many of them are merged into the epic branch.
- An issue counts as merged if its status is merged, its linked PR merged, or a PR from a branch named after it (`3594/…` or `3594-…`) merged.
- A PR without a plan issue changes neither number but is still listed under "Merged child PRs". Two PRs for one issue count it once. A branch from another epic (`3589-epic-…`) isn't counted as a PR for the issue its name starts with.
- An issue closed as not planned (status closed) drops out of M, as closed issues already did.
- An epic with no plan still counts its PRs, and its comments say "pull requests" instead of "issues".

Behaviour changes to be aware of
- An open human PR into the epic branch no longer holds back the "ready for final merge" comment.
- To match branches to issues, the PR list now records the source branch for merged and closed PRs too, not only open ones.

Comments
- The progress comment now reads `N of M issues merged` instead of "N out of M PRs merged".
- The ready comment shows the same line and says `All N issues have been merged…`. The final-merge comment uses the same wording.
- Once the epic PR is merged, the progress comment drops the bar and percentage. It shows ✅ if every issue merged; otherwise it says how many issues weren't merged before the epic PR merged. This removes the "⏳ 75%" next to "merged" seen on #3456.

Epic body
- The issue list and `Fixes #` lines leave out issues whose plan status is closed, and issues GitHub reports as closed `not_planned` or `duplicate`.
- This takes effect the next time the body is rewritten, which happens when a child PR merges; closing an issue alone doesn't trigger it. That logic moved to the new `packages/core/src/webhook/epicPRBody.ts`. Both changed files had gone past the 400-line lint limit, which is why this and the count module were split out.

Tests (regression tests as the issue asked)
- `test/epicMergeProgress.test.ts` (71 pass), `test/epicMergeProgressHandler.test.ts` (53 pass) and `packages/core/test/pullRequestStatusEpicSync.test.ts` (35 pass).
- New tests cover:
  - an extra human PR, both merged and open, in the count, the ready comment and the status line
  - two PRs for one issue, including the case where the merged one isn't the linked one
  - an issue closed as not planned, in the count and in the body's `Fixes` lines
  - the merged epic's final progress comment and final report
- Existing assertions were updated to the new wording. In the status sync tests, open PRs from non-plan branches used to raise the total (for example "1 of 14"); those now expect "1 of 3".

I also updated `docs/docs/features/work-splitting.md`, `docs/docs/features/pr-status.md` and added a Fixed entry to `CHANGELOG.md`. No preview was made: the change is GitHub comment and title text, not app UI.

* feat(ai): I fixed F1 and F2. The affected suites pass, and every new regression test fails when run against the code before the fix.

I fixed F1 and F2. The affected suites pass, and every new regression test fails when run against the code before the fix.

**F1: a closed issue whose work merged now stays in the epic body**
- I moved the "this issue's work is merged" rule into one shared function, `epicIssuesWithMergedWork` in `epicProgressCount.ts`. An issue counts as merged if its status is merged, its linked PR merged, or a PR from a branch named after it merged. The progress count uses it too, so the count and the body can't disagree.
- The body filter `epicBodyIssueNumbers` now drops a closed issue only when it has no merged work. Issues GitHub closed as not planned or as duplicates are still dropped.
- A new `loadEpicBodyIssueNumbers` reads the PRs into the epic branch so the filter can see that merged work. Both places that write the body, creating the epic PR and rewriting its body after a merge, now use it. It only reads the PR list when a plan issue is closed.
- New tests in `test/epicMergeProgressHandler.test.ts` cover the case from the finding, for both creating and rewriting the body: issue #101's linked PR #202 is closed without merging, then an alternate PR #203 from `101/…` merges. #101 keeps its list entry and its `Fixes` line, and an issue closed with no merged work is still left out. I also added a count test for the same case.

**F2: a planned epic no longer falls back to counting PRs**
- `computeEpicMergeProgress` now counts PRs only when no plan was passed at all. A plan whose issues were all filtered out, for example because they shipped through an earlier epic, gives 0 of 0 issues instead of counting a human PR as 1 of 1.
- Both callers already passed nothing for "no plan" and a list for "plan", so neither needed changing.
- New tests:
  - **Count:** an empty plan list gives 0 of 0, with no switch to "pull requests".
  - **Progress comment:** a successor epic whose plan issues all shipped through the previous epic, with a human PR merged afterwards. Both the open-epic and merged-epic paths count 0 of 0, and no comment says "pull requests".
  - **Status line:** the same successor case, in `pullRequestStatusEpicSync.test.ts`. The status line and title no longer show "1 of 1 issues merged".

**Checks**

| Suite | Passed | Failed |
|---|---|---|
| `test/epicMergeProgress.test.ts` | 75 | 0 |
| `test/epicMergeProgressHandler.test.ts` | 55 | 0 |
| `test/epicMergeProgressRetry.test.ts` | 21 | 0 |
| `test/taskIntentWithdrawal.test.ts` | 169 | 0 |
| `test/intentWithdrawalWebhook.test.ts` | 36 | 0 |
| `packages/core/test/pullRequestStatusEpicSync.test.ts` | 37 | 0 |
| `packages/core/test/pullRequestStatusEpic.test.ts` | 24 | 0 |
| `packages/core/test/pullRequestStatusEpicChildReads.test.ts` | 6 | 0 |
| `packages/core/test/epicQueueBlockedHead.test.ts` | 14 | 0 |

- Typecheck for `packages/core` and lint with zero warnings allowed on the three changed source files are both clean.
- The lint config doesn't cover these test files: ESLint skips them with "file ignored" warnings rather than linting them.
- The docs and CHANGELOG already say issues "closed without a merge" are left out, which matches the corrected behaviour, so I didn't change them.
- No preview: nothing in the app's UI changed.

I found nothing else outside F1 and F2 that needed fixing.

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

* feat(ai): I fixed F3. When GitHub's list of PRs into the epic branch doesn't yet include the PR that just merged, the epic body now looks that PR up on its own before deciding which closed issues to drop. A closed issue whose alternate PR merged keeps its list entry and its `Fixes` line, so the body matches the progress count again.

I fixed F3. When GitHub's list of PRs into the epic branch doesn't yet include the PR that just merged, the epic body now looks that PR up on its own before deciding which closed issues to drop. A closed issue whose alternate PR merged keeps its list entry and its `Fixes` line, so the body matches the progress count again.

**The fix**
- I added `withTriggeringChildEvidence` in `packages/core/src/webhook/epicMergeProgress.ts`. If the merging PR is missing from the list, or its row lacks the merge or the branch name, it reads that PR with the same `readMergedChild` call the progress update uses. A PR that turns out to have merged into a different branch isn't added.
- `loadEpicBodyIssueNumbers` in `packages/core/src/webhook/epicPRBody.ts` now uses it, which covers both callers: creating the epic PR and rewriting its body.
- If the read can't confirm the merge, the body is built from the list as before rather than failing. The progress update still throws and retries in that case, as it did before.

**Tests** (`test/epicMergeProgressHandler.test.ts`)
- There are two new tests, one for creation and one for rewriting. In both, #101 is closed, its linked PR #202 was abandoned, and #203 from `101/codex-second` merges while the list doesn't include it yet. Each test checks that #203 was read on its own and that the body keeps `- #101`, `Fixes #101` and `Fixes #100` but still leaves out #102.
- With the fix taken out, both new tests fail. With it, the handler suite passes 57/57.
- `test/epicMergeProgress.test.ts` (75/75) and `packages/core/test/pullRequestStatusEpicSync.test.ts` (37/37) also pass. ESLint with zero warnings passes on the two changed source files, and `tsc --noEmit` passes for `packages/core`.

**Found separately, not changed:** the title a new epic PR starts with is worked out from the plan and the merging PR's number only, without its branch. In the same scenario it could start at a lower count, for example `0/1` instead of `1/2`. The code comment says the status sync corrects the title afterwards, so the wrong count should only last until that sync runs. This behaviour already existed on `main` and is outside F3, so I left it alone.

No preview was made, because the change only affects text written to GitHub.

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

* feat(ai): I fixed F4. A merged PR from an issue branch that only begins like an epic branch, such as `101-epic-progress-count-plan`, now counts toward its plan issue, and the epic body keeps that issue's list entry and `Fixes #101` line.

I fixed F4. A merged PR from an issue branch that only begins like an epic branch, such as `101-epic-progress-count-plan`, now counts toward its plan issue, and the epic body keeps that issue's list entry and `Fixes #101` line.

**Fix** (`packages/core/src/webhook/epicProgressCount.ts`)
- `epicChildBranchIssue` now uses the repository's real `EPIC_BRANCH_PATTERN` from `services/epicPRService.ts` (`{id}-epic-{word}-{word}-{rand}`). The prefix-only `EPIC_HEAD_PATTERN` (`/^\d+-epic-/`) is gone.
- Only actual epic branches, like `101-epic-other-plan-abc`, are now kept from being matched to an issue.

**Other code with the same assumption**
- Both places that turn a branch name into a plan issue go through `epicChildBranchIssue`, so both are fixed:
  - the count and body path, through `epicIssuesWithMergedWork`, which `computeEpicMergeProgress` and `loadEpicBodyIssueNumbers` both use.
  - the status-line child-to-issue mapping in `pullRequestStatusEpicFacts.ts`.
- That status-line file already checked for other epic branches with `EPIC_BRANCH_PATTERN`, so the two checks now agree.
- No other prefix-only epic check exists in the PR's changes.
- Recovering the merge evidence of a PR that GitHub's list doesn't show yet sends the branch through the same function, so that path is fixed too.

**Regression tests**
- `test/epicMergeProgress.test.ts`: `epicChildBranchIssue('101-epic-progress-count-plan')` returns 101, while an actual epic branch returns null. A closed #101 whose alternate PR #203 merged from that branch counts 2 of 2 with nothing excluded.
- `test/epicMergeProgressHandler.test.ts`: the two existing tests for an alternate PR's body now also run with the `101-epic-progress-count-plan` branch. One covers PRs already in GitHub's list and one covers a merge the list doesn't show yet, each for both creating and rewriting the body. All of them check for `- #101: Issue` and `Fixes #101`.

**Verification**
- Test results:
  - `test/epicMergeProgress.test.ts`: 76 of 76 pass.
  - `test/epicMergeProgressHandler.test.ts`: 61 of 61 pass.
  - `packages/core/test/pullRequestStatusEpicSync.test.ts`: 37 of 37 pass.
- With the old regex put back temporarily, all 5 new cases fail: 1 in the count tests and 4 in the body tests.
- Core `tsc --noEmit` and core ESLint (`--max-warnings 0`) on the changed source file both pass.
- The root ESLint config skips these test files, so they weren't linted.

I made no visual preview, since this changes GitHub comment and body text, not the app's UI.

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

* feat(ai): I fixed F5. A later epic on the same branch now drops an issue that a previous epic already shipped, even when the PR that shipped it is an alternate PR from the issue's branch and the issue's linked PR is still open. In that case the later epic used to show "0 of 1 issues merged" for work that had already shipped, and could never become ready.

I fixed F5. A later epic on the same branch now drops an issue that a previous epic already shipped, even when the PR that shipped it is an alternate PR from the issue's branch and the issue's linked PR is still open. In that case the later epic used to show "0 of 1 issues merged" for work that had already shipped, and could never become ready.

**Change**
- **New helper:** `epicIssuesShippedBefore` in `packages/core/src/webhook/epicProgressCount.ts`. It lists the plan issues that a previous epic already shipped. It matches a shipped PR to an issue the same way the progress count does: either the PR is the issue's linked PR, or it comes from a branch named for the issue (`101/…` or `101-…`).
- **Both progress paths now use it** instead of checking only `issue.pr_number`:
  - the progress comments, via `reportablePlanIssues` in `epicMergeProgress.ts`
  - the status line and title, via `loadEpicStatusFacts` in `pullRequestStatusEpicFacts.ts`
- **Lint:** adding this to `updateEpicMergeProgress` pushed it over the complexity limit, so the lookup now happens inside `reportablePlanIssues` instead.

**Tests**
- **New regressions:** each sets up the case from the finding. Issue #101's linked PR is still open, and an alternate PR from its branch merged before the previous epic. A human PR and a PR for a second issue merge after it. The new tests check:
  - in `test/epicMergeProgress.test.ts`, with the trigger being a child PR merge and with the epic itself merged: the count is 1 of 1, and the ready comment (or, once the epic merged, the final-merge comment) is posted.
  - in `packages/core/test/pullRequestStatusEpicSync.test.ts`: the status line reads `✅ 1 of 1 issues merged` and the title shows `1/1`.
- **Negative check:** all three new tests fail when run against the source files from before this change.
- **Suites:** `test/epicMergeProgress.test.ts` (78 pass), `test/epicMergeProgressHandler.test.ts` (61 pass) and `pullRequestStatusEpicSync.test.ts` (38 pass) all pass. ESLint with zero warnings and `tsc --noEmit` pass in `packages/core`.

**Also found, not changed:**
- **Plural on the status line:** it reads "1 of 1 issues merged" where the progress comment would say "issue". The comment uses `progressNoun` to pick the word, but the status line always prints "issues". That is outside F5, so the new test accepts either form.
- **Epic body:** the issue list and `Fixes` lines don't drop issues that a previous epic shipped, by either kind of PR. They never checked for this, so it isn't the defect F5 describes.

No preview was made: the change only affects GitHub comment, status-line and title text.

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

---------

Co-authored-by: propr-dev[bot] <1316198+propr-dev[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

1 participant