diff --git a/.github/workflows/check-worker-versions.test.ts b/.github/workflows/check-worker-versions.test.ts index 43632529..d29922e4 100644 --- a/.github/workflows/check-worker-versions.test.ts +++ b/.github/workflows/check-worker-versions.test.ts @@ -14,16 +14,22 @@ const { parse }: { parse: (source: string) => unknown } = interface Step { id?: string; + name?: string; run?: string; env?: Record; } interface WorkerVersionWorkflow { + permissions: Record; jobs: Record; } const workflow = parse(readFileSync(".github/workflows/check-worker-versions.yml", "utf8")) as WorkerVersionWorkflow; const setupStep = workflow.jobs["setup-matrix"].steps.find((candidate) => candidate.id === "set")!; +const createIssueStep = workflow.jobs["check-versions"].steps.find((candidate) => candidate.id === "create_issue")!; +const dispatchUpgradeStep = workflow.jobs["check-versions"].steps.find( + (candidate) => candidate.name === "Dispatch worker version upgrade", +)!; const expectedWorkers = [ { worker: "coder-acp-copilot", checker: "version-checker-acp-copilot" }, { worker: "coder-acp-claude-code", checker: "version-checker-claude-code" }, @@ -68,4 +74,15 @@ describe("Check Worker Versions workflow", () => { it.each(expectedWorkers)("selects only $worker when requested", ({ worker, checker }) => { expect(selectedWorkers(worker)).toEqual([{ worker, checker }]); }); + + it("dispatches the upgrade workflow explicitly after creating an issue", () => { + expect(workflow.permissions.actions).toBe("write"); + expect(createIssueStep.env?.GH_TOKEN).toBe("${{ secrets.GITHUB_TOKEN }}"); + expect(createIssueStep.run).toContain('echo "issue_number=$ISSUE_NUMBER" >> $GITHUB_OUTPUT'); + expect(dispatchUpgradeStep.env?.GH_TOKEN).toBe("${{ secrets.GITHUB_TOKEN }}"); + expect(dispatchUpgradeStep.run).toContain("gh workflow run worker-version-upgrade.lock.yml"); + expect(dispatchUpgradeStep.run).toContain('-f issue_number="${{ steps.create_issue.outputs.issue_number }}"'); + expect(dispatchUpgradeStep.run).toContain('--arg actor "${{ github.actor }}"'); + expect(dispatchUpgradeStep.run).toContain('--arg command_name "worker-version-upgrade"'); + }); }); diff --git a/.github/workflows/check-worker-versions.yml b/.github/workflows/check-worker-versions.yml index ec315e61..19768623 100644 --- a/.github/workflows/check-worker-versions.yml +++ b/.github/workflows/check-worker-versions.yml @@ -16,6 +16,7 @@ on: - coder-acp-claude-code permissions: + actions: write contents: read issues: write @@ -207,7 +208,34 @@ jobs: --title "${{ steps.check.outputs.title }}" \ --body-file /tmp/issue-body.md \ --label "type: worker-update") + ISSUE_NUMBER="${ISSUE_URL##*/}" echo "issue_url=$ISSUE_URL" >> $GITHUB_OUTPUT + echo "issue_number=$ISSUE_NUMBER" >> $GITHUB_OUTPUT + + - name: Dispatch worker version upgrade + if: steps.create_issue.outputs.issue_number != '' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + AW_CONTEXT=$(jq -Rs \ + --arg actor "${{ github.actor }}" \ + --arg command_name "worker-version-upgrade" \ + --arg issue_number "${{ steps.create_issue.outputs.issue_number }}" \ + '{ + actor: $actor, + command_name: $command_name, + item_type: "issue", + item_number: ($issue_number | tonumber), + issue_number: $issue_number, + issue_body: . + }' \ + /tmp/issue-body.md) + + # workflow_dispatch is allowed to create a downstream run with GITHUB_TOKEN. + gh workflow run worker-version-upgrade.lock.yml \ + --ref "${{ github.ref_name }}" \ + -f issue_number="${{ steps.create_issue.outputs.issue_number }}" \ + -f aw_context="$AW_CONTEXT" - name: Close superseded issue if: steps.existing.outputs.exists == 'true' && steps.existing.outputs.same_version == 'false' && steps.create_issue.outputs.issue_url != '' diff --git a/.github/workflows/worker-version-upgrade.lock.yml b/.github/workflows/worker-version-upgrade.lock.yml index 88b99aa2..415204b9 100644 --- a/.github/workflows/worker-version-upgrade.lock.yml +++ b/.github/workflows/worker-version-upgrade.lock.yml @@ -1,5 +1,5 @@ -# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"8da589511e1413ea0d84ab82a748d2a1cb11cddec70861ec5a55932d28afa462","body_hash":"ee5c7ca429dc819894ac6931fa62a2d96aa596bcde626d0ec82761179c3a5b4e","compiler_version":"v1.2.2","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.103"}} -# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_AGENT_TOKEN","GH_AW_DEFAULT_OTLP_ENDPOINT","GH_AW_DEFAULT_OTLP_HEADERS","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"9000827ccba6bdab643e8b6fd33ac0654aef8333","version":"v8.0.2"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"949feb2413d6458794dcd2491c4babbbce0c15c1","version":"v7.1.0"},{"repo":"actions/upload-artifact","sha":"cf430e030ddbb5b0abf93d22962f4752f3646cd9","version":"v7.0.2"},{"repo":"github/gh-aw-actions/setup","sha":"53d0749e19424a918acd82b4d140264ce48f2f14","version":"v1.2.2"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.29.11","digest":"sha256:8774a73c351395b41d2ad0af4ddb4689007c67de3cd08bd9f43bb8a0e300690e","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.29.11@sha256:8774a73c351395b41d2ad0af4ddb4689007c67de3cd08bd9f43bb8a0e300690e"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.29.11","digest":"sha256:88d2d0e315a504d93fd4fb8847fd0f6b7f4469f41a6fc6047b3dc9654c56ab2c","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.29.11@sha256:88d2d0e315a504d93fd4fb8847fd0f6b7f4469f41a6fc6047b3dc9654c56ab2c"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.29.11","digest":"sha256:861739ecf924dd2db5e5fb652db2ad82aaafd1615623297ddabc8f41a36b2847","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.29.11@sha256:861739ecf924dd2db5e5fb652db2ad82aaafd1615623297ddabc8f41a36b2847"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.5.6","digest":"sha256:342cd624e1f179d91be2de7a146fc4f387092e62e6c8a47506d7932e113d2311","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.5.6@sha256:342cd624e1f179d91be2de7a146fc4f387092e62e6c8a47506d7932e113d2311"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:8735428c2d4e602f90781ba0c571c400e8ff93c7ee1508a75d71f87e34e415cc","pinned_image":"ghcr.io/github/gh-aw-node@sha256:8735428c2d4e602f90781ba0c571c400e8ff93c7ee1508a75d71f87e34e415cc"},{"image":"ghcr.io/github/github-mcp-server:v2.1.0","digest":"sha256:f6056fc10bfffcc8c81a6417a2e9ca12808647e8dd6049642a4feaadee0e0f8a","pinned_image":"ghcr.io/github/github-mcp-server:v2.1.0@sha256:f6056fc10bfffcc8c81a6417a2e9ca12808647e8dd6049642a4feaadee0e0f8a"}],"mcp_servers":[{"name":"github","tools":["get_commit","get_file_contents","get_latest_release","get_me","get_pull_request","get_pull_request_comments","get_pull_request_diff","get_pull_request_files","get_pull_request_review_comments","get_pull_request_reviews","get_pull_request_status","get_release_by_tag","get_tag","issue_read","list_branches","list_commits","list_issue_types","list_issues","list_pull_requests","list_releases","list_starred_repositories","list_tags","pull_request_read","search_code","search_issues","search_pull_requests","search_repositories"]},{"name":"safeoutputs","tools":["assign_to_agent","noop","report_incomplete","report_missing_data","report_missing_tool"]}],"threat_detection":{"mode":"enabled"},"admission":false,"agent_metadata":{"03cbf8931deff21d5116":{"name":"Agentic Workflows"}}} +# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"31f50d6a727054af2b4f2ae0aa733cbeafdbe8adeede62c949f29f49cf20301e","body_hash":"6003f42121074e067952f8eb1602d510b36dd6b2a41cde5b5c91dcbc7a08a09a","compiler_version":"v1.2.2","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.103"}} +# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_DEFAULT_OTLP_ENDPOINT","GH_AW_DEFAULT_OTLP_HEADERS","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"9000827ccba6bdab643e8b6fd33ac0654aef8333","version":"v8.0.2"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"949feb2413d6458794dcd2491c4babbbce0c15c1","version":"v7.1.0"},{"repo":"actions/upload-artifact","sha":"cf430e030ddbb5b0abf93d22962f4752f3646cd9","version":"v7.0.2"},{"repo":"github/gh-aw-actions/setup","sha":"53d0749e19424a918acd82b4d140264ce48f2f14","version":"v1.2.2"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.29.11","digest":"sha256:8774a73c351395b41d2ad0af4ddb4689007c67de3cd08bd9f43bb8a0e300690e","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.29.11@sha256:8774a73c351395b41d2ad0af4ddb4689007c67de3cd08bd9f43bb8a0e300690e"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.29.11","digest":"sha256:88d2d0e315a504d93fd4fb8847fd0f6b7f4469f41a6fc6047b3dc9654c56ab2c","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.29.11@sha256:88d2d0e315a504d93fd4fb8847fd0f6b7f4469f41a6fc6047b3dc9654c56ab2c"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.29.11","digest":"sha256:861739ecf924dd2db5e5fb652db2ad82aaafd1615623297ddabc8f41a36b2847","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.29.11@sha256:861739ecf924dd2db5e5fb652db2ad82aaafd1615623297ddabc8f41a36b2847"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.5.6","digest":"sha256:342cd624e1f179d91be2de7a146fc4f387092e62e6c8a47506d7932e113d2311","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.5.6@sha256:342cd624e1f179d91be2de7a146fc4f387092e62e6c8a47506d7932e113d2311"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:8735428c2d4e602f90781ba0c571c400e8ff93c7ee1508a75d71f87e34e415cc","pinned_image":"ghcr.io/github/gh-aw-node@sha256:8735428c2d4e602f90781ba0c571c400e8ff93c7ee1508a75d71f87e34e415cc"},{"image":"ghcr.io/github/github-mcp-server:v2.1.0","digest":"sha256:f6056fc10bfffcc8c81a6417a2e9ca12808647e8dd6049642a4feaadee0e0f8a","pinned_image":"ghcr.io/github/github-mcp-server:v2.1.0@sha256:f6056fc10bfffcc8c81a6417a2e9ca12808647e8dd6049642a4feaadee0e0f8a"}],"mcp_servers":[{"name":"github","tools":["get_commit","get_file_contents","get_latest_release","get_me","get_pull_request","get_pull_request_comments","get_pull_request_diff","get_pull_request_files","get_pull_request_review_comments","get_pull_request_reviews","get_pull_request_status","get_release_by_tag","get_tag","issue_read","list_branches","list_commits","list_issue_types","list_issues","list_pull_requests","list_releases","list_starred_repositories","list_tags","pull_request_read","search_code","search_issues","search_pull_requests","search_repositories"]},{"name":"safeoutputs","tools":["create_pull_request","noop","report_incomplete","report_missing_data","report_missing_tool"]}],"threat_detection":{"mode":"enabled"},"admission":false,"agent_metadata":{"03cbf8931deff21d5116":{"name":"Agentic Workflows"}}} # This file was automatically generated by gh-aw (v1.2.2). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md # # ___ _ _ @@ -23,13 +23,12 @@ # # For more information: https://github.github.com/gh-aw/introduction/overview/ # -# Automatically assigns Copilot coding agent to version update issues created -# by the check-worker-versions workflow. Copilot reads the issue body, updates -# the versions.env file, runs integration tests, and opens a PR. +# Applies version update issues created by the check-worker-versions workflow. +# The workflow updates the versions.env file, runs targeted integration tests, +# and opens a guarded draft PR. # # Secrets used: # - COPILOT_GITHUB_TOKEN -# - GH_AW_AGENT_TOKEN # - GH_AW_DEFAULT_OTLP_ENDPOINT # - GH_AW_DEFAULT_OTLP_HEADERS # - GH_AW_GITHUB_MCP_SERVER_TOKEN @@ -75,6 +74,10 @@ on: description: "Agent caller context (Reserved for Agentic Workflows)." required: false type: string + issue_number: + description: Worker update issue number + required: true + type: string # Jobs receive only their explicitly declared permissions. permissions: {} @@ -316,7 +319,7 @@ jobs: with: github-token: no-authentication script: | - const promptEnvironment = new Set(["GH_AW_ACTIONS_DIR","GH_AW_EXPR_76DF9333","GH_AW_EXPR_77C1A4D2","GH_AW_EXPR_7C248226","GH_AW_EXPR_C19C384F","GH_AW_GITHUB_ACTOR","GH_AW_GITHUB_REPOSITORY","GH_AW_GITHUB_RUN_ID","GH_AW_GITHUB_WORKSPACE","GH_AW_PROMPT","GH_AW_PROMPT_CONFIG","GH_AW_PROMPT_CONTENT_0000","GH_AW_PROMPT_CONTENT_0001","GH_AW_PROMPT_CONTENT_0002","GH_AW_PROMPT_CONTENT_0003","GH_AW_PROMPT_CONTENT_0004","GH_AW_SAFE_OUTPUTS","GH_AW_STEPS_SANITIZED_OUTPUTS_TEXT","GITHUB_ACTION","GITHUB_ACTOR","GITHUB_API_URL","GITHUB_EVENT_NAME","GITHUB_EVENT_PATH","GITHUB_GRAPHQL_URL","GITHUB_JOB","GITHUB_OUTPUT","GITHUB_REF","GITHUB_REPOSITORY","GITHUB_RUN_ATTEMPT","GITHUB_RUN_ID","GITHUB_RUN_NUMBER","GITHUB_SERVER_URL","GITHUB_SHA","GITHUB_STEP_SUMMARY","GITHUB_WORKFLOW","GITHUB_WORKSPACE","PATH","RUNNER_ARCH","RUNNER_OS","RUNNER_TEMP"]); + const promptEnvironment = new Set(["GH_AW_ACTIONS_DIR","GH_AW_EXPR_54492A5B","GH_AW_EXPR_76DF9333","GH_AW_EXPR_77C1A4D2","GH_AW_EXPR_7C248226","GH_AW_EXPR_C19C384F","GH_AW_GITHUB_ACTOR","GH_AW_GITHUB_REPOSITORY","GH_AW_GITHUB_RUN_ID","GH_AW_GITHUB_WORKSPACE","GH_AW_INPUTS_ISSUE_NUMBER","GH_AW_PROMPT","GH_AW_PROMPT_CONFIG","GH_AW_PROMPT_CONTENT_0000","GH_AW_PROMPT_CONTENT_0001","GH_AW_PROMPT_CONTENT_0002","GH_AW_PROMPT_CONTENT_0003","GH_AW_PROMPT_CONTENT_0004","GH_AW_SAFE_OUTPUTS","GH_AW_STEPS_SANITIZED_OUTPUTS_TEXT","GITHUB_ACTION","GITHUB_ACTOR","GITHUB_API_URL","GITHUB_EVENT_NAME","GITHUB_EVENT_PATH","GITHUB_GRAPHQL_URL","GITHUB_JOB","GITHUB_OUTPUT","GITHUB_REF","GITHUB_REPOSITORY","GITHUB_RUN_ATTEMPT","GITHUB_RUN_ID","GITHUB_RUN_NUMBER","GITHUB_SERVER_URL","GITHUB_SHA","GITHUB_STEP_SUMMARY","GITHUB_WORKFLOW","GITHUB_WORKSPACE","PATH","RUNNER_ARCH","RUNNER_OS","RUNNER_TEMP"]); for (const name of Object.keys(process.env)) { if (!promptEnvironment.has(name)) delete process.env[name]; } @@ -326,6 +329,7 @@ jobs: await main(core); env: GH_AW_ACTIONS_DIR: ${{ runner.temp }}/gh-aw/actions + GH_AW_EXPR_54492A5B: ${{ github.event.issue.number || inputs.issue_number }} GH_AW_EXPR_76DF9333: ${{ github.event.pull_request.number || (fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').item_type == 'pull_request' && fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').item_number) }} GH_AW_EXPR_77C1A4D2: ${{ github.event.comment.id || fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').comment_id }} GH_AW_EXPR_7C248226: ${{ github.event.issue.number || (fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').item_type == 'issue' && fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').item_number) }} @@ -334,17 +338,18 @@ jobs: GH_AW_GITHUB_REPOSITORY: ${{ github.repository }} GH_AW_GITHUB_RUN_ID: ${{ github.run_id }} GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }} + GH_AW_INPUTS_ISSUE_NUMBER: ${{ inputs.issue_number }} GH_AW_OTLP_ENDPOINTS: "" GH_AW_OTLP_IF_MISSING: "" GH_AW_OTLP_LOGS_ENABLED: "" GH_AW_OTLP_LOGS_MAX_BYTES: "" GH_AW_PROMPT: ${{ runner.temp }}/gh-aw/aw-prompts/prompt.txt - GH_AW_PROMPT_CONFIG: "{\"items\":[{\"content_env\":\"GH_AW_PROMPT_CONTENT_0000\"},{\"file\":\"xpia.md\"},{\"file\":\"temp_folder_prompt.md\"},{\"file\":\"markdown.md\"},{\"file\":\"safe_outputs_mcp_transport_prompt.md\"},{\"file\":\"safe_outputs_prompt.md\"},{\"content_env\":\"GH_AW_PROMPT_CONTENT_0001\"},{\"content_env\":\"GH_AW_PROMPT_CONTENT_0002\"},{\"file\":\"mcp_cli_tools_with_safeoutputs_prompt.md\"},{\"content_env\":\"GH_AW_PROMPT_CONTENT_0003\"},{\"file\":\"github_mcp_tools_with_safeoutputs_prompt.md\"},{\"content_env\":\"GH_AW_PROMPT_CONTENT_0004\"},{\"author_file\":\".github/workflows/worker-version-upgrade.md\"}],\"system_item_count\":12,\"author_expressions\":{\"steps.sanitized.outputs.text\":\"GH_AW_STEPS_SANITIZED_OUTPUTS_TEXT\"}}" + GH_AW_PROMPT_CONFIG: "{\"items\":[{\"content_env\":\"GH_AW_PROMPT_CONTENT_0000\"},{\"file\":\"xpia.md\"},{\"file\":\"temp_folder_prompt.md\"},{\"file\":\"markdown.md\"},{\"file\":\"safe_outputs_mcp_transport_prompt.md\"},{\"file\":\"safe_outputs_prompt.md\"},{\"content_env\":\"GH_AW_PROMPT_CONTENT_0001\"},{\"file\":\"safe_outputs_create_pull_request.md\"},{\"content_env\":\"GH_AW_PROMPT_CONTENT_0002\"},{\"file\":\"mcp_cli_tools_with_safeoutputs_prompt.md\"},{\"content_env\":\"GH_AW_PROMPT_CONTENT_0003\"},{\"file\":\"github_mcp_tools_with_safeoutputs_prompt.md\"},{\"content_env\":\"GH_AW_PROMPT_CONTENT_0004\"},{\"author_file\":\".github/workflows/worker-version-upgrade.md\"}],\"system_item_count\":13,\"author_expressions\":{\"github.event.issue.number || inputs.issue_number\":\"GH_AW_EXPR_54492A5B\",\"inputs.issue_number\":\"GH_AW_INPUTS_ISSUE_NUMBER\",\"steps.sanitized.outputs.text\":\"GH_AW_STEPS_SANITIZED_OUTPUTS_TEXT\"}}" GH_AW_PROMPT_CONTENT_0000: | GH_AW_PROMPT_CONTENT_0001: | - Tools: assign_to_agent, report_missing_tool, report_missing_data, noop(max:2) + Tools: create_pull_request, report_missing_tool, report_missing_data, noop(max:2) GH_AW_PROMPT_CONTENT_0002: | GH_AW_PROMPT_CONTENT_0003: |+ @@ -389,17 +394,18 @@ jobs: with: github-token: no-authentication script: | - const promptEnvironment = new Set(["GH_AW_ACTIONS_DIR","GH_AW_ENGINE_ID","GH_AW_EXPR_76DF9333","GH_AW_EXPR_77C1A4D2","GH_AW_EXPR_7C248226","GH_AW_EXPR_C19C384F","GH_AW_GITHUB_ACTOR","GH_AW_GITHUB_REPOSITORY","GH_AW_GITHUB_RUN_ID","GH_AW_GITHUB_WORKSPACE","GH_AW_MCP_CLI_SERVERS_LIST","GH_AW_NEEDS_PRE_ACTIVATION_OUTPUTS_ACTIVATED","GH_AW_PROMPT","GH_AW_SKILL_DIR","GH_AW_SKILL_EXT","GH_AW_STEPS_SANITIZED_OUTPUTS_TEXT","GH_AW_SUB_AGENT_DIR","GH_AW_SUB_AGENT_EXT","GITHUB_ACTION","GITHUB_ACTOR","GITHUB_API_URL","GITHUB_EVENT_NAME","GITHUB_EVENT_PATH","GITHUB_GRAPHQL_URL","GITHUB_JOB","GITHUB_OUTPUT","GITHUB_REF","GITHUB_REPOSITORY","GITHUB_RUN_ATTEMPT","GITHUB_RUN_ID","GITHUB_RUN_NUMBER","GITHUB_SERVER_URL","GITHUB_SHA","GITHUB_STEP_SUMMARY","GITHUB_WORKFLOW","GITHUB_WORKSPACE","PATH","RUNNER_ARCH","RUNNER_OS","RUNNER_TEMP"]); + const promptEnvironment = new Set(["GH_AW_ACTIONS_DIR","GH_AW_ENGINE_ID","GH_AW_EXPR_54492A5B","GH_AW_EXPR_76DF9333","GH_AW_EXPR_77C1A4D2","GH_AW_EXPR_7C248226","GH_AW_EXPR_C19C384F","GH_AW_GITHUB_ACTOR","GH_AW_GITHUB_REPOSITORY","GH_AW_GITHUB_RUN_ID","GH_AW_GITHUB_WORKSPACE","GH_AW_INPUTS_ISSUE_NUMBER","GH_AW_MCP_CLI_SERVERS_LIST","GH_AW_NEEDS_PRE_ACTIVATION_OUTPUTS_ACTIVATED","GH_AW_PROMPT","GH_AW_SKILL_DIR","GH_AW_SKILL_EXT","GH_AW_STEPS_SANITIZED_OUTPUTS_TEXT","GH_AW_SUB_AGENT_DIR","GH_AW_SUB_AGENT_EXT","GITHUB_ACTION","GITHUB_ACTOR","GITHUB_API_URL","GITHUB_EVENT_NAME","GITHUB_EVENT_PATH","GITHUB_GRAPHQL_URL","GITHUB_JOB","GITHUB_OUTPUT","GITHUB_REF","GITHUB_REPOSITORY","GITHUB_RUN_ATTEMPT","GITHUB_RUN_ID","GITHUB_RUN_NUMBER","GITHUB_SERVER_URL","GITHUB_SHA","GITHUB_STEP_SUMMARY","GITHUB_WORKFLOW","GITHUB_WORKSPACE","PATH","RUNNER_ARCH","RUNNER_OS","RUNNER_TEMP"]); for (const name of Object.keys(process.env)) { if (!promptEnvironment.has(name)) delete process.env[name]; } global.core = core; global.context = context; const { main } = require(process.env.GH_AW_ACTIONS_DIR + '/interpolate_prompt.cjs'); - await main({ authorExpressions: {"needs.pre_activation.outputs.activated":"GH_AW_NEEDS_PRE_ACTIVATION_OUTPUTS_ACTIVATED","steps.sanitized.outputs.text":"GH_AW_STEPS_SANITIZED_OUTPUTS_TEXT"} }); + await main({ authorExpressions: {"github.event.issue.number || inputs.issue_number":"GH_AW_EXPR_54492A5B","inputs.issue_number":"GH_AW_INPUTS_ISSUE_NUMBER","needs.pre_activation.outputs.activated":"GH_AW_NEEDS_PRE_ACTIVATION_OUTPUTS_ACTIVATED","steps.sanitized.outputs.text":"GH_AW_STEPS_SANITIZED_OUTPUTS_TEXT"} }); env: GH_AW_ACTIONS_DIR: ${{ runner.temp }}/gh-aw/actions GH_AW_ENGINE_ID: copilot + GH_AW_EXPR_54492A5B: ${{ github.event.issue.number || inputs.issue_number }} GH_AW_EXPR_76DF9333: ${{ github.event.pull_request.number || (fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').item_type == 'pull_request' && fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').item_number) }} GH_AW_EXPR_77C1A4D2: ${{ github.event.comment.id || fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').comment_id }} GH_AW_EXPR_7C248226: ${{ github.event.issue.number || (fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').item_type == 'issue' && fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').item_number) }} @@ -408,6 +414,7 @@ jobs: GH_AW_GITHUB_REPOSITORY: ${{ github.repository }} GH_AW_GITHUB_RUN_ID: ${{ github.run_id }} GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }} + GH_AW_INPUTS_ISSUE_NUMBER: ${{ inputs.issue_number }} GH_AW_MCP_CLI_SERVERS_LIST: |- - `github` — run `github --help` to see available tools - `safeoutputs` — run `safeoutputs --help` to see available tools @@ -432,7 +439,7 @@ jobs: with: github-token: no-authentication script: | - const promptEnvironment = new Set(["GH_AW_ACTIONS_DIR","GH_AW_EXPR_76DF9333","GH_AW_EXPR_77C1A4D2","GH_AW_EXPR_7C248226","GH_AW_EXPR_C19C384F","GH_AW_GITHUB_ACTOR","GH_AW_GITHUB_REPOSITORY","GH_AW_GITHUB_RUN_ID","GH_AW_GITHUB_WORKSPACE","GH_AW_MCP_CLI_SERVERS_LIST","GH_AW_NEEDS_PRE_ACTIVATION_OUTPUTS_ACTIVATED","GH_AW_PROMPT","GH_AW_STEPS_SANITIZED_OUTPUTS_TEXT","GITHUB_ACTION","GITHUB_ACTOR","GITHUB_API_URL","GITHUB_EVENT_NAME","GITHUB_EVENT_PATH","GITHUB_GRAPHQL_URL","GITHUB_JOB","GITHUB_OUTPUT","GITHUB_REF","GITHUB_REPOSITORY","GITHUB_RUN_ATTEMPT","GITHUB_RUN_ID","GITHUB_RUN_NUMBER","GITHUB_SERVER_URL","GITHUB_SHA","GITHUB_STEP_SUMMARY","GITHUB_WORKFLOW","GITHUB_WORKSPACE","PATH","RUNNER_ARCH","RUNNER_OS","RUNNER_TEMP"]); + const promptEnvironment = new Set(["GH_AW_ACTIONS_DIR","GH_AW_EXPR_54492A5B","GH_AW_EXPR_76DF9333","GH_AW_EXPR_77C1A4D2","GH_AW_EXPR_7C248226","GH_AW_EXPR_C19C384F","GH_AW_GITHUB_ACTOR","GH_AW_GITHUB_REPOSITORY","GH_AW_GITHUB_RUN_ID","GH_AW_GITHUB_WORKSPACE","GH_AW_INPUTS_ISSUE_NUMBER","GH_AW_MCP_CLI_SERVERS_LIST","GH_AW_NEEDS_PRE_ACTIVATION_OUTPUTS_ACTIVATED","GH_AW_PROMPT","GH_AW_STEPS_SANITIZED_OUTPUTS_TEXT","GITHUB_ACTION","GITHUB_ACTOR","GITHUB_API_URL","GITHUB_EVENT_NAME","GITHUB_EVENT_PATH","GITHUB_GRAPHQL_URL","GITHUB_JOB","GITHUB_OUTPUT","GITHUB_REF","GITHUB_REPOSITORY","GITHUB_RUN_ATTEMPT","GITHUB_RUN_ID","GITHUB_RUN_NUMBER","GITHUB_SERVER_URL","GITHUB_SHA","GITHUB_STEP_SUMMARY","GITHUB_WORKFLOW","GITHUB_WORKSPACE","PATH","RUNNER_ARCH","RUNNER_OS","RUNNER_TEMP"]); for (const name of Object.keys(process.env)) { if (!promptEnvironment.has(name)) delete process.env[name]; } @@ -445,6 +452,7 @@ jobs: return await substitutePlaceholders({ file: process.env.GH_AW_PROMPT, substitutions: { + GH_AW_EXPR_54492A5B: process.env.GH_AW_EXPR_54492A5B, GH_AW_EXPR_76DF9333: process.env.GH_AW_EXPR_76DF9333, GH_AW_EXPR_77C1A4D2: process.env.GH_AW_EXPR_77C1A4D2, GH_AW_EXPR_7C248226: process.env.GH_AW_EXPR_7C248226, @@ -453,6 +461,7 @@ jobs: GH_AW_GITHUB_REPOSITORY: process.env.GH_AW_GITHUB_REPOSITORY, GH_AW_GITHUB_RUN_ID: process.env.GH_AW_GITHUB_RUN_ID, GH_AW_GITHUB_WORKSPACE: process.env.GH_AW_GITHUB_WORKSPACE, + GH_AW_INPUTS_ISSUE_NUMBER: process.env.GH_AW_INPUTS_ISSUE_NUMBER, GH_AW_MCP_CLI_SERVERS_LIST: process.env.GH_AW_MCP_CLI_SERVERS_LIST, GH_AW_NEEDS_PRE_ACTIVATION_OUTPUTS_ACTIVATED: process.env.GH_AW_NEEDS_PRE_ACTIVATION_OUTPUTS_ACTIVATED, GH_AW_STEPS_SANITIZED_OUTPUTS_TEXT: process.env.GH_AW_STEPS_SANITIZED_OUTPUTS_TEXT @@ -460,6 +469,7 @@ jobs: }); env: GH_AW_ACTIONS_DIR: ${{ runner.temp }}/gh-aw/actions + GH_AW_EXPR_54492A5B: ${{ github.event.issue.number || inputs.issue_number }} GH_AW_EXPR_76DF9333: ${{ github.event.pull_request.number || (fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').item_type == 'pull_request' && fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').item_number) }} GH_AW_EXPR_77C1A4D2: ${{ github.event.comment.id || fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').comment_id }} GH_AW_EXPR_7C248226: ${{ github.event.issue.number || (fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').item_type == 'issue' && fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').item_number) }} @@ -468,6 +478,7 @@ jobs: GH_AW_GITHUB_REPOSITORY: ${{ github.repository }} GH_AW_GITHUB_RUN_ID: ${{ github.run_id }} GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }} + GH_AW_INPUTS_ISSUE_NUMBER: ${{ inputs.issue_number }} GH_AW_MCP_CLI_SERVERS_LIST: |- - `github` — run `github --help` to see available tools - `safeoutputs` — run `safeoutputs --help` to see available tools @@ -740,7 +751,7 @@ jobs: env: GH_AW_FILE_ROOT: "${{ runner.temp }}/gh-aw" GH_AW_FILE_CONFIG: "{\"files\":[{\"path\":\"safeoutputs/config.json\",\"content_env\":\"GH_AW_SAFE_OUTPUTS_CONFIG\"}]}" - GH_AW_SAFE_OUTPUTS_CONFIG: "{\"assign_to_agent\":{\"max\":1,\"name\":\"copilot\",\"target\":\"triggering\"},\"create_report_incomplete_issue\":{},\"noop\":{\"max\":2,\"report-as-issue\":\"false\"},\"report_incomplete\":{},\"report_missing_data\":{},\"report_missing_tool\":{}}" + GH_AW_SAFE_OUTPUTS_CONFIG: "{\"create_pull_request\":{\"allowed_files\":[\"apps/workers/coder-acp-copilot/versions.env\",\"apps/workers/coder-acp-copilot/src/acp-client.ts\",\"apps/workers/coder-acp-claude-code/versions.env\",\"apps/workers/coder-acp-claude-code/src/acp-client.ts\"],\"base_branch\":\"main\",\"draft\":true,\"max\":1,\"max_patch_files\":100,\"max_patch_size\":4096,\"protect_top_level_dot_folders\":true,\"protected_files\":[\"package.json\",\"bun.lockb\",\"bunfig.toml\",\"deno.json\",\"deno.jsonc\",\"deno.lock\",\"global.json\",\"NuGet.Config\",\"Directory.Packages.props\",\"mix.exs\",\"mix.lock\",\"go.mod\",\"go.sum\",\"stack.yaml\",\"stack.yaml.lock\",\"pom.xml\",\"build.gradle\",\"build.gradle.kts\",\"settings.gradle\",\"settings.gradle.kts\",\"gradle.properties\",\"package-lock.json\",\"yarn.lock\",\"pnpm-lock.yaml\",\"npm-shrinkwrap.json\",\"requirements.txt\",\"Pipfile\",\"Pipfile.lock\",\"pyproject.toml\",\"setup.py\",\"setup.cfg\",\"Gemfile\",\"Gemfile.lock\",\"uv.lock\",\"CODEOWNERS\",\"DESIGN.md\",\"README.md\",\"CONTRIBUTING.md\",\"SECURITY.md\",\"CODE_OF_CONDUCT.md\",\"AGENTS.md\"],\"protected_files_policy\":\"request-review\"},\"create_report_incomplete_issue\":{},\"noop\":{\"max\":2,\"report-as-issue\":\"false\"},\"report_incomplete\":{},\"report_missing_data\":{},\"report_missing_tool\":{}}" with: script: | const path = require('path'); @@ -754,55 +765,71 @@ jobs: GH_AW_TOOLS_META_JSON: | { "description_suffixes": { - "assign_to_agent": " CONSTRAINTS: Maximum 1 issue(s) can be assigned to agent." + "create_pull_request": " CONSTRAINTS: Maximum 1 pull request(s) can be created. PRs will be created as drafts." }, "repo_params": {}, "dynamic_tools": [] } GH_AW_VALIDATION_JSON: | { - "assign_to_agent": { + "create_pull_request": { "defaultMax": 1, "fields": { - "agent": { + "base": { "type": "string", "sanitize": true, "maxLength": 128 }, - "confidence": { + "body": { + "required": true, "type": "string", - "enum": [ - "LOW", - "MEDIUM", - "HIGH" - ], - "x-strip-on-error": true + "sanitize": true, + "maxLength": 65000 }, - "issue_number": { - "issueNumberOrTemporaryId": true + "branch": { + "required": true, + "type": "string", + "sanitize": true, + "maxLength": 256 }, - "pull_number": { - "optionalPositiveInteger": true + "dependencies": { + "type": "array", + "itemType": "string", + "itemSanitize": true, + "itemMaxLength": 256 }, - "pull_request_repo": { + "draft": { + "type": "boolean" + }, + "labels": { + "type": "array", + "itemType": "string", + "itemSanitize": true, + "itemMaxLength": 128 + }, + "repo": { "type": "string", "maxLength": 256 }, - "rationale": { + "stack_position": { + "optionalPositiveInteger": true + }, + "stack_root": { "type": "string", "sanitize": true, - "maxLength": 280, - "x-strip-on-error": true + "maxLength": 256 }, - "repo": { + "temporary_id": { "type": "string", - "maxLength": 256 + "pattern": "^#?aw_[A-Za-z0-9_]{3,12}$" }, - "suggest": { - "type": "boolean" + "title": { + "required": true, + "type": "string", + "sanitize": true, + "maxLength": 128 } - }, - "customValidation": "requiresOneOf:issue_number,pull_number" + } }, "noop": { "defaultMax": 2, @@ -1451,10 +1478,11 @@ jobs: permissions: actions: read # Read workflow runs and artifacts for workflow context. checks: read # Read check runs for workflow context. + contents: write # Create or update repository contents. issues: write # Create or update issues and comments. - pull-requests: read # Read pull requests and review comments for workflow context. + pull-requests: write # Create or update pull requests and review comments. concurrency: - group: "gh-aw-conclusion-worker-version-upgrade" + group: "gh-aw-conclusion-worker-version-upgrade-${{ github.event.issue.number || inputs.issue_number || github.run_id }}" cancel-in-progress: false queue: max env: @@ -1651,8 +1679,8 @@ jobs: GH_AW_MISSING_MODEL_PRICING_MODEL_NAME: ${{ needs.agent.outputs.missing_model_pricing_model_name }} GH_AW_SHELL_EXPANSION_GUARD_REJECTED: ${{ needs.agent.outputs.shell_expansion_guard_rejected }} GH_AW_ENGINE_API_HOSTS: "api.enterprise.githubcopilot.com,api.githubcopilot.com,api.business.githubcopilot.com,api.individual.githubcopilot.com" - GH_AW_ASSIGNMENT_ERRORS: ${{ needs.safe_outputs.outputs.assign_to_agent_assignment_errors }} - GH_AW_ASSIGNMENT_ERROR_COUNT: ${{ needs.safe_outputs.outputs.assign_to_agent_assignment_error_count }} + GH_AW_CODE_PUSH_FAILURE_ERRORS: ${{ needs.safe_outputs.outputs.code_push_failure_errors }} + GH_AW_CODE_PUSH_FAILURE_COUNT: ${{ needs.safe_outputs.outputs.code_push_failure_count }} GH_AW_LOCKDOWN_CHECK_FAILED: ${{ needs.activation.outputs.lockdown_check_failed }} GH_AW_OAUTH_TOKEN_CHECK_FAILED: ${{ needs.activation.outputs.oauth_token_check_failed }} GH_AW_STALE_LOCK_FILE_FAILED: ${{ needs.activation.outputs.stale_lock_file_failed }} @@ -1914,7 +1942,7 @@ jobs: uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: WORKFLOW_NAME: "Worker Version Upgrade" - WORKFLOW_DESCRIPTION: "Automatically assigns Copilot coding agent to version update issues created\nby the check-worker-versions workflow. Copilot reads the issue body, updates\nthe versions.env file, runs integration tests, and opens a PR." + WORKFLOW_DESCRIPTION: "Applies version update issues created by the check-worker-versions workflow.\nThe workflow updates the versions.env file, runs targeted integration tests,\nand opens a guarded draft PR." HAS_PATCH: ${{ needs.agent.outputs.has_patch }} GH_AW_DETECTION_CONTINUE_ON_ERROR: "true" GH_AW_DETECTION_SKIP_PROMPT_SUMMARY: "true" @@ -1989,7 +2017,7 @@ jobs: RUNNER_TEMP: ${{ runner.temp }} TRACEPARENT: ${{ env.GITHUB_AW_OTEL_TRACE_ID != '' && env.GITHUB_AW_OTEL_PARENT_SPAN_ID != '' && format('00-{0}-{1}-01', env.GITHUB_AW_OTEL_TRACE_ID, env.GITHUB_AW_OTEL_PARENT_SPAN_ID) || '' }} WORKFLOW_NAME: "Worker Version Upgrade" - WORKFLOW_DESCRIPTION: "Automatically assigns Copilot coding agent to version update issues created\nby the check-worker-versions workflow. Copilot reads the issue body, updates\nthe versions.env file, runs integration tests, and opens a PR." + WORKFLOW_DESCRIPTION: "Applies version update issues created by the check-worker-versions workflow.\nThe workflow updates the versions.env file, runs targeted integration tests,\nand opens a guarded draft PR." HAS_PATCH: ${{ needs.agent.outputs.has_patch }} GH_AW_DETECTION_CONTINUE_ON_ERROR: "true" GH_AW_DETECTION_INPUT_DIR: "/tmp/gh-aw/threat-detection-inputs" @@ -2216,11 +2244,13 @@ jobs: - agent - detection if: (!cancelled()) && needs.agent.result != 'skipped' && needs.detection.result == 'success' - runs-on: ubuntu-slim + runs-on: ubuntu-latest # Safe-output code publication checks out repository files; ubuntu-slim is limited to 15 minutes. # Permissions for the safe_outputs job (workflow permissions default to none). permissions: + contents: write # Create or update repository contents. issues: write # Create or update issues and comments. - timeout-minutes: 15 + pull-requests: write # Create or update pull requests and review comments. + timeout-minutes: 45 env: GH_AW_AGENT_AIC: ${{ needs.agent.outputs.aic }} GH_AW_AIC: ${{ needs.agent.outputs.aic }} @@ -2242,13 +2272,13 @@ jobs: GH_AW_WORKFLOW_NAME: "Worker Version Upgrade" GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/worker-version-upgrade.md" outputs: - assign_to_agent_assigned: ${{ steps.process_safe_outputs.outputs.assign_to_agent_assigned }} - assign_to_agent_assignment_error_count: ${{ steps.process_safe_outputs.outputs.assign_to_agent_assignment_error_count }} - assign_to_agent_assignment_errors: ${{ steps.process_safe_outputs.outputs.assign_to_agent_assignment_errors }} + activation_comment_links: ${{ steps.process_safe_outputs.outputs.activation_comment_links }} code_push_failure_count: ${{ steps.process_safe_outputs.outputs.code_push_failure_count }} code_push_failure_errors: ${{ steps.process_safe_outputs.outputs.code_push_failure_errors }} create_discussion_error_count: ${{ steps.process_safe_outputs.outputs.create_discussion_error_count }} create_discussion_errors: ${{ steps.process_safe_outputs.outputs.create_discussion_errors }} + created_pr_number: ${{ steps.process_safe_outputs.outputs.created_pr_number }} + created_pr_url: ${{ steps.process_safe_outputs.outputs.created_pr_url }} process_safe_outputs_items_applied: ${{ steps.process_safe_outputs.outputs.items_applied }} process_safe_outputs_items_cancelled: ${{ steps.process_safe_outputs.outputs.items_cancelled }} process_safe_outputs_items_deferred: ${{ steps.process_safe_outputs.outputs.items_deferred }} @@ -2293,6 +2323,25 @@ jobs: if [ -f "/tmp/gh-aw/agent_output.json" ]; then echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT" fi + - name: Download patch artifact + continue-on-error: true + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: agent + path: /tmp/gh-aw/ + - name: Checkout repository (gh-aw default) + if: (!cancelled()) && needs.agent.result != 'skipped' && contains(needs.agent.outputs.output_types, 'create_pull_request') + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: true + token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + - name: Configure Git credentials + if: (!cancelled()) && needs.agent.result != 'skipped' && contains(needs.agent.outputs.output_types, 'create_pull_request') + env: + GH_AW_GIT_REPOSITORY: ${{ github.repository }} + GITHUB_SERVER_URL: ${{ github.server_url }} + GIT_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + run: bash "${RUNNER_TEMP}/gh-aw/actions/configure_git_credentials.sh" - name: Configure GH_HOST for enterprise compatibility id: ghes-host-config shell: bash @@ -2313,9 +2362,7 @@ jobs: GH_AW_ALLOWED_DOMAINS: "archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,s.symcb.com,s.symcd.com,security.ubuntu.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com" GITHUB_SERVER_URL: ${{ github.server_url }} GITHUB_API_URL: ${{ github.api_url }} - GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"assign_to_agent\":{\"github-token\":\"${{ secrets.GH_AW_AGENT_TOKEN }}\",\"max\":1,\"name\":\"copilot\",\"target\":\"triggering\"},\"create_report_incomplete_issue\":{},\"noop\":{\"max\":2,\"report-as-issue\":\"false\"},\"report_incomplete\":{},\"report_missing_data\":{},\"report_missing_tool\":{}}" - GH_AW_ASSIGN_TO_AGENT_TOKEN: ${{ secrets.GH_AW_AGENT_TOKEN }} - GH_AW_ASSIGN_TO_AGENT_TOKEN_SOURCE: "configured" + GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"create_pull_request\":{\"allowed_files\":[\"apps/workers/coder-acp-copilot/versions.env\",\"apps/workers/coder-acp-copilot/src/acp-client.ts\",\"apps/workers/coder-acp-claude-code/versions.env\",\"apps/workers/coder-acp-claude-code/src/acp-client.ts\"],\"base_branch\":\"main\",\"draft\":true,\"max\":1,\"max_patch_files\":100,\"max_patch_size\":4096,\"protect_top_level_dot_folders\":true,\"protected_files\":[\"package.json\",\"bun.lockb\",\"bunfig.toml\",\"deno.json\",\"deno.jsonc\",\"deno.lock\",\"global.json\",\"NuGet.Config\",\"Directory.Packages.props\",\"mix.exs\",\"mix.lock\",\"go.mod\",\"go.sum\",\"stack.yaml\",\"stack.yaml.lock\",\"pom.xml\",\"build.gradle\",\"build.gradle.kts\",\"settings.gradle\",\"settings.gradle.kts\",\"gradle.properties\",\"package-lock.json\",\"yarn.lock\",\"pnpm-lock.yaml\",\"npm-shrinkwrap.json\",\"requirements.txt\",\"Pipfile\",\"Pipfile.lock\",\"pyproject.toml\",\"setup.py\",\"setup.cfg\",\"Gemfile\",\"Gemfile.lock\",\"uv.lock\",\"CODEOWNERS\",\"DESIGN.md\",\"README.md\",\"CONTRIBUTING.md\",\"SECURITY.md\",\"CODE_OF_CONDUCT.md\",\"AGENTS.md\"],\"protected_files_policy\":\"request-review\"},\"create_report_incomplete_issue\":{},\"noop\":{\"max\":2,\"report-as-issue\":\"false\"},\"report_incomplete\":{},\"report_missing_data\":{},\"report_missing_tool\":{}}" GH_AW_GITHUB_TOKEN_SOURCE: ${{ secrets.GH_AW_GITHUB_TOKEN != '' && 'pat' || 'github_actions' }} with: github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/worker-version-upgrade.md b/.github/workflows/worker-version-upgrade.md index 1fa463a6..138a1357 100644 --- a/.github/workflows/worker-version-upgrade.md +++ b/.github/workflows/worker-version-upgrade.md @@ -1,14 +1,19 @@ --- description: | - Automatically assigns Copilot coding agent to version update issues created - by the check-worker-versions workflow. Copilot reads the issue body, updates - the versions.env file, runs integration tests, and opens a PR. + Applies version update issues created by the check-worker-versions workflow. + The workflow updates the versions.env file, runs targeted integration tests, + and opens a guarded draft PR. on: issues: types: [opened, edited] names: ["type: worker-update"] workflow_dispatch: + inputs: + issue_number: + description: Worker update issue number + required: true + type: string # Workaround: gh-aw compiler bug — `names:` is commented out in the lock file # and no label condition is injected. Use on.steps to enforce label filtering. steps: @@ -22,6 +27,9 @@ on: if: github.event_name == 'workflow_dispatch' || needs.pre_activation.outputs.label_check_result == 'success' +concurrency: + job-discriminator: ${{ github.event.issue.number || inputs.issue_number || github.run_id }} + permissions: contents: read issues: read @@ -29,20 +37,25 @@ permissions: network: defaults safe-outputs: - assign-to-agent: - name: copilot - target: "triggering" - github-token: ${{ secrets.GH_AW_AGENT_TOKEN }} + create-pull-request: + draft: true + base-branch: main + github-token-for-extra-empty-commit: none + allowed-files: + - apps/workers/coder-acp-copilot/versions.env + - apps/workers/coder-acp-copilot/src/acp-client.ts + - apps/workers/coder-acp-claude-code/versions.env + - apps/workers/coder-acp-claude-code/src/acp-client.ts --- # Worker Version Upgrade When a version update issue is created by the check-worker-versions workflow, -apply the update and open a pull request. +apply the requested update and open a draft pull request. ## Context -Analyze the triggering issue: "${{ steps.sanitized.outputs.text }}" +Analyze issue #${{ github.event.issue.number || inputs.issue_number }}: "${{ steps.sanitized.outputs.text }}" The issue was created by an automated version checker. It contains a structured body with: @@ -67,9 +80,16 @@ body with: `npx vitest run --config vitest.integration.config.ts --passWithNoTests apps/workers//` Derive `` from the `versions.env` path parsed in step 1. -5. **If tests fail** — Read the error output, identify the root cause, and - attempt to fix it. Common issues include API changes in new versions that - require code updates in the worker source files listed below. +5. **Handle test failures** — Read the error output, identify the root cause, + and attempt to fix it. Only edit the worker's allowed source file listed + below. If the hosted agent environment cannot provide Docker or another + required integration-test dependency, continue with a draft PR and clearly + state which test could not run and why. + +6. **Create the draft PR** — Call `create_pull_request` from the `safeoutputs` + MCP server exactly once. Use a concise version-update title. Include the + changed version, test result, and `Fixes #${{ github.event.issue.number || inputs.issue_number }}` + in the body. ## Workers and their version files @@ -80,13 +100,13 @@ body with: ## Allowed source files for test fixes -If integration tests fail after a version update, only edit files in these paths: +If integration tests fail after a version update, only edit the matching file: - **coder-acp-copilot**: `apps/workers/coder-acp-copilot/src/acp-client.ts` - **coder-acp-claude-code**: `apps/workers/coder-acp-claude-code/src/acp-client.ts` ## Constraints -- Only modify the `versions.env` file and the allowed source files listed above +- Only modify the matching `versions.env` file and allowed source file - Do not modify Dockerfiles, docker-compose files, or build scripts - The `versions.env` file is the single source of truth for version pinning