Skip to content

fix(ci_timing): treat PR runs cancelled by their PR closing as abandoned - #315

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/ci-timing-abandoned-pr-cancels
Oct 21, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/ci-timing-abandoned-pr-cancels

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Summary

After #313, two red suspect_cancelled ci_timing rows remained: workspace-test Smoke Tests pull_request runs (2026-09-19) cancelled ~20 s after their PRs closed unmerged, with no successor. GitHub empties a run's pull_requests on PR close, so the collector could not see why.

  • ci_timing.sh makes one best-effort pulls?state=closed&per_page=50 call per polled repo (head ref + closed_at) and passes it as --closed-prs <file>; any failure → no feed → today's behaviour.
  • classify_cancelled: a non-superseded cancelled pull_request run (not on main) is abandoned (benign, counted, no event) when a closed PR on its head branch has created_at ≤ closed_at ≤ updated_at + SUPERSEDE_SLACK_S. Main/push cancels, open PRs and late closures stay suspects; superseded wins over abandoned.
  • New additive per-gate abandoned counter (readers checked: monitoring/dashboard/timings ignore unknown gate keys; older sidecars read as 0).
  • No threshold, weight or slack changes.

Closes #314

Validation

  • tests/test_ci_timing.py + new tests/test_ci_timing_script.py (stub-gh plumbing): 57 passed (re-run in-session); full suite 1295 passed.
  • Tenant firewall (organ code) check run locally: OK (neutral placeholders only).
  • Live collector into scratch state dirs, main → branch: 2 → 0 hang events (both gates now abandoned 1); every other gate's superseded count unchanged; no fetch errors.
  • In-session diff review.
  • Heart at the door: YELLOW (no override).

🤖 Generated with Claude Code

A cancelled pull_request run with no successor was a kill suspect even when
its PR had just been closed unmerged: GitHub empties the run's pull_requests
once the PR closes, so the collector could not see the closure.

ci_timing.sh now also fetches one page of recently closed PRs per repo
(head ref + closed_at) and passes it as --closed-prs; a failed or empty
fetch degrades to the superseded-only behaviour. classify_cancelled returns
"abandoned" for a non-superseded pull_request cancel (not on main) when a
same-head-branch PR closed between the run's created_at and updated_at +
SUPERSEDE_SLACK_S. Abandoned is benign: counted in a new per-gate
"abandoned" key (sidecar + rollup), no event. Push/main cancels never use
the rule; thresholds, weights and slack are unchanged.

Fixes #314

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jammy2211

Copy link
Copy Markdown
Contributor Author

Heart YELLOW acknowledged by the human 2026-10-21 (after PR-open; ship-time ask was missed): "! manifest drift: workspace checkouts (manifest ↔ disk) — 1 mismatch(es) vs PyAutoMind/repos.yaml"; "? test run status unknown"; "? release validation incomplete: no rehearsal for current source".

@Jammy2211
Jammy2211 merged commit 7674b0a into main Oct 21, 2026
2 checks passed
@Jammy2211
Jammy2211 deleted the feature/ci-timing-abandoned-pr-cancels branch October 21, 2026 10:36
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.

fix: ci_timing flags PR runs cancelled on PR close as kill suspects

1 participant