Skip to content

Preserve inline agents and skills in embedded prompts - #76429

Merged
pelikhan merged 5 commits into
mainfrom
copilot/fix-inline-sub-agents-issue
Nov 10, 2026
Merged

pelikhan merged 5 commits into
mainfrom
copilot/fix-inline-sub-agents-issue

Conversation

Copilot AI commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

With inlined-imports: true, the compiler stripped inline sub-agent and skill definitions before embedding the workflow prompt, so runtime extraction could not create their files. This caused tools such as Copilot’s task to fail with Unknown agent_type.

  • Prompt assembly: For compile-time embedded prompts, expand the original workflow Markdown so inline definitions and their markers reach runtime.
  • Compiler processing: Keep using stripped Markdown for tool resolution and metadata processing.
## agent: `greeter`
---
description: Greets the user
---
Say hello from greeter.
## end agent: `greeter`

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix inline sub-agents being dropped with inlined-imports Preserve inline agents and skills in embedded prompts Nov 10, 2026
Copilot AI requested a review from pelikhan November 10, 2026 07:00
@github-actions

Copy link
Copy Markdown
Contributor

Category: bug | Risk: medium | Score: 55/100 (impact 27 + urgency 16 + quality 12) | Recommended action: batch_review | Notes: preserves inline agents and skills in embedded prompts; cross-cutting compiler correctness fix with real runtime implications.

Generated by 🔧 PR Triage Agent · copilot · mai11 · ~9 AIC · ⌖ ~2 AIC · ⊞ 15.8K · ◷

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

Category: bug | Risk: medium | Score: 55/100 (impact 27 + urgency 16 + quality 12) | Recommended action: batch_review | Notes: preserves inline agents and skills in embedded prompts; cross-cutting compiler correctness fix with real runtime implications.

Generated by 🔧 PR Triage Agent · copilot · mai11 · ~9 AIC · ⌖ ~2 AIC · ⊞ 15.8K · ◷

@github-actions

Copy link
Copy Markdown
Contributor

Category: bug | Risk: medium | Score: 55/100 (impact 27 + urgency 16 + quality 12) | Recommended action: batch_review | Notes: preserves inline agents and skills in embedded prompts; runtime correctness fix with moderate urgency.

Generated by 🔧 PR Triage Agent · copilot · mai11 · ~9 AIC · ⌖ ~2 AIC · ⊞ 15.8K · ◷

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

Category: bug | Risk: medium | Score: 55/100 (impact 27 + urgency 16 + quality 12) | Recommended action: batch_review | Notes: preserves inline agents and skills in embedded prompts; runtime correctness fix with moderate urgency.

Generated by 🔧 PR Triage Agent · copilot · mai11 · ~9 AIC · ⌖ ~2 AIC · ⊞ 15.8K · ◷

@pelikhan
pelikhan marked this pull request as ready for review November 10, 2026 14:27
Copilot AI adaptive review requested due to automatic review settings November 10, 2026 14:27
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

Design Decision Gate 🏗️

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Design Decision Gate 🏗️ · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 8.5K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Ponytail Reviewer · routed: gpt61 medium · ~4 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 181 · ◷

Generated by Ponytail Reviewer for #76429

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from PR Specification Reviewer · gpt56 · ~3 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 1.6K · ◷

Generated by PR Specification Reviewer for #76429

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Test Quality Sentinel · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 7.2K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions github-actions Bot 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.

Found one blocking correctness issue: the new prompt content path overwrites mainWorkflowMarkdown, which is also consumed by metadata, validation, and hash/input analysis. This changes behavior beyond the intended prompt embedding. Please preserve the stripped artifact for those consumers and use a separate prompt-only field.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~4 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again

