From 0439826620c7a642f6e7e733dfb832ba8d099ebd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Feb 2026 12:26:26 +0000 Subject: [PATCH 1/3] Initial plan From a7c3ba2e0b1b0eedc75ea5a473f49c2ca94f5234 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Feb 2026 12:31:45 +0000 Subject: [PATCH 2/3] Initial plan: emit compilation error for agent file import with inlined-imports Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .github/agents/agentic-workflows.agent.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/agents/agentic-workflows.agent.md b/.github/agents/agentic-workflows.agent.md index d89d7bfdf4a..2c7f53e9f8a 100644 --- a/.github/agents/agentic-workflows.agent.md +++ b/.github/agents/agentic-workflows.agent.md @@ -16,7 +16,7 @@ This is a **dispatcher agent** that routes your request to the appropriate speci - **Debugging workflows**: Routes to `debug` prompt - **Upgrading workflows**: Routes to `upgrade-agentic-workflows` prompt - **Creating shared components**: Routes to `create-shared-agentic-workflow` prompt -- **Fixing Dependabot PRs**: Routes to `dependabot` prompt — use this when Dependabot opens PRs that modify generated manifest files (`.github/workflows/package.json`, `.github/workflows/requirements.txt`, `.github/workflows/go.mod`) or `.github/aw/actions-lock.json`. Never merge those PRs directly; instead update the source `.md` files and rerun `gh aw compile --dependabot` to bundle all fixes +- **Fixing Dependabot PRs**: Routes to `dependabot` prompt — use this when Dependabot opens PRs that modify generated manifest files (`.github/workflows/package.json`, `.github/workflows/requirements.txt`, `.github/workflows/go.mod`) or `https://github.com/github/gh-aw/blob/main/.github/aw/actions-lock.json`. Never merge those PRs directly; instead update the source `.md` files and rerun `gh aw compile --dependabot` to bundle all fixes Workflows may optionally include: @@ -98,7 +98,7 @@ When you interact with this agent, it will: - "Design a shared workflow for database queries" ### Fix Dependabot PRs -**Load when**: User needs to close or fix open Dependabot PRs that update dependencies in generated manifest files (`.github/workflows/package.json`, `.github/workflows/requirements.txt`, `.github/workflows/go.mod`) or `.github/aw/actions-lock.json` +**Load when**: User needs to close or fix open Dependabot PRs that update dependencies in generated manifest files (`.github/workflows/package.json`, `.github/workflows/requirements.txt`, `.github/workflows/go.mod`) or `https://github.com/github/gh-aw/blob/main/.github/aw/actions-lock.json` **Prompt file**: https://github.com/github/gh-aw/blob/main/.github/aw/dependabot.md From ef1498090dd9a390938d70daa2573273f43a82cd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Feb 2026 12:37:06 +0000 Subject: [PATCH 3/3] Emit compilation error when agent file is imported with inlined-imports Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .../compiler_orchestrator_workflow.go | 10 ++++ pkg/workflow/inline_imports_test.go | 52 +++++++++++++++++-- 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/pkg/workflow/compiler_orchestrator_workflow.go b/pkg/workflow/compiler_orchestrator_workflow.go index c294940034a..77b5bb0ea33 100644 --- a/pkg/workflow/compiler_orchestrator_workflow.go +++ b/pkg/workflow/compiler_orchestrator_workflow.go @@ -51,6 +51,16 @@ func (c *Compiler) ParseWorkflowFile(markdownPath string) (*WorkflowData, error) // Store a stable workflow identifier derived from the file name. workflowData.WorkflowID = GetWorkflowIDFromPath(cleanPath) + // Validate that inlined-imports is not used with agent file imports. + // Agent files require runtime access and cannot be resolved without sources. + if workflowData.InlinedImports && engineSetup.importsResult.AgentFile != "" { + return nil, formatCompilerError(cleanPath, "error", + fmt.Sprintf("inlined-imports cannot be used with agent file imports: '%s'. "+ + "Agent files require runtime access and will not be resolved without sources. "+ + "Remove 'inlined-imports: true' or do not import agent files.", + engineSetup.importsResult.AgentFile), nil) + } + // Validate bash tool configuration BEFORE applying defaults // This must happen before applyDefaults() which converts nil bash to default commands if err := validateBashToolConfig(workflowData.ParsedTools, workflowData.Name); err != nil { diff --git a/pkg/workflow/inline_imports_test.go b/pkg/workflow/inline_imports_test.go index ce737d510f0..70e7ac7fd91 100644 --- a/pkg/workflow/inline_imports_test.go +++ b/pkg/workflow/inline_imports_test.go @@ -293,9 +293,55 @@ Do something useful. assert.Contains(t, yamlContent, "Do something useful", "main workflow body should be inlined") } -// TestInlinedImports_AgentFileCleared verifies that when inlined-imports: true, the AgentFile -// field is cleared in WorkflowData so the engine doesn't read it from disk separately -// (the agent content is already inlined via ImportPaths → step 1b). +// TestInlinedImports_AgentFileError verifies that when inlined-imports: true and a custom agent +// file is imported, ParseWorkflowFile returns a compilation error. +// Agent files require runtime access and will not be resolved without sources. +func TestInlinedImports_AgentFileError(t *testing.T) { + tmpDir := t.TempDir() + + // Create the .github/agents directory and agent file + agentsDir := filepath.Join(tmpDir, ".github", "agents") + require.NoError(t, os.MkdirAll(agentsDir, 0o755)) + agentFile := filepath.Join(agentsDir, "my-agent.md") + require.NoError(t, os.WriteFile(agentFile, []byte("# Agent\nDo things.\n"), 0o644)) + + // Create the workflow file with inlined-imports: true importing the agent file + workflowDir := filepath.Join(tmpDir, ".github", "workflows") + require.NoError(t, os.MkdirAll(workflowDir, 0o755)) + workflowFile := filepath.Join(workflowDir, "test-workflow.md") + workflowContent := `--- +name: inlined-agent-test +on: + workflow_dispatch: +permissions: + contents: read +engine: copilot +inlined-imports: true +imports: + - ../../.github/agents/my-agent.md +--- + +# Main Workflow + +Do something. +` + require.NoError(t, os.WriteFile(workflowFile, []byte(workflowContent), 0o644)) + + compiler := NewCompiler( + WithNoEmit(true), + WithSkipValidation(true), + ) + + _, err := compiler.ParseWorkflowFile(workflowFile) + require.Error(t, err, "should return an error when inlined-imports is used with an agent file") + assert.Contains(t, err.Error(), "inlined-imports cannot be used with agent file imports", + "error message should explain the conflict") + assert.Contains(t, err.Error(), "my-agent.md", + "error message should include the agent file path") +} + +// TestInlinedImports_AgentFileCleared verifies that buildInitialWorkflowData clears the AgentFile +// field when inlined-imports is true. Note: ParseWorkflowFile will error before this state is used. func TestInlinedImports_AgentFileCleared(t *testing.T) { compiler := NewCompiler()