Skip to content

Ensure inline sub-agents always trigger interpolation step generation#39651

Merged
pelikhan merged 4 commits into
mainfrom
copilot/fix-inline-sub-agents-extraction
Jun 16, 2026
Merged

Ensure inline sub-agents always trigger interpolation step generation#39651
pelikhan merged 4 commits into
mainfrom
copilot/fix-inline-sub-agents-extraction

Conversation

Copilot AI commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Workflows with inline ## agent: blocks could compile without the Interpolate variables and render templates activation step when GitHub-context templating was suppressed (for example tools.github: false). That prevented interpolate_prompt.cjs from running, so inline sub-agents were never extracted into the activation artifact.

  • Compiler gating fix

    • Updated interpolation-step generation logic in pkg/workflow/template.go to treat inline sub-agent markers as an explicit trigger.
    • The interpolation step is now emitted when any of these are present:
      • expression mappings
      • template conditionals / GitHub-context path
      • inline sub-agent blocks (## agent: \name``)
  • Focused regression coverage

    • Added TestGenerateInterpolationAndTemplateStep_WithInlineSubAgent in pkg/workflow/template_test.go.
    • The test covers the suppressed-GitHub-context scenario (tools.github: false) and asserts that interpolate_prompt.cjs is still included.
hasTemplatePattern := strings.Contains(data.MarkdownContent, "{{#if ")
hasGitHubContext := hasGitHubTool(data.ParsedTools)
hasInlineSubAgents := inlineSubAgentPattern.MatchString(data.MarkdownContent)
hasTemplates := hasTemplatePattern || hasGitHubContext || hasInlineSubAgents

Copilot AI and others added 2 commits June 16, 2026 18:56
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] Fix inline sub-agents not extracted when suppressing github-context block Ensure inline sub-agents always trigger interpolation step generation Jun 16, 2026
Copilot AI requested a review from pelikhan June 16, 2026 19:05
@pelikhan pelikhan marked this pull request as ready for review June 16, 2026 19:57
Copilot AI review requested due to automatic review settings June 16, 2026 19:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Not ready to approve

The new regression test does not currently validate the intended “GitHub context suppressed” scenario, so the key behavior change isn’t reliably covered.

Pull request overview

This PR updates the gh-aw workflow compiler to ensure the “Interpolate variables and render templates” activation step is emitted whenever inline sub-agent blocks are present, even when GitHub-context templating is otherwise suppressed, so interpolate_prompt.cjs runs and extracts inline sub-agents into the activation artifact.

Changes:

  • Treat inline ## agent: \name`` markers as an explicit trigger for generating the interpolation/template step.
  • Add a regression test intended to cover the “GitHub context suppressed” + inline sub-agent scenario.
  • Regenerate pr-code-quality-reviewer.lock.yml metadata.
File summaries
File Description
pkg/workflow/template.go Adds inline sub-agent detection to force interpolation/template step generation.
pkg/workflow/template_test.go Adds a regression test for interpolation step generation with inline sub-agents.
.github/workflows/pr-code-quality-reviewer.lock.yml Updates generated workflow lock metadata (frontmatter hash).

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 2

Note

Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/workflow/template.go Outdated
Comment thread pkg/workflow/template_test.go
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

…sed GitHub context

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

@copilot run pr-finisher skill

Done. Two fixes in the latest commit:

  1. inlineSubAgentPattern regex — added the missing [ \t]*$ to align exactly with the canonical subAgentSeparatorRegex in sub_agent_extractor.go / extract_inline_sub_agents.cjs, preventing partial-match drift.

  2. Test setup — changed NewTools(map[string]any{"github": false}) to NewTools(map[string]any{}). Since parseGitHubTool doesn't treat boolean false as disabled (it falls through to a non-nil default), the old setup left hasGitHubTool returning true. The empty map ensures hasGitHubTool is false, so the test now genuinely verifies that the inline sub-agent marker alone triggers the interpolation step.

@pelikhan pelikhan merged commit 58a40b9 into main Jun 16, 2026
29 checks passed
@pelikhan pelikhan deleted the copilot/fix-inline-sub-agents-extraction branch June 16, 2026 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants