Repository navigation
Extract shared work-queue worker target resolution - #75807
Conversation
Co-authored-by: gh-aw-bot <[email protected]>
|
❌ Design Decision Gate 🏗️ failed to deliver outputs during design decision gate check.
|
|
✅ Ponytail Reviewer completed successfully!
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ PR Specification Reviewer completed successfully! PR Specification 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.
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
✅ 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.
|
There was a problem hiding this comment.
Reviewed the changed work-queue target resolution and tests. I found no actionable correctness, security, performance, or maintainability issues on the changed lines. Static review only; tests were not run.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~2 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again
|
Warning The 🏗️ Design Decision Gate — ADR RequiredThis PR adds 117 lines under 📄 Draft ADR committed: The draft records the decision to move work-queue worker target lookup and worker detection into
📋 What to do next
Once an ADR is linked in the PR body, this gate will re-run and check that the implementation matches the decision. ❓ Why ADRs Matter
ADRs create a searchable, permanent record of why the codebase looks the way it does. Future contributors (and your future self) will thank you. 📋 Michael Nygard ADR Format ReferenceAn ADR must contain these four sections to be considered complete:
All ADRs are stored in
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the shared worker-target resolution refactor.
No open issues 🎉
What changed in this PR
This PR centralizes worker-target resolution in the gh-aw workflow compiler, reducing duplication across three work-queue validators while preserving caller-specific behavior.
Changes:
- Adds a shared helper for workflow lookup, compiler-managed source validation, and worker detection.
- Preserves error messages, non-worker skip/reject policies, and the profile self-reference shortcut.
- Adds tests for target resolution and caller-specific validation behavior.
| File | Description |
|---|---|
pkg/workflow/work_queue_policy.go |
Extracts shared resolution logic and updates all three callers. |
pkg/workflow/work_queue_policy_test.go |
Tests resolution outcomes and preserved caller policies and error messages. |
Review effort: Balanced (auto)
There was a problem hiding this comment.
What this change does: It centralizes workflow lookup and worker declaration checks for approved dispatch targets, default profiles, and configured profiles. It keeps the caller-specific messages and policies through a new lookup-error marker.
Should fix:
-
The shared resolver adds an error protocol instead of removing one (
pkg/workflow/work_queue_policy.go:L572-L587)- What this is: The marker type and classifier exist only to tell the three callers whether resolution failed in
findWorkflowFileor inmdHasWorkQueueWorker. - Problem: For an invalid target such as
../outside, the helper wraps the lookup error and each caller immediately detects that wrapper just to add its own prefix; the extraction adds more error plumbing than it removes. - Fix: Return a
sourceFound/compiler-managed flag alongside the raw error, so callers can distinguish lookup failure from source inspection failure without the custom type,Unwrap, anderrors.As. - If we skip it: Future target-validation changes must maintain three copies of this classification path.
- What this is: The marker type and classifier exist only to tell the three callers whether resolution failed in
Not checked: I did not run tests; I reviewed the pre-fetched diff and the connected resolver and callers.
Verdict: fix 1 first.
Lean: -16 lines possible.
Generated by ✂️ Ponytail Reviewer for #75807 · codex · routed: gpt56 max · ~4 AIC · ⌖ ~1 AIC · ⊞ 118
Comment /ponytail to run again
|
|
||
| var errNotCompilerManagedWorkQueueTarget = errors.New("workflow source is not compiler-managed") | ||
|
|
||
| type workQueueTargetLookupError struct { |
There was a problem hiding this comment.
What this is: This marker type and its classifier exist only to tell the three callers whether resolution failed in findWorkflowFile or in mdHasWorkQueueWorker. Problem: For an invalid target such as ../outside, the helper wraps the lookup error and each caller immediately detects that wrapper just to add its own prefix; the extraction adds more error plumbing than it removes. Fix: Return a sourceFound/compiler-managed flag alongside the raw error, so callers can distinguish lookup failure from source inspection failure without workQueueTargetLookupError, Unwrap, and errors.As. If we skip it: Future target-validation changes must maintain three copies of this classification path.
There was a problem hiding this comment.
Simplified the helper to resolve only a compiler-managed source path and return lookup errors raw; callers now add their own lookup prefixes. Removed the marker wrapper and classifier in 6623326.
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /codebase-design and /tdd to this refactor. Behavior looks preserved and the targeted work-queue tests pass. Two follow-ups: simplify the helper error channel, and cover the caller-specific lookup wrapping in tests.
📋 Key Themes & Highlights
Key Themes
- Error channel complexity: resolveWorkQueueWorkerTarget returns three kinds of error (sentinel, wrapper, raw parser error). The wrapper type and two predicates exist only to keep caller prefixes.
- Test gap: the lookup prefixes in the approved-worker and worker-profile callers are not asserted by any test. The profile-target wrapper is unreachable through filepath.Base.
Positive Highlights
- ✅ The duplicated lookup and worker-detection code now lives in one place.
- ✅ Caller-specific messages and the profile self-reference shortcut are preserved, and TestWorkQueueTargetCallersPreserveWorkerPolicies pins them.
- ✅ The non-worker and not-compiler-managed paths have direct test coverage.
Validation
- go test ./pkg/workflow with the -run filter for TestResolveWorkQueueWorkerTarget, TestWorkQueueTargetCallersPreserveWorkerPolicies, and WorkQueue passes.
- A temporary probe confirmed the approved-worker lookup-error wrapping. The probe file was removed afterwards.
@copilot please address the review comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~5 AIC · ⌖ ~2 AIC · ⊞ 5.4K
Comment /matt to run again
| return errors.As(err, &lookupErr) | ||
| } | ||
|
|
||
| func resolveWorkQueueWorkerTarget(name, markdownPath string) (bool, error) { |
There was a problem hiding this comment.
[/codebase-design] The helper removes the lookup duplication, but its error channel now carries three categories: the not-compiler-managed sentinel, the workQueueTargetLookupError wrapper, and raw parser errors. That needs a wrapper type plus two predicates, and each caller still repeats the same three-way branch.
💡 Simpler split
Return only the source path from the lookup and keep the worker check in callers:
func resolveWorkQueueWorkerSource(name, markdownPath string) (string, error) {
target, err := findWorkflowFile(name, markdownPath)
if err != nil {
return "", err
}
if !target.mdExists {
return "", errNotCompilerManagedWorkQueueTarget
}
return target.mdPath, nil
}Callers check the sentinel first, wrap any other lookup error with their prefix, then call mdHasWorkQueueWorker and return its error unchanged. workQueueTargetLookupError, isWorkQueueTargetLookupError, and the wrapper's Error/Unwrap methods can then be removed.
@copilot please address this.
There was a problem hiding this comment.
Removed the wrapper type and classifier. The helper now returns the compiler-managed source path or a raw lookup/sentinel error; each caller wraps lookup failures and runs the worker declaration check separately. Fixed in 6623326.
| require.False(t, worker) | ||
| } | ||
|
|
||
| func TestWorkQueueTargetCallersPreserveWorkerPolicies(t *testing.T) { |
There was a problem hiding this comment.
[/tdd] The PR says lookup errors keep their caller-specific wrapping, but no test asserts the %w prefixes for the default-profile or profile-target callers. Only the approved-worker path was checked, and only manually.
💡 Suggested assertion
Add a case with "../outside" in DispatchWorkflow.Workflows and assert on populateDefaultWorkQueueProfiles, which should produce the prefix work-queue: worker profile "../outside": invalid workflow name. Do the same for validateApprovedWorkQueueTargets with the approved worker prefix.
The profile-target wrapper is hard to reach: validateWorkQueueProfileTargets derives the name with filepath.Base, which strips path separators before lookup. Either pick a different trigger for it or leave that wrapper uncovered and say so in the PR.
@copilot please address this.
There was a problem hiding this comment.
Added exact lookup-error assertions for populateDefaultWorkQueueProfiles and validateApprovedWorkQueueTargets. I left the profile-target lookup prefix uncovered: that caller applies filepath.Base before lookup, so traversal input is normalized and cannot exercise the same invalid-name lookup path. Added in 6623326.
|
Copilot assignment requested for the following outstanding work:
Once you start work, post this work summary as a PR comment without the leading Copilot mention, including the Sous-chef head, work, and state lines below, to record that the assignment is running. Apply the necessary fixes on this PR's existing branch, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved; stop when only human review or CI remains. Do not merge or trigger CI. Sous-chef requested-head: d727ba1
|
Sous-chef requested-head: d727ba1 |
…act-worker-target-resolution Co-authored-by: gh-aw-bot <[email protected]>
Co-authored-by: gh-aw-bot <[email protected]>
Triage
|
|
Copilot assignment requested for the following outstanding work:
Once you start work, post this work summary as a PR comment without the leading Copilot mention, including the Sous-chef head, work, and state lines below, to record that the assignment is running. Apply the necessary fixes on this PR's existing branch, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved; stop when only human review or CI remains. Do not merge or trigger CI. Sous-chef requested-head: 6623326
|
I’m starting the requested branch update and impacted Go test investigation. Sous-chef requested-head: 6623326 |
…act-worker-target-resolution Co-authored-by: gh-aw-bot <[email protected]>
Co-authored-by: gh-aw-bot <[email protected]>
|
@copilot resolve the merge conflicts on this branch. |
I’m updating the branch with the latest Sous-chef requested-head: 6623326
Merged the latest |
…act-worker-target-resolution # Conflicts: # pkg/workflow/mcp_scripts_shared_queries_test.go Co-authored-by: pelikhan <[email protected]>
|
PR triage: category=refactor | risk=medium | total=47 | breakdown=impact 26, urgency 10, quality 11 | action=batch_review | batch=pr-batch:quality-copilot
|
|
🎉 This pull request is included in a new release. Release: |
Three work-queue validators repeated workflow lookup, compiler-managed source checks, and worker declaration checks, while applying different policies and error messages.
resolveWorkQueueWorkerTargetto centralize lookup and worker detection.