-
Notifications
You must be signed in to change notification settings - Fork 321
Compiled <safe-output-tools> prompt inlines ${{ }} expressions, re-triggering expression-size limit #23768
Description
Summary
The compiled <safe-output-tools> prompt block in the agent run: heredoc now inlines ${{ }} expressions from max: safe-output config values. This makes the entire run: block subject to the 21KB expression-size limit, causing compilation failures for workflows with large prompts (many imported fragments).
This is a regression from the fix for #21157, which addressed the same root cause in the tools.json block. The <safe-output-tools> prompt section is a different code path that was not covered by that fix.
Reproduction
Any workflow with:
- Many imported fragments (large total prompt)
- A safe-output
max:value using${{ inputs.* }}
For example:
# fragment: safe-output-review-comment.md
safe-outputs:
create-pull-request-review-comment:
max: ${{ inputs.create-pull-request-review-comment-max }}Compiles to (inside the prompt heredoc):
<safe-output-tools>
Tools: add_comment, create_pull_request_review_comment(max:${{ inputs.create-pull-request-review-comment-max }}), ...
</safe-output-tools>
The old compiler (v0.62.4) emitted <safe-output-tools> without (max:...) annotations, so no ${{ }} appeared in the heredoc.
Affected workflows
gh-aw-mention-in-pr.md(26.4 KB, limit 20.5 KB)gh-aw-mention-in-pr-no-sandbox.md(24.0 KB)gh-aw-estc-docs-pr-review.md(22.9 KB)
Expected behavior
The (max:N) annotations in <safe-output-tools> should either:
- Extract
${{ }}expressions toGH_AW_EXPR_*env vars (like the rest of the prompt), or - Resolve the expression value before embedding it in the prompt text
Workaround
Hardcode max: values in the safe-output fragment instead of using ${{ inputs.* }}:
safe-outputs:
create-pull-request-review-comment:
max: 30 # was: ${{ inputs.create-pull-request-review-comment-max }}This removes the ${{ }} from the heredoc entirely, so the 21KB limit no longer applies.
Related
- Safe outputs tools.json block triggers expression-size limit when target uses ${{ }} #21157 (original tools.json fix, closed as completed)