Repository navigation
Add opt-in agent-success gate for safe-output publication - #77559
Conversation
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
|
✅ PR Code Quality Reviewer completed the code quality review. PR Code Quality ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ PR Specification Reviewer completed successfully!
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: 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.
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: 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.
|
🏗️ Design Decision Gate: ADR RequiredThis PR adds 199 lines in business-logic directories ( Inferred decision: add an opt-in Next step: review the draft, fill in the
|
There was a problem hiding this comment.
Reviewed head 57d92237d49b9c55ef4e27a82371a20406c79509 against docs/src/content/docs/specs/safe-outputs-specification.md v1.29.25 and the changed implementation/tests.
Blocking finding: the new require-agent-success behavior is not enforced for the upload_assets publication job. pkg/workflow/publish_assets.go omits requireSafeOutputsAgentSuccess, so assets may publish after an agent failure despite the documented contract. An inline comment is attached to the changed documentation line.
The formal safe-outputs specification has no current section for this new option. The intentional behavior is eligible for synchronization (default false, import precedence, detection/handlers/custom jobs/assets gated, conclusion/failure reporting unchanged), but I did not apply a spec update while the implementation is incomplete. No tests were run per static-review constraints.
Generated by PR Specification Reviewer for #77559 · copilot · gpt50 · ~6 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review-specs to run again
|
|
||
| ### Require Agent Success (`require-agent-success`) | ||
|
|
||
| `safe-outputs.require-agent-success` is a boolean that defaults to `false`. When `true`, detection, built-in safe-output handlers, custom safe jobs, and asset publication require `needs.agent.result == 'success'`. Downstream uploads and workflow calls are also skipped when safe-output processing is skipped. |
There was a problem hiding this comment.
The documented gate is not applied to asset publication. pkg/workflow/publish_assets.go builds the upload_assets job condition with BuildSafeOutputType("upload_asset") but never calls requireSafeOutputsAgentSuccess, so require-agent-success: true still allows asset publication after the agent fails. Please apply the same gate before the conditional-detection wrapping and add coverage for the upload-assets job. This is required by the behavior described here and by the PR’s stated publication contract.
There was a problem hiding this comment.
Asset publication already receives the gate through buildSafeOutputJob. The compiled-condition coverage includes upload_assets across detection modes; verified in 82d2954.
There was a problem hiding this comment.
Found one blocking correctness issue: the new success gate is not applied to push_repo_memory and potentially other downstream writers, allowing failed-agent output to be published despite require-agent-success: true. Please gate all agent-derived publication jobs consistently and add coverage.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~6 AIC · ⌖ ~1 AIC · ⊞ 1.5K
Comment /review to run again
| BuildStringLiteral("skipped"), | ||
| ), | ||
| ) | ||
| agentNotSkipped = requireSafeOutputsAgentSuccess(agentNotSkipped, data.SafeOutputs) |
There was a problem hiding this comment.
This gate does not cover all agent-derived publication jobs. In particular, push_repo_memory is still built by buildPushRepoMemoryJobCondition with only the existing agent.result != skipped check, so with require-agent-success: true a failed agent can still push staged repo-memory changes. That contradicts the documented publication gate and leaves the main safety issue exploitable on workflows using repo memory. Apply the same helper to every downstream writer (at least push_repo_memory, and audit the other memory/coverage publishers) and add a compiled-condition test.
There was a problem hiding this comment.
Fixed in 82d2954. Repo-memory now requires agent success when enabled; cache and drive memory already require it, and ledger and coverage depend on safe-output processing.
Comment MemoryPeek at saved memory (spec-review-history)History |
Comment MemoryPeek at saved memory (review-history)History |
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs, /tdd, and /grill-with-docs. Requesting changes because the new gate does not cover every publication path.
📋 Key Themes and Highlights
Key Themes
- Publication bypass (blocking):
push_repo_memorystill runs after an agent failure. Its condition (repo_memory.go~L1029-1043) never consultsrequire-agent-success, andbuildDetectionPassedCondition()treats a skipped detection as a pass. Confirmed by compiling a workflow withrequire-agent-success: true,threat-detection: true, andrepo-memory. - Test gap:
TestSafeOutputsRequireAgentSuccesscovers the main job and detection gating, but nothing asserts the gate on the repo memory push job. - Docs scope: the "Require Agent Success" section says the gate applies to all publication, which is not true until the push job is gated.
Positive Highlights
- ✅ The gate is applied consistently through a single
requireSafeOutputsAgentSuccesshelper at the four safe-output call sites (main job, detection, custom safe jobs, and the shared job builder used by upload_assets). - ✅ Default
falsekeeps existing behavior, and the import merge rule (explicit main value wins) is covered by tests. - ✅ Failure reporting is unaffected:
handle_agent_failureruns withalways()and reads engine error outputs from the agent job, not from detection. - ✅ The
call_workflowjob gates onneeds.safe_outputs.outputs.call_workflow_name, so it is skipped when safe_outputs is skipped.
🔧 Checked and Verified
go test ./pkg/parser/ -run 'RequireAgentSuccess|MainWorkflowSchema'passes.go test ./pkg/workflow/ -run RequireAgentSuccesspasses.gofmt -l pkg/parser pkg/workflowis clean.- Uncertainty: the review did not run the full compile golden suite, so any lock-file diffs outside these tests were not checked.
@copilot please address the review comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~8 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again
| ) | ||
| } | ||
|
|
||
| func requireSafeOutputsAgentSuccess(condition ConditionNode, safeOutputs *SafeOutputsConfig) ConditionNode { |
There was a problem hiding this comment.
[/diagnosing-bugs] The root cause is only partly fixed: push_repo_memory still runs after an agent failure. buildPushRepoMemoryJobCondition (pkg/workflow/repo_memory.go L1029-1043) never reads data.SafeOutputs, and buildDetectionPassedCondition() accepts a skipped detection. This gate skips detection on agent failure, so the repo memory push proceeds. Confirmed in the compiled YAML: the push_repo_memory if: checks (needs.detection.result == 'success' || needs.detection.result == 'skipped') and needs.agent.result != 'skipped', with no agent-success term.
💡 Suggested fix
Pass data.SafeOutputs into buildPushRepoMemoryJobCondition and wrap its condition with requireSafeOutputsAgentSuccess when threatDetectionEnabled is true. Repo memory is a publication path, and update_cache_memory already requires agent success (cache_memory.go ~L564), so this matches existing behavior.
@copilot please address this.
There was a problem hiding this comment.
Fixed in 82d2954, including when threat detection is disabled or conditional.
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| func TestSafeOutputsRequireAgentSuccess(t *testing.T) { |
There was a problem hiding this comment.
[/tdd] This table covers the main job and detection gating, but no assertion checks the gate on push_repo_memory. Add a case with repo-memory enabled and require-agent-success: true, then assert that the push job if: contains needs.agent.result == 'success'. That test would have caught the gap above.
@copilot please address this.
There was a problem hiding this comment.
Added compiled-condition coverage for repo-memory, agent outcomes, and detection outcomes in 82d2954.
| add-comment: | ||
| ``` | ||
|
|
||
| A failing agent step, including a deterministic `post-steps` check, blocks publication without needing to delete staged output files. The check must fail the agent job; a step with `continue-on-error: true` does not block publication. This setting does not provide a new gate hook or change the restrictions on accessing safe-output files from `post-steps`. |
There was a problem hiding this comment.
[/grill-with-docs] This statement is not accurate yet. A failing agent blocks publication, but the repo memory push still runs until the gap above is closed. Once that is fixed, the wording holds for the gated outputs.
@copilot please address this.
There was a problem hiding this comment.
Repo-memory publication is now gated and explicitly documented in 82d2954.
There was a problem hiding this comment.
🟡 Changes recommended
When agent success is required, a failed agent can skip threat detection while staged repo-memory is still pushed, bypassing the existing threat check.
1 open issue
What changed in this PR
Adds an opt-in agent-success requirement to gh-aw’s safe-output pipeline so a failed deterministic check can block staged output publication while preserving existing behavior by default.
Changes:
- Adds
safe-outputs.require-agent-success, including schema validation and import precedence. - Applies the requirement to detection, built-in handlers, custom safe jobs, and asset publication.
- Documents the option and adds compilation, import, and schema coverage.
| File | Description |
|---|---|
pkg/workflow/threat_detection_job.go |
Applies the success requirement to detection. |
pkg/workflow/safe_outputs_jobs.go |
Gates generated safe-output jobs. |
pkg/workflow/safe_outputs_import_test.go |
Tests imported values and main-workflow precedence. |
pkg/workflow/safe_outputs_config_types.go |
Adds the configuration field. |
pkg/workflow/safe_outputs_config_global.go |
Parses the boolean option. |
pkg/workflow/safe_jobs.go |
Gates custom safe jobs. |
pkg/workflow/imports.go |
Merges imported requirements with explicit overrides. |
pkg/workflow/expression_builder.go |
Adds a shared agent-success condition helper. |
pkg/workflow/compiler_safe_outputs_job.go |
Gates consolidated safe-output processing. |
pkg/workflow/compiler_safe_outputs_job_test.go |
Tests publication conditions across job outcomes. |
pkg/parser/schemas/main_workflow_schema.json |
Defines the option and its default. |
pkg/parser/schema_safe_outputs_target_test.go |
Tests accepted values and metadata classification. |
pkg/parser/schema_compiler.go |
Classifies the option as configuration metadata. |
docs/src/content/docs/reference/safe-outputs.md |
Explains behavior, limitations, and import precedence. |
Review effort: Max (dynamic)
| BuildStringLiteral("skipped"), | ||
| ) | ||
| jobConditionNode := BuildAnd(alwaysFunc, agentNotSkipped) | ||
| jobConditionNode = requireSafeOutputsAgentSuccess(jobConditionNode, data.SafeOutputs) |
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering. Structured data{
"completed_task": 0,
"head": "c66587c2fae53aee57e9930723b380dfbb58b83a",
"kind": "requested",
"schema_version": "1",
"state": "acb47bb1758b2fa6be58a91e6a08e99adc554e323a2116eed9817c9247dc409b",
"work": [
"02cf70ea0dee2776c753ccd073bc795829c27c6967dacf2bfba181d1f227a438",
"12b0e7ba6b6dde22286c7eb05b3f47889259c57dac6aaa5d08781177e78754eb",
"19a0b0b4e19dc8c4eaa8c96ed25ca7230c0c3c4328bfb0a4e75164963ff025cb",
"70691bf2484c21b8066e43fa87342721eca0380ef30afe2b787793dc9c3e6992",
"d011f4c72f4f3e031f700f44ede364d2d8476cab2ba0f76ea6e8f647838efd65"
],
"workflow": "pr-sous-chef"
}
|
…uts-block-publication Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
…77643) #77559 and #77560 merged with a semantic conflict: the parameter topRawSafeOutputs was renamed to explicitSafeOutputs, leaving an undefined reference that broke every Go build. Keep import values OR-combined, with only the main workflow able to override them. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
🎉 This pull request is included in a new release. Release: |

A failed agent job can still publish staged safe outputs, so failing a deterministic check does not block publication.
safe-outputs.require-agent-success: trueto require agent success before detection, built-in handlers, custom safe jobs, and asset publication run.false, preserving publication after agent failure. Conclusion and failure-reporting jobs remain unchanged.trueenables the gate.Checks must fail the agent job;
continue-on-error: truedoes not block publication.