Fix safe-output updates for fork pull request branches - #56341
Conversation
There was a problem hiding this comment.
Pull request overview
Forwards recorded PR-head baseline metadata through MCP container boundaries so safe outputs can update fork PR branches.
Changes:
- Passes baseline variables into the MCP gateway and nested safeoutputs containers.
- Adds JSON, TOML, and workflow-compilation regression checks.
- Adds a patch changeset.
Show a summary per file
| File | Description |
|---|---|
.changeset/patch-forward-pr-head-baseline-to-safeoutputs.md |
Documents the patch behavior. |
pkg/workflow/mcp_setup_gateway.go |
Forwards metadata into the gateway container. |
pkg/workflow/mcp_renderer_builtin.go |
Adds metadata to JSON and TOML safeoutputs configurations. |
pkg/workflow/mcp_setup_generator_test.go |
Tests compiled workflow forwarding. |
pkg/workflow/mcp_renderer_test.go |
Tests JSON and TOML rendering. |
pkg/workflow/mcp_gateway_mount_policy_test.go |
Tests gateway environment flags. |
Review details
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 6/6 changed files
- Comments generated: 2
- Review effort level: Balanced
…propagation # Conflicts: # pkg/workflow/security_architecture_rs05a_formal_test.go
|
Live validation against fsprojects/Paket PR #4321:
Targeted validation after merging current
All passed. Merge commit: |
|
Follow-up on contributor-fork error handling ( The early MCP rejection now occurs only when the apply-time handler is guaranteed to reject the same operation under the existing destination policy: the trusted PR head repository differs from the base repository and does not match configured A Paired tests cover both layers with a PAT present:
Focused validation passed: checkout head-repo export, safe-output baseline/fork guard, all 5 apply-time fork cases, renderer/gateway tests, compile-level integration test, WASM goldens, formatting, and |
|
@copilot Open review threads with follow-up already posted:
Failed checks to address:
I also attempted a branch refresh where allowed. After addressing the above, please run the
|
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Both review threads were already resolved (dsyme's replies in 1ce1b30 / 093aeb9 addressed the TOML expectation and WASM golden regeneration), so no further action was needed there. The CI failures traced to a single root cause: Validated: targeted renderer/gateway tests, full |
Summary
push_to_pull_request_branchcan generate incremental patches from the fetched PR headhead-repodoes not authorize the fork, including when a PAT may have write accessadd_commentorreport_incompleteRoot cause
The checkout step recorded the fetched PR head before agent commits, and patch generation knew how to consume that baseline. However, the generated MCP gateway command and nested safeoutputs server configuration did not forward the recorded metadata. Inside the safeoutputs container, incremental patch generation therefore fell back to
origin/<branch>, which does not exist for a contributor-fork branch.This change propagates the trusted baseline across both container boundaries. It also records and propagates the actual PR head repository so MCP-time validation can distinguish an authorized fork destination from the base repository.
Fork authorization
Credentials and destination authorization remain separate. A
github-tokenor PAT supplies credentials, but it does not authorize an arbitrary contributor fork. The workflow must explicitly configuresafe-outputs.push-to-pull-request-branch.head-repofor that fork.When the triggering PR belongs to an unconfigured contributor fork, the safe-output call now fails before persisting a patch or bundle. The existing privileged apply-time validation remains in place as defense in depth.
Validation
Targeted validation completed:
Live validation in
fsprojects/Paketconfirmed:Fixes #56115