From 5d7aa67d31e0e896c2de03cce6cb17513d877854 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 28 Jan 2026 19:00:44 +0000 Subject: [PATCH 1/2] Initial plan From 12c57168e56292c8cf3d6b92e76924db534c9af3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 28 Jan 2026 19:15:21 +0000 Subject: [PATCH 2/2] fix: rename create_agent_task to create_agent_session in all files - Update JavaScript handler manager and tests - Update Go safe outputs config generation - Update Go validation config and tests - Update Go tool description enhancer - Update Go notify comment This fixes the issue where create_agent_session tool was defined but not properly exposed to the agent because the code referenced the old create_agent_task name. Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com> --- .github/workflows/poem-bot.lock.yml | 21 +++++++++++++++++-- .../security-alert-burndown.lock.yml | 21 +++++++++++++++++-- .../setup/js/safe_output_handler_manager.cjs | 2 +- .../js/safe_output_handler_manager.test.cjs | 14 ++++++------- pkg/workflow/notify_comment.go | 2 +- pkg/workflow/safe_output_validation_config.go | 2 +- .../safe_output_validation_config_test.go | 2 +- .../safe_outputs_config_generation.go | 6 +++--- pkg/workflow/tool_description_enhancer.go | 2 +- 9 files changed, 53 insertions(+), 19 deletions(-) diff --git a/.github/workflows/poem-bot.lock.yml b/.github/workflows/poem-bot.lock.yml index e387b00d8a..b6f00062fc 100644 --- a/.github/workflows/poem-bot.lock.yml +++ b/.github/workflows/poem-bot.lock.yml @@ -210,7 +210,7 @@ jobs: mkdir -p /tmp/gh-aw/safeoutputs mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs cat > /opt/gh-aw/safeoutputs/config.json << 'EOF' - {"add_comment":{"max":3,"target":"*"},"add_labels":{"allowed":["poetry","creative","automation","ai-generated","epic","haiku","sonnet","limerick"],"max":5},"create_agent_task":{"max":1},"create_discussion":{"max":2},"create_issue":{"group":true,"max":2},"create_missing_tool_issue":{"max":1,"title_prefix":"[missing tool]"},"create_pull_request":{},"create_pull_request_review_comment":{"max":2},"link_sub_issue":{"max":3},"missing_data":{},"missing_tool":{},"noop":{"max":1},"push_to_pull_request_branch":{"max":0},"update_issue":{"max":2},"upload_asset":{"max":0}} + {"add_comment":{"max":3,"target":"*"},"add_labels":{"allowed":["poetry","creative","automation","ai-generated","epic","haiku","sonnet","limerick"],"max":5},"create_agent_session":{"max":1},"create_discussion":{"max":2},"create_issue":{"group":true,"max":2},"create_missing_tool_issue":{"max":1,"title_prefix":"[missing tool]"},"create_pull_request":{},"create_pull_request_review_comment":{"max":2},"link_sub_issue":{"max":3},"missing_data":{},"missing_tool":{},"noop":{"max":1},"push_to_pull_request_branch":{"max":0},"update_issue":{"max":2},"upload_asset":{"max":0}} EOF cat > /opt/gh-aw/safeoutputs/tools.json << 'EOF' [ @@ -254,6 +254,23 @@ jobs: }, "name": "create_issue" }, + { + "description": "Create a GitHub Copilot agent session to delegate coding work. Use this when you need another Copilot agent to implement code changes, fix bugs, or complete development tasks. The task becomes a new issue that triggers the Copilot coding agent. For non-coding tasks or manual work items, use create_issue instead. CONSTRAINTS: Maximum 1 agent task(s) can be created. Base branch for tasks: \"main\".", + "inputSchema": { + "additionalProperties": false, + "properties": { + "body": { + "description": "Clear, detailed task description for the Copilot agent. Include specific files to modify, expected behavior, acceptance criteria, and any constraints. The description should be actionable and self-contained.", + "type": "string" + } + }, + "required": [ + "body" + ], + "type": "object" + }, + "name": "create_agent_session" + }, { "description": "Create a GitHub discussion for announcements, Q\u0026A, reports, status updates, or community conversations. Use this for content that benefits from threaded replies, doesn't require task tracking, or serves as documentation. For actionable work items that need assignment and status tracking, use create_issue instead. CONSTRAINTS: Maximum 2 discussion(s) can be created. Title will be prefixed with \"[📜 POETRY] \". Discussions will be created in category \"General\".", "inputSchema": { @@ -663,7 +680,7 @@ jobs: } } }, - "create_agent_task": { + "create_agent_session": { "defaultMax": 1, "fields": { "body": { diff --git a/.github/workflows/security-alert-burndown.lock.yml b/.github/workflows/security-alert-burndown.lock.yml index 7bc2e064c1..7b96c18db7 100644 --- a/.github/workflows/security-alert-burndown.lock.yml +++ b/.github/workflows/security-alert-burndown.lock.yml @@ -155,10 +155,27 @@ jobs: mkdir -p /tmp/gh-aw/safeoutputs mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs cat > /opt/gh-aw/safeoutputs/config.json << 'EOF' - {"create_agent_task":{"max":3},"create_project_status_update":{"max":1},"missing_data":{},"missing_tool":{},"noop":{"max":1},"update_project":{"max":100}} + {"create_agent_session":{"max":3},"create_project_status_update":{"max":1},"missing_data":{},"missing_tool":{},"noop":{"max":1},"update_project":{"max":100}} EOF cat > /opt/gh-aw/safeoutputs/tools.json << 'EOF' [ + { + "description": "Create a GitHub Copilot agent session to delegate coding work. Use this when you need another Copilot agent to implement code changes, fix bugs, or complete development tasks. The task becomes a new issue that triggers the Copilot coding agent. For non-coding tasks or manual work items, use create_issue instead. CONSTRAINTS: Maximum 3 agent task(s) can be created. Base branch for tasks: \"main\".", + "inputSchema": { + "additionalProperties": false, + "properties": { + "body": { + "description": "Clear, detailed task description for the Copilot agent. Include specific files to modify, expected behavior, acceptance criteria, and any constraints. The description should be actionable and self-contained.", + "type": "string" + } + }, + "required": [ + "body" + ], + "type": "object" + }, + "name": "create_agent_session" + }, { "description": "Report that a tool or capability needed to complete the task is not available, or share any information you deem important about missing functionality or limitations. Use this when you cannot accomplish what was requested because the required functionality is missing or access is restricted.", "inputSchema": { @@ -403,7 +420,7 @@ jobs: EOF cat > /opt/gh-aw/safeoutputs/validation.json << 'EOF' { - "create_agent_task": { + "create_agent_session": { "defaultMax": 1, "fields": { "body": { diff --git a/actions/setup/js/safe_output_handler_manager.cjs b/actions/setup/js/safe_output_handler_manager.cjs index 118bfba5d7..38b57af3ff 100644 --- a/actions/setup/js/safe_output_handler_manager.cjs +++ b/actions/setup/js/safe_output_handler_manager.cjs @@ -153,7 +153,7 @@ const HANDLER_MAP = { * Note: Project-related types (create_project, create_project_status_update, update_project, copy_project) * require GH_AW_PROJECT_GITHUB_TOKEN and are processed in the dedicated project handler manager */ -const STANDALONE_STEP_TYPES = new Set(["assign_to_agent", "create_agent_task", "create_project", "create_project_status_update", "update_project", "copy_project", "upload_asset", "noop"]); +const STANDALONE_STEP_TYPES = new Set(["assign_to_agent", "create_agent_session", "create_project", "create_project_status_update", "update_project", "copy_project", "upload_asset", "noop"]); /** * Load configuration for safe outputs diff --git a/actions/setup/js/safe_output_handler_manager.test.cjs b/actions/setup/js/safe_output_handler_manager.test.cjs index c85a7ebf52..358d7d1c14 100644 --- a/actions/setup/js/safe_output_handler_manager.test.cjs +++ b/actions/setup/js/safe_output_handler_manager.test.cjs @@ -396,13 +396,13 @@ describe("Safe Output Handler Manager", () => { const messages = [ { type: "create_issue", title: "Issue" }, { type: "update_project", project: "https://github.com/orgs/myorg/projects/42" }, - { type: "create_agent_task", title: "Task" }, + { type: "create_agent_session", title: "Task" }, ]; const mockHandler = vi.fn().mockResolvedValue({ success: true }); // Only create_issue handler is available - // update_project and create_agent_task are handled by standalone steps + // update_project and create_agent_session are handled by standalone steps const handlers = new Map([["create_issue", mockHandler]]); const result = await processMessages(handlers, messages); @@ -422,24 +422,24 @@ describe("Safe Output Handler Manager", () => { // Third message should also be skipped (standalone step) expect(result.results[2].success).toBe(false); - expect(result.results[2].type).toBe("create_agent_task"); + expect(result.results[2].type).toBe("create_agent_session"); expect(result.results[2].skipped).toBe(true); expect(result.results[2].reason).toBe("Handled by standalone step"); // Should NOT have logged warnings for standalone step types expect(core.warning).not.toHaveBeenCalledWith(expect.stringContaining("No handler loaded for message type 'update_project'")); - expect(core.warning).not.toHaveBeenCalledWith(expect.stringContaining("No handler loaded for message type 'create_agent_task'")); + expect(core.warning).not.toHaveBeenCalledWith(expect.stringContaining("No handler loaded for message type 'create_agent_session'")); // Should have logged debug messages expect(core.debug).toHaveBeenCalledWith(expect.stringContaining("update_project")); - expect(core.debug).toHaveBeenCalledWith(expect.stringContaining("create_agent_task")); + expect(core.debug).toHaveBeenCalledWith(expect.stringContaining("create_agent_session")); }); it("should track skipped message types for logging", async () => { const messages = [ { type: "create_issue", title: "Issue" }, { type: "update_project", project: "https://github.com/orgs/myorg/projects/42" }, - { type: "create_agent_task", title: "Task" }, + { type: "create_agent_session", title: "Task" }, { type: "unknown_type", data: "test" }, { type: "another_unknown", data: "test2" }, ]; @@ -456,7 +456,7 @@ describe("Safe Output Handler Manager", () => { // Collect skipped standalone types const skippedStandaloneResults = result.results.filter(r => r.skipped && r.reason === "Handled by standalone step"); const standaloneTypes = [...new Set(skippedStandaloneResults.map(r => r.type))]; - expect(standaloneTypes).toEqual(expect.arrayContaining(["update_project", "create_agent_task"])); + expect(standaloneTypes).toEqual(expect.arrayContaining(["update_project", "create_agent_session"])); // Collect skipped no-handler types const skippedNoHandlerResults = result.results.filter(r => !r.success && !r.skipped && r.error?.includes("No handler loaded")); diff --git a/pkg/workflow/notify_comment.go b/pkg/workflow/notify_comment.go index d78c1f77ba..ca9cde79ff 100644 --- a/pkg/workflow/notify_comment.go +++ b/pkg/workflow/notify_comment.go @@ -397,7 +397,7 @@ func buildSafeOutputJobsEnvVars(jobNames []string) (string, []string) { urlKey = "pull_request_url" case "close_discussion": urlKey = "discussion_url" - case "create_agent_task": + case "create_agent_session": urlKey = "task_url" case "push_to_pull_request_branch": urlKey = "commit_url" diff --git a/pkg/workflow/safe_output_validation_config.go b/pkg/workflow/safe_output_validation_config.go index e31624bac1..92b2294cf7 100644 --- a/pkg/workflow/safe_output_validation_config.go +++ b/pkg/workflow/safe_output_validation_config.go @@ -54,7 +54,7 @@ var ValidationConfig = map[string]TypeValidationConfig{ "repo": {Type: "string", MaxLength: 256}, // Optional: target repository in format "owner/repo" }, }, - "create_agent_task": { + "create_agent_session": { DefaultMax: 1, Fields: map[string]FieldValidation{ "body": {Required: true, Type: "string", Sanitize: true, MaxLength: MaxBodyLength}, diff --git a/pkg/workflow/safe_output_validation_config_test.go b/pkg/workflow/safe_output_validation_config_test.go index 4bbc5debf0..cb918a8534 100644 --- a/pkg/workflow/safe_output_validation_config_test.go +++ b/pkg/workflow/safe_output_validation_config_test.go @@ -22,7 +22,7 @@ func TestGetValidationConfigJSON(t *testing.T) { // Verify all expected types are present expectedTypes := []string{ "create_issue", - "create_agent_task", + "create_agent_session", "add_comment", "create_pull_request", "add_labels", diff --git a/pkg/workflow/safe_outputs_config_generation.go b/pkg/workflow/safe_outputs_config_generation.go index 78867450e9..725982b21f 100644 --- a/pkg/workflow/safe_outputs_config_generation.go +++ b/pkg/workflow/safe_outputs_config_generation.go @@ -37,7 +37,7 @@ func generateSafeOutputsConfig(data *WorkflowData) string { safeOutputsConfig["create_issue"] = config } if data.SafeOutputs.CreateAgentSessions != nil { - safeOutputsConfig["create_agent_task"] = generateMaxConfig( + safeOutputsConfig["create_agent_session"] = generateMaxConfig( data.SafeOutputs.CreateAgentSessions.Max, 1, // default max ) @@ -515,7 +515,7 @@ func generateFilteredToolsJSON(data *WorkflowData, markdownPath string) (string, enabledTools["create_issue"] = true } if data.SafeOutputs.CreateAgentSessions != nil { - enabledTools["create_agent_task"] = true + enabledTools["create_agent_session"] = true } if data.SafeOutputs.CreateDiscussions != nil { enabledTools["create_discussion"] = true @@ -768,7 +768,7 @@ func addRepoParameterIfNeeded(tool map[string]any, toolName string, safeOutputs hasAllowedRepos = len(config.AllowedRepos) > 0 targetRepoSlug = config.TargetRepoSlug } - case "create_agent_task": + case "create_agent_session": if config := safeOutputs.CreateAgentSessions; config != nil { hasAllowedRepos = len(config.AllowedRepos) > 0 targetRepoSlug = config.TargetRepoSlug diff --git a/pkg/workflow/tool_description_enhancer.go b/pkg/workflow/tool_description_enhancer.go index e8be1c3230..30fffbcf62 100644 --- a/pkg/workflow/tool_description_enhancer.go +++ b/pkg/workflow/tool_description_enhancer.go @@ -43,7 +43,7 @@ func enhanceToolDescription(toolName, baseDescription string, safeOutputs *SafeO } } - case "create_agent_task": + case "create_agent_session": if config := safeOutputs.CreateAgentSessions; config != nil { if config.Max > 0 { constraints = append(constraints, fmt.Sprintf("Maximum %d agent task(s) can be created.", config.Max))