Skip to content

[Epic] 0.9.3: follow-up and bot-comment reliability - #3707

Merged
integry merged 9 commits into
mainfrom
3686-epic-0-9-g6i
Nov 18, 2026
Merged

integry merged 9 commits into
mainfrom
3686-epic-0-9-g6i

Conversation

@propr-dev

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

Copy link
Copy Markdown
Contributor

0.9.3: follow-up and bot-comment reliability

This Epic PR aggregates all changes for the plan: 0.9.3: follow-up and bot-comment reliability

Issues in this Epic

Auto-close

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

Fixes #3686
Fixes #3687
Fixes #3688
Fixes #3689
Fixes #3690
Fixes #3691
Fixes #3692


Created automatically by ProPR

… is sometimes never picked up (#3700)

* I found two causes and fixed both. The first is proven from the PR timelines. The second is my best reading of the evidence: I had no worker logs, so I couldn't watch it happen. There is no UI change, so no previews.

Cause 1: PRs opened by the retry fallback never got the `AI` label (#3643, propr-site#222, #226)

Evidence:
- All three PR bodies read `Resolves #N\n\n_PR created via retry mechanism_`.
- Their timelines have no `labeled AI` event. #3643's only label was `ultrafix`; #222's only label was `ultrafix`; #226 had none.
- For comparison, #3667 was created normally and has `labeled AI` and `labeled llm-claude-opus55` 2 s after it was opened.

What happened: when post-processing doesn't leave a PR, `retryPRCreationViaAPI` (`src/jobs/issueJobPRRetry.ts`) opens one, but it never added the labels that normal creation adds. The webhook then treats the PR as not opted in, so every plain follow-up was dropped as `no_comment_trigger` with only a debug log. `/ultrafix` still worked on #3643 and #222 because slash commands don't need the label, which is why these PRs looked half-alive. A PR found during final validation had the same gap.

Fix: new `src/jobs/pullRequestProcessingLabels.ts` adds the processing and model labels, with retries. It never throws, and it can't block the PR retry itself. It is called on the three recovery routes: a PR the retry creates, an existing PR it finds after a 422, and a PR found during final validation. `PR_LABEL` and `modelName` are passed in from `processGitHubIssueJob.ts`.

PRs that already exist without the label are not fixed by this. They need the `AI` label added by hand before follow-ups on them are accepted.

Cause 2: a follow-up stored behind a running job could be left with no job to pick it up (#3667)

Evidence:
- The first request (comment 6945632909, 10:37) never got a run.
- The re-sent text (6947331935, 11:56:00) got a brand-new job, `…-1794916564247`, created at 11:56:04. So nothing was queued for the PR at that point.
- That run's receipt lists only `trigger-comment-ids=6947331935`, so the first comment was not waiting anywhere.
- The two comments are 79 minutes apart, more than the pending list's 1-hour expiry.

What happened: when any job for the PR exists, intake only appends the comment to the `pending-pr-comments` Redis list and calls it accepted. An active job has already read that list when it started. It looks once more near the end of its cleanup, and some early-exit paths never look at all. A comment stored after that last look had nothing to read it, and the list expired an hour later: no run, no comment. Which job was running for #3667 at 10:37 is the part I couldn't confirm without logs.

Fix:
- New `packages/core/src/webhook/pendingCommentDrain.ts`: after storing a comment, if no waiting or delayed job exists for the PR, intake queues a drain job. That job waits for the PR lock and then picks up the stored comments. If queuing it fails, the webhook delivery fails and is redelivered instead of being lost.
- `cleanupJob` no longer queues a second follow-up when a job is already queued for the PR. The queue check lives in the new `src/jobs/prCommentQueuedPickup.ts`.

On a labelled PR, a matching follow-up now always ends as a queued run, or as one of the existing outcomes (a held follow-up, or the assignment-gate refusal comment). A PR whose first run failed in post-processing now gets its label, so later follow-ups are accepted.

Tests
- New `test/recoveredPullRequestLabels.test.ts` (6 tests): the retry route, the 422 route and the found-during-validation route all add the labels; transient label failures are retried and a lasting one is logged. 4 of these fail against the old code.
- `test/commentEventHandler.switch-use.test.ts`: 3 new tests (active job → drain queued; delayed job → no drain; a job for a different PR doesn't count). Four existing tests that asserted "nothing queued" behind an active job now expect the drain job. With the drain call disabled, 6 tests fail.
- `test/prCommentCleanupOrder.test.ts`: 3 new tests for the cleanup dedupe.
- 57 related suites (root, core and api tests that touch these files) pass. Lint passes with zero warnings and typecheck is clean for root and core. The Redis integration suite ran 0 tests here because there is no Redis in this container.

* feat(ai): I've fixed F1. A delayed PR comment job no longer counts as the pickup for a stored follow-up if it runs after that follow-up's pending list expires. This applies to both intake and cleanup, so the usage-limit retry an hour away no longer blocks the timely drain or follow-up job.

I've fixed F1. A delayed PR comment job no longer counts as the pickup for a stored follow-up if it runs after that follow-up's pending list expires. This applies to both intake and cleanup, so the usage-limit retry an hour away no longer blocks the timely drain or follow-up job.

**The fix**
- **Run time comes from BullMQ's delayed set.** Both checks read the delayed job's score with `zscore` (the run timestamp shifted left 12 bits). I didn't use the job's `timestamp + delay` fields, because PR-lock waits move the job back to delayed: that rewrites `delay` relative to the move but keeps the original creation timestamp, so the sum would be too early.
- **Expiry comes from the list itself.** Both checks read the list's remaining TTL with `pttl`, instead of assuming 3,600 s. In cleanup the list may have been written up to an hour earlier.
- **The rule:** a waiting job always counts. A delayed job counts only if it runs at least 60 s before the list expires. If either the run time or the TTL can't be read, the code queues the drain rather than suppressing it; the cost is at most one extra job that claims an empty list.
- **Where it lives:**
  - Intake: `packages/core/src/webhook/pendingCommentDrain.ts`, with `storeCommentForBatch` in `commentEventHandler.ts` passing in the list's TTL.
  - Cleanup: `src/jobs/prCommentQueuedPickup.ts`, which `cleanupJob` now calls with the Redis client and the list key.
  - The check is duplicated in the two packages on purpose. Exporting a new helper from `@propr/core` would break the test suites that mock that module by listing its exports one by one.

I checked the sibling paths. Every intake route, including slash commands and `/switch`, goes through `storeCommentForBatch`, so the one intake change covers them all. The other jobs that sit delayed (lock waits) put their claimed comments back on the list with a fresh TTL, and they are now judged by their real run time too.

**Tests**
- New in `test/commentEventHandler.switch-use.test.ts`:
  - A comment arrives behind an active job while a usage-limit retry is queued 65 minutes out; intake queues a drain.
  - A delayed job whose run time can't be read; intake queues a drain.
  - The existing "delayed job, no drain" test now gives that job a run time 3 s away.
- New in `test/prCommentCleanupOrder.test.ts`, each showing cleanup still queues the follow-up:
  - behind a distant usage-limit retry.
  - behind a job due in 5 minutes when the list has only 2 minutes left.
  - behind a delayed job whose run time can't be read.
- All 5 new regressions fail against the previous source and pass now.
- All 32 related root and core suites pass, each run on its own. `ultrafixRecoveryRedisIntegration` ran 0 tests because there is no Redis in this container.
- Root lint passes with zero warnings, core lint is clean on the changed files, and typecheck is clean for root and core.

There is no UI change, so there are no previews.

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

* feat(ai): I fixed the failure. It was caused by this PR, and two shards hit it, not just Shard 3. In both, an older test still assumed that no job is queued while another job for the PR is running. The drain job this PR added now queues one in that case, which is the intended behaviour.

I fixed the failure. It was caused by this PR, and two shards hit it, not just Shard 3. In both, an older test still assumed that no job is queued while another job for the PR is running. The drain job this PR added now queues one in that case, which is the intended behaviour.

- **Shard 3/4:** `packages/api/test/taskFollowupRoutes.test.ts`, "review batched behind manual work preserves command metadata", failed with `1 !== 0` on the queued-job count.
- **Shard 1/4:** `packages/api/test/taskReviewRoutes.test.ts`, "dedicated review batched behind manual work retains review metadata and its idempotent receipt", failed the same way.

In both tests the only existing job for the PR is a running one. The command is still stored on the pending list and reported as `batched`, and the new code then queues a drain job to pick it up. That's the same change the earlier commit made to the four core tests in `commentEventHandler.switch-use.test.ts`.

**Fix:** I only changed the two tests, not the product code. They now expect exactly one drain job:
- In the follow-up test, the job is a delayed `processPullRequestComment` with empty `comments` and no `commandMode`. The command itself still goes only to the pending list.
- In the review test, the repeated request still adds nothing, so the count stays at one.

**Verification:** both suites pass locally (62 of 62 tests), and lint passes with zero warnings on the two files.

PR: #3700
Comment by: @propr-dev[bot] (ID: 6977156358)
Model: Claude Opus 5.5

---------

Co-authored-by: propr-dev[bot] <1316198+propr-dev[bot]@users.noreply.github.com>
@propr-dev

propr-dev Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Epic progress: 0.9.3: follow-up and bot-comment reliability

7 of 7 issues merged ✅

Merged child PRs: #3700, #3708, #3710, #3712, #3718, #3721, #3723

✅ This epic PR has been merged into main.


This comment is updated automatically by ProPR as child PRs open, change and merge.

@propr-dev propr-dev Bot added the AI label Nov 18, 2026
@propr-dev propr-dev Bot changed the title ◔ 1/7 [Epic] 0.9.3: follow-up and bot-comment reliability ⚠️ 1/7 [Epic] 0.9.3: follow-up and bot-comment reliability Nov 18, 2026
…already exists" when creating the worktree (#3708)

What was going wrong. The worker already had a path for reusing an existing local branch. The four failures on #3644 came through it (the "Cannot create worktree:" prefix only comes from there), so its existence check said "no such branch" while git still saw one. The check worked by listing branches (`git show-ref --heads`), but `git worktree add -b` reads the branch ref itself. When the two disagree, the code fell through to `-b` and failed on every later run. I couldn't reproduce that disagreement in this container (git 2.39; the worker image is Alpine with a newer git), so this is the most likely cause, not a confirmed one.

Changes in `packages/core/src/git/worktreeCreation.ts`:
- Existence check: it now looks the ref up directly, the same way `git worktree add -b` does. If the branch exists but its tip commit is missing from the clone, the run fails with a message naming the branch and changes nothing.
- Fallback: if `git worktree add -b` still says the branch already exists, the worker reuses the existing branch the same safe way. If the branch can't be read, the run fails with a message naming it. Runs that need a brand-new branch still refuse an existing one.

How each stale state is handled now:
- Same as remote: reused as is.
- Behind remote: moved forward to the fetched remote head.
- Diverged from a force-pushed remote: restarted from the remote head, with the local-only commits saved under `refs/propr/superseded/…`. This was already the behaviour.
- Held by a worktree whose folder is gone: the branch is released and reused. A leftover registration for the same worktree path is cleared, but only when nothing in it would be lost. I didn't add a blanket `git worktree prune`: the worker turns pruning off on purpose so that work isn't lost.

Unpushed commits. The issue asks for the run to fail when the stale branch has commits that aren't on the remote. I kept the current behaviour instead: the follow-up continues on top of those commits, and nothing is deleted. Existing tests require this, and goal continuation and replacement attempts rely on it. Changing it to fail would be a small edit in `realignDivergedLocalBranch` if you want the stricter rule.

Tests. I added `test/followupStaleLocalBranch.integration.test.ts`, which uses real temporary git repos with a bare remote and runs without `SSH_ASKPASS`. It covers branch equal to remote, behind, unpushed commits kept, diverged with a backup ref, a worktree whose folder is gone (both the different-path and same-path cases), a missing tip commit, and the fallback. A missing tip commit is actually refused earlier, at fetch, with an error naming the branch. The new suite and four existing worktree suites all pass (8, 83, 3, 9 and 9 tests). Lint and typecheck for `packages/core` are clean.

There's nothing visual to preview.

Co-authored-by: propr-dev[bot] <1316198+propr-dev[bot]@users.noreply.github.com>
@propr-dev propr-dev Bot changed the title ⚠️ 1/7 [Epic] 0.9.3: follow-up and bot-comment reliability ◔ 2/7 [Epic] 0.9.3: follow-up and bot-comment reliability Nov 18, 2026
@propr-dev propr-dev Bot changed the title ◔ 2/7 [Epic] 0.9.3: follow-up and bot-comment reliability ⚠️ 2/7 [Epic] 0.9.3: follow-up and bot-comment reliability Nov 18, 2026
…pull request (#3710)

Why #3620 was reported done without a PR. The run's records show the commit was made and pushed, but nothing reached GitHub afterwards:

- The commit and push worked. Commit `c1e1862e` was made at 03:18:50 and pushed at 03:18:52.
- PR creation was reached. The "Review digest" event at 03:18:55 is recorded inside the PR creation step.
- Then nothing was posted. No PR, no failure comment, no label change (`AI-processing` stayed on, `AI-done` was never added). PR #3652 was opened by hand at 07:06.
- The task was still marked a success. It was recorded at 03:19:00 as "Task completed successfully", with status `claude_success_no_changes`, `pr: null`, and a commit attached.

So this was a swallowed PR creation error, not "no commits" and not a push failure. Three gaps in `src/jobs` let it reach the success path (the pipeline lives there, not in `packages/core/src`):

1. When opening the PR failed, the error was caught and the fallback comment was posted. If that comment also failed, nothing showed on the issue at all.
2. The final-validation step can open the missing PR, but its result was thrown away.
3. The step that sets the task's final status only checked "agent succeeded" and "a PR exists". "Agent succeeded, no PR" became `claude_success_no_changes`, even with a commit.

The worker log with the exact GitHub error isn't kept; the task logs only hold the agent conversation. The fact that both the PR request and the comment failed points to GitHub rejecting all API calls at that moment, possibly the installation rate limit in #3680 item 10. That part is unconfirmed.

What changed:
- Failed state. A successful agent run with a commit, or with a failed step, but no PR is now marked failed with status `publication_failed`. The reason names the step, e.g. "Opening the pull request failed: …". Runs with no changes still complete as "no changes". The fix is in `src/jobs/issueJob/completion.ts`, the same check as `getTaskCompletionStatus`.
- Comment names the step. Post-processing now tracks the current step (commit, push, opening the PR). The comment reads, for example: "❌ Opening the pull request failed. The changes were committed (`c1e1862`) and pushed to `<branch>`, so no pull request was opened." The issue no longer gets `AI-done` in this case; it keeps its `AI` label and loses `AI-processing`.
- No silent success. A PR creation call that returns no PR is now treated as a failure.
- Comment is harder to suppress. A failed label change or report can no longer stop the failure comment from being posted. If GitHub rejects every call, as it seems to have for #3620, the comment can still be lost; the failed task state is what stays reliable then.
- Recovered PRs count. A PR opened by the final-validation retry now becomes the run's outcome.
- Cancellation unchanged. A user cancel is not reported as a failed step.

I moved the failure handler into `src/jobs/issueJobPostProcessingFailure.ts` to stay under the 400-line lint limit. The step names live in `src/jobs/postProcessingStep.ts`.

Tests: typecheck and lint pass on `src/jobs/`.
- New tests. `test/issueJobPublicationFailure.test.ts` (8 tests) covers both outcomes: commit then PR failure, a PR call returning nothing, commit failure, no changes, and recovered or still-missing PR. `test/issueJobCompletion.test.ts` has 5 new tests on the final task status.
- Negative check. Against the old `completion.ts`, 3 of the new status tests fail.
- Changed test. In `test/prCompletionTriggerReleaseFailure.test.ts` I updated one test that asserted the old "Post-processing encountered an error" comment and the `AI-done` label.
- Existing suites. The other 22 root suites and 1 API suite that use these modules all pass.

Not covered: if the agent commits on its own and leaves nothing staged, the run still takes the "no changes" path. That didn't happen in #3620 (ProPR made that commit), so I left it out of this fix.

No preview images, since nothing here is visual.

Co-authored-by: propr-dev[bot] <1316198+propr-dev[bot]@users.noreply.github.com>
@propr-dev propr-dev Bot changed the title ⚠️ 2/7 [Epic] 0.9.3: follow-up and bot-comment reliability ◔ 3/7 [Epic] 0.9.3: follow-up and bot-comment reliability Nov 18, 2026
@propr-dev propr-dev Bot changed the title ◔ 3/7 [Epic] 0.9.3: follow-up and bot-comment reliability ⚠️ 3/6 [Epic] 0.9.3: follow-up and bot-comment reliability Nov 18, 2026
@propr-dev propr-dev Bot changed the title ⚠️ 3/6 [Epic] 0.9.3: follow-up and bot-comment reliability ◔ 3/7 [Epic] 0.9.3: follow-up and bot-comment reliability Nov 18, 2026
@propr-dev propr-dev Bot changed the title ◔ 3/7 [Epic] 0.9.3: follow-up and bot-comment reliability ⚠️ 3/7 [Epic] 0.9.3: follow-up and bot-comment reliability Nov 18, 2026
@propr-dev propr-dev Bot changed the title ⚠️ 3/7 [Epic] 0.9.3: follow-up and bot-comment reliability ◔ 3/7 [Epic] 0.9.3: follow-up and bot-comment reliability Nov 18, 2026
@propr-dev propr-dev Bot changed the title ◔ 3/7 [Epic] 0.9.3: follow-up and bot-comment reliability ⚠️ 3/7 [Epic] 0.9.3: follow-up and bot-comment reliability Nov 18, 2026
…te limit, cancelled, started, failed (#3712)

* The four repeated notices (rate limit, cancelled, started, merge-conflict failure) now post once and update that comment on a repeat. The rate-limit notice also shows the correct reset time. Typecheck and lint (`--max-warnings 0`) pass, and the 16 related suites pass, including 11 new tests.

Shared helper (`src/jobs/repeatedNoticeComment.ts`)
- It works like `ciFailureCommentGrouping.ts`. Each notice ends with a hidden marker: `<!-- propr:notice kind="…" key="…" count="N" -->`.
- The key is built from the notice kind, a scope (task id, issue, or head commit) and the notice text with timestamps removed.
- Before posting, it reads the thread once. If one of ProPR's own comments has the same marker, it edits that comment instead: latest text, plus a line `_Reported N times; last at <time> UTC._`.
- It never edits a person's comment that happens to contain the marker. It can ignore earlier notices older than a set time window.
- If reading or editing fails, it posts a new comment, so no notice is lost. Like the CI-failure grouping, two notices arriving at the same moment can still both post.

Where it is used
- Rate limit (`errorHandlers.ts`): one notice per issue within 12 hours. Later retries and sibling runs hitting the same limit update it with the newest reset time.
  - No notice is posted when the retry is due within 2 minutes.
- Execution Cancelled (`errorHandlers.ts`): one notice per issue within 10 minutes, so the several handlers and sibling runs that report one stop produce a single comment.
- "AI processing has started" (`issueJob/worktree.ts`): grouped by task id. A rate-limit retry keeps the same task id, so it updates the existing start notice instead of announcing a new run, including on an issue that by then has its PR and `AI-done`. A different task (another model, a new request) still posts its own.
  - The updated start comment ends with "Reported 3 times", which reads a little oddly on a start notice.
- Failed to resolve merge conflicts (`processMergeConflictJob.ts`): grouped by head SHA plus the error text. If an identical failure on that head was already reported, that report is updated and this attempt's "Auto-resolving…" comment is deleted. If the delete fails, that comment is rewritten with the failure text.

Reset time, fixed at the source (`packages/core/src/utils/scheduling.ts`)
- The parser only understood a bare time (`resets 1am (UTC)`). A weekly message like `resets Nov 20, 1am (UTC)` failed to parse and fell back to "next hour + 2 min". That was the weekly limit shown with an hourly reset.
- It now reads dated resets ("Nov 20, 1am" and "Nov 20 at 10am"), named time zones, and a December reset that falls in January.
- When a message lists several limits, it uses the reset of the one described as hit or reached.
- The displayed reset time now includes the date when it is more than 20 hours away (e.g. `Nov 20, 1:00 AM UTC`).

Tests
- New: `test/repeatedNoticeComment.test.ts` (helper, rate limit, weekly reset, immediate retry, cancellation) and `test/issueStartNotice.test.ts` (start notice).
- Extended: `test/processMergeConflictJob.test.ts` (three identical failures leave one comment) and `test/scheduling.test.ts` (weekly, five-hour, multiple-limit and time-zone parsing).
- I updated the GitHub fakes in two existing tests because the code now reads comments before posting.

Open questions
- Rate limit on another account: I couldn't find a path where an issue run moves to another account after a usage limit. Synthetic agents already switch members within the same attempt without posting anything. So I used the 2-minute rule above as the check for an immediate retry. If the retry on another account happens somewhere I didn't find, that place needs to tell the handler.
- Rate limit grouping: grouping is per issue rather than per task, because the four comments on #3556 may have come from sibling runs with different task ids.
- Merge conflicts: the per-head grouping covers only this system-triggered failure comment.

No previews, since nothing here is visual.

* feat(ai): I fixed F1, F2 and F3, and each has a regression test. I ran each new test against the previous code. The scheduling suite hung there until killed, and the other new tests failed, so they catch the defects.

I fixed F1, F2 and F3, and each has a regression test. I ran each new test against the previous code. The scheduling suite hung there until killed, and the other new tests failed, so they catch the defects.

**F1: reset parsing could loop forever** (`packages/core/src/utils/scheduling.ts`)
- **Cause:** for a reset given only as a time, each next-day candidate was built from the UTC date. In a zone ahead of UTC, an early-morning reset that had already passed kept producing the same instant. For example, `resets 1am (Europe/Riga)` at 16:57 UTC never returned.
- **Fix:** the parser now takes the current date in the reset's own time zone and checks a few calendar days around it there. It converts each one to UTC and returns the first that is still in the future. The loop is bounded and can no longer repeat.
- **Tests** in `test/scheduling.test.ts`:
  - the case from the finding (Riga 1am at 16:57 UTC, giving Nov 16 23:00 UTC).
  - Tokyo 1:30am.
  - a moment when Riga's date is already a day ahead of UTC.
  - a zone behind UTC (New York 11pm).
- **Also checked:** the only other caller is the provider rate-limit handler, through `parseResetTimeFromMessage`. Dated resets never had this loop. That caller's test (`claudeRateLimitPropagation`) still passes.

**F2: a new reset time split the rate-limit notice** (`src/jobs/errorHandlers.ts`)
- **Fix:** the new `rateLimitNoticeFingerprint` replaces the whole "resets …" clause (optional date, time with optional minutes, am/pm, optional zone) with a placeholder, then replaces any remaining digits as before. The rest of the text is kept, so a weekly limit and a session limit still get separate notices.
- **Tests** in `test/repeatedNoticeComment.test.ts`:
  - four reports in a row (11am → 1pm → 1:30pm → `Nov 20, 1am (Europe/Riga)`) end up as one comment showing the newest text and "Reported 4 times".
  - direct checks that the reset clause is dropped and different limits stay apart.
- **Design note:** I put the pattern in `errorHandlers.ts` rather than exporting it from core. Root test suites mock `@propr/core` with a fixed list of exports, and a new export could break them. As a result, the pattern now exists in two places, matching the forms the parser reads.

**F3: merge failures were grouped by the queued head** (`src/jobs/processMergeConflictJob.ts`)
- **Fix:** a `processedHeadSha` variable starts as the queued head and takes the live head as soon as it is resolved. The failure notice now uses it.
- **Test** in `test/processMergeConflictJob.test.ts`:
  - a job queued for an old head and a job queued for the live head fail the same way and share one report.
  - after the PR moves to a new head, the next failure posts a separate report and the earlier one is left alone.
- **Also checked:** this is the only place in the PR that groups by head, so there was nothing else to correct.

To keep `processMergeConflictJob.ts` under the 400-line lint limit, I merged one nearby statement onto a single line.

Typecheck passes for the root and for `packages/core`, and lint passes with `--max-warnings 0` on the changed files. These suites pass:

| Suite | Tests passing |
|---|---|
| `scheduling` | 21 |
| `repeatedNoticeComment` | 11 |
| `processMergeConflictJob` | 26 |
| `issueStartNotice` | 2 |
| `issueUsageLimitRetry` | 16 |
| `claudeRateLimitPropagation` | 1 |

Nothing here is visual, so there are no previews.

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

* feat(ai): I fixed F4 and F5 in `src/jobs/repeatedNoticeComment.ts` and added a regression test for each. Both new tests fail against the previous version of the helper and pass now.

I fixed F4 and F5 in `src/jobs/repeatedNoticeComment.ts` and added a regression test for each. Both new tests fail against the previous version of the helper and pass now.

**F4: ownership check.** `findRepeatedNotice` used to accept any comment whose author was a bot account. It now accepts only comments posted by ProPR's own bot account. That account comes from the new `proprBotUsernames()`, which reads it the same way `scanCiFailureComments` does: the detected bot name, then `GITHUB_BOT_USERNAME`, then `propr-dev[bot]`. Another app's comment that quotes the hidden marker is now skipped, so the earlier ProPR notice is the one that gets updated.
- Many test suites replace `@propr/core` with a stand-in that doesn't include the function that returns the bot name. The helper looks that function up through the whole module, so those suites still load and fall back to the configured and default names.
- All three places that publish these notices go through this one function (`errorHandlers.ts`, `issueJob/worktree.ts`, `processMergeConflictJob.ts`). No other code in this PR chooses comments by bot type, so there was nowhere else to fix.

**F5: comments past the 1,000 cap.** The 10-page limit is gone, and the helper now reads the whole thread, so a notice posted after the first 1,000 comments is found again on the next repeat. When a notice has a time window, the read passes GitHub's `since` filter, so only comments changed inside that window are fetched. The existing time check still runs as well.

**Tests** (in `test/repeatedNoticeComment.test.ts`):
- The fake thread now splits comments into pages of 100 and honours `since`.
- The F4 test has a ProPR notice followed by another bot's comment quoting it. The ProPR notice is updated to a count of 2 and the other comment is left alone.
- The F5 test has 1,050 earlier comments. Three identical reports leave one notice with a count of 3, both with and without a time window.
- The fake GitHub comments in `test/issueStartNotice.test.ts` and `test/processMergeConflictJob.test.ts` now carry a `propr-dev[bot]` login, since the check now goes by account name.

**Checks:** the typecheck passes and lint passes with zero warnings. I split `findRepeatedNotice` into small helpers to get under the lint complexity limit. The six related suites pass: repeatedNoticeComment 13/13, issueStartNotice, processMergeConflictJob, issueUsageLimitRetry, taskSubmissionLifecycle and prContinuation. I ran the last three before the final helper split, which only moved code around.

Reading the whole thread means a notice on a very long thread costs one request per 100 comments when no time window is set. Two identical notices arriving at the same moment can still both post, as before. That race comes from GitHub's API and isn't something this change can close.

Nothing here is visible on screen, so there are no previews.

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

* feat(ai): I fixed F6. A dated reset in a named time zone now takes its year from the current date in that zone, not from UTC, so the retry lands at the right instant around New Year.

I fixed F6. A dated reset in a named time zone now takes its year from the current date in that zone, not from UTC, so the retry lands at the right instant around New Year.

**Change (`packages/core/src/utils/scheduling.ts`, `resetClauseTimestamp`):** the code first works out the current local date in the reset's zone. Dated resets now take their starting year from that date, and the next-year rollover adds one to that same year. Undated resets already used this local date and behave as before. Unknown zones still fall back to UTC.

**Regression test (`test/scheduling.test.ts`):** the new test covers the reported case: at `2027-01-01T00:00:00Z`, `resets Dec 31, 11pm (America/New_York)` now returns `2027-01-01T04:00:00Z`. It also checks the opposite case, a zone ahead of UTC: at `2026-12-31T16:00Z`, `resets Jan 1, 5am (Asia/Tokyo)` returns `2026-12-31T20:00Z`. The old code already got that one right through its rollover rule. I ran the new test against the previous version of the file and it fails there.

**Other places with the same assumption:** the dated branch was the only code that read the UTC year. The undated branch already used the local date. `handleUsageLimitError` and `formatRetryTime` only use the timestamp the parser returns, so they need no change.

**Verification:**
- `test/scheduling.test.ts`: 22 tests pass.
- `test/repeatedNoticeComment.test.ts` and `test/issueUsageLimitRetry.test.ts`: 29 tests pass.
- Typecheck of `packages/core` (`tsc --noEmit`) and ESLint with `--max-warnings 0` on the changed file are clean.

I found nothing else outside F6. Nothing here is visual, so there are no previews.

PR: #3712
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>
@propr-dev propr-dev Bot changed the title ⚠️ 3/7 [Epic] 0.9.3: follow-up and bot-comment reliability ◑ 4/7 [Epic] 0.9.3: follow-up and bot-comment reliability Nov 18, 2026
@propr-dev propr-dev Bot changed the title ◑ 4/7 [Epic] 0.9.3: follow-up and bot-comment reliability ⚠️ 4/7 [Epic] 0.9.3: follow-up and bot-comment reliability Nov 18, 2026
…aiting is reported as finished (#3718)

* A run whose last message says the agent is still working or waiting no longer reads as a clean success. The summary-selection call that already picks the summary now also returns whether the run looks unfinished, plus a one-line reason. It is the same single request, with no extra call. When no summarization model is set, the call fails, or there is only one message to choose from, the result comes back unchanged.

All tests pass: the 27 in `test/runSummarySelection.test.ts` and 23 other suites that build completion comments. Typecheck and lint are clean. I didn't run the full test suite or try it on a live run.

How it works
- Model reply (`packages/core/src/agents/runSummarySelection.ts`): the prompt asks whether the last message says the agent is still working, waiting, or about to do more, and to reply with `{"index", "unfinished", "reason"}`. Only `"unfinished": true` counts, so a reply in the old shape reads as finished. The reason is flattened to one line, capped at 300 characters, and given a default when empty. The flag can also come back when no message was picked as the summary.
- Plumbing: the result carries a new `unfinishedReason` field through the two places that convert agent results for the issue and follow-up paths.

What the comments say now
- Issue runs (`packages/core/src/utils/github/logFiles.ts`): the header becomes "AI Processing Ended Unconfirmed" with status "Ended before the agent confirmed completion". A warning says "The run ended before the agent confirmed completion." with the reason, followed by the agent's last update and a list of committed files. If the agent didn't write its own commit message, the fallback commit message uses the same headline.
- PR follow-ups (`src/jobs/prCompletionComment.ts`): the ✅ "Applied the requested follow-up changes" line becomes "⚠️ Committed follow-up changes", with the same warning, "## Last Agent Update" and "## Committed Changes". If nothing was committed, the warning still appears above the analysis.

Decisions for you
- Follow-up requests aren't marked as done. I treat an unfinished follow-up like a partial one: the trigger comments are still marked handled, but they aren't recorded as completed requests for later reviews. This is a judgement call about review behaviour, so flag it if you'd rather keep recording them.
- The shared wording lives in `@propr/shared` (new file `packages/shared/src/unfinishedRun.ts`), not core. Several root tests mock `@propr/core` with a fixed export list, and adding new core exports broke `prCompletionTriggerReleaseFailure.test.ts`.

Tests added with mocked model replies: finished, the old reply shape, unfinished with and without a reason (including when no message is picked as the summary), a capped reason, a failed call, and no configured model. They also check what the follow-up comment and the issue report contain for a finished and an unfinished run.

This only changes GitHub comment text, so I made no visual previews.

* feat(ai): I fixed F1: the classification call now sees the agent's complete last message, so a "still running / I'll report back" line past character 1,500 is no longer cut off before the model judges whether the run is unfinished.

I fixed F1: the classification call now sees the agent's complete last message, so a "still running / I'll report back" line past character 1,500 is no longer cut off before the model judges whether the run is unfinished.

**The fix** (`packages/core/src/agents/runSummarySelection.ts`, `buildSummarySelectionPrompt`): the candidates are still cut to 1,500 characters for picking the summary. When the last message is longer than that, the prompt now also quotes it in full in its own `<last-message>` block, with a note to use it for the unfinished verdict. It's still the same single request. Short last messages aren't quoted twice, and earlier candidates stay cut. The block's closing tag is escaped the same way the candidate tags are, so text inside the message can't close it early.

**Other places with the same problem:** none. This prompt builder is the only thing that feeds the verdict, and `selectRunSummary` is its only caller.

**Regression tests** (`test/runSummarySelection.test.ts`):
- A long final message whose waiting statement comes after character 1,500 appears complete in the prompt.
- Through `applyRunSummarySelection`, the prompt sent to the model contains that waiting statement, and the reason from the unfinished verdict is recorded.
- A short last message produces no `<last-message>` block.
- An earlier long candidate stays cut and isn't quoted in full.
- A closing tag inside the full message is escaped.

**Verification:** all 32 tests in `test/runSummarySelection.test.ts` pass, and core typecheck and lint are clean. As a negative check, I switched the new block off and three of the new tests failed, so they do catch the old behaviour.

This only changes the text sent to the model, so I made no visual previews.

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

* feat(ai): I fixed F2. When a run is flagged unfinished and commits nothing, the issue comment no longer says the work was complete, and nothing in it points to committed changes that don't exist.

I fixed F2. When a run is flagged unfinished and commits nothing, the issue comment no longer says the work was complete, and nothing in it points to committed changes that don't exist.

**What changed**
- **Issue comment headline** (`src/jobs/issueJobPostProcessingHelpers.ts`, `handleNoCodeChanges`): for a successful run flagged unfinished, the "✅ No code changes needed - the implementation was already complete." line becomes "⚠️ **No code changes were committed, and the agent did not confirm the work was complete.**" Finished runs keep the ✅ headline. The function now tells the report builder that nothing was committed (a new `noCodeChanges` option).
- **Issue report** (`packages/core/src/utils/github/logFiles.ts`, `buildUnfinishedSummarySection`): when nothing was committed, the "Committed changes: see the committed diff" line is left out. The warning now ends "No changes were committed, so the requested work may still be outstanding." instead of "Review the committed changes before relying on them." Runs that did commit work look the same as before.
- **Shared wording** (`packages/shared/src/unfinishedRun.ts`): the warning helper takes a `{ committed: false }` option, and there is a new `UNFINISHED_NO_CHANGE_HEADLINE` constant.

**Same defect on the PR follow-up path:** the follow-up comment had the same problem when nothing was committed. An unfinished run showed the warning telling readers to review committed changes, then said "No code changes were necessary based on the current state of the branch." It now shows the no-commit warning and says "No code changes were committed." This is in `src/jobs/prCompletionComment.ts`. I moved that wording into a small helper to stay under the lint complexity limit.

**Tests:** the new `test/unfinishedNoChangeComment.test.ts` checks three things:
- the full no-change issue comment that `handleNoCodeChanges` publishes for an unfinished run
- the same comment for a finished run, which keeps its success headline
- the no-change follow-up comment for an unfinished run

I ran the new tests against the old code: the two unfinished cases failed and the finished case passed, as expected. With the fix, 215 tests across 19 related suites pass, including `runSummarySelection` and the no-change completion, PR completion and issue-publication suites. Root, core and shared typecheck cleanly, and lint passes with zero warnings on `src/` and the changed core file.

**Not changed:** `handleNoCodeChanges` still applies the done label to an unfinished no-change run. The finding asked only for the headline and the committed-work wording, so I left the label as it is.

This only changes GitHub comment text, so I made no visual previews.

PR: #3718
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>
@propr-dev propr-dev Bot changed the title ⚠️ 4/7 [Epic] 0.9.3: follow-up and bot-comment reliability ◑ 5/7 [Epic] 0.9.3: follow-up and bot-comment reliability Nov 18, 2026
@propr-dev propr-dev Bot changed the title ◑ 5/7 [Epic] 0.9.3: follow-up and bot-comment reliability ⚠️ 5/7 [Epic] 0.9.3: follow-up and bot-comment reliability Nov 18, 2026
…hen a PR is created (#3721)

What the PR timelines show. I checked the last 80 PRs and 23 have `AI` added twice, in two patterns:
- Older PRs (#3579–#3711): `AI` and `llm-*` appear twice, 0–1 s apart. ProPR's retry waits at least 2 s, so a retry can't explain this.
- Newer PRs (#3712, #3717): `AI`, `ultrafix` and `llm-*` all appear again 2 s after `ultrafix` is added. No ProPR code adds those three together, and `ultrafix` was already on the PR.

Normal creation makes a single label call. The labels were already in place when the second set appeared. That suggests GitHub may record labels again on a PR it is still setting up, which ProPR can't prevent. I couldn't test that without making real PRs.

Code paths that could label twice, now fixed:
- Final validation: if a step after creation failed, the run lost track of the PR it had opened. Final validation then found that PR and labelled it again. Validation now records the labels the PR already has (`packages/core/src/utils/prValidation.ts`), so that second call sends nothing.
- Creation itself: in `src/jobs/issueJobHelpers.ts`, only the create request is now inside the `try`. Labelling happens once afterwards, so an error after labelling can no longer fall into the "find existing PR" path and label again.
- The other paths (existing PR found after a duplicate error, and the API retry in `src/jobs/issueJobPRRetry.ts`) use the same shared helper and skip labels GitHub already lists on the PR.
- The shared helper in `src/jobs/pullRequestProcessingLabels.ts` now sends only the missing labels, and makes no call at all when nothing is missing.

Tests
- A new file, `test/pullRequestCreationLabels.test.ts`, checks that each creation path makes exactly one label call. It also checks that labels already on the PR aren't re-sent, and that a failed label call isn't repeated through the existing-PR fallback.
- I added cases to `test/recoveredPullRequestLabels.test.ts` covering final validation and the API retry when the PR already has some or all of its labels.
- Against the original `issueJobHelpers.ts`, 2 of the 5 new creation-path tests fail. The single-call tests also pass on the old code, because it already made one call per path.
- The suites that touch these files ran 508 tests with 507 passing and 0 failing. Typecheck is clean for the root and core packages, and lint is clean on the changed source files.

If the duplicates continue after this ships, the next step is to compare ProPR's worker log for one affected PR with its timeline. Two "Added processing labels" log lines would mean ProPR sent two calls; one would mean the duplicate comes from GitHub.

The change isn't visible on screen, so there are no previews.

Co-authored-by: propr-dev[bot] <1316198+propr-dev[bot]@users.noreply.github.com>
@propr-dev propr-dev Bot changed the title ⚠️ 5/7 [Epic] 0.9.3: follow-up and bot-comment reliability ◕ 6/7 [Epic] 0.9.3: follow-up and bot-comment reliability Nov 18, 2026
@propr-dev propr-dev Bot changed the title ◕ 6/7 [Epic] 0.9.3: follow-up and bot-comment reliability ⚠️ 6/7 [Epic] 0.9.3: follow-up and bot-comment reliability Nov 18, 2026
@propr-dev propr-dev Bot changed the title ⚠️ 6/7 [Epic] 0.9.3: follow-up and bot-comment reliability ◕ 6/7 [Epic] 0.9.3: follow-up and bot-comment reliability Nov 18, 2026
…mp`-dependent test (#3723)

1. New picomatch suffix
- Both builds were renamed in their `package.json`: `4.0.8-extglobguard.2` and `4.0.8-v2.3.2-extglobguard.2`. I repacked both tarballs and removed the `.1` ones.
- The new names are in the root `package.json` (the direct dependency and the three overrides for `anymatch`, `micromatch` and `readdirp`), `THIRD_PARTY_LICENSES.md`, `test/vendoredPicomatch.test.mjs` and `docs/dependency-audit-exceptions.md`.
- The signed-RPM acceptance Dockerfile and its context list also named the tarballs, so I updated those too (`apps/desktop/scripts/signed-rpm-acceptance.Dockerfile`, `signed-rpm-acceptance-context.mjs` and its test).
- In `package-lock.json` I set the new integrity hashes on all four entries that point to the tarballs, then ran `npm install` (npm 10.9). The lockfile diff only touches picomatch, and `npm ls picomatch --all` reports every copy at `.2` with nothing marked invalid.
- Both READMEs now say, in their Version section, that the suffix must change whenever the tarball's content changes. They explain why (npm only reinstalls a `file:` tarball when its version changes) and list every file that names the tarball.
- `test/vendoredPicomatch.test.mjs` passes: 13/13.

2. Test under `/tmp` (`apps/desktop/scripts/signed-rpm-acceptance-diagnostics.test.mjs`)
- I first ran the test from a copy of the scripts under `/tmp` and it failed there, as the issue described.
- The blanket "no `/tmp/`" check is replaced by checks for the specific temporary paths:
  - the runner's `propr-signed-rpm-` workspace.
  - the test's own `signed-rpm-diagnostics-` directory.
  - a fixed path that the fake child process prints, which must never be echoed. It replaces the old `/tmp/x` sentinel.
- All three are built from the system temp directory, so they still match when `/tmp` isn't the temp root.
- The test passes (17/17) from the workspace and from the `/tmp` copy. To check it still catches a real leak, I made a copy of the runner expose its workspace path on the error, and the test failed as it should.
- The related context test passes (5/5) and lint is clean.

This is a dependency and test change with nothing to see, so there are no previews.

Co-authored-by: propr-dev[bot] <1316198+propr-dev[bot]@users.noreply.github.com>
@propr-dev propr-dev Bot changed the title ◕ 6/7 [Epic] 0.9.3: follow-up and bot-comment reliability ⚠️ 6/7 [Epic] 0.9.3: follow-up and bot-comment reliability Nov 18, 2026
@propr-dev propr-dev Bot changed the title ⚠️ 6/7 [Epic] 0.9.3: follow-up and bot-comment reliability ◕ 7/7 [Epic] 0.9.3: follow-up and bot-comment reliability Nov 18, 2026
@propr-dev

propr-dev Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

✅ Epic ready for final merge: 0.9.3: follow-up and bot-comment reliability

7 of 7 issues merged

All 7 issues have been merged into this epic branch. This epic PR is ready for final review and merge.


Posted automatically by ProPR

@integry
integry marked this pull request as ready for review November 18, 2026 20:19

integry commented Nov 18, 2026

Copy link
Copy Markdown
Owner

/ultrafix goal=8 max=3

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

propr-dev Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

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

First action: /review

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

@propr-dev

propr-dev Bot commented Nov 18, 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 18, 2026

Copy link
Copy Markdown
Contributor Author

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

Overall Evaluation

The PR addresses follow-up pickup, publication outcomes, repeated notices, unfinished summaries, and dependency packaging. It needs changes before merge: the stale-branch behavior contradicts a visible acceptance criterion, and notice grouping still permits concurrent duplicates.

✅ Publication failures remain failures — Commit, push, and PR-creation failures now carry explicit step information, with tests preventing committed-but-unpublished work from being classified as “no changes.”

✅ Recovered PR labels — Recovery paths apply missing processing labels and avoid resending labels already present in GitHub responses.

✅ Retention-aware pickup — The new drain logic excludes delayed retries scheduled beyond pending-comment retention.

The supplied checks report 38 passed and no failures or pending checks. Several issue descriptions are explicitly truncated; this review assesses their visible requirements. No commands were run or files modified.

Merge blockers

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

F1: 🔴 Refuse reuse of unpushed branches

  • Category: requirement

  • Required behavior: Issue Follow-up fix fails with "a branch named … already exists" when creating the worktree #3687 explicitly requires a run to fail with a clear branch-naming message when the stale local branch contains commits absent from the remote PR branch.

  • Evidence: packages/core/src/git/worktreeCreation.ts, addWorktreeWithoutTracking; test/followupStaleLocalBranch.integration.test.ts, tests for unpushed and diverged branches.

    1. A previous run leaves local commits that are absent from the remote PR branch.
    2. The changed reuse path invokes realignDivergedLocalBranch and proceeds to add the worktree.
    3. The new integration tests explicitly require successful continuation on an unpushed commit, or successful reset of a diverged branch with its old commits retained under a backup ref.

    Static trace: these expected outcomes directly contradict the requested refusal. Preserving a backup protects reachability but does not satisfy the requirement to stop and identify the branch. The new fallback after Git reports “already exists” also enters this reuse policy, rather than applying the required refusal.

  • Minimum fix: Before reusing or resetting an existing branch, reject local commits absent from the fetched remote head with a branch-naming error. Update the ahead/diverged integration tests to assert rejection and unchanged local refs; preserve successful equal/behind cases.

F2: 🔴 Serialize identical notice publication

  • Category: correctness

  • Required behavior: Issue Repeated and contradictory bot comments: rate limit, cancelled, started, failed #3689 requires an identical notice for one issue or PR to be posted once, with repeats updating the existing comment.

  • Evidence: src/jobs/repeatedNoticeComment.ts, publishRepeatedNotice; src/jobs/errorHandlers.ts, postCancellationNotice and postRateLimitNotice.

    1. Two sibling runs report the same cancellation or rate limit for the same issue. Both callers intentionally use the same issue-wide scope.
    2. Both calls await listThreadComments. Before either publishes, each receives a thread without the matching notice.
    3. Both execute the new-comment POST, leaving two identical marked notices. Later calls update only the last matching comment; the other duplicate remains.

    Static trace: the helper explicitly acknowledges that simultaneous notices can both post. There is no shared serialization or duplicate reconciliation between its read and POST operations. Task-specific identities do not prevent this sequence because these callers deliberately group sibling tasks under scope: 'issue'. The added sibling-notice tests invoke handlers sequentially and therefore do not exercise it.

    Proposed regression: synchronize two callers so both comment reads complete before either POST, then assert that only one notice remains.

  • Minimum fix: Serialize the read-and-publish operation across workers for the same target and notice key, or add reconciliation that removes concurrent duplicates. Cover simultaneous sibling calls with a regression test.

Suggestions

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

S1: 🟢 Share pending-pickup calculations

packages/core/src/webhook/pendingCommentDrain.ts and src/jobs/prCommentQueuedPickup.ts duplicate TTL interpretation, delayed-score decoding, and the retention margin. A shared internal helper would prevent intake and cleanup from drifting. Their current calculations agree, so this is optional maintenance rather than a merge blocker.

Score

The PR has substantial targeted coverage and passing current-head checks, but the branch-refusal requirement and concurrent notice duplication need correction before merge.

Score: 6/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 1m 16s
  • Tokens: 120,012 (118,368 in / 1,644 out)
  • Cost: $1.16

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

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 1c10d86

Addressed 1 AI review comment (IDs: 6991156993)

Addressed findings F1, F2

Summary of Changes

I fixed both findings and added regression tests for each. All the tests I ran pass, and the core lint and typechecks are clean.

F1 – Refuse reuse of unpushed branches

Change (packages/core/src/git/worktreeCreation.ts): addWorktreeWithoutTracking has a new refuseLocalOnlyCommits option. Only createWorktreeFromExistingBranch (the follow-up path on a PR branch) turns it on. When the existing local branch has commits that aren't on the fetched origin/<branch>, whether unpushed or diverged, the run now fails with an error that names the branch and nothing is changed. The message reads: "Local branch '' has N commit(s) that are not on origin/ (local tip …); refusing to reuse or reset it … Nothing was changed: push, back up or delete refs/heads/ …". No backup ref is written and no worktree is created. A branch equal to the remote is still reused, and one behind is still fast-forwarded. The fallback after Git's "already exists" error goes through the same check, so it refuses too.

Callers checked:

  • Task replacement (createWorktreeForIssue with reuseBranch, in repoManager.ts): this path also calls addWorktreeWithoutTracking with resetBranch, but on purpose it continues a lost attempt's local commits. Its existing test covers that, so I left its behaviour as it was; the refusal applies only to the PR follow-up path.
  • Paths that know an attempt is over (the follow-up hold auto-release and the operator release with restart) already call restartBranchFromRemoteHead before reuse. They still work: followupHandoffWorktreeRestore and followupHandoffRecovery both pass.

Tests:

  • test/followupStaleLocalBranch.integration.test.ts: the unpushed and diverged cases now expect the refusal, with the branch tip unchanged, no backup ref and no worktree. A new test covers an unpushed branch hit through the "already exists" fallback.
  • test/worktreeLifecycle.integration.test.ts: three tests that expected reuse or reset on this path, two of them already on main, now expect the refusal. The existing case of the "remote-only then locally advanced" loop now expects the refusal; its issue (task replacement) case still expects reuse.

F2 – Serialize identical notice publication

Change (src/jobs/repeatedNoticeComment.ts): after publishRepeatedNotice posts a new notice, or turns an attempt comment into one, it reads the thread again. If an identical notice created earlier exists, it raises that comment's count and deletes its own. Only the caller with the newer comment acts, so two callers never delete each other's comment. The newer comment's caller reads the thread after its own comment exists, so it always sees the older one and only one notice is left. This needs no new lock and works across workers.

If the second read fails, or the earlier comment can't be updated (for example it was deleted in the meantime), the caller keeps its own comment, so no notice is lost.

Tests (test/repeatedNoticeComment.test.ts): a barrier holds each caller's first read until every caller has read, so all of them post. The new tests cover:

  • three concurrent publishRepeatedNotice calls.
  • two attempt comments turned into the same notice at once.
  • postCancellationNotice from two sibling tasks at once.
  • handleUsageLimitError from two sibling tasks at once.
  • the case where the earlier comment can't be updated, so both comments are kept.

The four duplicate tests fail on the previous code and pass with the fix.

Found separately, not changed

If two callers update the same existing notice at the same moment, both can write the same count. One comment remains but its count is one too low. This is a race between GitHub API calls and only affects the count shown.

Review digest

Risk-tiered paths

  • High risk: none
  • Normal risk (2 files)
    • packages/core/src/git/worktreeCreation.ts (+30/−10)
    • src/jobs/repeatedNoticeComment.ts (+88/−14)
  • Low risk (3 files)
    • test/followupStaleLocalBranch.integration.test.ts (+50/−10)
    • test/repeatedNoticeComment.test.ts (+94/−0)
    • test/worktreeLifecycle.integration.test.ts (+25/−23)

Diff size: 5 files changed, +287/−57 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-ultrafix
  • Time: 13m 11s
  • Tokens: 3,037,403 (3,008,915 in / 28,488 out)
  • Cost: $1.69
  • Subscription usage: Weekly +1%

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

…All the tests I ran pass, and the core lint and typechecks are clean.

I fixed both findings and added regression tests for each. All the tests I ran pass, and the core lint and typechecks are clean.

## F1 – Refuse reuse of unpushed branches
**Change** (`packages/core/src/git/worktreeCreation.ts`): `addWorktreeWithoutTracking` has a new `refuseLocalOnlyCommits` option. Only `createWorktreeFromExistingBranch` (the follow-up path on a PR branch) turns it on. When the existing local branch has commits that aren't on the fetched `origin/<branch>`, whether unpushed or diverged, the run now fails with an error that names the branch and nothing is changed. The message reads: "Local branch '<b>' has N commit(s) that are not on origin/<b> (local tip …); refusing to reuse or reset it … Nothing was changed: push, back up or delete refs/heads/<b> …". No backup ref is written and no worktree is created. A branch equal to the remote is still reused, and one behind is still fast-forwarded. The fallback after Git's "already exists" error goes through the same check, so it refuses too.

**Callers checked:**
- **Task replacement (`createWorktreeForIssue` with `reuseBranch`, in `repoManager.ts`)**: this path also calls `addWorktreeWithoutTracking` with `resetBranch`, but on purpose it continues a lost attempt's local commits. Its existing test covers that, so I left its behaviour as it was; the refusal applies only to the PR follow-up path.
- **Paths that know an attempt is over** (the follow-up hold auto-release and the operator release with restart) already call `restartBranchFromRemoteHead` before reuse. They still work: `followupHandoffWorktreeRestore` and `followupHandoffRecovery` both pass.

**Tests:**
- `test/followupStaleLocalBranch.integration.test.ts`: the unpushed and diverged cases now expect the refusal, with the branch tip unchanged, no backup ref and no worktree. A new test covers an unpushed branch hit through the "already exists" fallback.
- `test/worktreeLifecycle.integration.test.ts`: three tests that expected reuse or reset on this path, two of them already on `main`, now expect the refusal. The `existing` case of the "remote-only then locally advanced" loop now expects the refusal; its `issue` (task replacement) case still expects reuse.

## F2 – Serialize identical notice publication
**Change** (`src/jobs/repeatedNoticeComment.ts`): after `publishRepeatedNotice` posts a new notice, or turns an attempt comment into one, it reads the thread again. If an identical notice created earlier exists, it raises that comment's count and deletes its own. Only the caller with the newer comment acts, so two callers never delete each other's comment. The newer comment's caller reads the thread after its own comment exists, so it always sees the older one and only one notice is left. This needs no new lock and works across workers.

If the second read fails, or the earlier comment can't be updated (for example it was deleted in the meantime), the caller keeps its own comment, so no notice is lost.

**Tests** (`test/repeatedNoticeComment.test.ts`): a barrier holds each caller's first read until every caller has read, so all of them post. The new tests cover:
- three concurrent `publishRepeatedNotice` calls.
- two attempt comments turned into the same notice at once.
- `postCancellationNotice` from two sibling tasks at once.
- `handleUsageLimitError` from two sibling tasks at once.
- the case where the earlier comment can't be updated, so both comments are kept.

The four duplicate tests fail on the previous code and pass with the fix.

## Found separately, not changed
If two callers update the same existing notice at the same moment, both can write the same count. One comment remains but its count is one too low. This is a race between GitHub API calls and only affects the count shown.

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

propr-dev Bot commented Nov 18, 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 18, 2026

Copy link
Copy Markdown
Contributor Author

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

Overall Evaluation

The PR addresses follow-up pickup, publication outcomes, repeated notices, unfinished summaries, and dependency maintenance with substantial targeted coverage. It needs a localized correction before merge.

✅ Preserves unpublished work — Existing-branch worktree creation refuses local-only commits, with real Git tests covering ahead, diverged, and stale-registration cases.

✅ Tracks publication failures — Commit and PR-creation failures now carry explicit failed steps, and successful final-validation recovery becomes the task outcome.

✅ Repairs recovered PR labels — Recovery paths apply missing processing labels while skipping labels already reported by GitHub.

This review uses the supplied code and visible acceptance criteria; several issue descriptions are truncated. No commands were run. Current checks report zero failures and four pending checks.

Merge blockers

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

F3: 🔴 Check unfinished singleton responses

  • Category: requirement

  • Required behavior: Issue A run whose last message says it is still waiting is reported as finished #3690 requires detecting when the agent exits with a final message saying work remains in progress. The specified unchanged-behavior exceptions are an unconfigured summarization model or a failed call.

  • Evidence: packages/core/src/agents/runSummarySelection.ts, applyRunSummarySelection — the function’s retained early-return contract explicitly includes runs with one candidate, while the new unfinished verdict is obtained only through summary selection.

    1. A successful agent execution supplies one textual candidate: “The tests are still running; I will report when they finish.”
    2. Even with a summarization model configured, the singleton shortcut returns the execution result unchanged.
    3. No unfinishedReason reaches the changed completion formatters. They therefore retain their ordinary success wording instead of reporting that completion was unconfirmed.

    static trace: the documented singleton bypass in applyRunSummarySelection, the new verdict propagation after selection, and the isUnfinishedRun checks in the completion formatters establish this gap. The added unfinished-run tests use multiple candidates and do not cover this boundary.

  • Minimum fix: Allow a singleton candidate through the configured model call for the unfinished verdict, preserving existing fallback behavior when configuration is absent or the call fails. Add a singleton waiting-message regression test.

Suggestions

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

S2: 🟢 Share pending-pickup calculations

packages/core/src/webhook/pendingCommentDrain.ts and src/jobs/prCommentQueuedPickup.ts duplicate retention calculations, delayed-set score decoding, and the retention margin. Sharing these calculations would prevent intake and cleanup from drifting. Their current behavior is aligned, so this is optional cleanup.

S3: 🟢 Clarify concurrent notice counts

Concurrent updates in src/jobs/repeatedNoticeComment.ts can read the same existing count and both write count + 1; the three-caller test deliberately accepts any digit rather than asserting three. Documenting the count as approximate would clarify its meaning. Exact counting is optional because the visible requirement primarily concerns retaining one notice.

Score

The implementation has strong targeted coverage and no reported check failures, but the singleton bypass leaves an explicit unfinished-run acceptance case unhandled. The correction is localized.

Score: 6/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 1m 16s
  • Tokens: 126,951 (125,266 in / 1,685 out)
  • Cost: $1.23

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 F3 S2 S3

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit d13c0af

Addressed 1 AI review comment (IDs: 6992015171)

Addressed finding F3

Summary of Changes

I fixed F3: a run with only one message now gets checked for "still waiting" too, so a lone message like "The tests are still running; I will report when they finish." is reported as unconfirmed instead of as a clean success. All 35 tests in test/runSummarySelection.test.ts pass, and typecheck and lint on core are clean. With the fix reverted, the two new tests that need the call fail as expected.

What changed in packages/core/src/agents/runSummarySelection.ts:

  • The singleton shortcut is gone. Both places that skipped one-message runs now let them through: applyRunSummarySelection no longer returns early, and selectRunSummary only skips a run with no messages at all.
  • A one-message run gets only the unfinished flag from the call. Its summary and commit message stay exactly as reported, whatever index the model returns, including null. So it is never swapped for the fixed "no summary" sentence and never marked as selected. If the model says the run is unfinished, unfinishedReason is added and the existing completion comments pick it up.
  • Behaviour is still unchanged when no summarization model is configured or the call fails.
  • The prompt reads naturally for one message ("Below is its last message, numbered 1.") instead of "last 1 messages".
  • The doc comment now describes the one-message case.

Tests in test/runSummarySelection.test.ts:

  • The old "single-candidate run makes no call" test now checks the opposite: one call is made and the result comes back unchanged.
  • A model reply of index: null leaves a one-message summary unchanged.
  • The regression from the finding: a single waiting message is judged in one call. The prompt contains the message, the summary stays as reported, and unfinishedReason carries through to the follow-up result.
  • A single waiting message is left unchanged when the call fails and when no model is configured; in the second case no call is made.

I checked both callers (src/jobs/issueJob/agent.ts and src/jobs/prCommentAgentUtils.ts). They already pass unfinishedReason on, so neither needed changes. This makes no visible UI change, so I made no previews.

Review digest

Risk-tiered paths

  • High risk: none
  • Normal risk (1 file)
    • packages/core/src/agents/runSummarySelection.ts (+17/−6)
  • Low risk (1 file)
    • test/runSummarySelection.test.ts (+42/−4)

Diff size: 2 files changed, +59/−10 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-ultrafix
  • Time: 4m 6s
  • Tokens: 501,418 (496,355 in / 5,063 out)
  • Cost: $0.44

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

…r "still waiting" too, so a lone message like "The tests are still running; I will report when they finish." is reported as unconfirmed instead of as a clean success. All 35 tests in `test/runSummarySelection.test.ts` pass, and typecheck and lint on core are clean. With the fix reverted, the two new tests that need the call fail as expected.

I fixed F3: a run with only one message now gets checked for "still waiting" too, so a lone message like "The tests are still running; I will report when they finish." is reported as unconfirmed instead of as a clean success. All 35 tests in `test/runSummarySelection.test.ts` pass, and typecheck and lint on core are clean. With the fix reverted, the two new tests that need the call fail as expected.

**What changed in `packages/core/src/agents/runSummarySelection.ts`:**
- **The singleton shortcut is gone.** Both places that skipped one-message runs now let them through: `applyRunSummarySelection` no longer returns early, and `selectRunSummary` only skips a run with no messages at all.
- **A one-message run gets only the unfinished flag from the call.** Its summary and commit message stay exactly as reported, whatever index the model returns, including `null`. So it is never swapped for the fixed "no summary" sentence and never marked as selected. If the model says the run is unfinished, `unfinishedReason` is added and the existing completion comments pick it up.
- **Behaviour is still unchanged** when no summarization model is configured or the call fails.
- **The prompt reads naturally for one message** ("Below is its last message, numbered 1.") instead of "last 1 messages".
- The doc comment now describes the one-message case.

**Tests in `test/runSummarySelection.test.ts`:**
- The old "single-candidate run makes no call" test now checks the opposite: one call is made and the result comes back unchanged.
- A model reply of `index: null` leaves a one-message summary unchanged.
- **The regression from the finding:** a single waiting message is judged in one call. The prompt contains the message, the summary stays as reported, and `unfinishedReason` carries through to the follow-up result.
- A single waiting message is left unchanged when the call fails and when no model is configured; in the second case no call is made.

I checked both callers (`src/jobs/issueJob/agent.ts` and `src/jobs/prCommentAgentUtils.ts`). They already pass `unfinishedReason` on, so neither needed changes. This makes no visible UI change, so I made no previews.

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

propr-dev Bot commented Nov 18, 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 18, 2026

Copy link
Copy Markdown
Contributor Author

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

Overall Evaluation

The PR addresses follow-up pickup, stale branches, publication outcomes, repeated notices, unfinished summaries, and vendored dependencies. No merge blocker was verified from the supplied code. Merge readiness is conditional on the two pending checks completing successfully; the supplied status reports no failed checks.

Several issue descriptions are explicitly truncated, so acceptance assessment is limited to their visible requirements. This was a static review; no commands or tests were run.

✅ Protects unpublished commits — Existing-branch reuse refuses local-only commits before resetting the branch, with real-repository regression tests covering equal, behind, diverged, and stale-registration cases.

✅ Records publication failures — Commit and PR-creation failures now carry explicit failed-step metadata, and recovered PRs propagate into the final task outcome.

✅ Handles unfinished summaries consistently — The existing summary-selection call supplies the unfinished verdict, and issue and follow-up comments distinguish committed work from no-change outcomes.

Merge blockers

No merge blockers.

Suggestions

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

S4: 🟢 Share pending-pickup logic

packages/core/src/webhook/pendingCommentDrain.ts and src/jobs/prCommentQueuedPickup.ts duplicate retention calculations, the retention margin, delayed-set score decoding, and pickup eligibility. Sharing these small helpers would prevent intake and cleanup from drifting. This is optional cleanup: their current implementations apply the same relevant rules.

S5: 🟢 Clarify concurrent repeat counts

In src/jobs/repeatedNoticeComment.ts, concurrent publishers can read the same count and each write the same incremented value. Three simultaneous notices can consequently leave one comment reporting two occurrences. The new concurrency test deliberately accepts any digit rather than asserting three. Exact counting is not an explicit acceptance requirement, so this is non-blocking, but documenting approximate counts—or serializing updates if exact counts matter—would make the behavior clearer.

S6: 🟢 Bound the full-message prompt

buildSummarySelectionPrompt now includes a long final message without a size limit. This preserves waiting statements beyond the previous cutoff, but unusually large messages can exceed the summarization model’s input budget and trigger the unchanged fallback. A bounded excerpt preserving the message’s ending would improve detection reliability without changing the required fallback behavior.

Score

The implementation has substantial targeted coverage and no verified blocker in the supplied changes. Two checks remain pending, and the truncated issue descriptions limit verification of the complete acceptance criteria.

Score: 8/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 56s
  • Tokens: 127,453 (126,203 in / 1,250 out)
  • Cost: $1.20

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 S4 S5 S6

🤖 Review by ProPR

@propr-dev propr-dev Bot removed the ultrafix label Nov 18, 2026
@propr-dev propr-dev Bot changed the title ◕ 7/7 [Epic] 0.9.3: follow-up and bot-comment reliability ✅ 7/7 [Epic] 0.9.3: follow-up and bot-comment reliability Nov 18, 2026
@integry
integry merged commit e7fe63c into main Nov 18, 2026
53 checks passed
@integry
integry deleted the 3686-epic-0-9-g6i branch November 18, 2026 22:28
@propr-dev propr-dev Bot changed the title ✅ 7/7 [Epic] 0.9.3: follow-up and bot-comment reliability [Epic] 0.9.3: follow-up and bot-comment reliability Nov 18, 2026
@propr-dev

propr-dev Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

✅ Epic merged: 0.9.3: follow-up and bot-comment reliability

Epic PR #3707 has been merged into main.

7 of 7 issues merged into main through this epic PR.

All planned epic work is now merged.

Posted automatically by ProPR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment