-
Notifications
You must be signed in to change notification settings - Fork 512
Include grader evaluator scripts in workflow packages #56268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
be9d6f4
Initial plan
Copilot fe53643
Include grader evaluators in package resources
Copilot 047b52f
Generalize grader resource discovery
Copilot 0480bdf
Reuse workflow resources for grader scripts
Copilot 1e2d4dc
Deduplicate shared grader evaluator resources
Copilot 37675b8
Include every declared grader evaluator
Copilot d6c2111
docs(adr): draft ADR-56268 for grader evaluator script packaging
github-actions[bot] 5be8a9c
Merge branch 'main' into copilot/fix-gh-aw-add-omit-evaluator-files
pelikhan a1405fb
Relax grader evaluator path handling
Copilot 5a4b99d
Tighten grader evaluator path pattern
Copilot 5116cab
Document grader path dot-prefix rejection
Copilot 8c50c8e
Merge branch 'main' into copilot/fix-gh-aw-add-omit-evaluator-files
github-actions[bot] 0c7f570
Add grader evaluators to package resources
Copilot 8c75bc0
Address package resource review nits
Copilot 453e3ab
Address grader packaging review follow-ups
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
docs/adr/56268-include-grader-evaluator-scripts-in-workflow-packages.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # ADR-56268: Include Grader Evaluator Scripts in Workflow Packages | ||
|
|
||
| **Date**: 2026-08-27 | ||
| **Status**: Draft | ||
| **Deciders**: Unknown | ||
|
|
||
| --- | ||
|
|
||
| ### Context | ||
|
|
||
| When users install a packaged workflow via `gh aw` that declares grader evaluators under `graders.*.run`, the evaluator shell scripts referenced by those keys were not co-installed alongside the workflow files. This caused workflow compilation to fail immediately in clean repositories because the compiler expects those scripts to be present. The root cause was that the package resource resolver (`extractResources`) only scanned the `resources:` frontmatter field and had no awareness of the `graders:` stanza. Evaluator scripts live at repository-root-relative paths (under `.github/graders/`) rather than relative to the workflow file, and the same evaluator may be shared across multiple workflows in one package. | ||
|
|
||
| ### Decision | ||
|
|
||
| We will extend `extractResources` to also parse grader frontmatter via `workflow.ParseGradersFromFrontmatter` and append each non-empty `run` path to the resource list, then deduplicate the combined set before returning it. Within `fetchAndSaveRemoteResources` we will introduce an `isGraderEvaluator` branch that (a) resolves evaluator paths repository-root-relative rather than workflow-directory-relative, (b) installs them relative to the git repository root rather than the workflows target directory, and (c) allows silent no-op re-installs when the existing file content matches the incoming download, blocking only on content divergence. This routes evaluator scripts through the existing resource installation and ownership infrastructure so that `gh aw update` can restore or update them without additional code paths. | ||
|
|
||
| ### Alternatives Considered | ||
|
|
||
| #### Alternative 1: Require explicit listing in `resources:` field | ||
|
|
||
| Workflow authors would be required to manually duplicate the evaluator path in both `graders.*.run` and `resources:`. This was the implicit status-quo before this fix. It is rejected because it creates a footgun: authors writing a `graders:` stanza naturally expect the referenced script to be packaged, and the silent omission produces a compilation failure that is hard to diagnose in clean repositories. | ||
|
|
||
| #### Alternative 2: Make missing evaluators a non-fatal warning at compile time | ||
|
|
||
| The compiler could treat a missing evaluator as a warning rather than an error, allowing workflows to install without the script. This is rejected because evaluators are required for grader execution — silencing the error would allow users to install broken workflows that fail at runtime rather than at installation/compilation time, which is a worse developer experience. | ||
|
|
||
| ### Consequences | ||
|
|
||
| #### Positive | ||
| - Workflows with grader evaluators install successfully in clean repositories without any manual `resources:` duplication. | ||
| - `gh aw update` automatically restores or updates missing evaluator scripts using the existing resource lifecycle. | ||
| - Evaluator scripts shared across multiple packaged workflows are deduplicated, avoiding redundant downloads. | ||
|
|
||
| #### Negative | ||
| - `fetchAndSaveRemoteResources` now contains two distinct path-resolution conventions (workflow-dir-relative for ordinary resources, repo-root-relative for grader evaluators), increasing the function's complexity. A `//nolint:largefunc` suppression is needed. | ||
| - Content-based conflict detection for grader evaluators (byte-by-byte comparison before allowing overwrite) is deferred until after the download, adding a network round-trip even when the file would ultimately be skipped. Ordinary resources use a pre-download existence check. | ||
| - The `isGraderEvaluator` heuristic relies on the `.github/graders/` path prefix convention; evaluators stored elsewhere would not be detected and would still require manual `resources:` listing. | ||
|
|
||
| #### Neutral | ||
| - The `downloadResourceFileFromGitHub` function is extracted as a package-level variable to allow test injection, which is a minor testability refactor with no production behavior change. | ||
| - The `absTargetDir` pre-computation is moved from the function entry point into the per-resource loop body to support per-resource target base switching. | ||
|
|
||
| --- | ||
|
|
||
| *ADR created by [adr-writer agent]. Review and finalize before changing status from Draft to Accepted.* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[/codebase-design]
appendPackageGraderEvaluatorResourceseagerly downloads every.mdsource file ininstallationSourcesto discover grader run paths. For a package with many workflows this is O(n) network calls during resolution — before a user has even confirmedgh aw add. The ADR acknowledges this cost but doesn't note the user-visible latency impact.💡 Suggestion
Consider a two-phase approach: parse grader config from the already-downloaded manifest metadata where possible, and defer evaluator content downloading to the install step (where downloads already happen). If downloading at resolution time is intentional and necessary, add a log line so users see progress during slow resolutions:
@copilot please address this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in 453e3ab. Package grader evaluator discovery now emits a debug log with the number of installable package sources being inspected.