mainWorkflowMarkdown := markdownContent
if c.inlinePrompt || resolveInlinedImports(result.Frontmatter) {
var promptIncludedFiles []string
mainWorkflowMarkdown, promptIncludedFiles, err = parser.ExpandIncludesWithManifest(result.Markdown, markdownDir, false, c.getSharedImportCache())

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.

mainWorkflowMarkdown is consumed beyond prompt embedding (for example by collectMarkdownMetadata, prompt-tool/runtime-import validation, and compiler hash/input analysis). Replacing it with the re-expanded raw result.Markdown makes inline agent/skill sections flow into those consumers too, contrary to the stated intent to keep stripped Markdown for metadata/tool processing, and can change metadata, validation behavior, and generated hashes for existing workflows. Please preserve the stripped value for these consumers and introduce a separate prompt-only field for the embedded markdown.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 0554032 and 9bc5125. MainWorkflowMarkdown remains stripped; a separate PromptMarkdown carries preserved definitions for embedding and expression processing. Metadata, tool validation, and hash analysis retain their existing inputs.

@github-actions github-actions Bot 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.

Skills-Based Review 🧠

Applied /codebase-design and /tdd. The fix is correct, and the regression test is real: it fails when the 8-line change is reverted. One design point needs a decision before merge.

📋 Key Themes & Highlights

Key Themes

  • Shared field now holds unstripped bodies: MainWorkflowMarkdown also feeds metadata scanning (compiler_markdown_metadata.go) and tool validation (prompt_tool_validation.go). Those paths previously saw stripped Markdown. I did not verify whether this changes their results. See the inline comment on line 485.
  • Loose test assertion: assert.Contains on the whole lock file does not prove placement or uniqueness. Compiling the sample workflow shows one start marker and one end marker for greeter, so the output is correct today.

Positive Highlights

  • ✅ Reuses the same inlined-imports and inlinePrompt condition used elsewhere, so the flags stay consistent.
  • ✅ Runtime stripping in extract_inline_sub_agents.cjs returns the stripped content after writing agent files, so the model prompt does not repeat the definitions.
  • ✅ The regression test fails without the fix and passes with it.

Test Status

  • TestCredentialFreePromptEnvironment fails in this environment because GITHUB_TOKEN is inherited through os.Environ(). It also fails with this PR's compiler change reverted, so it is unrelated to the PR.
  • I could not compare against the base commit because the clone's promisor remote is unreachable. I used a revert of the change instead.

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~5 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again

mainWorkflowMarkdown := markdownContent
if c.inlinePrompt || resolveInlinedImports(result.Frontmatter) {
var promptIncludedFiles []string
mainWorkflowMarkdown, promptIncludedFiles, err = parser.ExpandIncludesWithManifest(result.Markdown, markdownDir, false, c.getSharedImportCache())

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.

[/codebase-design] This sets mainWorkflowMarkdown to the unstripped body, including inline agent and skill blocks. That field also feeds metadata and validation (compiler_markdown_metadata.go, prompt_tool_validation.go, credential_free_prompt.go, compiler_validators.go). The PR description says those paths should keep using stripped Markdown.

💡 Suggested fix

Add a separate field, for example PromptMarkdown, that carries the expanded unstripped body and is used only for prompt chunks and prompt-expression extraction. Keep MainWorkflowMarkdown stripped. If the shared field stays, add a test showing that an inline agent body which mentions a disabled tool gives the same validation result as before.

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 0554032 and 9bc5125 with a separate prompt artifact. Regression coverage verifies that a disabled-tool instruction inside an inline agent does not affect main-prompt tool validation, while definitions and their imported expressions still reach prompt processing.

Comment thread pkg/workflow/inline_imports_test.go Outdated
"Use the greeting skill.",
"## end skill: `greeting`",
} {
assert.Contains(t, string(lockContent), expected)

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.

[/tdd] assert.Contains over the whole lock file passes if the text appears anywhere in it. It does not prove the definitions reach the prompt, and it does not catch duplicates.

💡 Suggested test

Scope the check to the prompt-generation step and assert an exact count, for example assert.Equal(t, 1, strings.Count(string(lockContent), "## agent: greeter")). I confirmed this test fails without the fix, so it is a valid regression test. Tightening the assertion makes it stronger.

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 0554032. The regression decodes the activation job, checks only prompt-content bindings in its prompt-creation step, and asserts exactly one occurrence of each definition marker and body. It also checks extraction-step emission and covers both embedding modes.

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.

🟡 Changes recommended

The preserved, expanded prompt bypasses expression-validation safeguards, allowing included expressions that serialize the GitHub context to potentially expose the job token.

3 open issues
What changed in this PR

This PR addresses #76317 by preserving inline agent and skill definitions in embedded workflow prompts so runtime extraction can create their files.

Changes:

  • Expands original Markdown for embedded prompts while retaining stripped Markdown for compiler processing.
  • Adds a regression test checking that agent and skill markers and bodies appear in the generated lock file.
File Description
pkg/​workflow/​inline_imports_test.go Tests preservation of inline definitions with inlined-imports: true.
pkg/​workflow/​compiler_orchestrator_tools.go Uses original Markdown when assembling embedded prompts and tracks its included files.

Review effort: Balanced (auto)

mainWorkflowMarkdown := markdownContent
if c.inlinePrompt || resolveInlinedImports(result.Frontmatter) {
var promptIncludedFiles []string
mainWorkflowMarkdown, promptIncludedFiles, err = parser.ExpandIncludesWithManifest(result.Markdown, markdownDir, false, c.getSharedImportCache())
mainWorkflowMarkdown := markdownContent
if c.inlinePrompt || resolveInlinedImports(result.Frontmatter) {
var promptIncludedFiles []string
mainWorkflowMarkdown, promptIncludedFiles, err = parser.ExpandIncludesWithManifest(result.Markdown, markdownDir, false, c.getSharedImportCache())
mainWorkflowMarkdown := markdownContent
if c.inlinePrompt || resolveInlinedImports(result.Frontmatter) {
var promptIncludedFiles []string
mainWorkflowMarkdown, promptIncludedFiles, err = parser.ExpandIncludesWithManifest(result.Markdown, markdownDir, false, c.getSharedImportCache())
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (pkg/workflow/compiler_orchestrator_tools.go:485): address unresolved feedback - Review comment
  3. Review (pkg/workflow/compiler_orchestrator_tools.go:485): address unresolved feedback - Review comment
  4. Review (pkg/workflow/inline_imports_test.go:88): address unresolved feedback - Review comment

Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering.

Structured data
{
  "completed_task": 0,
  "head": "0e3be8e729072b0d1c4dd12f8abd030070e1d491",
  "kind": "requested",
  "schema_version": "1",
  "state": "339efbc554b5b56e6555f77f293dd0eb42b4a9bf1752542a44ceb0887187401a",
  "work": [
    "0a2db83e213b7018d123019db89ebd16aab3efa940890c7e790929ffd900fb99",
    "8ca0b382dc91e1f56824a9e5215efec8e370d90d0280dcaa9a566fe5a43cae20",
    "c3fcc8b4a5e90535b6691277f41f0a89462dfc134cea80b97dfd9d89d93b6903"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~4 AIC · ⌖ ~2 AIC · ⊞ 6.9K · ◷
Comment /souschef to run again

Copilot AI and others added 3 commits November 10, 2026 15:21
…b-agents-issue

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:...

Updated from main using make merge-main (ddcf9ea), without conflicts, and addressed the three linked reviews in 0554032 and 9bc5125. Final repository validation passed, including all 365 workflow compilations; focused Go checks, 209 runtime tests, and secret scanning passed. CodeQL timed out and could not complete. No PR merge or workflow dispatch was performed.

Copilot AI requested a review from gh-aw-bot November 10, 2026 15:51
@pelikhan
pelikhan merged commit 1da90b1 into main Nov 10, 2026
91 checks passed
@pelikhan
pelikhan deleted the copilot/fix-inline-sub-agents-issue branch November 10, 2026 16:53
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.2.3

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.

Inline sub-agents (## agent:) are dropped when inlined-imports: true, so the Copilot task tool reports "Unknown agent_type"

4 participants