Update WritePromptTextToYAML to chunk large text into multiple heredoc blocks#1879
Merged
Update WritePromptTextToYAML to chunk large text into multiple heredoc blocks#1879
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update compiler function helper to chunk prompt text
Update WritePromptTextToYAML to chunk large text into multiple heredoc blocks
Oct 17, 2025
pelikhan
reviewed
Oct 17, 2025
| // Each chunk is written as a separate heredoc to avoid GitHub Actions step size limits (21KB). | ||
| func WritePromptTextToYAML(yaml *strings.Builder, text string, indent string) { | ||
| yaml.WriteString(indent + "cat >> $GITHUB_AW_PROMPT << 'EOF'\n") | ||
| const maxChunkSize = 20000 // 20KB limit for each chunk |
Contributor
Author
There was a problem hiding this comment.
Done in commit 8f1bb14. Moved maxChunkSize and maxChunks constants to the package-level const block in compiler.go as MaxPromptChunkSize and MaxPromptChunks.
Collaborator
|
@copilot the limit is for "steps" so you need to generate a new step for each chunk. |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
Author
Done in commit b5cd9f3. Now generating separate steps for each chunk instead of multiple heredocs in one step. The 21KB limit is per step, so each chunk now gets its own step with proper naming (e.g., "part 1", "part 2"). Example output: - name: Append instructions (part 1)
run: |
cat >> $GITHUB_AW_PROMPT << 'EOF'
[chunk 1...]
EOF
- name: Append instructions (part 2)
run: |
cat >> $GITHUB_AW_PROMPT << 'EOF'
[chunk 2...]
EOFTested with 230KB input → creates 5 separate steps correctly. |
Contributor
|
Agentic Changeset Generator triggered by this pull request. |
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.
Update WritePromptTextToYAML to chunk text in groups of lines less than 20000 characters, with a maximum of 5 chunks.
Summary
Successfully implemented prompt text chunking to handle GitHub Actions step size limits (21KB per step).
Latest Changes (addressing PR feedback)
generateStaticPromptStepcreates multiple steps (one per chunk) instead of multiple heredocs in a single step.WritePromptTextToYAMLnow creates a single heredoc blockgenerateStaticPromptStephandles chunking and creates multiple stepsRequirements Met ✅
Implementation
Core Changes
generateStaticPromptStep(pkg/workflow/prompt_step_helper.go): Now chunks text and creates multiple steps (one per chunk)WritePromptTextToYAML(pkg/workflow/sh.go): Simplified to write a single heredoc blockchunkLines(pkg/workflow/sh.go): Helper function to split lines into size-appropriate chunkspkg/workflow/compiler.go):MaxPromptChunkSize(20000) andMaxPromptChunks(5)Example Output
Old approach (incorrect - multiple heredocs in ONE step):
New approach (correct - separate steps):
Test Coverage
Verification
Testing Completed
Impact
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.