fix: resolve workflow_install_note.md ENOENT in safe_outputs job#33654
Merged
Conversation
…safe_outputs
The messages_footer.cjs file was using a hardcoded relative path
(path.join(__dirname, "../md/workflow_install_note.md")) to read the
workflow install note template. When running in the safe_outputs job,
__dirname is ${RUNNER_TEMP}/gh-aw/safeoutputs, so the path resolves to
${RUNNER_TEMP}/gh-aw/md/workflow_install_note.md which doesn't exist.
The template is actually deployed to ${RUNNER_TEMP}/gh-aw/prompts/ by
setup.sh. Fix this by using getPromptPath() (which resolves via
RUNNER_TEMP or GH_AW_PROMPTS_DIR) with a fallback to the source tree
path for local dev/test environments — the same pattern used in
firewall_blocked_domains.cjs.
Update affected test files to set GH_AW_PROMPTS_DIR to the source md/
directory so tests can find template files when RUNNER_TEMP is set in
the CI environment.
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix ENOENT error in safe_outputs when workflow files are modified
fix: resolve workflow_install_note.md ENOENT in safe_outputs job
May 21, 2026
Collaborator
|
@copilot remove fallback, use get prompt path |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
Author
Done — removed the |
pelikhan
approved these changes
May 21, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes an ENOENT crash in the safe_outputs job when resolving workflow_install_note.md after deployment by switching footer template resolution to the runtime prompts directory, and adjusts unit tests to ensure getPromptPath() resolves templates correctly in CI.
Changes:
- Update
messages_footer.cjsto resolveworkflow_install_note.mdviagetPromptPath(). - Update multiple Vitest suites to set
GH_AW_PROMPTS_DIRto the sourcemd/directory during tests. - Add env restoration in
pr_review_buffer.test.cjsforGH_AW_PROMPTS_DIR.
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/messages_footer.cjs | Switches install-note template lookup to runtime prompt resolution. |
| actions/setup/js/messages.test.cjs | Sets GH_AW_PROMPTS_DIR in test setup to make prompt resolution deterministic in CI. |
| actions/setup/js/close_entity_helpers.test.cjs | Sets GH_AW_PROMPTS_DIR in test setup to avoid missing prompt templates in CI. |
| actions/setup/js/pr_review_buffer.test.cjs | Sets and restores GH_AW_PROMPTS_DIR during tests. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 4/4 changed files
- Comments generated: 3
Comment on lines
132
to
136
| const templateContext = toSnakeCase({ ...ctx, agenticWorkflowUrl }); | ||
|
|
||
| const defaultInstallTemplatePath = path.join(__dirname, "../md/workflow_install_note.md"); | ||
| const defaultInstallTemplatePath = getPromptPath("workflow_install_note.md"); | ||
|
|
||
| // Use custom installation message if configured |
Comment on lines
+41
to
46
| // Point GH_AW_PROMPTS_DIR to the source md/ directory so getPromptPath() | ||
| // resolves template files from the source tree in test environments where | ||
| // RUNNER_TEMP is set but the runtime prompts directory is not populated. | ||
| process.env.GH_AW_PROMPTS_DIR = path.join(path.dirname(fileURLToPath(import.meta.url)), "../md"); | ||
| // Clear cache by reimporting | ||
| vi.resetModules(); |
Comment on lines
+18
to
22
| // Point GH_AW_PROMPTS_DIR to the source md/ directory so getPromptPath() | ||
| // resolves template files from the source tree in test environments where | ||
| // RUNNER_TEMP is set but the runtime prompts directory is not populated. | ||
| (process.env.GH_AW_PROMPTS_DIR = path.join(path.dirname(fileURLToPath(import.meta.url)), "../md")), | ||
| (global.context.eventName = "issues"), |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When
create_pull_requestsafe-output touches.github/workflows/files, thesafe_outputsjob crashes withENOENT: no such file or directory, open '…/gh-aw/md/workflow_install_note.md'. The template is deployed to${RUNNER_TEMP}/gh-aw/prompts/bysetup.sh, butmessages_footer.cjswas resolving it viapath.join(__dirname, "../md/…")— which is valid from the source tree but resolves to the non-existent.../safeoutputs/../md/when deployed.Changes
messages_footer.cjs— ImportgetPromptPathfrommessages_core.cjsand use it to resolveworkflow_install_note.mdat runtime, falling back to the source-tree path for local dev (mirrors the pattern infirewall_blocked_domains.cjs):messages.test.cjs,close_entity_helpers.test.cjs,pr_review_buffer.test.cjs— SetGH_AW_PROMPTS_DIRto the sourcemd/directory in test setup sogetPromptPath()resolves against the source tree whenRUNNER_TEMPis set in CI.