Skip to content

[refactor] Unify remote dependency fetch policies - #79431

Merged
pelikhan merged 6 commits into
mainfrom
copilot/refactor-unify-strict-mode-policy
Nov 20, 2026
Merged

pelikhan merged 6 commits into
mainfrom
copilot/refactor-unify-strict-mode-policy

Conversation

@gh-aw-bot

@gh-aw-bot gh-aw-bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Strict mode currently affects only some remote dependency fetchers, while other failures always stop processing. This refactor centralizes all six steps and preserves their existing failure and warning behavior.

  • Ordered policy table: Each fetch step declares its label, runner, fatality policy, and warning behavior.
  • Shared error handling: The runner preserves strict-only failures for includes, frontmatter imports, and runtime imports; dispatch, call-workflow, and resource failures remain fatal. Existing warning order and verbosity are retained.
  • Regression coverage: Table-driven cases cover strict and non-strict modes, warning behavior, wrapped errors, and whether later steps run.
fatal := step.fatalAlways || (strict && step.fatalWhenStrict)

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@gh-aw-bot gh-aw-bot changed the title [WIP] Refactor to unify strict-mode policy across remote dependency fetchers [refactor] Unify remote dependency fetch policies Nov 20, 2026
@pelikhan
pelikhan marked this pull request as ready for review November 20, 2026 05:47
Copilot AI adaptive review requested due to automatic review settings November 20, 2026 05:47
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_action

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.

Generated by PR Specification Reviewer for #79431 · copilot · gpt56 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.7K · ◷

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Generated by Ponytail Reviewer for #79431 · codex · routed: gpt61 medium · ~4 AIC · ⌖ ~1 AIC · ⊞ 185 · ◷

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

PR Code Quality Reviewer

Outcome: reported_action

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.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~2 AIC · ⌖ ~2 AIC · ⊞ 1.6K · ◷

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

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 analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 7.2K · ◷

@github-actions

github-actions Bot commented Nov 20, 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 · copilot · routed: haiku55 xhigh · ~7 AIC · ⌖ ~2 AIC · ⊞ 6.6K · ◷

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

What this change does: It runs six remote dependency fetches through a shared policy table. It preserves their existing failure and warning behavior.

Should fix

  1. Remove redundant policy flags. The six steps use only two independent policy choices. Three flags repeat those choices, making each entry longer and allowing inconsistent combinations. Derive those flags from fatalAlways and warnAlways; otherwise, future changes must keep the duplicate settings in sync.

Verdict: Ship after simplifying the policy table.

Lean: -14 lines possible.

Generated by ✂️ Ponytail Reviewer for #79431 · codex · routed: gpt61 medium · ~4 AIC · ⌖ ~1 AIC · ⊞ 185
Comment /ponytail to run again

Comment thread pkg/cli/includes.go Outdated
fatalAlways bool
warnWhenVerbose bool
warnAlways bool
warnBeforeFatal bool

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.

All six steps make fatalWhenStrict the inverse of fatalAlways, warnBeforeFatal equal to fatalAlways, and warnWhenVerbose the inverse of warnAlways; keep only fatalAlways and warnAlways and derive the rest to remove redundant settings and invalid combinations.

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.

Reduced each step to fatalAlways and warnAlways; strict fatality and verbosity behavior are now derived. Commit adb7d977.

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

Reviewed the changed remote dependency policy refactor and its regression coverage. I found no actionable correctness, compatibility, security, or performance issues in the changed lines. Existing fatality and warning behavior appears preserved across strict and non-strict modes.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~2 AIC · ⌖ ~2 AIC · ⊞ 1.6K
Comment /review to run again

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (spec-review-history)
{"id":"ldg-43c4a366-158c-43c8-9487-cbb4df5dd31a","parents":[],"payload":{"id":"ldg-506f88ea-62fc-4de6-b7c1-f45b5e7c1f2c","operation":"append","value":{"finding_count":0,"head_sha":"101a4060ee023968a948aaba535c3a5d4e37f8f8","outcome":"aligned"}},"sha":"sha256:50beaf507dbb745a329799bb9515b07475b4e38caab81fe444949e69e817e93c","timestamp":"2026-11-20T05:54:08.204Z","type":"ledger_append","version":1}
History

@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (>100 new lines) but does not have a linked Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/79431-unify-remote-dependency-fetch-policies.md — review and complete it before merging.

🔒 This PR cannot merge until an ADR is linked in the PR body.

🔍 Evidence
  • No implementation label is present.
  • The PR adds 208 lines in business-logic directories (pkg/cli/includes.go +130, pkg/cli/remote_workflow_test.go +78), above the 100-line default threshold.
  • No ADR is linked in the PR body. The linked issue [refactor] Unify strict-mode policy across remote dependency fetchers in fetchAllRemoteDependenciesWithOptions #79392 is a refactoring proposal and contains no ADR.
  • No existing ADR in docs/adr/ covers this change. ADR-48282 (link unavailable: invalid HTTPS URL) is related because it names fetchAllRemoteDependencies as the ordered integration point.
📋 What to do next
  1. Review the draft ADR committed to your branch. It was generated from the PR diff.

  2. Complete the missing sections: add context the AI could not infer, refine the decision rationale, and list real alternatives you considered. Items marked [TODO: verify] need confirmation, including the deciders and whether any caller relies on the non-strict early return.

  3. Commit the finalized ADR to docs/adr/ on your branch.

  4. Reference the ADR in this PR body by adding a line such as:

    ADR: ADR-79431: Declare Remote Dependency Fetch Policies in One Ordered Table (link unavailable: invalid HTTPS URL)

Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision.

📋 Michael Nygard ADR Format Reference

An ADR must contain these four sections to be considered complete:

  • Context: What is the problem? What forces are at play?
  • Decision: What did you decide? Why?
  • Alternatives Considered: What else could have been done?
  • Consequences: What are the trade-offs (positive and negative)?

All ADRs are stored in docs/adr/ as Markdown files numbered by PR number (for example, 0042-use-postgresql.md for PR #42).

References: §44683407338

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 8.6K · ◷
Comment /review to run again

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (review-history)
{"id":"ldg-dbea418f-66ba-4686-8201-fc4a644777a1","parents":[],"payload":{"id":"ldg-af7c6d0f-d99a-4566-b123-bd4b3f61410c","operation":"append","value":{"finding_count":0,"head_sha":"101a4060ee023968a948aaba535c3a5d4e37f8f8","outcome":"no_findings"}},"sha":"sha256:003124961ae56d56e58e5428663b4a7599b8a4f1bf90f32d4b9f08da95096b36","timestamp":"2026-11-20T05:55:49.227Z","type":"ledger_append","version":1}
History

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.

🟡 Changes recommended

Replacing warning callbacks with counters leaves activation-warning output and strict/verbose error-detail handling untested, allowing output regressions to pass unnoticed.

1 open issue
What changed in this PR

Centralizes remote dependency fetching in the gh-aw CLI using an ordered policy table, preserving the existing behavior requested in #79392.

Changes:

  • Defines explicit failure and warning policies for all six fetch steps.
  • Shares error handling while retaining step order, strict-mode behavior, and error wrapping.
  • Adds table-driven tests covering strict and verbose modes, warning calls, and early termination.
File Description
pkg/​cli/​remote_workflow_test.go Adds regression coverage for fetch policies and execution order.
pkg/​cli/​includes.go Extracts the ordered policy table and shared runner; updates behavior comments.

Review effort: Balanced (adaptive)

Comment thread pkg/cli/remote_workflow_test.go Outdated
Comment on lines +712 to +719
warningCount := 0
for i := range steps {
steps[i].warn = func(error) {
warningCount++
}
}

err := runRemoteDependencySteps(steps, strict, verbose)

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.

Kept the real warning handlers while counting calls and capturing stderr. The test verifies the activation warning, verbose-only error detail, and no strict-mode output. Commit adb7d977.

@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 /codebase-design and /tdd. The refactor preserves behavior, and the new table-driven test passes (24 subtests, go vet and gofmt clean). Three non-blocking suggestions are inline.

📋 Key Themes & Highlights

Key Themes

  • Policy encoding: warnBeforeFatal depends on warnWhenVerbose, and the verbosity source is split between the step hook and the runner.
  • Test gap: warning text and stderr routing are not asserted; only warning counts are.

Positive Highlights

  • ✅ Each step declares its label, fatality, and warning policy in one ordered table.
  • ✅ Original strict/non-strict and verbose behavior is preserved, and the wrapped error format (failed to fetch <label>: %w) is unchanged.
  • ✅ Table-driven coverage checks which later steps run after a failure.

Note: the review used the pr-triage output. Its claim of 288 test cases is incorrect; the table produces 24 subtests.

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~7 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again

Comment thread pkg/cli/includes.go Outdated
fatalAlways bool
warnWhenVerbose bool
warnAlways bool
warnBeforeFatal bool

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.

[/codebase-design] warnBeforeFatal only takes effect when warnWhenVerbose is also set (the runner checks both, line 876), so setting it alone silently does nothing. Every fatalAlways step sets it and no other step does, so it could be derived from fatalAlways. Either way, the five booleans allow invalid combinations and the warning rules are hard to audit.

💡 Possible shape

Keep one explicit fatal policy and one explicit warning policy per step, e.g. fatal: fatalNever | fatalStrict | fatalAlways and warn: warnNever | warnVerbose | warnAlways. A short comment on the struct stating the rules ("always-fatal steps warn before returning in verbose mode; strict-fatal steps do not") would make the table easy to audit.

@copilot please address this.

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.

Reduced the policy fields to fatalAlways and warnAlways; strict failure and warning behavior are derived, removing invalid combinations. Commit adb7d977.

Comment thread pkg/cli/includes.go
warnAlways: true,
warn: func(err error) {
fmt.Fprintln(os.Stderr, console.FormatWarningMessage("Failed to fetch runtime-import dependencies; activation may fail"))
if verbose {

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.

[/codebase-design] The runtime-import warning reads verbose from the remoteDependencySteps argument, while the runner reads the same flag from its own argument (line 920). Nothing passes different values today, but the contract is implicit: two sources of truth for one flag.

💡 Suggestion

Pass verbosity into the hook, e.g. warn func(err error, verbose bool), so the runner is the only place verbosity is read. The runtime-import closure then takes verbose as an argument instead of capturing it.

@copilot please address this.

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.

Warning callbacks now receive verbosity from the runner, so the runtime-import warning no longer captures a second verbosity value. Commit adb7d977.

Comment thread pkg/cli/remote_workflow_test.go Outdated
steps := remoteDependencySteps(fetchers, verbose)
warningCount := 0
for i := range steps {
steps[i].warn = func(error) {

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.

[/tdd] The test replaces every warn hook with a counter, so warning text and stderr routing are never asserted. The runtime-import message ("activation may fail") and its verbose-only detail line are untested, as is the remoteDependencyWarning formatting.

💡 Suggested test

Keep the counter for the policy assertions and add a focused case that captures stderr (the os.Pipe pattern used around line 1254) for the runtime-import step. Assert the message in non-verbose mode and the error detail in verbose mode, using substrings only so the test is not brittle.

@copilot please address this.

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 real callbacks are preserved and stderr is captured; assertions cover the activation warning, verbose-only error details, and strict-mode silence. Commit adb7d977.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator Author

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (pkg/cli/includes.go:806): address unresolved feedback - Review comment
  3. Review (pkg/cli/remote_workflow_test.go:719): address unresolved feedback - Review comment
  4. Review (pkg/cli/includes.go:806): address unresolved feedback - Review comment
  5. Review (pkg/cli/includes.go:839): address unresolved feedback - Review comment
  6. Review (pkg/cli/remote_workflow_test.go:714): address unresolved feedback - Review comment

Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering.

Structured data
{
  "completed_task": 0,
  "head": "9b9a60497b5769e479c2adc88c3a94a7415bf457",
  "kind": "requested",
  "schema_version": "1",
  "state": "1d20dc80be93ee07a596f41e0ebe3cdf067a28fa0d5386d2944c16fce9162f51",
  "work": [
    "13c595bd5b5e7d01e6bac6a98d305a475be623e5ab097d3d8c9d296b845b400e",
    "1db9d56fbd2ad9f8aa6741a864e80ce281dcca65782035cc432ad1cd7aa06fe2",
    "2e69dc8f16d66e7dc400c07dc3888fecd72ccf0ff37525dc56c475b544441731",
    "9d26470c93e051581c3c1d01fc22ccf2687ca0b9181656e51409aa1420bf1b7e",
    "cfacefa7dc421417c98662f95db0cc2355d0c6758fc9083c9bc6e58f0e25f46d"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~2 AIC · ⌖ ~2 AIC · ⊞ 7K · ◷
Comment /souschef to run again

gh-aw-bot and others added 2 commits November 20, 2026 06:36
…y-strict-mode-policy

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>

Copilot AI commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:...

Merged latest main as 06f06dab and addressed the listed review feedback in adb7d977. Focused and impacted tests passed; the final gate reported unrelated existing custom-linter findings, and the CodeQL check timed out.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator Author

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Fix failing check Unit tests (H-M) (FAILURE): Check run.

Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering.

Structured data
{
  "completed_task": 0,
  "head": "adb7d9773a3ae04c7e5b7d19e5d7621a96ea5a44",
  "kind": "requested",
  "schema_version": "1",
  "state": "6e10c29f87d39507a788f1dbc62886b3f80a92235a3f5afa9a505dc3a8b82290",
  "work": [
    "0215fa6a7e95d212b943e1dcdbb6a5dd7a082cda1dd71a971263c5c8122eb0a6"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 7K · ◷
Comment /souschef to run again

Co-authored-by: copilot-swe-agent[bot] <[email protected]>

Copilot AI commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:...

make merge-main completed; origin/main was already an ancestor, and all 369 workflows recompiled. Fixed the H-M timing-test failure by widening the shared-CI noise margin from 5 ms to 10 ms; the focused test passed five consecutive runs. Commit: 64938d7. The final gate's only failure was existing custom-linter findings in pkg/cli/includes.go.

@pelikhan
pelikhan merged commit 812a691 into main Nov 20, 2026
59 checks passed
@pelikhan
pelikhan deleted the copilot/refactor-unify-strict-mode-policy branch November 20, 2026 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[refactor] Unify strict-mode policy across remote dependency fetchers in fetchAllRemoteDependenciesWithOptions

4 participants