Skip to content

fix(recipes): step-03 shell quoting + PR URL resolution (#4221, #4233)#4236

Closed
rysweet wants to merge 1 commit intomainfrom
fix/step-03-quoting-and-pr-url
Closed

fix(recipes): step-03 shell quoting + PR URL resolution (#4221, #4233)#4236
rysweet wants to merge 1 commit intomainfrom
fix/step-03-quoting-and-pr-url

Conversation

@rysweet
Copy link
Copy Markdown
Owner

@rysweet rysweet commented Apr 4, 2026

Fixes #4221 and #4233.

#4221: Shell quoting failure in step-03-create-issue

Root cause: Heredoc used unquoted delimiter (<<EOFTASKDESC), allowing bash to expand `$()` and backticks in template-substituted content.

Fix: Switch to quoted heredoc (<<'_AMPLIHACK_STEP03_TASK_EOF_') with unique delimiter.

#4233: step-03b fails on PR URL output

Root cause: step-03b-extract-issue-number only matched issues/[0-9]+ URLs. When step-03 returns a PR URL (pull/[0-9]+), extraction fails.

Fix:

  1. Try issue URL first (existing behavior)
  2. If no match, try PR URL → resolve linked issue via gh pr view
  3. If no linked issue, use PR number as reference
  4. Last resort: scan task_description for #NNNN references

Driven by Simard — this PR demonstrates Simard's ability to drive fixes on the amplihack ecosystem.

Fix two bugs in default-workflow step-03:

#4221 - Shell quoting failure:
- Changed heredoc from unquoted (<<EOFTASKDESC) to quoted (<<'DELIM')
  to prevent bash from expanding $(), backticks, or other metacharacters
  in template-substituted task_description content
- Used unique delimiters (_AMPLIHACK_STEP03_TASK_EOF_) unlikely to
  collide with user task descriptions

#4233 - PR URL extraction failure:
- step-03b now handles PR URLs (pull/NNN) in addition to issue URLs
- When a PR URL is found, resolves linked issue via gh pr view
- Falls back to using PR number as reference if no linked issue exists
- Last resort: scans task_description for bare #NNNN references

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@rysweet
Copy link
Copy Markdown
Owner Author

rysweet commented Apr 17, 2026

Superseded by PR #4368 (merged) which comprehensively fixed step-03b issue/PR reference extraction.

@rysweet rysweet closed this Apr 17, 2026
@rysweet rysweet deleted the fix/step-03-quoting-and-pr-url branch April 17, 2026 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

default-workflow step-03-create-issue shell quoting failure in Copilot CLI

1 participant