Skip to content

docs(merge-gate-watcher): an empty run list satisfies "everything finished" - #346

Merged
CybotTM merged 1 commit into
mainfrom
feat/retro-empty-run-list-watcher
Sep 22, 2026
Merged

CybotTM merged 1 commit into
mainfrom
feat/retro-empty-run-list-watcher

Conversation

@CybotTM

@CybotTM CybotTM commented Sep 22, 2026

Copy link
Copy Markdown
Member

Merging this adds one subsection to references/merge-gate-watcher.md, on a watcher that reports "settled" before the runs it watches exist. Documentation only; no script changes.

The defect

A tag push or a merge does not create the workflow runs at once. For a second or two actions/runs?head_sha=... answers {"workflow_runs": []} for a SHA that will carry several. A loop asking "does any run have a status other than completed" is therefore vacuously true on its first tick: it exits immediately and reports a settled verdict for work that has not started.

The extracted-value guard one section above does not cover this. That one is about an extraction that comes back empty; here the extraction succeeds and yields a count of zero from an honest empty list.

Why the obvious repair is the part worth writing down

Adding "and the list is not empty" looks correct. As a second API call it is not: the two conditions describe two different instants, the runs appear between them, and both pass. The diff shows the shape.

Observed 2026-09-22 on netresearch/ldap-manager v1.7.0 - the loop returned on its first pass and printed Release: null and CI: null as its result, which are a queued and an in_progress run.

What the section says to do instead

Take both facts from one response, with the predicate in a single jq expression. Verified in both directions against the live API while writing it: true for the settled commit a5e669f, false for a SHA with no runs. Then, where the workflow is known, the better tool - resolve the run id once and hand it to gh run watch <id> --exit-status, which fixes the subject and carries the conclusion in its exit code. The id-resolution snippet guards on an empty and a null id before it is used.

Not touched

Every other section of the file, including the head_sha= server-side filter above it and the extracted-value guard it builds on. No script, no pr-status.sh behaviour.

Assisted by claude-code:claude-opus-5 - Session

…ished"

A tag push or a merge does not create the workflow runs at once. For a second
or two the runs endpoint answers {"workflow_runs": []} for a SHA that will
carry several, so a loop asking "does any run have a status other than
completed" is vacuously true on its first tick and returns a settled verdict
for work that has not started.

The extracted-value guard documented one section above does not cover it: the
extraction succeeds, it just yields a count of zero from an honest empty list.

The reflex repair -- "and the list is not empty" -- is the part worth writing
down, because it looks correct and is not. As a SECOND API call the two
conditions describe two different instants: the runs appear between them, the
first sees none unfinished because it sees none at all, the second sees them
and reports non-empty, and the loop exits on its first pass. Observed
2026-09-22 on netresearch/ldap-manager v1.7.0, where the loop returned
instantly and printed a queued and an in_progress run as its result.

Both facts must come from one response. The jq predicate given is verified in
both directions against the live API -- true for the settled commit, false for
a SHA with no runs -- and the section closes on the better tool where the
workflow is known: resolve the run id once and `gh run watch <id>
--exit-status`, which fixes the subject and carries the conclusion in its exit
code.

Learning-Id: retro-20260922-empty-run-list-watcher

Assisted-by: claude-code:claude-opus-5
Agent-Session: https://claude.ai/code/session_013GWpRpyiM13Rh1NMQMBJo5
Agent-Host: 0493f0
Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
Copilot AI lite review requested due to automatic review settings September 22, 2026 06:11
@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 314dc5b4-b09a-470f-bec9-7d3a5c07aed8

📥 Commits

Reviewing files that changed from the base of the PR and between 4e7ca86 and 4160133.

📒 Files selected for processing (1)
  • skills/git-workflow/references/merge-gate-watcher.md

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The watcher documentation now prevents empty run lists from causing premature completion. It derives non-empty and all-completed checks from one API response. For known workflows, it resolves the specific run ID, uses gh run watch --exit-status, and fails explicitly when the run is unavailable.

Priority: ⬇️ Low

Change: Other

Merge Risk: ⚪ Minimal · up to 41601

This documentation-only change clarifies safe workflow-run monitoring and introduces no production behavior change. It is ready to merge.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the documented merge-gate watcher defect: an empty run list can incorrectly satisfy the “everything finished” condition.
Description check ✅ Passed The description directly explains the documentation change, the empty-list race condition, the single-response jq check, and the known-workflow run-watching approach.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
✨ Simplify code
  • Commit to this branch
  • Create a new PR

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.

@sonarqubecloud

Copy link
Copy Markdown

@github-actions github-actions Bot added documentation Improvements or additions to documentation skill labels Sep 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@CybotTM

CybotTM commented Sep 22, 2026

Copy link
Copy Markdown
Member Author

Self-review: 4160133

The bot review this pull request demands is unsatisfiable (Copilot quota wall or repeated bot failures on this head). The diff on this head was reviewed by the PR author; this comment is the on-the-record attestation the merge gate reads back. It stops matching on the next push.

@CybotTM
CybotTM merged commit 2519e6a into main Sep 22, 2026
24 of 25 checks passed
@CybotTM
CybotTM deleted the feat/retro-empty-run-list-watcher branch September 22, 2026 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation skill

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants