From 84f966427ccb25858de5b5ad06fc1e47d4d75712 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Feb 2026 07:00:21 +0000 Subject: [PATCH 1/2] Initial plan From e54bc3f4284128b7a8399b8b7de695d1fb282ca5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Feb 2026 07:03:53 +0000 Subject: [PATCH 2/2] Change code-simplifier to create GitHub issues instead of discussions and set schedule to run once daily at midnight UTC Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> --- .github/workflows/code-simplifier.lock.yml | 56 ++++++++++++++-------- .github/workflows/code-simplifier.md | 30 ++++++------ 2 files changed, 50 insertions(+), 36 deletions(-) diff --git a/.github/workflows/code-simplifier.lock.yml b/.github/workflows/code-simplifier.lock.yml index b8aa4275f..8583ef78e 100644 --- a/.github/workflows/code-simplifier.lock.yml +++ b/.github/workflows/code-simplifier.lock.yml @@ -23,13 +23,12 @@ # # Source: github/gh-aw/.github/workflows/code-simplifier.md@76d37d925abd44fee97379206f105b74b91a285b # -# frontmatter-hash: 524bb76c31408e5f0f29cecabd86aedd3f216a21307f8504a8a48d99e7824284 +# frontmatter-hash: 1c0c4c191cbfebf7496722aa00bc84f536fa50dd93a9071c938661172f1d7f11 name: "Code Simplifier" "on": schedule: - - cron: "7 16 * * *" - # Friendly format: daily (scattered) + - cron: "0 0 * * *" # skip-if-match: is:pr is:open in:title "[code-simplifier]" # Skip-if-match processed as search check in pre-activation job workflow_dispatch: @@ -71,7 +70,6 @@ jobs: runs-on: ubuntu-latest permissions: contents: read - discussions: read issues: read pull-requests: read concurrency: @@ -159,25 +157,39 @@ jobs: mkdir -p /tmp/gh-aw/safeoutputs mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs cat > /opt/gh-aw/safeoutputs/config.json << 'EOF' - {"create_discussion":{"expires":168,"max":1},"missing_data":{},"missing_tool":{},"noop":{"max":1}} + {"create_issue":{"max":1},"missing_data":{},"missing_tool":{},"noop":{"max":1}} EOF cat > /opt/gh-aw/safeoutputs/tools.json << 'EOF' [ { - "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 1 discussion(s) can be created. Title will be prefixed with \"[code-simplifier] \". Discussions will be created in category \"general\".", + "description": "Create a new GitHub issue for tracking bugs, feature requests, or tasks. Use this for actionable work items that need assignment, labeling, and status tracking. For reports, announcements, or status updates that don't require task tracking, use create_discussion instead. CONSTRAINTS: Maximum 1 issue(s) can be created. Title will be prefixed with \"[code-simplifier] \". Labels [refactoring code-quality automation] will be automatically added.", "inputSchema": { "additionalProperties": false, "properties": { "body": { - "description": "Discussion content in Markdown. Do NOT repeat the title as a heading since it already appears as the discussion's h1. Include all relevant context, findings, or questions.", + "description": "Detailed issue description in Markdown. Do NOT repeat the title as a heading since it already appears as the issue's h1. Include context, reproduction steps, or acceptance criteria as appropriate.", "type": "string" }, - "category": { - "description": "Discussion category by name (e.g., 'General'), slug (e.g., 'general'), or ID. If omitted, uses the first available category. Category must exist in the repository.", + "labels": { + "description": "Labels to categorize the issue (e.g., 'bug', 'enhancement'). Labels must exist in the repository.", + "items": { + "type": "string" + }, + "type": "array" + }, + "parent": { + "description": "Parent issue number for creating sub-issues. This is the numeric ID from the GitHub URL (e.g., 42 in github.com/owner/repo/issues/42). Can also be a temporary_id (e.g., 'aw_abc123def456') from a previously created issue in the same workflow run.", + "type": [ + "number", + "string" + ] + }, + "temporary_id": { + "description": "Unique temporary identifier for referencing this issue before it's created. Format: 'aw_' followed by 12 hex characters (e.g., 'aw_abc123def456'). Use '#aw_ID' in body text to reference other issues by their temporary_id; these are replaced with actual issue numbers after creation.", "type": "string" }, "title": { - "description": "Concise discussion title summarizing the topic. The title appears as the main heading, so keep it brief and descriptive.", + "description": "Concise issue title summarizing the bug, feature, or task. The title appears as the main heading, so keep it brief and descriptive.", "type": "string" } }, @@ -187,7 +199,7 @@ jobs: ], "type": "object" }, - "name": "create_discussion" + "name": "create_issue" }, { "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.", @@ -262,7 +274,7 @@ jobs: EOF cat > /opt/gh-aw/safeoutputs/validation.json << 'EOF' { - "create_discussion": { + "create_issue": { "defaultMax": 1, "fields": { "body": { @@ -271,15 +283,22 @@ jobs: "sanitize": true, "maxLength": 65000 }, - "category": { - "type": "string", - "sanitize": true, - "maxLength": 128 + "labels": { + "type": "array", + "itemType": "string", + "itemSanitize": true, + "itemMaxLength": 128 + }, + "parent": { + "issueOrPRNumber": true }, "repo": { "type": "string", "maxLength": 256 }, + "temporary_id": { + "type": "string" + }, "title": { "required": true, "type": "string", @@ -820,8 +839,6 @@ jobs: GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }} GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.agent.outputs.secret_verification_result }} GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }} - GH_AW_CREATE_DISCUSSION_ERRORS: ${{ needs.safe_outputs.outputs.create_discussion_errors }} - GH_AW_CREATE_DISCUSSION_ERROR_COUNT: ${{ needs.safe_outputs.outputs.create_discussion_error_count }} with: github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} script: | @@ -993,7 +1010,6 @@ jobs: runs-on: ubuntu-slim permissions: contents: read - discussions: write issues: write timeout-minutes: 15 env: @@ -1029,7 +1045,7 @@ jobs: uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: GH_AW_AGENT_OUTPUT: ${{ env.GH_AW_AGENT_OUTPUT }} - GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"create_discussion\":{\"category\":\"general\",\"expires\":168,\"fallback_to_issue\":true,\"labels\":[\"refactoring\",\"code-quality\",\"automation\"],\"max\":1,\"title_prefix\":\"[code-simplifier] \"},\"missing_data\":{},\"missing_tool\":{}}" + GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"create_issue\":{\"labels\":[\"refactoring\",\"code-quality\",\"automation\"],\"max\":1,\"title_prefix\":\"[code-simplifier] \"},\"missing_data\":{},\"missing_tool\":{}}" with: github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} script: | diff --git a/.github/workflows/code-simplifier.md b/.github/workflows/code-simplifier.md index aa02ecdcd..5acd06de2 100644 --- a/.github/workflows/code-simplifier.md +++ b/.github/workflows/code-simplifier.md @@ -1,15 +1,14 @@ --- on: - schedule: daily + schedule: + - cron: "0 0 * * *" skip-if-match: is:pr is:open in:title "[code-simplifier]" permissions: contents: read issues: read pull-requests: read - discussions: read safe-outputs: - create-discussion: - category: "general" + create-issue: labels: - refactoring - code-quality @@ -35,7 +34,7 @@ You are an expert code simplification specialist focused on enhancing code clari ## Your Mission -Analyze recently modified code from the last 24 hours and apply refinements that improve code quality while preserving all functionality. Create a GitHub discussion with a properly formatted diff if improvements are found. +Analyze recently modified code from the last 24 hours and apply refinements that improve code quality while preserving all functionality. Create a GitHub issue with a properly formatted diff if improvements are found. ## Current Context @@ -239,11 +238,11 @@ npm run build python -m py_compile changed_files.py ``` -## Phase 4: Create GitHub Discussion with Diff +## Phase 4: Create GitHub Issue with Diff -### 4.1 Determine If Discussion Is Needed +### 4.1 Determine If Issue Is Needed -Only create a discussion if: +Only create an issue if: - ✅ You made actual code simplifications - ✅ All tests pass - ✅ Linting is clean @@ -259,7 +258,7 @@ No simplifications needed - code already meets quality standards. ### 4.2 Generate Git Diff -Before creating the discussion, generate a properly formatted git diff that can be used to create a pull request: +Before creating the issue, generate a properly formatted git diff that can be used to create a pull request: ```bash # Stage all changes if not already staged @@ -285,9 +284,9 @@ This format is compatible with: - GitHub Copilot for suggesting PR creation - Manual copy-paste into PR creation interface -### 4.3 Generate Discussion Description +### 4.3 Generate Issue Description -If creating a discussion, use this structure: +If creating an issue, use this structure: ```markdown ## Code Simplification - [Date] @@ -369,11 +368,10 @@ Please verify: ### 4.4 Use Safe Outputs -Create the discussion using the safe-outputs configuration: +Create the issue using the safe-outputs configuration: - Title will be prefixed with `[code-simplifier]` - Labeled with `refactoring`, `code-quality`, `automation` -- Posted to the "General" discussion category - Contains complete git diff for easy PR creation ## Important Guidelines @@ -391,7 +389,7 @@ Create the discussion using the safe-outputs configuration: - **Clear over clever**: Prioritize readability and maintainability ### Exit Conditions -Exit gracefully without creating a discussion if: +Exit gracefully without creating an issue if: - No code was changed in the last 24 hours - No simplifications are beneficial - Tests fail after changes @@ -423,9 +421,9 @@ Your output MUST either: No simplifications needed - code already meets quality standards. ``` -3. **If simplifications made**: Create a discussion with the changes using safe-outputs, including: +3. **If simplifications made**: Create an issue with the changes using safe-outputs, including: - Clear description of improvements - Complete git diff in proper format - Instructions for applying the diff or creating a PR -Begin your code simplification analysis now. Find recently modified code, assess simplification opportunities, apply improvements while preserving functionality, validate changes, and create a discussion with a git diff if beneficial. +Begin your code simplification analysis now. Find recently modified code, assess simplification opportunities, apply improvements while preserving functionality, validate changes, and create an issue with a git diff if beneficial.