Skip to content

fix(worker): tell the pull request when a command failed before it started - #3425

Merged
integry merged 1 commit into
mainfrom
fix/pr-command-unstarted-failure-comment
Nov 8, 2026
Merged

integry merged 1 commit into
mainfrom
fix/pr-command-unstarted-failure-comment

Conversation

@integry

@integry integry commented Nov 8, 2026

Copy link
Copy Markdown
Owner

Why

A /fix all on #3423 looked ignored. The worker had picked it up within a second and tried three times, but every attempt failed with Worktree disk pressure: admission reserve unavailable; data retained. Worktree admission wraps the whole job processor (createWorker in packages/core/src/queue/taskQueue.ts), so a refused job never creates its task state or its starting comment, and the processor's own failure handling (handleJobError) never runs. Nothing reached GitHub or the UI; only the worker log knew. The same happened to a review_pull_request request on integry/mcptest#523 and 80 other attempts since yesterday evening.

What

  • attachPRCommentTaskStateFinalizers already finalizes exhausted PR comment jobs. When that finalization finds no task state, the job never started, so it now posts a comment on the pull request via the new postUnstartedPRCommentFailure (src/jobs/prCommentUnstartedFailure.ts).
  • Disk pressure gets a plain explanation: the worker's working-copy disk is nearly full, nothing was changed, free space and post the command again. Any other pre-start failure quotes the sanitized error and the attempt count.
  • The comment names the command (/fix, /review, …) and the requesters, and carries the usual Comment ID: n✓ and propr:work-evidence phase=failed markers, so polling does not re-queue the spent command on its own.
  • The storage lifecycle throws a typed WorktreeDiskPressureError; isWorktreeDiskPressureError recognises it by name or by its unchanged message after a queue round-trip. Both are exported from @propr/core.
  • Docs: a "When A Command Cannot Start" section in PR Comment Commands, and a sentence in Maintenance under worker admission.

Issue jobs are left alone: the processing label is applied inside the processor, so a refused issue keeps its trigger label and polling retries it on a later poll.

Tests

  • test/prCommentUnstartedFailure.test.ts: body for disk pressure and for a generic error, synthetic ultrafix comments filtered, follow-up without known comments, the GitHub request, a failing post is logged and not thrown, error recognition.
  • test/prCommentTaskStateFinalizers.test.ts: the exhausted attempt with missing task state is reported once; a job whose own handling ran is not.
  • Core lifecycle and intake tests still pass with the typed error.

🤖 Generated with Claude Code

…arted

Worktree admission wraps the whole job processor, so a PR comment job that
is refused under disk pressure fails all its attempts without ever creating
its task or posting anything: the /fix or /review looks ignored on GitHub,
and only the worker log knows.

The exhausted-failure finalizer now notices a job whose task state never
existed and posts a comment on the pull request naming the cause. Disk
pressure gets a plain explanation (free space, then post the command
again); any other pre-start failure quotes the sanitized error. The comment
carries the usual processed markers so polling does not re-queue the spent
command on its own.

The storage lifecycle throws a typed WorktreeDiskPressureError, recognised
by name or by its unchanged message after a queue round-trip.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@integry integry added the AI label Nov 8, 2026
@integry

integry commented Nov 8, 2026

Copy link
Copy Markdown
Owner Author

/review

@propr-dev

propr-dev Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

✅ AI Code Review Complete requested by @integry

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

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

Overall Evaluation

Ready to merge within scope. The change addresses silent pre-start failures with a focused reporting path. The supplied current-head checks show 21 passed and none failed or pending. This review used static analysis only; no commands were run.

✅ Compatible error recognition — The typed disk-pressure error preserves the existing message and supports recognition after queue serialization.

✅ Polling-compatible failure receipts — Failure comments include real request IDs, checkmarks, and failed work-evidence markers matching the supplied consumers.

✅ Contained reporting failures — GitHub posting errors are caught and logged without escaping the failure reporter.

Merge blockers

No merge blockers.

Suggestions

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

S1: 🟢 Restore the mock implementation correctly

In test/prCommentTaskStateFinalizers.test.ts, originalImplementation captures the mockImplementation setter itself, rather than the mock’s current implementation. Passing that setter back installs it as the mocked finalizer’s behavior. Restore an explicitly defined default implementation instead, and have the subsequent test assert successful finalization as well as zero reporting calls. This improves test isolation and prevents a misleading negative assertion; it does not demonstrate a production defect.

Score

The implementation satisfies the scoped objective, with compatible failure markers and coverage of the principal reporting paths. No production blocker was verified, and current-head checks are green.

Score: 9/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 25s
  • Tokens: 44,676 (44,188 in / 488 out)
  • Cost: $0.33

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

🤖 Review by ProPR

@integry
integry merged commit a8f10be into main Nov 8, 2026
47 checks passed
@integry
integry deleted the fix/pr-command-unstarted-failure-comment branch November 8, 2026 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants