Preserve resolvable safe-output targets - #64176
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. No ADR enforcement needed: PR does not have the implementation label and has ≤100 new lines of code in business logic directories.
|
|
✅ Ponytail Reviewer completed successfully! Lean already. Ship.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The dependency propagation and selective sanitization correctly address the reported regression with focused coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Preserves resolvable safe-output targets by making sanitization aware of the agent job’s direct dependencies.
Changes:
- Records agent job dependencies before safe-output config generation.
- Sanitizes only unresolvable
needs.<job>expressions. - Adds regression coverage for preserved and sanitized references.
| File | Description |
|---|---|
pkg/workflow/workflow_data.go |
Stores resolved agent dependencies. |
pkg/workflow/safe_outputs_config_generation.go |
Filters sanitization to unresolvable jobs. |
pkg/workflow/safe_outputs_config_generation_test.go |
Tests mixed resolvable and unresolvable references. |
pkg/workflow/compiler_main_job.go |
Resolves dependencies before generating agent steps. |
pkg/workflow/compiler_main_job_helpers.go |
Publishes resolved dependencies to workflow data. |
pkg/workflow/compiler_jobs_engine_env_test.go |
Verifies dependencies remain available during config generation. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Comment MemoryNote This comment is managed by comment memory.It stores persistent context for this thread in the code block at the top of this comment.
|
There was a problem hiding this comment.
Verdict
No blocking issues found in the changed lines; the ordering fix now makes the agents direct dependencies available before safe-outputs config generation, which is the behavior this regression needed.
Reviewed themes
- Verified the new
AgentJobNeedsplumbing is populated beforegenerateMCPSetup()consumes safe-outputs config. - Checked the sanitization change only preserves
needs.<job>expressions for jobs the agent actually depends on and still neutralizes unrelated safe-output dependencies. - Reviewed the added regression tests for both the preserved target and the still-sanitized unrelated dependency path.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 33.9 AIC · ⌖ 6.95 AIC · ⊞ 20.2K
Comment /review to run again
There was a problem hiding this comment.
Impeccable Skills Review
This is a Go compiler internals fix (dependency-aware sanitization of safe-output needs expressions), not a UI/frontend change, so Impeccable's UI-focused modes (audit, critique, harden, distill, extract, clarify) don't apply. I performed a standard correctness/security review instead.
Verification performed:
go build ./...— passes- Targeted tests (
TestGenerateSafeOutputsConfig*,TestBuildMainJobEngineEnvNeedsExpression,TestSanitizeAgentSafeOutputsConfig*) — all pass - Full
pkg/workflowsuite — 2 unrelated pre-existing failures (TestCloudHypervisorSetupBundleScriptExecutesAgainstFixtures,TestBuildDynamicEnclaveExpiryScriptResolvesMinOfConfiguredAndJobExpiry), confirmed present on the base commit before this PR too (time-sensitive/flaky, untouched files)
Findings:
data.AgentJobNeedsis populated inbuildMainJobDependenciesbeforegenerateSafeOutputsConfigconsumes it (via the reorder inbuildMainJob), so the resolvable-target check has correct data at generation time.- Reordering
buildMainJobDependencies/warnBuiltinJobEnvReferencesearlier inbuildMainJobis safe — neitherjobConditionnor step generation depend ondepends/engineEnvContent. - Direct unit-test callers of
generateSafeOutputsConfigthat don't setAgentJobNeedssafely default to nil → full sanitization (equivalent to prior behavior), so no regression for those tests. - New regression test (
TestGenerateSafeOutputsConfigPreservesResolvableNeedsExpressions) correctly covers both the fixed case (needs.setupresolvable) and the still-sanitized case (needs.approval_allowlistunresolvable).
No blocking or actionable issues found.
🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · copilot · sonnet50 · 69.3 AIC · ⌖ 13.2 AIC · ⊞ 8.1K
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /codebase-design and /tdd to review this bug fix. This is a small, well-scoped, correctly-tested change — no blocking issues found.
📋 Key Themes & Highlights
Positive Highlights
- ✅ Root cause fix, not symptom patching: the previous code sanitized all jobs in
safe-outputs.needsregardless of whether the agent job actually depended on them. The fix correctly threads through the agent job's real dependency list (AgentJobNeeds) so only genuinely unresolvableneeds.<job>references are neutralized. - ✅ Good regression coverage:
TestGenerateSafeOutputsConfigPreservesResolvableNeedsExpressionswas extended to cover both a resolvable (setup, inAgentJobNeeds) and an unresolvable (approval_allowlist, not inAgentJobNeeds) job in the same test, verifying the fix doesn't regress the original neutralization behavior.TestBuildMainJobEngineEnvNeedsExpressionalso assertsAgentJobNeedsis populated as a side effect. - ✅ Reasoning documented in comments: the updated comment in
safe_outputs_config_generation.goclearly explains why only jobs not inAgentJobNeedsare neutralized. - ✅ Verified other callers of
generateSafeOutputsConfig(evals, threat-detection) passSafeOutputs: nil, so the new logic path is never reached there — no unintended side effects.
Minor Observations (non-blocking)
- The new
WorkflowData.AgentJobNeedsfield is populated as a mutation side effect insidebuildMainJobDependencies, consumed later (indirectly, viagenerateMainJobSteps→generateMCPSetup→generateSafeOutputsConfig) in the samebuildMainJobcall. This is consistent with existing patterns in the file (e.g., other derived fields set during job construction), and call-order was verified to be correct, but it does add an implicit ordering dependency betweenbuildMainJobDependenciesand the later config-generation step that isn't obvious from the type signature alone. A short doc comment on the field noting "must be set beforegenerateSafeOutputsConfigis called" could help future maintainers avoid an ordering regression. - No changeset file was included in this PR. If this repo's release process expects one for user-facing compiler behavior changes, it may be worth adding.
All targeted tests (TestGenerateSafeOutputsConfig*, TestBuildMainJobDependencies, TestBuildMainJobEngineEnv*) pass, and go build ./... succeeds.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 142.4 AIC · ⌖ 14.5 AIC · ⊞ 10K
Comment /matt to run again
|
@copilot Please review the remaining feedback/checks, refresh the branch if needed, and run the
|
Reviewed the remaining feedback and checks. No unresolved review threads or actionable findings remain; the branch already includes current |
When an
update-pull-request.targetreferenced a job insafe-outputs.needs, the compiler blanked the target in the agent config—even if the agent depended on that job. Onworkflow_dispatch, this incorrectly treated the target astriggeringand rejected the update.needs.<job>expressions for jobs the agent directly depends on; continue neutralizing references the agent cannot resolve.update-pull-requesttarget from asafe-outputs.needsjob output is blanked in the agent config and rejected onworkflow_dispatch#64021