Skip to content

fix(source-control): read a missing canary workflow as no canary, not unreadable - #14067

Merged
kyle-sexton merged 2 commits into
mainfrom
fix/14059-canary-404-absent
Nov 8, 2026
Merged

kyle-sexton merged 2 commits into
mainfrom
fix/14059-canary-404-absent

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Summary

The post-merge check listed post-merge-detect-silent-revert.yml push runs unconditionally. In a repository without that workflow (pr-pipeline-sandbox), the listing answers 404 and the verdict is unreadable. As a result the pr-merge lane refused every unattended merge there (run 42448013205). This PR implements option 1 from the issue, which the owner approved.

Closes #14059

Change (babysit_postmerge.py)

  • New _canary_absent: a failed canary run listing means "this repository has no canary" only when both of these hold:
    • the listing answered HTTP 404 (and was not a search-cap error);
    • .github/workflows/post-merge-detect-silent-revert.yml is absent on the default branch. This is checked with the existing _default_branch_text, which maps a 404 on a file read to None.
  • _listed_runs returns None for the canary runs in that case.
  • _judge handles canary_runs is None this way:
    • it does not add canary-run-pending;
    • a merge verifies on its green dispatch run plus its read-back.
  • _verifying_runs_unchanged skips the canary listing in that case.
  • Everything else stays unreadable:
    • a 404 while the file is present;
    • a failed file read;
    • 403, 5xx, a capped listing, or a partial listing.
  • The FULL_RUN_WORKFLOW reads are unchanged.

Why the 404 is confirmed with a file read

  • Repository-level 404s: at both call sites the full-run listing runs first, with the same repository and token. A 404 caused by repository access therefore already fails closed before the canary is read.
  • What stays ambiguous: a 404 on the canary listing while the canary exists. A transient error or a 404 on a later page would look the same.
  • What the file read settles: it resolves that case. The extra read only happens on the 404 path.
  • Fit with the issue: option 1 itself describes absence as "the workflow file absent on the default branch".

Why _judge changed too

Treating the 404 as readable but leaving canary-run-pending in place would leave every lane merge unverified forever. Unverified merges count against merge.max-in-flight (in_flight), so after one merge the lane would block again. "No canary signal" therefore means no canary run is required.

Tests

  • test_babysit_postmerge.py NoCanaryWorkflow:
    • a canary 404 with no workflow file verifies on the dispatch run;
    • paired case: a readable canary listing with no runs still holds the merge as canary-run-pending;
    • a 404 with the file present is unreadable;
    • a 403 or a 502 is unreadable;
    • a failed file read is unreadable;
    • a full-run 404 is still unreadable;
    • under --remediate, a canary 404 makes no writes.
  • test_babysit_lane_room.py PendingRunsUnchanged (the _verifying_runs_unchanged path):
    • a canary 404 with no file holds (True);
    • a 404 with the file present, a 403, a 502, or a full-run 404 moves it (False).
  • Before the fix, the two absent-canary tests failed with the issue's exact reason: unreadable: post-merge-detect-silent-revert.yml push runs created >=...: gh: Not Found (HTTP 404).
  • python3 -m unittest discover over plugins/source-control/skills/babysit-prs/scripts/tests: 4193 tests, OK (17 skipped).

🤖 Generated with Claude Code

https://claude.ai/code/session_015te8CrqV9crjukceRMFxz3

… unreadable

The post-merge check listed post-merge-detect-silent-revert.yml push runs
unconditionally. In a repository without that workflow (pr-pipeline-sandbox)
the listing answers 404, the verdict was unreadable, and the pr-merge lane
refused every unattended merge.

A canary run listing that answers 404, with the workflow file absent on the
default branch (_default_branch_text), now means the repository has no
canary: _listed_runs returns no canary runs (None), _judge verifies a merge
without a canary run, and _verifying_runs_unchanged skips the canary listing.
A 404 while the file is present, a failed file read, a 403, a 5xx and a
capped or partial listing stay unreadable. The full-run reads are unchanged.

Closes #14059

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015te8CrqV9crjukceRMFxz3
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-08T05:49:04.677055Z
We couldn’t complete this review. Comment @codex review to try again.
fdb354c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 15bf8429280bb046e2eb9289675904ec39b3a4b4: read 1 of 1 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #14067 (head 15bf8429), incremental since fdb354c7

I found no security issues in this push.

critical-findings: 0

What I reviewed. Only one file changed since the last review, plugins/source-control/skills/babysit-prs/scripts/babysit_postmerge.py, and I read its whole change. The file matches a trusted-path glob. The push adds a single type annotation in _listed_runs, canaries: list[Run] | None, just before the try that lists canary runs (L2807).

Effect. Python does not enforce a local variable annotation at runtime, so no control flow, value or exception path changes. The fail-closed handling of the canary listing that the previous review checked still behaves the same: only a non-capped 404, with the canary workflow file also missing, counts as "no canary". This push widens no trust control and removes no merge hold.

Blocking only. This lane already reviewed an earlier head, so this round reports only CRITICAL and IMPORTANT findings. There were none, and there are no SUGGESTION findings to drop either.

The prior summary comment is not restated: it reported no findings.

Spend: none.

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 15bf8429280bb046e2eb9289675904ec39b3a4b4: read 1 of 1 changed file(s); 0 finding(s), 0 as inline comments.

claude-review incremental review of 15bf8429 (since fdb354c7): read 1 of 1 changed file; 0 findings.

Code review: no findings

What changed. One line, in _listed_runs in plugins/source-control/skills/babysit-prs/scripts/babysit_postmerge.py. The change is the declaration canaries: list[Run] | None (L2807). It sits before the try block, which either assigns the _runs(...) result or sets None after _canary_absent.

What I checked by reading the code:

  • Python never evaluates a local variable annotation at runtime, and the module has from __future__ import annotations at L62. So the line cannot change behaviour.
  • Run is defined in the same module at L837.
  • The declared type matches both assignments and how the code reads the variable afterwards: (canaries or []) and if canaries is None.

I ran no type checker or tests, because this lane has no shell.

Scope. This is a blocking-only review, because the lane already reviewed an earlier head. There were no earlier inline findings to carry forward. The PR's trusted-path file (babysit_postmerge.py) got a full read of this change; the change only adds a type annotation and affects no merge decision.

Spend. None added.

I found no embedded instructions in the inputs.

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

PR body contract — issue linkage

This PR body does not yet satisfy the issue-linkage contract:

  • Missing a "## Fix" section. State the concrete change and how it addresses the problem.
  • Missing a "## Verification" section. Record concrete evidence the change works (commands, gates, output).
  • Missing a "## Related" section. List related PRs, ADRs, or decision-log entries this PR does not close.

Edit the body and this comment updates itself on the next run.

@github-actions github-actions Bot added the needs-issue-linkage Pull request body has no issue linkage line; set by the check-contract step, advisory. label Nov 8, 2026
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 8, 2026
Merged via the queue into main with commit 267f95f Nov 8, 2026
69 checks passed
@kyle-sexton
kyle-sexton deleted the fix/14059-canary-404-absent branch November 8, 2026 06:38
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) needs-issue-linkage Pull request body has no issue linkage line; set by the check-contract step, advisory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pr-merge: post-merge gate refuses every sandbox merge on a missing canary workflow (404)

1 participant