Skip to content

Skip Design Decision Gate ADR writes for already-closed PRs - #69504

Merged
pelikhan merged 1 commit into
mainfrom
pelikhan-fix-design-gate-task-completion
Oct 16, 2026
Merged

pelikhan merged 1 commit into
mainfrom
pelikhan-fix-design-gate-task-completion

Conversation

@pelikhan

Copy link
Copy Markdown
Collaborator

Root cause

Run 38967187202 was not an ADR policy rejection or another model failure. PR #69467 merged at 21:07:47Z, the same second the run was created. At 21:09:29Z, Checkout PR branch could no longer fetch its deleted branch and explicitly logged that the PR was now closed, treating checkout failure as expected. The agent still received an enforcement task in a detached merge checkout (4bbb40da012788fecf1cd437db782e0d649fad68), generated an ADR, failed both push attempts, and emitted report_incomplete. Its fallback ADR comment succeeded; the conclusion job correctly failed on the incomplete report.

Change

  • Request current PR state in the existing authenticated prefetch metadata call.
  • For positively confirmed CLOSED/MERGED PRs, populate the existing skip_reason envelope and require noop without ADR generation/push.
  • Preserve all OPEN-PR ADR thresholds, label requirements, permissions, sandbox settings, output limits and approval protections. Failed metadata requests still fail rather than producing a skip.
  • Add isolated tests executing the real workflow shell body with mocked GitHub responses; wire into make test-scripts.

This addresses closure before prefetch, as observed in the failed run; it does not claim atomic protection against a PR closing later during the agent's work. No shared runtime failure handling or model settings are changed.

Evidence and validation

  • Regression cases passed: OPEN PR with 553 business additions still requires ADR; CLOSED and MERGED produce skip; manual dispatch with/without PR preserved; metadata HTTP403 fails without skip.
  • Shellcheck passed for the harness and emitted dry-run run steps.
  • make recompile: 344/344; normal scoped compilation passed.
  • make agent-report-progress passed, including all workflow drift checks. No Go files changed, so impacted Go tests were correctly skipped.
  • Source, generated payload, credential/input boundaries, permissions and protection controls reviewed; no confirmed vulnerabilities. Exact publication lock diff changes only metadata hashes and the prefetch script.
  • Dry-run gate remains blocked by the pre-existing workflow_dispatch concurrency/job-discriminator compiler warning (plus existing experimental-feature notice). Diagnostic lock was emitted and shellcheck passed; other optional scanners were not run. Normal publication lock was regenerated with the repository compiler; no dry-run behavior is published.
  • Other supplied successful runs concern different PRs/revisions, so they do not establish recovery from this race. Run38976953864 on PR fix: use model routing for Duplicate Code Detector #69499 subsequently succeeded, independently of this fix.

No workflows were dispatched or rerun, and no PR was merged.

Avoid generating an ADR and reporting incomplete when a PR merges and its branch disappears before the gate starts. Keep all open-PR ADR enforcement unchanged and cover lifecycle handling with mocked same-source regressions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review October 16, 2026 22:58
Copilot AI max review requested due to automatic review settings October 16, 2026 22:58
@pelikhan
pelikhan merged commit ce981e8 into main Oct 16, 2026
49 of 56 checks passed
@pelikhan
pelikhan deleted the pelikhan-fix-design-gate-task-completion branch October 16, 2026 22:58
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Ponytail Reviewer · gpt56 · 5.89 AIC · ⌖ 5.36 AIC · ⊞ 14.6K · ◷

Generated by Ponytail Reviewer for #69504

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

Design Decision Gate 🏗️

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Design Decision Gate 🏗️ · opus55 · 11 AIC · ⌖ 36.2 AIC · ◇ 16.3 AIC · ⊞ 1.9K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Test Quality Sentinel · haiku45 · 12.3 AIC · ⌖ 9.25 AIC · ◇ 2.54 AIC · ⊞ 9.2K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-10-16T23:00:30Z
review_event: REQUEST_CHANGES
top_themes:
  - lockfile drift not covered by regression test
  - workflow_dispatch skip path can fail on non-numeric PR selectors
files_reviewed:
  - .github/workflows/design-decision-gate.md
  - Makefile
  - scripts/design-decision-gate-prefetch_test.sh
comment_count: 2

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 58.4 AIC · ⌖ 5.84 AIC · ⊞ 12.7K · ◷
Comment /review to run again

