Skip to content

Name a Stale Job Record on a Completed Run in pr_review.py - #3662

Merged
ptr727 merged 3 commits into
developfrom
feature/auto-3362
Oct 30, 2026
Merged

ptr727 merged 3 commits into
developfrom
feature/auto-3362

Conversation

@ptr727

@ptr727 ptr727 commented Oct 30, 2026

Copy link
Copy Markdown
Owner

Summary

A job record can stay IN_PROGRESS after its workflow run has completed. pr_review.py status and wait read it as a check still running, so a driver waits on a record no run will update. This change names that shape and says how to clear it.

  • check_nodes marks a check run that is still IN_PROGRESS while its suite has completed as stale. It also carries the run's id on every check run.
  • check_shape judges a stale node STALE_RECORD at any age. The digest prints CHECK RECORD STALE with the run id and both remedies, a re-run of that job or a new head.
  • A required stale record on a BLOCKED merge takes exit 44. It is not settling, so it holds no poll.
  • A stale record in an older run counts as finished for superseding. So while a newer run of the same workflow is still going on the head, the poll holds instead of exiting 44 on a record that run will replace.

Changes

  • scripts/pr_review_checks.py was at 447 lines against its 450 ceiling. So STUCK_LINES and check_lines move first into a new reader, scripts/pr_review_check_lines.py, which gets its own size ceiling and its own place in the reader import guards. Their inline comments move into docstrings.
  • The new shape is added to the --help text, the CHECKS_NOT_MERGEABLE line, and scripts/README.md.
  • The test fixture check() now gives a running job an in-progress suite unless a case names the suite's status, since a running job in a completed suite is the shape this change reads as stale.
  • New tests cover the shape at two ages, the digest line, the 44 exit, the poll that no longer holds, and the newer-run supersede. Each one fails with the reader change reverted.

Verification

  • python -m unittest discover -s tests: 3128 tests OK (7 skipped), run before the two review-fix commits. After them, the test_pr_review* suites pass (565 tests).
  • The pre-commit hook (ruff, mypy, prose gate, eol) passes on every commit.
  • A local strict review ran three rounds. Round 1 found the older-run supersede gap and a docstring inaccuracy. Round 2 found a dangling / in the superseded line. Both were fixed, and round 3 found nothing.

Closes on promotion: #3362

🤖 Generated with Claude Code

A job record can stay in progress after its workflow run has completed.
status and wait read it as a check still running, so a driver waits on a
record no run will update. The reader now marks a check run whose suite
has completed while the job is in progress, and judges it STALE_RECORD.
The digest line names the run and the two remedies, a re-run of that job
or a new head. A required one on a BLOCKED merge takes exit 44, and it
holds no poll, since waiting cannot end it.

pr_review_checks.py was three lines under its ceiling, so the digest's
check lines move into pr_review_check_lines.py first, beside a ceiling
of their own.
A stale record in an older run now counts as finished for superseding, so a newer run of the same workflow on the head holds the poll rather than the wait exiting 44 on a record that run will replace.
A superseded stale record has no conclusion, so its line printed a dangling slash.
Copilot AI lite review requested due to automatic review settings October 30, 2026 12:14
@coderabbitai

coderabbitai Bot commented Oct 30, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ptr727

ptr727 commented Oct 30, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 46a5f0d1aaf0af7a8ec7e62c8eaf0ca4012c3fd6, the content this pull request carries at that commit against develop, and it recorded 0 findings.

@codecov

codecov Bot commented Oct 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.72%. Comparing base (b38e084) to head (46a5f0d).
⚠️ Report is 29 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3662      +/-   ##
===========================================
+ Coverage    81.60%   81.72%   +0.11%     
===========================================
  Files           26       27       +1     
  Lines         9070     9126      +56     
===========================================
+ Hits          7402     7458      +56     
  Misses        1668     1668              
Flag Coverage Δ
python-3.13 81.72% <100.00%> (+0.11%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are identified, with corresponding test coverage and documentation for stale-record handling and related output behavior.

No open issues 🎉

What changed in this PR

This pull request detects stale IN_PROGRESS job records after their workflow run completes, preventing indefinite polling and providing remediation guidance.

Changes:

  • Adds STALE_RECORD detection, reporting, superseding behavior, and exit code 44 handling.
  • Extracts check-line rendering into pr_review_check_lines.py with updated import guards and size limits.
  • Expands tests for stale records, digest output, polling, and superseding runs.
  • Includes minor documentation and wording fixes noted for follow-up.
File Summary
tests/​test_pr_review.py Adds coverage for stale records, output, exit behavior, polling, and superseding.
tests/​test_pr_review_size.py Adds the size ceiling for the new reader module.
scripts/​README.md Documents the new reader module and STALE_RECORD behavior.
scripts/​pr_review.py Updates stale-record help text and remediation guidance.
scripts/​pr_review_digest.py Imports check-line rendering from the new reader module.
scripts/​pr_review_checks.py Detects stale records, carries workflow run IDs, and handles superseding runs.
scripts/​pr_review_check_lines.py Renders diagnostic lines for check states, including stale records.

This pull request is ready to be approved.

Review effort: Lite

@ptr727
ptr727 merged commit b09f957 into develop Oct 30, 2026
14 checks passed
@ptr727
ptr727 deleted the feature/auto-3362 branch October 30, 2026 12:27
ptr727 added a commit that referenced this pull request Oct 30, 2026
…Session Prompt Rules (#3667)

Promotes the changes merged into `develop` since promotion #3636 to
`main`.

- [#3640](#3640) Pins the
validator's `uvx ruff` to a Dependabot-managed manifest.
- [#3642](#3642) Counts
Copilot findings under the unresolved bullet and the file table.
- [#3644](#3644) Aligns
the split comment copies and drops the stale counts.
- [#3646](#3646) Sends a
command meant for the session's input line in a plain message, never in
a blocking prompt.
- [#3648](#3648) Opens the
attended session by cloning a hub checkout of the session's own.
- [#3650](#3650) Reads a
held package as installed in both Linux host scripts.
- [#3652](#3652) States
the PowerShell `-Help` and `-h` form in the command-line argument rules.
- [#3654](#3654) Counts
sentences in Markdown table cells for the sentence-length check.
- [#3658](#3658) Splits a
table row only at an unescaped pipe in the semicolon rule.
- [#3660](#3660) Finds
table cell boundaries before blanking code spans and quotations.
- [#3662](#3662) Names a
stale job record on a completed run in `pr_review.py`.
- [#3665](#3665) Keeps a
line holding code after a block comment's closer out of `comment-added`.
Its squash commit on `develop` carries the pull request's original
title, which names a heredoc reading. That reading was withdrawn before
the merge on decision #3666, so a workflow `run:` heredoc body still
reads as code.
- [#3669](#3669) Counts
each `[Pn]` marker in a Copilot Findings cell, so a second finding in
one cell is no longer dropped from triage. It answers one of the two
findings Copilot raised on this promotion. The other is declined with a
parser probe in its thread.

Closes #3616
Closes #3610
Closes #3622
Closes #3638
Closes #3604
Closes #3511
Closes #3602
Closes #3456
Closes #3655
Closes #3657
Closes #3362
Closes #1664

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants