Skip to content

Add pre-created pull request safe output mode - #53576

Merged
pelikhan merged 13 commits into
mainfrom
copilot/add-support-safe-output-pr
Aug 18, 2026
Merged

Add pre-created pull request safe output mode#53576
pelikhan merged 13 commits into
mainfrom
copilot/add-support-safe-output-pr

Conversation

Copilot AI commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Adds an opt-in mode that allocates a draft pull request during activation, making the workflow run visible immediately and ensuring subsequent agent changes reuse that pull request.

safe-outputs:
  create-pull-request:
    pre-create: true

Changes

  • Activation

    • Creates a dedicated branch, draft PR, and in-progress check linked to the workflow run.
    • Exposes the PR, branch, and check identifiers to downstream jobs.
  • Agent execution

    • Checks out the pre-created branch by default.
    • Preserves the allocated branch throughout safe-output processing.
  • Safe outputs

    • Validates and updates the existing open PR instead of creating another.
    • Requires same-repository, single-PR operation with the default checkout.
  • Conclusion

    • Completes the linked check with the workflow’s success, failure, or cancellation result.
  • Configuration

    • Adds schema validation and documentation for pre-create.
    • Requires contents: write, pull-requests: write, and checks: write.

Run: https://github.com/github/gh-aw/actions/runs/32103414328> Generated by 👨‍🍳 PR Sous Chef · gpt54 · 14 AIC · ⌖ 7.84 AIC · ⊞ 8.8K ·

Comment /souschef to run again


Caution

agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.

Details

Potential security threats were detected in the agent output.

Review the workflow run logs for details.

Run: https://github.com/github/gh-aw/actions/runs/32109331559> Generated by 👨‍🍳 PR Sous Chef · gpt54 · 30 AIC · ⌖ 11.4 AIC · ⊞ 8.8K ·

Comment /souschef to run again


Run: https://github.com/github/gh-aw/actions/runs/32123781702> Generated by 👨‍🍳 PR Sous Chef · gpt54 · 41.3 AIC · ⌖ 7.88 AIC · ⊞ 8.8K ·

Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 25.8 AIC · ⌖ 7.82 AIC · ⊞ 6.4K ·
Comment /souschef to run again

Copilot AI and others added 3 commits August 18, 2026 03:50
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan August 18, 2026 03:58
@pelikhan
pelikhan marked this pull request as ready for review August 18, 2026 04:41
Copilot AI balanced review requested due to automatic review settings August 18, 2026 04:41
@github-actions

github-actions Bot commented Aug 18, 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 Aug 18, 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 Aug 18, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Ponytail Reviewer completed successfully!

Generated by Ponytail Reviewer for #53576

@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

reviewed_at: 2026-08-18T00:00:00Z
review_event: REQUEST_CHANGES
top_themes:
  - wrong merge base for pre-created PR branch
  - reused PR does not enforce configured draft state
files_reviewed:
  - actions/setup/js/pre_create_pull_request.cjs
  - actions/setup/js/create_or_update_pull_request.cjs
  - actions/setup/js/create_pull_request.cjs
  - pkg/workflow/compiler_precreate_pull_request.go
  - pkg/workflow/compiler_activation_steps.go
  - pkg/workflow/compiler_safe_outputs_steps.go
  - pkg/workflow/create_pull_request.go
comment_count: 2

Note

This comment is managed by comment memory.

It stores persistent context for this thread in the code block at the top of this comment.
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 · gpt54 · 14.2 AIC · ⌖ 7.09 AIC · ⊞ 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.

Request changes

The pre-created PR flow has a couple of correctness holes that can produce the wrong branch ancestry and let the reused placeholder drift out of the requested draft state.

Blocking themes
  • The activation step creates the placeholder branch from the activation checkout head, not from the eventual PR base branch, so runs targeting a different base can pre-create a PR with the wrong merge base.
  • Reusing an allocated PR updates title/body/base only; it does not enforce the configured draft state, so a previously readied PR can stay non-draft across reruns.

🔎 Code quality review by PR Code Quality Reviewer · gpt54 · 14.2 AIC · ⌖ 7.09 AIC · ⊞ 7K
Comment /review to run again

const workflowName = process.env.GH_AW_WORKFLOW_NAME || context.workflow || "Agentic workflow";
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
const branch = `gh-aw/pre-created/${context.runId}-${process.env.GITHUB_RUN_ATTEMPT || "1"}`;
const { stdout: checkoutHead } = await exec.getExecOutput("git", ["rev-parse", "HEAD"]);

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 creates the placeholder branch and PR from whatever commit happened to be checked out in the activation job, but the activation checkout still uses the event default ref instead of the resolved PR base branch. On issue_comment/manual runs that target a different base branch, the pre-created branch will be forked from the wrong commit, so later updates either produce a nonsense diff or can’t be rebased onto the requested base cleanly.

💡 Why this blocks merge The new mode promises that the eventual PR reuses the pre-created branch, so its starting point has to match the branch the real PR is targeting. Here you derive `headSha` from `git rev-parse HEAD` and create the synthetic commit/ref from that checkout, but nothing in this step aligns the activation checkout to `create-pull-request.base-branch` or the runtime-selected base. That means a workflow configured to open against `release/*` can pre-create a PR from `main`, and every subsequent push will inherit the wrong merge base.

At minimum, pre-creation needs to resolve the effective base branch first and create the branch from that ref, or reject configurations where the base can differ from the activation checkout.

if (existingPullRequest.state !== "open" || existingPullRequest.head.ref !== preCreatedBranch) {
throw new Error(`Pre-created pull request #${preCreatedPullRequestNumber} is not open on branch ${preCreatedBranch}`);
}
return githubClient.rest.pulls.update({

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.

If the pre-created PR is already marked ready for review, this update path can never recover because you omit draft on pulls.update(). The workflow will keep reusing the same PR number but silently leave it non-draft, which breaks the contract that pre-created PRs stay WIP until the agent is done.

💡 Why this blocks merge `pulls.create()` respects the configured `draft` flag, but the pre-created path only updates `title`, `body`, and `base`. GitHub's update endpoint also accepts `draft`, so once a user or automation flips the placeholder PR out of draft, later workflow runs cannot restore the intended state. That is especially bad for reruns because the activation job always creates a placeholder titled “Work in progress”, but the finalization path no longer controls whether reviewers/merge automation see it as ready.

Pass draft through on update as well, or explicitly detect and reject a pre-created PR whose draft state no longer matches the requested configuration.

@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 /tdd, /diagnosing-bugs, and /grill-with-docs — requesting changes on correctness and test-coverage gaps.

📋 Key Themes & Highlights

Key Themes

  • Missing draft propagation: the update path in create_or_update_pull_request.cjs never passes draft, so a workflow that signals a PR is ready will leave it permanently in draft state.
  • Retriable vs non-retriable errors: throwing a state-mismatch error inside withRetry burns the retry budget on a non-transient condition.
  • Orphaned branches: if pulls.create or checks.create fails after the branch ref is created, the run leaves a dangling branch with no PR.
  • Unconstrained max validation: pre-create: true passes validation when max is unset, even though "unlimited PRs" contradicts a single pre-created PR.
  • Thin test coverage: cancelled conclusion and the early-exit guard in complete_pre_created_check_run are untested.

Positive Highlights

  • ✅ Clean end-to-end lifecycle: activation → agent checkout → safe-outputs reuse → conclusion check.
  • ✅ Good use of withRetry with descriptive labels; the retry config is consistently applied.
  • ✅ Solid validation surface in validatePreCreatePullRequest with a comprehensive test table.
  • ✅ Integration test covers all four generated job sections in one shot.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 61.5 AIC · ⌖ 11.7 AIC · ⊞ 7.8K
Comment /matt to run again

Comments that could not be inline-anchored

actions/setup/js/create_or_update_pull_request.cjs:220

[/tdd] draft field is missing from the update call — if the agent signals the PR is ready for review (draft: false), the pre-created draft PR stays as a draft permanently.

<details>
<summary>💡 Suggested fix</summary>

Add draft to the update payload:

return githubClient.rest.pulls.update({
  owner: repoParts.owner,
  repo: repoParts.repo,
  pull_number: preCreatedPullRequestNumber,
  title,
  body,
  base: baseBranch,
  draft,   // ← add this
});

Add a test asserting th…

actions/setup/js/create_or_update_pull_request.cjs:211

[/diagnosing-bugs] Throwing inside withRetry when the PR is closed/merged causes the error to be retried unnecessarily before bubbling up. A state-mismatch is not a transient error; it should fail immediately without exhausting retries.

<details>
<summary>💡 Suggested approach</summary>

Fetch the PR outside the withRetry wrapper (or use a non-retriable error subclass), so the retry budget is preserved for actual transient failures (rate limits, network blips). Add a test covering this…

actions/setup/js/pre_create_pull_request.cjs:505

[/diagnosing-bugs] No cleanup if pulls.create or checks.create fails after the branch ref is already created — the run leaves an orphaned branch (gh-aw/pre-created/&lt;runId&gt;-&lt;attempt&gt;) with no associated PR.

<details>
<summary>💡 Suggested mitigation</summary>

Wrap pulls.create and checks.create in a try/catch that deletes the ref on failure:

try {
  const { data: pullRequest } = await github.rest.pulls.create({ ... });
  const { data: checkRun } = await github.rest.checks.

</details>

<details><summary>pkg/workflow/create_pull_request.go:1133</summary>

**[/grill-with-docs]** When `config.Max` is `nil` (not explicitly set), `pre-create: true` passes validation  but `nil` typically means &quot;unlimited&quot; in this codebase. Allowing unlimited PRs with a single pre-created PR is logically contradictory and the behavior is undefined.

&lt;details&gt;
&lt;summary&gt;💡 Suggested fix&lt;/summary&gt;

Treat `nil` the same as an explicit value other than `&quot;1&quot;`:

```go
if config.Max == nil {
    return errors.New(&quot;safe-outputs.create-pull-request.pre-create requires max: 1&quot;)…

</details>

<details><summary>actions/setup/js/complete_pre_created_check_run.test.cjs:172</summary>

**[/tdd]** Missing test cases for `cancelled` conclusion and for the early-exit path when `GH_AW_PRE_CREATED_CHECK_RUN_ID` is absent.

&lt;details&gt;
&lt;summary&gt;💡 Suggested additions&lt;/summary&gt;

```js
it(&quot;completes the check with &#39;cancelled&#39; when a job was cancelled&quot;, async () =&gt; {
  process.env.GH_AW_NEEDS = JSON.stringify({ agent: { result: &quot;cancelled&quot; } });
  const { main } = await import(&quot;./complete_pre_created_check_run.cjs&quot;);
  await main();
  expect(global.github.rest.checks.update).toHaveBeenC…

</details>

@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.

Review: Add pre-created pull request safe output mode

The overall approach is sound — pre-allocating a draft PR on activation makes the workflow run immediately visible. The implementation is clean and well-tested. I found one notable bug and a minor concern.

Bug: draft state not updated on pre-created PR

In create_or_update_pull_request.cjs, the draft parameter is destructured from options but never passed to pulls.update. This means the pre-created draft PR will never be promoted to a non-draft state when the agent finishes — it stays as a draft regardless of the user's draft: false config.

The GitHub REST API's PATCH /repos/{owner}/{repo}/pulls/{pull_number} does accept a draft field to change draft state.

Minor: No idempotency guard on repeated activation

In pre_create_pull_request.cjs, a new empty commit and branch are created every activation. On a re-run (GITHUB_RUN_ATTEMPT > 1) the branch name includes the attempt number so it's unique, but if the activation step itself retries within the same attempt, duplicate branches/PRs could be created. Consider checking whether the branch already exists before creating it.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 46.6 AIC · ⌖ 8.91 AIC · ⊞ 5.7K

return githubClient.rest.pulls.update({
owner: repoParts.owner,
repo: repoParts.repo,
pull_number: preCreatedPullRequestNumber,

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.

The draft parameter is destructured from options but never passed to pulls.update. When the agent completes and calls createOrUpdatePullRequest, the pre-created draft PR will remain a draft regardless of the workflow config.

Fix:

return githubClient.rest.pulls.update({
  owner: repoParts.owner,
  repo: repoParts.repo,
  pull_number: preCreatedPullRequestNumber,
  title,
  body,
  base: baseBranch,
  draft,  // add this
});

@copilot please address this.

@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.

Ponytail review: over-engineering pass only.

net: -8 lines possible.

Generated by ✂️ Ponytail Reviewer for #53576 · auto · 62 AIC · ⌖ 5.11 AIC · ⊞ 7.3K
Comment /ponytail to run again

remoteTarget: pushRemoteUrl || "origin",
remoteToken: headGitHubToken,
cwd: forkCwd,
allowExistingBranch: branchName === preCreatedBranch,

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.

shrink: allowExistingBranch: branchName === preCreatedBranch repeated 3x (L1812, L2207, L2384) with identical logic. Compute once as const allowExistingBranch = branchName === preCreatedBranch; near L1751 and reuse.

stepID,
)...)
}
appToken := fmt.Sprintf("${{ steps.%s.outputs.token }}", stepID)

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.

yagni: app-token-mint-then-combine pattern duplicated almost verbatim between addActivationPreCreatePullRequestStep (L40-57) and buildConclusionPreCreatedCheckRunStep (L84-103). Extract a shared helper that mints and resolves the token, then call it from both.

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.

Pull request overview

Adds opt-in draft PR pre-creation so agent changes reuse a PR visible from workflow activation onward.

Changes:

  • Creates and checks out a pre-allocated PR branch.
  • Reuses the PR and completes its workflow check.
  • Adds validation, schema, documentation, and tests.
Show a summary per file
File Description
pkg/workflow/safe_outputs_handler_registry.go Passes pre-created PR identifiers to handlers.
pkg/workflow/safe_output_handlers.go Adds check-write permissions.
pkg/workflow/notify_comment.go Adds check completion to conclusion jobs.
pkg/workflow/create_pull_request.go Defines and validates pre-create.
pkg/workflow/compiler_yaml_checkout.go Checks out the allocated branch.
pkg/workflow/compiler_validators.go Registers pre-create validation.
pkg/workflow/compiler_safe_outputs_steps.go Preserves the branch in safe outputs.
pkg/workflow/compiler_precreate_pull_request.go Generates activation and conclusion steps.
pkg/workflow/compiler_precreate_pull_request_test.go Tests compiler behavior and validation.
pkg/workflow/compiler_precreate_pull_request_integration_test.go Tests compiled workflow integration.
pkg/workflow/compiler_activation_steps.go Adds activation checkout and PR creation.
pkg/workflow/compiler_activation_permissions.go Grants activation write permissions.
pkg/workflow/checkout_step_generator.go Applies generated checkout ref overrides.
pkg/workflow/checkout_manager.go Adds default ref override state.
pkg/parser/schemas/main_workflow_schema.json Adds the schema property.
docs/src/content/docs/reference/safe-outputs-pull-requests.md Documents pre-created PRs.
actions/setup/js/pre_create_pull_request.test.cjs Tests PR and check creation.
actions/setup/js/pre_create_pull_request.cjs Creates the branch, PR, and check.
actions/setup/js/create_pull_request.cjs Reuses the allocated branch and PR.
actions/setup/js/create_pull_request_precreate.test.cjs Tests PR reuse.
actions/setup/js/create_or_update_pull_request.cjs Selects PR creation or update.
actions/setup/js/complete_pre_created_check_run.test.cjs Tests check conclusions.
actions/setup/js/complete_pre_created_check_run.cjs Completes the linked check.
.github/workflows/mcp-inspector.lock.yml Refreshes generated strict-mode metadata.
.github/workflows/daily-team-evolution-insights.lock.yml Refreshes generated strict-mode metadata.

Review details

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 25/25 changed files
  • Comments generated: 5
  • Review effort level: Balanced

Comment on lines +154 to +161
if isPreCreatePullRequestEnabled(data) {
checkoutManager := NewCheckoutManager(data.CheckoutConfigs)
if checkoutManager.HasAppAuth() {
ctx.steps = append(ctx.steps, checkoutManager.GenerateCheckoutAppTokenSteps(c, resolveCheckoutPermissions(data))...)
}
checkoutSteps = checkoutManager.GenerateDefaultCheckoutStep(c.trialMode, c.trialLogicalRepoSlug, c.getActionPin)
} else {
checkoutSteps = c.generateCheckoutGitHubFolderForActivation(data)
CustomToken: token,
})...)
}
steps = append(steps, c.buildConclusionPreCreatedCheckRunStep(data)...)
Comment on lines +45 to +48
func validatePreCreatePullRequest(data *WorkflowData) error {
if !isPreCreatePullRequestEnabled(data) {
return nil
}
Comment on lines +34 to +41
return githubClient.rest.pulls.update({
owner: repoParts.owner,
repo: repoParts.repo,
pull_number: preCreatedPullRequestNumber,
title,
body,
base: baseBranch,
});
team-reviewers: [platform-reviewers] # team slugs to request as reviewers
assignees: [user1] # assignees for the created PR and any fallback issue
draft: true # create as draft — enforced as policy (default: true)
pre-create: true # allocate a draft PR before the agent starts (default: false)
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Please address the blocking review feedback below, refresh the branch if needed, then run the pr-finisher skill and report back with validation results and any remaining blockers.

Run: https://github.com/github/gh-aw/actions/runs/32100908477

Generated by 👨🍳 PR Sous Chef · gpt54

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 32.3 AIC · ⌖ 10 AIC · ⊞ 8.8K ·
Comment /souschef to run again

@github-actions

Copy link
Copy Markdown
Contributor

🎉 Excellent work on this PR! This feature addition for pre-created pull request safe outputs looks solid.

What we are seeing:

  • Well-focused implementation across activation, agent execution, and safe-output handling
  • Comprehensive test coverage across both JS and Go components (351 lines of tests)
  • Clear documentation with an ADR and reference docs
  • Proper security considerations (required permissions: contents: write, pull-requests: write, checks: write)

PR readiness:
This PR is aligned with the contribution guidelines and ready for maintainer review. The implementation follows the agentic development process and includes all expected artifacts (tests, ADR, documentation).

Great job on the structured breakdown and permission auditing! 🚀

Generated by ✅ Contribution Check · auto · 47 AIC · ⌖ 8.51 AIC · ⊞ 9.2K ·

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Please confirm the latest fixes are complete, refresh the branch if needed, and run the pr-finisher skill only if any further edits are still required.

  • No failed checks were listed in the compact queue for this run.
  • make fmt could not run in this sandbox, so no formatter push was attempted here.
  • Recent follow-up indicates maintainer review approval, stale bot-review cleanup, and CI re-trigger may be the only remaining items; please confirm.

Run: https://github.com/github/gh-aw/actions/runs/32120796211

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 21.2 AIC · ⌖ 7.92 AIC · ⊞ 8.8K ·
Comment /souschef to run again

Copilot AI commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Please confirm the latest fixes are complete, refresh the branch if needed, and run the pr-finisher skill only if any further edits are still required.

  • No failed checks were listed in th...

Confirmed — no further edits were required, so I did not run pr-finisher beyond verification.

Branch: HEAD is still fced389, working tree clean, and git rev-list --count HEAD..origin/main = 0, so no refresh was needed. make fmt runs fine here (go1.26.5 matches go.mod) and produces no changes to any file in this PR.

Fixes still in place on HEAD: draft-state alignment via GraphQL after update, conclusion job running when pre_created_pull_request_check_run_id is set (cancelled runs), pre-creation compiled out under staged, base-branch forking, preserved workflow_call activation checkout, orphaned-branch cleanup, and fail-fast on a closed/relocated pre-created PR.

Remaining items — confirmed: maintainer review approval, dismissal of the two stale CHANGES_REQUESTED bot reviews (4957317604, 4957324153), and a CI re-trigger. get_status on fced389 is pending with total_count: 0 — no checks exist for this HEAD because agent pushes don't trigger workflows. I can't resolve threads or dismiss reviews myself.

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot make the test parallelizer agentic workflow use this feature .

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot the pre-created PR is ALWAYS in draft mode, regardless of the draft field value. If draft:false, the PR is undrafted in the safe output phase.

Add tests.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Please address the latest maintainer feedback on this PR, then run the pr-finisher skill and report back with validation results and any remaining blockers.

  • Latest maintainer feedback requests:
    • make the test parallelizer agentic workflow use this feature
    • ensure pre-created PRs stay draft during pre-create and only undraft in the safe output phase when draft: false; add tests
  • No failed checks were listed in the compact queue for this run.
  • Branch refresh was requested for this PR.
  • After fixes, please identify any addressed stale review threads and stale blocking reviews.

Run: https://github.com/github/gh-aw/actions/runs/32133383697

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 25.8 AIC · ⌖ 7.82 AIC · ⊞ 6.4K ·
Comment /souschef to run again

Copilot AI commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

@copilot make the test parallelizer agentic workflow use this feature .

Done in 9f2ba63. .github/workflows/daily-go-test-parallelizer.md now sets pre-create: true on its create-pull-request safe output (compatible with its existing config: same-repo, max: 1, no branch-prefix/allowed-branches/allowed-base-branches), and the lock file is recompiled — activation gets checks/contents/pull-requests: write plus the pre-create step, and the agent/safe-outputs jobs check out the allocated branch.

That workflow runs every 2h and noops most runs, which would have left an empty draft PR per run, so I also made the conclusion step discard an unused allocation: when the pre-created PR is still open on its branch with changed_files === 0, it is closed and the branch deleted (best-effort, warning on failure). Docs updated and tests added.

Validation: make agent-report-progress passes (fmt, lint, typecheck, impacted Go + JS tests, full recompile with lock files in sync).

Copilot AI and others added 2 commits August 18, 2026 12:10
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

@copilot the pre-created PR is ALWAYS in draft mode, regardless of the draft field value. If draft:false, the PR is undrafted in the safe output phase.

Add tests.

Confirmed — that is the implemented behavior, and tests now lock it in (fd51ee0, 9013e9d):

  • pre_create_pull_request.cjs always calls pulls.create with draft: true and never reads any draft configuration; added a test asserting draft: true even when the safe-outputs config sets draft: false, plus a Go test asserting the activation step emits no draft configuration.
  • create_or_update_pull_request.cjs aligns draft state in the safe output phase via GraphQL (markPullRequestReadyForReview / convertPullRequestToDraft, since REST pulls.update ignores draft). Tests cover: undraft when draft: false, back-to-draft when draft: true and the PR is not draft, no mutation when the state already matches (draft: true and undefined), and a warning-not-failure when the mutation errors.
  • Docs updated to state the allocated PR is always opened as a draft regardless of draft, and is only marked ready for review in the safe output phase.

The test parallelizer workflow already uses pre-create: true (.github/workflows/daily-go-test-parallelizer.md, recompiled).

Validation: make agent-report-progress — Go and JS pre-create suites pass, make fmt clean. One pre-existing sandbox failure unrelated to this PR: the typecheck step fails on eslint-factory/tsconfig.json (moduleResolution=node10 removed in TypeScript 7); that file is untouched here and fails on main too.

@github-actions

Copy link
Copy Markdown
Contributor

PR Triage

Category: feature | Risk: high | Priority: medium (score 55)

  • Impact 32/50 — adds pre-created PR safe-output mode, notable new capability
  • Urgency 10/30 — CHANGES_REQUESTED (2x), CI blocked
  • Quality 13/20 — large diff (28 files), unresolved review feedback

Recommended action: defer — resolve CHANGES_REQUESTED before advancing

Generated by 🔧 PR Triage Agent · auto · 53.1 AIC · ⌖ 2.52 AIC · ⊞ 8.3K ·

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot mark this field as experimental

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

@copilot mark this field as experimental

Done in f1eeacapre-create is now marked experimental following the existing convention used by approve-workflow-run, lsp, and friends:

  • Schema (pkg/parser/schemas/main_workflow_schema.json): description prefixed with ⚠️ Experimental. and notes that using the field emits a compile-time warning.
  • Compile-time warning (pkg/workflow/compiler_validators.go): added to emitExperimentalFeatureWarnings, so gh aw compile prints Using experimental feature: create-pull-request pre-create and increments the warning count (also aggregated in batch mode via GetExperimentalFeatureUsage).
  • Docs: :::caution[Experimental] block on the "Pre-created pull requests" section.
  • Go struct comment: PreCreate documented as experimental.
  • Test: precreate_pull_request_experimental_warning_test.go, mirroring the other *_experimental_warning_test.go files (warning emitted with pre-create: true, not emitted for plain create-pull-request).

Validation: make recompile — 286/286 workflows compile with no lock file drift (the parallelizer now surfaces the new warning); make fmt clean; Go unit + integration tests for pre-create and the experimental warnings pass.

@pelikhan
pelikhan merged commit 846c520 into main Aug 18, 2026
@pelikhan
pelikhan deleted the copilot/add-support-safe-output-pr branch August 18, 2026 15:23
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.87.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants