Conversation
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/295933aa-8fb4-4a7c-ae9d-38098552007a Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Refactors unified prompt generation to keep heredoc blocks open across adjacent prompt content (including runtime-import macros) so compiled .lock.yml diffs contain far fewer hash-delimiter lines when prompts change.
Changes:
- Refactored
generateUnifiedPromptCreationStepto defer<system>opening and merge</system>+ user prompt content into fewer heredoc blocks. - Updated unit tests and regenerated wasm golden fixtures to match the new consolidated output structure.
- Recompiled workflow lock files to reflect the new heredoc grouping.
Reviewed changes
Copilot reviewed 183 out of 183 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/unified_prompt_step.go | Consolidates prompt concatenation into fewer heredoc blocks by deferring <system> and keeping a single heredoc open across user chunks/macros. |
| pkg/workflow/unified_prompt_creation_test.go | Updates delimiter-count expectations to reflect the new merged heredoc structure. |
| pkg/workflow/xml_comments_test.go | Adjusts long-workflow assertions after heredoc consolidation changes. |
| pkg/workflow/testdata/wasm_golden/TestWasmGolden_CompileFixtures/with-imports.golden | Updates golden output showing runtime-import lines merged into the </system> heredoc block. |
| pkg/workflow/testdata/wasm_golden/TestWasmGolden_CompileFixtures/basic-copilot.golden | Updates golden output showing user prompt merged into the </system> heredoc block. |
| .github/workflows/*.lock.yml (178 files) | Regenerated compiled workflow lock files to reduce delimiter-line churn by consolidating heredoc blocks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Long workflow (with imports) should be inlined into a single consolidated heredoc block. | ||
| // The compiler groups all user prompt chunks into the same heredoc to minimise the number | ||
| // of delimiter lines that change in the diff when content changes. | ||
| // Verify this by checking that the long workflow's run section is larger than the normal | ||
| // workflow's (which uses a compact runtime-import macro instead of inlining the full text). | ||
| if len(lockString) <= len(normalLockString) { | ||
| t.Errorf("Expected long workflow lock file to be larger than normal (normal=%d bytes, long=%d bytes)", len(normalLockString), len(lockString)) | ||
| } |
There was a problem hiding this comment.
The new assertion compares len(lockString) vs len(normalLockString), which doesn’t actually verify the intended heredoc consolidation behavior (and the preceding comment about a “single consolidated heredoc block” is misleading since the lock file still contains multiple heredocs for built-in inline sections like GitHub context). Consider asserting on the number/placement of cat << 'GH_AW_PROMPT_…_EOF' blocks in the long workflow’s prompt creation step (e.g., that </system> and subsequent user/runtime-import content are emitted in a single heredoc) rather than relying on file size differences.
|
Hey This PR is well-aligned with the project's guidelines and quality standards: it's focused on a single compiler concern, ships with updated tests in ✅ The PR looks ready for maintainer review. No further changes needed from a contribution-guidelines standpoint.
|
Summary
Updates the compiler to group all concatenations in the "Create prompt with built-in context" step into as few heredoc blocks as possible, minimizing the number of lines that change in compiled lock file diffs when a workflow's prompt changes.
Problem
Each
cat << 'DELIMITER'...DELIMITERheredoc block contributes two lines containing the hash-based delimiter. Since the delimiter is derived from the workflow's frontmatter hash, it changes whenever the user edits their workflow. With many separate blocks, a small prompt change could cause dozens of delimiter lines to appear in the diff — noise that makes code review harder.Before (4 blocks for a workflow with
</system>+ 2 runtime-import macros):After (1 block for all of the above):
Changes
pkg/workflow/unified_prompt_step.go: RefactoredgenerateUnifiedPromptCreationStep:<system>opening tag: write it as the first line of the first inline section's heredoc (when the first section is inline), rather than always as its own standalone block</system>into the already-open heredoc (if any after inline built-in sections), or start a new heredoc that stays open for user content — so</system>and all user prompt content land in the same blockTest updates in
unified_prompt_creation_test.goandxml_comments_test.goto reflect the new consolidated structureGolden file regeneration in
testdata/wasm_golden/Lock file recompilation: all 178
.lock.ymlfiles updated (net ~900 lines removed)