From cfb5a7cc3c17ab8f0a1e0c49abf59c6aaa12db5f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 16 Apr 2026 01:01:02 +0000 Subject: [PATCH 1/2] Initial plan From 96a9fa2e0bf4c1e45161e5a1e1a6fbfacfbec030 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 16 Apr 2026 01:45:37 +0000 Subject: [PATCH 2/2] feat(sergo): create up to 3 labeled issues from top findings Agent-Logs-Url: https://github.com/github/gh-aw/sessions/6242dbee-b0c9-4546-a786-786645e2c275 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .github/workflows/sergo.lock.yml | 66 ++++++++++++++++++++++++-------- .github/workflows/sergo.md | 59 ++++++++++++++++++++++------ 2 files changed, 98 insertions(+), 27 deletions(-) diff --git a/.github/workflows/sergo.lock.yml b/.github/workflows/sergo.lock.yml index 9c7b6649c59..cf570c65b3d 100644 --- a/.github/workflows/sergo.lock.yml +++ b/.github/workflows/sergo.lock.yml @@ -1,4 +1,4 @@ -# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"af533ebfcee6ef0562c1a099c964f0b1cbe1df627ceccd31c0b1ec1e0273906a","strict":true,"agent_id":"claude"} +# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"8e7a939ff5ef8f556e0fe362c39474fc57accec7994e39d0e38c858da90b3754","strict":true,"agent_id":"claude"} # gh-aw-manifest: {"version":1,"secrets":["ANTHROPIC_API_KEY","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"373c709c69115d41ff229c7e5df9f8788daa9553","version":"v9"},{"repo":"actions/setup-node","sha":"53b83947a5a98c8d113130e565377fae1a50d02f","version":"v6.3.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.25.20","digest":"sha256:9161f2415a3306a344aca34dd671ee69f122317e0a512e66dc64c94b9c508682","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.25.20@sha256:9161f2415a3306a344aca34dd671ee69f122317e0a512e66dc64c94b9c508682"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.25.20","digest":"sha256:6971639e381e82e45134bcd333181f456df3a52cd6f818a3e3d6de068ff91519","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.25.20@sha256:6971639e381e82e45134bcd333181f456df3a52cd6f818a3e3d6de068ff91519"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.25.20","digest":"sha256:5411d903f73ee597e6a084971c2adef3eb0bd405910df3ed7bf5e3d6bd58a236","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.25.20@sha256:5411d903f73ee597e6a084971c2adef3eb0bd405910df3ed7bf5e3d6bd58a236"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.2.19","digest":"sha256:44d4d8de7e6c37aaea484eba489940c52df6a0b54078ddcbc9327592d5b3c3dd","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.2.19@sha256:44d4d8de7e6c37aaea484eba489940c52df6a0b54078ddcbc9327592d5b3c3dd"},{"image":"ghcr.io/github/github-mcp-server:v0.32.0","digest":"sha256:2763823c63bcca718ce53850a1d7fcf2f501ec84028394f1b63ce7e9f4f9be28","pinned_image":"ghcr.io/github/github-mcp-server:v0.32.0@sha256:2763823c63bcca718ce53850a1d7fcf2f501ec84028394f1b63ce7e9f4f9be28"},{"image":"ghcr.io/github/serena-mcp-server:latest","digest":"sha256:bf343399e3725c45528f531a230f3a04521d4cdef29f9a5af6282ff0d3c393c5","pinned_image":"ghcr.io/github/serena-mcp-server:latest@sha256:bf343399e3725c45528f531a230f3a04521d4cdef29f9a5af6282ff0d3c393c5"},{"image":"node:lts-alpine","digest":"sha256:01743339035a5c3c11a373cd7c83aeab6ed1457b55da6a69e014a95ac4e4700b","pinned_image":"node:lts-alpine@sha256:01743339035a5c3c11a373cd7c83aeab6ed1457b55da6a69e014a95ac4e4700b"}]} # ___ _ _ # / _ \ | | (_) @@ -179,17 +179,17 @@ jobs: run: | bash "${RUNNER_TEMP}/gh-aw/actions/create_prompt_first.sh" { - cat << 'GH_AW_PROMPT_f94ae548125e0e19_EOF' + cat << 'GH_AW_PROMPT_9eb9a06ceb6f83e6_EOF' - GH_AW_PROMPT_f94ae548125e0e19_EOF + GH_AW_PROMPT_9eb9a06ceb6f83e6_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/xpia.md" cat "${RUNNER_TEMP}/gh-aw/prompts/temp_folder_prompt.md" cat "${RUNNER_TEMP}/gh-aw/prompts/markdown.md" cat "${RUNNER_TEMP}/gh-aw/prompts/cache_memory_prompt.md" cat "${RUNNER_TEMP}/gh-aw/prompts/safe_outputs_prompt.md" - cat << 'GH_AW_PROMPT_f94ae548125e0e19_EOF' + cat << 'GH_AW_PROMPT_9eb9a06ceb6f83e6_EOF' - Tools: create_discussion, missing_tool, missing_data, noop + Tools: create_issue(max:3), create_discussion, missing_tool, missing_data, noop The following GitHub context information is available for this workflow: @@ -219,9 +219,9 @@ jobs: {{/if}} - GH_AW_PROMPT_f94ae548125e0e19_EOF + GH_AW_PROMPT_9eb9a06ceb6f83e6_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/github_mcp_tools_with_safeoutputs_prompt.md" - cat << 'GH_AW_PROMPT_f94ae548125e0e19_EOF' + cat << 'GH_AW_PROMPT_9eb9a06ceb6f83e6_EOF' ## Serena Code Analysis @@ -257,7 +257,7 @@ jobs: {{#runtime-import .github/workflows/shared/reporting.md}} {{#runtime-import .github/workflows/shared/mcp/serena-go.md}} {{#runtime-import .github/workflows/sergo.md}} - GH_AW_PROMPT_f94ae548125e0e19_EOF + GH_AW_PROMPT_9eb9a06ceb6f83e6_EOF } > "$GH_AW_PROMPT" - name: Interpolate variables and render templates uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 @@ -460,15 +460,16 @@ jobs: mkdir -p "${RUNNER_TEMP}/gh-aw/safeoutputs" mkdir -p /tmp/gh-aw/safeoutputs mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs - cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_322d0ad52f08c937_EOF' - {"create_discussion":{"category":"audits","close_older_discussions":true,"expires":24,"fallback_to_issue":true,"max":1,"title_prefix":"[sergo] "},"create_report_incomplete_issue":{},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"true"},"report_incomplete":{}} - GH_AW_SAFE_OUTPUTS_CONFIG_322d0ad52f08c937_EOF + cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_080a4f5bb1a0135a_EOF' + {"create_discussion":{"category":"audits","close_older_discussions":true,"expires":24,"fallback_to_issue":true,"max":1,"title_prefix":"[sergo] "},"create_issue":{"expires":168,"labels":["sergo"],"max":3},"create_report_incomplete_issue":{},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"true"},"report_incomplete":{}} + GH_AW_SAFE_OUTPUTS_CONFIG_080a4f5bb1a0135a_EOF - name: Write Safe Outputs Tools env: GH_AW_TOOLS_META_JSON: | { "description_suffixes": { - "create_discussion": " CONSTRAINTS: Maximum 1 discussion(s) can be created. Title will be prefixed with \"[sergo] \". Discussions will be created in category \"audits\"." + "create_discussion": " CONSTRAINTS: Maximum 1 discussion(s) can be created. Title will be prefixed with \"[sergo] \". Discussions will be created in category \"audits\".", + "create_issue": " CONSTRAINTS: Maximum 3 issue(s) can be created. Labels [\"sergo\"] will be automatically added." }, "repo_params": {}, "dynamic_tools": [] @@ -501,6 +502,39 @@ jobs: } } }, + "create_issue": { + "defaultMax": 1, + "fields": { + "body": { + "required": true, + "type": "string", + "sanitize": true, + "maxLength": 65000 + }, + "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", + "sanitize": true, + "maxLength": 128 + } + } + }, "missing_data": { "defaultMax": 20, "fields": { @@ -650,7 +684,7 @@ jobs: export MCP_GATEWAY_DOCKER_COMMAND='docker run -i --rm --network host -v /var/run/docker.sock:/var/run/docker.sock -e MCP_GATEWAY_PORT -e MCP_GATEWAY_DOMAIN -e MCP_GATEWAY_API_KEY -e MCP_GATEWAY_PAYLOAD_DIR -e MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD -e DEBUG -e MCP_GATEWAY_LOG_DIR -e GH_AW_MCP_LOG_DIR -e GH_AW_SAFE_OUTPUTS -e GH_AW_SAFE_OUTPUTS_CONFIG_PATH -e GH_AW_SAFE_OUTPUTS_TOOLS_PATH -e GH_AW_ASSETS_BRANCH -e GH_AW_ASSETS_MAX_SIZE_KB -e GH_AW_ASSETS_ALLOWED_EXTS -e DEFAULT_BRANCH -e GITHUB_MCP_SERVER_TOKEN -e GITHUB_MCP_GUARD_MIN_INTEGRITY -e GITHUB_MCP_GUARD_REPOS -e GITHUB_REPOSITORY -e GITHUB_SERVER_URL -e GITHUB_SHA -e GITHUB_WORKSPACE -e GITHUB_TOKEN -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RUN_ATTEMPT -e GITHUB_JOB -e GITHUB_ACTION -e GITHUB_EVENT_NAME -e GITHUB_EVENT_PATH -e GITHUB_ACTOR -e GITHUB_ACTOR_ID -e GITHUB_TRIGGERING_ACTOR -e GITHUB_WORKFLOW -e GITHUB_WORKFLOW_REF -e GITHUB_WORKFLOW_SHA -e GITHUB_REF -e GITHUB_REF_NAME -e GITHUB_REF_TYPE -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GH_AW_SAFE_OUTPUTS_PORT -e GH_AW_SAFE_OUTPUTS_API_KEY -v /tmp/gh-aw/mcp-payloads:/tmp/gh-aw/mcp-payloads:rw -v /opt:/opt:ro -v /tmp:/tmp:rw -v '"${GITHUB_WORKSPACE}"':'"${GITHUB_WORKSPACE}"':rw ghcr.io/github/gh-aw-mcpg:v0.2.19' GH_AW_NODE=$(which node 2>/dev/null || command -v node 2>/dev/null || echo node) - cat << GH_AW_MCP_CONFIG_fc9f4a3e84dd282e_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs" + cat << GH_AW_MCP_CONFIG_cb37c45f99701908_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs" { "mcpServers": { "github": { @@ -716,7 +750,7 @@ jobs: "payloadDir": "${MCP_GATEWAY_PAYLOAD_DIR}" } } - GH_AW_MCP_CONFIG_fc9f4a3e84dd282e_EOF + GH_AW_MCP_CONFIG_cb37c45f99701908_EOF - name: Download activation artifact uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: @@ -1350,6 +1384,8 @@ jobs: 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_issue_number: ${{ steps.process_safe_outputs.outputs.created_issue_number }} + created_issue_url: ${{ steps.process_safe_outputs.outputs.created_issue_url }} process_safe_outputs_processed_count: ${{ steps.process_safe_outputs.outputs.processed_count }} process_safe_outputs_temporary_id_map: ${{ steps.process_safe_outputs.outputs.temporary_id_map }} steps: @@ -1398,7 +1434,7 @@ jobs: GH_AW_ALLOWED_DOMAINS: "*.githubusercontent.com,anthropic.com,api.anthropic.com,api.github.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,cdn.playwright.dev,codeload.github.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,docs.github.com,files.pythonhosted.org,ghcr.io,github-cloud.githubusercontent.com,github-cloud.s3.amazonaws.com,github.blog,github.com,github.githubassets.com,go.dev,golang.org,goproxy.io,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,lfs.github.com,objects.githubusercontent.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,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,pkg.go.dev,playwright.download.prss.microsoft.com,ppa.launchpad.net,proxy.golang.org,pypi.org,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,sentry.io,statsig.anthropic.com,storage.googleapis.com,sum.golang.org,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com" GITHUB_SERVER_URL: ${{ github.server_url }} GITHUB_API_URL: ${{ github.api_url }} - GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"create_discussion\":{\"category\":\"audits\",\"close_older_discussions\":true,\"expires\":24,\"fallback_to_issue\":true,\"max\":1,\"title_prefix\":\"[sergo] \"},\"create_report_incomplete_issue\":{},\"missing_data\":{},\"missing_tool\":{},\"noop\":{\"max\":1,\"report-as-issue\":\"true\"},\"report_incomplete\":{}}" + GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"create_discussion\":{\"category\":\"audits\",\"close_older_discussions\":true,\"expires\":24,\"fallback_to_issue\":true,\"max\":1,\"title_prefix\":\"[sergo] \"},\"create_issue\":{\"expires\":168,\"labels\":[\"sergo\"],\"max\":3},\"create_report_incomplete_issue\":{},\"missing_data\":{},\"missing_tool\":{},\"noop\":{\"max\":1,\"report-as-issue\":\"true\"},\"report_incomplete\":{}}" with: github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} script: | diff --git a/.github/workflows/sergo.md b/.github/workflows/sergo.md index 7dc52ac36a1..0066f57558c 100644 --- a/.github/workflows/sergo.md +++ b/.github/workflows/sergo.md @@ -32,7 +32,7 @@ imports: tools: cache-memory: true github: - toolsets: [default] + toolsets: [default, issues] edit: bash: - "cat go.mod" @@ -44,6 +44,11 @@ tools: timeout-minutes: 45 strict: true +safe-outputs: + create-issue: + max: 3 + labels: [sergo] + expires: 7d --- # Sergo 🔬 - The Serena Go Expert @@ -65,8 +70,9 @@ Each day, you will: 4. **Explain** your strategy selection and reasoning 5. **Execute** deep research using your chosen strategy and Serena tools 6. **Generate** 1-3 improvement agentic tasks based on findings -7. **Track** success metrics in cache -8. **Create** a comprehensive discussion with your analysis +7. **Create** up to 3 GitHub issues for the top findings (skip duplicates) +8. **Track** success metrics in cache +9. **Create** a comprehensive discussion with your analysis ## Step 1: Initialize Serena and Scan Available Tools @@ -353,16 +359,43 @@ Order your 1-3 tasks by: 2. **Scope**: Broader patterns before isolated issues 3. **Effort**: Quick wins before complex refactors -## Step 7: Track Success in Cache +## Step 7: Create Up to 3 Issues for Top Findings -### 7.1 Calculate Success Score +### 7.1 Find Existing Open Tracking Issues + +Before creating any new issue, search for existing open tracking issues that already cover the finding: +- Use GitHub issues search tools to check for open issues with similar scope +- Prioritize open issues already labeled `sergo` +- If a finding is already tracked by an open issue, **do not create a duplicate** + +### 7.2 Select the Top Findings for Issue Creation + +From your findings, select up to 3 that are: +- High impact and actionable +- Distinct (not overlapping with one another) +- Not already tracked by an open issue + +### 7.3 Create Issues Using Safe Outputs + +Create issues using the safe output `create-issue` tool. Create **between 1 and 3** issues based on the number of actionable findings in this run (do not force 3 if fewer high-quality findings exist). + +For each issue: +- Include a concise title and a clear problem statement +- Add file paths, line references, and severity +- Include recommended next steps and validation guidance +- Skip creation if an open tracking issue already exists +- Note that `create-issue.expires: 7d` is configured, so generated tracking issues are expected to auto-close after 7 days unless updated + +## Step 8: Track Success in Cache + +### 8.1 Calculate Success Score Rate your analysis run on a scale of 0-10 based on: - **Findings Quality** (0-4): How critical/actionable are the issues? - **Coverage** (0-3): How much of the codebase was analyzed? - **Task Generation** (0-3): Did you create 1-3 high-quality tasks? -### 7.2 Save Strategy Results +### 8.2 Save Strategy Results Append your results to the strategy history: ```bash @@ -370,7 +403,7 @@ Append your results to the strategy history: echo '{"date": "2026-01-15", "strategy": "your-strategy-name", "tools": ["tool1", "tool2"], "findings": 5, "tasks_created": 2, "success_score": 8, "notes": "Additional context"}' >> /tmp/gh-aw/cache-memory/sergo-strategies.jsonl ``` -### 7.3 Update Statistics +### 8.3 Update Statistics Update aggregate statistics: ```bash @@ -387,9 +420,9 @@ cat > /tmp/gh-aw/cache-memory/sergo-stats.json << 'EOF' EOF ``` -## Step 8: Create Comprehensive Discussion +## Step 9: Create Comprehensive Discussion -### 8.1 Discussion Structure +### 9.1 Discussion Structure **Title Format**: `Sergo Report: [Strategy Name] - [Date]` @@ -522,7 +555,7 @@ EOF *Strategy: [Your strategy name]* ``` -### 8.2 Discussion Quality Guidelines +### 9.2 Discussion Quality Guidelines Ensure your discussion: - **Is comprehensive**: Covers all aspects of your analysis @@ -570,8 +603,9 @@ Your output MUST include: 2. **Clear strategy explanation** with 50/50 split justification 3. **Detailed findings** from your analysis 4. **1-3 improvement tasks** with complete specifications -5. **Success tracking** in cache files -6. **Comprehensive discussion** with all findings and recommendations +5. **Up to 3 created issues** from top findings (or explicit duplicate-skip rationale) +6. **Success tracking** in cache files +7. **Comprehensive discussion** with all findings and recommendations ## Success Criteria @@ -581,6 +615,7 @@ A successful Sergo run delivers: - ✅ Strategy clearly explained and justified - ✅ Deep analysis executed using Serena and selected strategy - ✅ 1-3 high-quality improvement tasks generated +- ✅ Up to 3 issues created from top findings, with duplicates skipped - ✅ Success metrics calculated and saved to cache - ✅ Comprehensive discussion created with all findings - ✅ Cache files properly updated for next run