@github-actions github-actions Bot 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.

Verdict

I did not find a changed-line issue that clearly blocks this PR.

Scope and limits

Reviewed the pre-fetched diff only; I did not execute the workflow or tests. The closed/merged short-circuit looks internally consistent, and the regression script covers the key OPEN/CLOSED/MERGED/manual-dispatch paths for this specific fix.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 58.4 AIC · ⌖ 5.84 AIC · ⊞ 12.7K
Comment /review to run again

--arg pr_number "${PR_NUMBER:-}" \
'{
pr_number: null,
pr_number: (if $pr_number == "" then null else ($pr_number | tonumber) end),

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.

This skip path coerces the raw workflow_dispatch input with tonumber, which will abort prefetch if the operator passes a PR URL/ref that gh pr view resolves successfully.

💡 Why this is a real regression

workflow_dispatch inputs are untyped strings. gh pr view "$PR_NUMBER" accepts more than bare numeric IDs, so a closed PR supplied as a URL or another resolvable selector reaches this branch and then dies while writing adr-prefetch-summary.json. That turns the intended noop skip into a hard failure.

Use the validated .number already returned in pr.json, or guard the conversion before calling tonumber.

/^ run: \|$/ { body = 1; next }
body && /^ / { sub(/^ /, ""); print; next }
body && /^$/ { print; next }
body { exit }

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.

This harness reads the markdown source instead of the compiled .lock.yml, so the test can pass while the workflow GitHub actually runs still contains stale prefetch logic.

💡 Why this blocks the fix

The regression you are fixing is in the production workflow, but this test extracts the shell body from .github/workflows/design-decision-gate.md. If the lockfile is stale or recompilation is skipped, CI still goes green here while the shipped workflow keeps the old behavior.

A safer pattern is to exercise design-decision-gate.lock.yml directly, or assert that the compiled lock step matches the markdown source before running the harness. That way this test actually proves the runnable workflow was updated.

@github-actions github-actions Bot 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.

Skills-Based Review 🧠

Applied /diagnosing-bugs and /tdd — approving.

📋 Key Themes & Highlights

Verification performed

Independently re-extracted and ran the shell body from the PR's committed HEAD content (not the locally-drifted sandbox working tree) across all 6 scenarios: OPEN, CLOSED, MERGED, workflow_dispatch without PR, workflow_dispatch with PR, and gh pr view HTTP 403 failure. All behaved as asserted by the new scripts/design-decision-gate-prefetch_test.sh.

Positive Highlights

  • ✅ Root cause fix (/diagnosing-bugs): adds state to the existing gh pr view --json call (no extra API round trip) and gates the skip decision before any ADR generation or push attempt — this matches the actual observed failure mode (PR closed before prefetch), not just a symptom patch.
  • ✅ Regression coverage (/tdd): follows the existing isolated-shell-execution pattern from pr-data-prefetch_test.sh, asserts exact gh call counts (so an extra unwanted API call would fail the test), and covers the open/closed/merged/dispatch/failure matrix.
  • ✅ Failed PR-metadata requests still hard-fail via set -euo pipefail rather than silently downgrading to a skip — preserves the safety invariant that an unverified PR state never results in a false skip.
  • ✅ PR description transparently discloses the remaining (narrower) race window rather than overclaiming atomic protection.

No actionable issues found.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 60.9 AIC · ⌖ 14.8 AIC · ⊞ 10.1K
Comment /matt to run again

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.

🔵 Needs a closer look

Independent compiler and scanner validation was unavailable for this production workflow change.

No open issues 🎉

What changed in this PR

Updates Design Decision Gate to skip ADR generation when prefetch confirms that a PR is closed or merged.

Changes:

  • Fetch current PR state and reuse the existing skip/noop path.
  • Preserve open-PR enforcement and metadata-error failures.
  • Regenerate the workflow lock and add shell regressions to make test-scripts.
File Description
scripts/​design-decision-gate-prefetch_test.sh Tests PR states, manual dispatch, and metadata failures.
Makefile Registers the new regression script.
.github/​workflows/​design-decision-gate.md Adds confirmed-closure skipping and explicit noop guidance.
.github/​workflows/​design-decision-gate.lock.yml Updates generated prefetch code and metadata.

Review effort: Max

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.92.5

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