diff --git a/.github/skills/sergo-examples/SKILL.md b/.github/skills/sergo-examples/SKILL.md new file mode 100644 index 00000000000..e9379f0c9a1 --- /dev/null +++ b/.github/skills/sergo-examples/SKILL.md @@ -0,0 +1,60 @@ +--- +name: sergo-examples +description: Optional Sergo examples for cache formats and reporting templates. +--- + +Use this skill only when Sergo needs concrete format examples. + +## Example: cached tools snapshot + +```json +{ + "last_updated": "2026-01-15T12:00:00Z", + "tools": [ + {"name": "tool-name-1", "description": "..."}, + {"name": "tool-name-2", "description": "..."} + ] +} +``` + +## Example: strategy history entries + +```json +{"date": "2026-01-14", "strategy": "symbol-analysis", "tools": ["find-symbol", "get-definition"], "findings": 3, "tasks_created": 2, "success_score": 8} +{"date": "2026-01-13", "strategy": "type-inspection", "tools": ["get-hover", "get-type"], "findings": 5, "tasks_created": 3, "success_score": 9} +``` + +## Example: task template + +```markdown +### Task [N]: [Short Title] + +**Issue Type**: [Symbol Analysis / Type Inspection / etc.] +**Problem**: [Clear description] +**Location(s)**: [file paths and line references] +**Impact**: Severity, affected files, risk +**Recommendation**: [Specific fix] +**Validation**: Existing tests, Serena verification, related-pattern check, docs if needed +**Estimated Effort**: [Small/Medium/Large] +``` + +## Example: discussion structure + +```markdown +# 🔬 Sergo Report: [Strategy Name] + +**Date**: [YYYY-MM-DD] +**Strategy**: [Name] +**Success Score**: [X/10] + +## Executive Summary +## 🛠️ Serena Tools Update +## 📊 Strategy Selection +## 🔍 Analysis Execution +## 📋 Detailed Findings +## ✅ Improvement Tasks Generated +## 📈 Success Metrics +## 📊 Historical Context +## 🎯 Recommendations +## 🔄 Next Run Preview +``` diff --git a/.github/workflows/go-logger.lock.yml b/.github/workflows/go-logger.lock.yml index e07c71e8531..e48518f26ed 100644 --- a/.github/workflows/go-logger.lock.yml +++ b/.github/workflows/go-logger.lock.yml @@ -1,4 +1,4 @@ -# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"4171091f44228b89cda79c2cb2902c88a519e0240b62094bd44e32e566b7d1ad","body_hash":"3f880d8d31febfbcea082ff217640a2458155256b1608b189d9a396e677dedc3","strict":true,"agent_id":"claude"} +# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"31ac3425391407c14d65bed30e5bb8d86bb3bf7d2423129097f4e8f6e65dd910","body_hash":"727f726b32a9569615c9af7d202682bf9056693a3decb05ae169f28970194e71","strict":true,"agent_id":"claude"} # gh-aw-manifest: {"version":1,"secrets":["ANTHROPIC_API_KEY","GH_AW_CI_TRIGGER_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GH_AW_OTEL_GRAFANA_AUTHORIZATION","GH_AW_OTEL_GRAFANA_ENDPOINT","GH_AW_OTEL_SENTRY_AUTHORIZATION","GH_AW_OTEL_SENTRY_ENDPOINT","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":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-go","sha":"4a3601121dd01d1626a1e23e37211e3254c1c06c","version":"v6.4.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.25.58"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.25.58"},{"image":"ghcr.io/github/gh-aw-firewall/cli-proxy:0.25.58"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.25.58"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.22","digest":"sha256:ce5c6f5461b077af0d8e8eb1763436e85153f8e9531117d58a7bdb23de71f00a","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.22@sha256:ce5c6f5461b077af0d8e8eb1763436e85153f8e9531117d58a7bdb23de71f00a"},{"image":"ghcr.io/github/github-mcp-server:v1.1.2","digest":"sha256:30197479d8036c7811892bc07e06f9a05c9ef3cdd79bc59f256d50647f95788c","pinned_image":"ghcr.io/github/github-mcp-server:v1.1.2@sha256:30197479d8036c7811892bc07e06f9a05c9ef3cdd79bc59f256d50647f95788c"},{"image":"node:lts-alpine","digest":"sha256:2bdb65ed1dab192432bc31c95f94155ca5ad7fc1392fb7eb7526ab682fa5bf14","pinned_image":"node:lts-alpine@sha256:2bdb65ed1dab192432bc31c95f94155ca5ad7fc1392fb7eb7526ab682fa5bf14"}]} # ___ _ _ # / _ \ | | (_) @@ -89,6 +89,7 @@ env: jobs: activation: + if: needs.pre_activation.outputs.should_run == 'true' || github.event_name == 'workflow_dispatch' runs-on: ubuntu-slim permissions: actions: read @@ -229,24 +230,24 @@ jobs: run: | bash "${RUNNER_TEMP}/gh-aw/actions/create_prompt_first.sh" { - cat << 'GH_AW_PROMPT_8353c1d7590fef21_EOF' + cat << 'GH_AW_PROMPT_93b22c4efbf9817a_EOF' - GH_AW_PROMPT_8353c1d7590fef21_EOF + GH_AW_PROMPT_93b22c4efbf9817a_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_8353c1d7590fef21_EOF' + cat << 'GH_AW_PROMPT_93b22c4efbf9817a_EOF' Tools: create_pull_request, missing_tool, missing_data, noop - GH_AW_PROMPT_8353c1d7590fef21_EOF + GH_AW_PROMPT_93b22c4efbf9817a_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/safe_outputs_create_pull_request.md" - cat << 'GH_AW_PROMPT_8353c1d7590fef21_EOF' + cat << 'GH_AW_PROMPT_93b22c4efbf9817a_EOF' - GH_AW_PROMPT_8353c1d7590fef21_EOF + GH_AW_PROMPT_93b22c4efbf9817a_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/mcp_cli_tools_prompt.md" - cat << 'GH_AW_PROMPT_8353c1d7590fef21_EOF' + cat << 'GH_AW_PROMPT_93b22c4efbf9817a_EOF' The following GitHub context information is available for this workflow: {{#if github.actor}} @@ -275,14 +276,14 @@ jobs: {{/if}} - GH_AW_PROMPT_8353c1d7590fef21_EOF + GH_AW_PROMPT_93b22c4efbf9817a_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/cli_proxy_with_safeoutputs_prompt.md" - cat << 'GH_AW_PROMPT_8353c1d7590fef21_EOF' + cat << 'GH_AW_PROMPT_93b22c4efbf9817a_EOF' {{#runtime-import .github/workflows/shared/otlp.md}} {{#runtime-import .github/workflows/shared/noop-reminder.md}} {{#runtime-import .github/workflows/go-logger.md}} - GH_AW_PROMPT_8353c1d7590fef21_EOF + GH_AW_PROMPT_93b22c4efbf9817a_EOF } > "$GH_AW_PROMPT" - name: Interpolate variables and render templates uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 @@ -443,6 +444,9 @@ jobs: run: bash "${RUNNER_TEMP}/gh-aw/actions/configure_gh_for_ghe.sh" env: GH_TOKEN: ${{ github.token }} + - id: logger_manifest + name: Build deterministic logger manifest + run: "set -euo pipefail\ncache_dir=\"/tmp/gh-aw/cache-memory/go-logger\"\nout_dir=\"/tmp/gh-aw/agent/go-logger\"\nmkdir -p \"$cache_dir\" \"$out_dir\"\n\ncurrent_sha=\"$(git rev-parse HEAD)\"\ncurrent_files=\"$out_dir/current-files.txt\"\nprocessed_files=\"$cache_dir/processed-files.txt\"\nfind pkg -name '*.go' -type f ! -name '*_test.go' | sort > \"$current_files\"\n[ -f \"$processed_files\" ] || : > \"$processed_files\"\n\nnew_files=\"$out_dir/new-files.txt\"\ncomm -23 \"$current_files\" \"$processed_files\" > \"$new_files\" || true\n\nlast_sha=\"\"\nif [ -f \"$cache_dir/last-run.json\" ]; then\n last_sha=\"$(jq -r '.commit_sha // empty' \"$cache_dir/last-run.json\" 2>/dev/null || true)\"\nfi\n\nfiles_needing_logger=\"$out_dir/files-needing-logger.txt\"\nfiles_missing_logger_import=\"$out_dir/files-missing-logger-import.txt\"\ncall_sites=\"$out_dir/call-sites.tsv\"\n: > \"$files_needing_logger\"\n: > \"$files_missing_logger_import\"\n: > \"$call_sites\"\n\nwhile IFS= read -r rel; do\n [ -f \"$rel\" ] || continue\n if ! grep -q \"var log = logger.New\" \"$rel\"; then\n echo \"$rel\" >> \"$files_needing_logger\"\n fi\n if grep -q \"log\\\\.\" \"$rel\" && ! grep -q '\"github.com/github/gh-aw/pkg/logger\"' \"$rel\"; then\n echo \"$rel\" >> \"$files_missing_logger_import\"\n fi\n while IFS=: read -r line_number match_line; do\n function_name=\"$(printf '%s' \"$match_line\" | sed -E 's/^[[:space:]]*func[[:space:]]+([A-Za-z0-9_]+).*/\\\\1/')\"\n printf \"%s\\\\t%s\\\\t%s\\\\n\" \"$rel\" \"$line_number\" \"$function_name\" >> \"$call_sites\"\n done < <(grep -nE \"^[[:space:]]*func[[:space:]]+[A-Za-z0-9_]+\" \"$rel\" || true)\ndone < \"$current_files\"\n\njq -n \\\n --argjson files_needing_logger \"$(jq -R -s 'split(\\\"\\\\n\\\") | map(select(length > 0))' \"$files_needing_logger\")\" \\\n --argjson missing_logger_import \"$(jq -R -s 'split(\\\"\\\\n\\\") | map(select(length > 0))' \"$files_missing_logger_import\")\" \\\n --argjson candidate_call_sites \"$(jq -R -s 'split(\\\"\\\\n\\\") | map(select(length > 0) | split(\\\"\\\\t\\\") | {file: .[0], line: (.[1] | tonumber), function: .[2]})' \"$call_sites\")\" \\\n '{files_needing_logger: $files_needing_logger, missing_logger_import: $missing_logger_import, candidate_call_sites: $candidate_call_sites}' \\\n > \"$out_dir/manifest.json\"\n\nshould_run=true\nif [ \"$current_sha\" = \"$last_sha\" ] && [ ! -s \"$new_files\" ]; then\n should_run=false\nfi\necho \"{\\\"should_run\\\": \\\"$should_run\\\", \\\"current_sha\\\": \\\"$current_sha\\\", \\\"last_sha\\\": \\\"$last_sha\\\", \\\"manifest\\\": \\\"$out_dir/manifest.json\\\", \\\"new_files\\\": \\\"$new_files\\\"}\" > \"$out_dir/preflight.json\"\necho \"should_run=$should_run\" >> \"$GITHUB_OUTPUT\"\n" - name: Setup Go uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 with: @@ -540,9 +544,9 @@ 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_9e99131ef5094c8c_EOF' + cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_2ba26db3ebdbc8c1_EOF' {"create_pull_request":{"draft":false,"expires":48,"labels":["enhancement","automation"],"max":1,"max_patch_files":100,"max_patch_size":1024,"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","CHANGELOG.md","SECURITY.md","CODE_OF_CONDUCT.md","CLAUDE.md","AGENTS.md"],"protected_files_policy":"request_review","title_prefix":"[log] "},"create_report_incomplete_issue":{},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"true"},"report_incomplete":{}} - GH_AW_SAFE_OUTPUTS_CONFIG_9e99131ef5094c8c_EOF + GH_AW_SAFE_OUTPUTS_CONFIG_2ba26db3ebdbc8c1_EOF - name: Generate Safe Outputs Tools env: GH_AW_TOOLS_META_JSON: | @@ -753,7 +757,7 @@ jobs: export MCP_GATEWAY_DOCKER_COMMAND='docker run -i --rm --network host --add-host host.docker.internal:127.0.0.1 --user '"${MCP_GATEWAY_UID}"':'"${MCP_GATEWAY_GID}"' --group-add '"${DOCKER_SOCK_GID}"' -v '"${DOCKER_SOCK_PATH}"':/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 DOCKER_HOST=unix:///var/run/docker.sock -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 -e GITHUB_AW_OTEL_TRACE_ID -e GITHUB_AW_OTEL_PARENT_SPAN_ID -e OTEL_EXPORTER_OTLP_HEADERS -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.3.22' GH_AW_NODE=$(which node 2>/dev/null || command -v node 2>/dev/null || echo node) - cat << GH_AW_MCP_CONFIG_dabd20e2920c78b3_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs" + cat << GH_AW_MCP_CONFIG_3d57c81eb20b2b51_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs" { "mcpServers": { "safeoutputs": { @@ -783,7 +787,7 @@ jobs: } } } - GH_AW_MCP_CONFIG_dabd20e2920c78b3_EOF + GH_AW_MCP_CONFIG_3d57c81eb20b2b51_EOF - name: Mount MCP servers as CLIs id: mount-mcp-clis continue-on-error: true @@ -817,12 +821,14 @@ jobs: id: agentic_execution # Allowed tools (sorted): # - Bash(./gh-aw compile) + # - Bash(cat /tmp/gh-aw/agent/go-logger/manifest.json) + # - Bash(cat /tmp/gh-aw/agent/go-logger/new-files.txt) + # - Bash(cat /tmp/gh-aw/agent/go-logger/preflight.json) # - Bash(cat /tmp/gh-aw/cache-memory/) # - Bash(cat > /tmp/gh-aw/cache-memory/) # - Bash(cat) # - Bash(date) # - Bash(echo) - # - Bash(find pkg -name "*.go" -type f ! -name "*_test.go") # - Bash(gh:*) # - Bash(git add:*) # - Bash(git branch:*) @@ -833,10 +839,7 @@ jobs: # - Bash(git status) # - Bash(git switch:*) # - Bash(git) - # - Bash(grep -n "func " pkg/*.go) - # - Bash(grep -r "var log = logger.New" pkg --include="*.go") # - Bash(grep) - # - Bash(head -n * pkg/**/*.go) # - Bash(head) # - Bash(ls) # - Bash(make build) @@ -850,7 +853,6 @@ jobs: # - Bash(sort) # - Bash(tail) # - Bash(uniq) - # - Bash(wc -l pkg/**/*.go) # - Bash(wc) # - Bash(yq) # - BashOutput @@ -956,7 +958,7 @@ jobs: fi # shellcheck disable=SC1003 sudo -E awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" ${GH_AW_TOOL_CACHE_MOUNT:+--mount "$GH_AW_TOOL_CACHE_MOUNT"} ${GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS} --tty --env-all --exclude-env ANTHROPIC_API_KEY --exclude-env GH_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_API_KEY --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --allow-host-ports 80,443,8080 --skip-pull --difc-proxy-host host.docker.internal:18443 --difc-proxy-ca-cert /tmp/gh-aw/difc-proxy-tls/ca.crt \ - -- /bin/bash -c 'set +o histexpand; export PATH="${RUNNER_TEMP}/gh-aw/mcp-cli/bin:$PATH" && GH_AW_TOOL_CACHE="${RUNNER_TOOL_CACHE:-/opt/hostedtoolcache}"; export PATH="$(find "$GH_AW_TOOL_CACHE" /opt/hostedtoolcache /home/runner/work/_tool -maxdepth 5 -type d -name bin 2>/dev/null | tr '\''\n'\'' '\'':'\'')$PATH"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true && GH_AW_NODE_EXEC="${GH_AW_NODE_BIN:-}"; if [ -z "$GH_AW_NODE_EXEC" ] || [ ! -x "$GH_AW_NODE_EXEC" ]; then GH_AW_NODE_EXEC="$(command -v node 2>/dev/null || true)"; fi; if [ -z "$GH_AW_NODE_EXEC" ]; then echo "node runtime missing on this runner — check runtimes.node in workflow YAML" >&2; exit 127; fi; GH_AW_NPM_GLOBAL_ROOT="$(npm root -g 2>/dev/null || true)"; if [ -n "$GH_AW_NPM_GLOBAL_ROOT" ]; then export NODE_PATH="${GH_AW_NPM_GLOBAL_ROOT}${NODE_PATH:+:${NODE_PATH}}"; fi; "$GH_AW_NODE_EXEC" ${RUNNER_TEMP}/gh-aw/actions/claude_harness.cjs claude --print --no-chrome --allowed-tools '\''Bash(./gh-aw compile),Bash(cat /tmp/gh-aw/cache-memory/),Bash(cat > /tmp/gh-aw/cache-memory/),Bash(cat),Bash(date),Bash(echo),Bash(find pkg -name "*.go" -type f ! -name "*_test.go"),Bash(gh:*),Bash(git add:*),Bash(git branch:*),Bash(git checkout:*),Bash(git commit:*),Bash(git merge:*),Bash(git rm:*),Bash(git status),Bash(git switch:*),Bash(git),Bash(grep -n "func " pkg/*.go),Bash(grep -r "var log = logger.New" pkg --include="*.go"),Bash(grep),Bash(head -n * pkg/**/*.go),Bash(head),Bash(ls),Bash(make build),Bash(make fmt),Bash(make recompile),Bash(mkdir -p /tmp/gh-aw/cache-memory/),Bash(mv /tmp/gh-aw/cache-memory/),Bash(printf),Bash(pwd),Bash(safeoutputs:*),Bash(sort),Bash(tail),Bash(uniq),Bash(wc -l pkg/**/*.go),Bash(wc),Bash(yq),BashOutput,Edit,Edit(/tmp/*),Edit(/tmp/gh-aw/agent/*),Edit(/tmp/gh-aw/cache-memory/*),ExitPlanMode,Glob,Grep,KillBash,LS,MultiEdit,MultiEdit(/tmp/*),MultiEdit(/tmp/gh-aw/agent/*),MultiEdit(/tmp/gh-aw/cache-memory/*),NotebookEdit,NotebookRead,Read,Read(/tmp/*),Read(/tmp/gh-aw/agent/*),Read(/tmp/gh-aw/cache-memory/*),Task,TodoWrite,Write,Write(/tmp/*),Write(/tmp/gh-aw/agent/*),Write(/tmp/gh-aw/cache-memory/*),mcp__github__download_workflow_run_artifact,mcp__github__get_code_scanning_alert,mcp__github__get_commit,mcp__github__get_dependabot_alert,mcp__github__get_discussion,mcp__github__get_discussion_comments,mcp__github__get_file_contents,mcp__github__get_job_logs,mcp__github__get_label,mcp__github__get_latest_release,mcp__github__get_me,mcp__github__get_notification_details,mcp__github__get_pull_request,mcp__github__get_pull_request_comments,mcp__github__get_pull_request_diff,mcp__github__get_pull_request_files,mcp__github__get_pull_request_review_comments,mcp__github__get_pull_request_reviews,mcp__github__get_pull_request_status,mcp__github__get_release_by_tag,mcp__github__get_secret_scanning_alert,mcp__github__get_tag,mcp__github__get_workflow_run,mcp__github__get_workflow_run_logs,mcp__github__get_workflow_run_usage,mcp__github__issue_read,mcp__github__list_branches,mcp__github__list_code_scanning_alerts,mcp__github__list_commits,mcp__github__list_dependabot_alerts,mcp__github__list_discussion_categories,mcp__github__list_discussions,mcp__github__list_issue_types,mcp__github__list_issues,mcp__github__list_label,mcp__github__list_notifications,mcp__github__list_pull_requests,mcp__github__list_releases,mcp__github__list_secret_scanning_alerts,mcp__github__list_starred_repositories,mcp__github__list_tags,mcp__github__list_workflow_jobs,mcp__github__list_workflow_run_artifacts,mcp__github__list_workflow_runs,mcp__github__list_workflows,mcp__github__pull_request_read,mcp__github__search_code,mcp__github__search_issues,mcp__github__search_orgs,mcp__github__search_pull_requests,mcp__github__search_repositories,mcp__github__search_users,mcp__safeoutputs'\'' --debug-file /tmp/gh-aw/agent-stdio.log --verbose --permission-mode acceptEdits --output-format stream-json --mcp-config "${RUNNER_TEMP}/gh-aw/mcp-config/mcp-servers.json" --prompt-file /tmp/gh-aw/aw-prompts/prompt.txt${GH_AW_MODEL_AGENT_CLAUDE:+ --model "$GH_AW_MODEL_AGENT_CLAUDE"}' 2>&1 | tee -a /tmp/gh-aw/agent-stdio.log + -- /bin/bash -c 'set +o histexpand; export PATH="${RUNNER_TEMP}/gh-aw/mcp-cli/bin:$PATH" && GH_AW_TOOL_CACHE="${RUNNER_TOOL_CACHE:-/opt/hostedtoolcache}"; export PATH="$(find "$GH_AW_TOOL_CACHE" /opt/hostedtoolcache /home/runner/work/_tool -maxdepth 5 -type d -name bin 2>/dev/null | tr '\''\n'\'' '\'':'\'')$PATH"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true && GH_AW_NODE_EXEC="${GH_AW_NODE_BIN:-}"; if [ -z "$GH_AW_NODE_EXEC" ] || [ ! -x "$GH_AW_NODE_EXEC" ]; then GH_AW_NODE_EXEC="$(command -v node 2>/dev/null || true)"; fi; if [ -z "$GH_AW_NODE_EXEC" ]; then echo "node runtime missing on this runner — check runtimes.node in workflow YAML" >&2; exit 127; fi; GH_AW_NPM_GLOBAL_ROOT="$(npm root -g 2>/dev/null || true)"; if [ -n "$GH_AW_NPM_GLOBAL_ROOT" ]; then export NODE_PATH="${GH_AW_NPM_GLOBAL_ROOT}${NODE_PATH:+:${NODE_PATH}}"; fi; "$GH_AW_NODE_EXEC" ${RUNNER_TEMP}/gh-aw/actions/claude_harness.cjs claude --print --no-chrome --allowed-tools '\''Bash(./gh-aw compile),Bash(cat /tmp/gh-aw/agent/go-logger/manifest.json),Bash(cat /tmp/gh-aw/agent/go-logger/new-files.txt),Bash(cat /tmp/gh-aw/agent/go-logger/preflight.json),Bash(cat /tmp/gh-aw/cache-memory/),Bash(cat > /tmp/gh-aw/cache-memory/),Bash(cat),Bash(date),Bash(echo),Bash(gh:*),Bash(git add:*),Bash(git branch:*),Bash(git checkout:*),Bash(git commit:*),Bash(git merge:*),Bash(git rm:*),Bash(git status),Bash(git switch:*),Bash(git),Bash(grep),Bash(head),Bash(ls),Bash(make build),Bash(make fmt),Bash(make recompile),Bash(mkdir -p /tmp/gh-aw/cache-memory/),Bash(mv /tmp/gh-aw/cache-memory/),Bash(printf),Bash(pwd),Bash(safeoutputs:*),Bash(sort),Bash(tail),Bash(uniq),Bash(wc),Bash(yq),BashOutput,Edit,Edit(/tmp/*),Edit(/tmp/gh-aw/agent/*),Edit(/tmp/gh-aw/cache-memory/*),ExitPlanMode,Glob,Grep,KillBash,LS,MultiEdit,MultiEdit(/tmp/*),MultiEdit(/tmp/gh-aw/agent/*),MultiEdit(/tmp/gh-aw/cache-memory/*),NotebookEdit,NotebookRead,Read,Read(/tmp/*),Read(/tmp/gh-aw/agent/*),Read(/tmp/gh-aw/cache-memory/*),Task,TodoWrite,Write,Write(/tmp/*),Write(/tmp/gh-aw/agent/*),Write(/tmp/gh-aw/cache-memory/*),mcp__github__download_workflow_run_artifact,mcp__github__get_code_scanning_alert,mcp__github__get_commit,mcp__github__get_dependabot_alert,mcp__github__get_discussion,mcp__github__get_discussion_comments,mcp__github__get_file_contents,mcp__github__get_job_logs,mcp__github__get_label,mcp__github__get_latest_release,mcp__github__get_me,mcp__github__get_notification_details,mcp__github__get_pull_request,mcp__github__get_pull_request_comments,mcp__github__get_pull_request_diff,mcp__github__get_pull_request_files,mcp__github__get_pull_request_review_comments,mcp__github__get_pull_request_reviews,mcp__github__get_pull_request_status,mcp__github__get_release_by_tag,mcp__github__get_secret_scanning_alert,mcp__github__get_tag,mcp__github__get_workflow_run,mcp__github__get_workflow_run_logs,mcp__github__get_workflow_run_usage,mcp__github__issue_read,mcp__github__list_branches,mcp__github__list_code_scanning_alerts,mcp__github__list_commits,mcp__github__list_dependabot_alerts,mcp__github__list_discussion_categories,mcp__github__list_discussions,mcp__github__list_issue_types,mcp__github__list_issues,mcp__github__list_label,mcp__github__list_notifications,mcp__github__list_pull_requests,mcp__github__list_releases,mcp__github__list_secret_scanning_alerts,mcp__github__list_starred_repositories,mcp__github__list_tags,mcp__github__list_workflow_jobs,mcp__github__list_workflow_run_artifacts,mcp__github__list_workflow_runs,mcp__github__list_workflows,mcp__github__pull_request_read,mcp__github__search_code,mcp__github__search_issues,mcp__github__search_orgs,mcp__github__search_pull_requests,mcp__github__search_repositories,mcp__github__search_users,mcp__safeoutputs'\'' --debug-file /tmp/gh-aw/agent-stdio.log --verbose --permission-mode acceptEdits --output-format stream-json --mcp-config "${RUNNER_TEMP}/gh-aw/mcp-config/mcp-servers.json" --prompt-file /tmp/gh-aw/aw-prompts/prompt.txt${GH_AW_MODEL_AGENT_CLAUDE:+ --model "$GH_AW_MODEL_AGENT_CLAUDE"}' 2>&1 | tee -a /tmp/gh-aw/agent-stdio.log env: ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} BASH_DEFAULT_TIMEOUT_MS: 60000 diff --git a/.github/workflows/go-logger.md b/.github/workflows/go-logger.md index e7618185f75..bac2a14002a 100644 --- a/.github/workflows/go-logger.md +++ b/.github/workflows/go-logger.md @@ -17,6 +17,62 @@ safe-outputs: - automation title-prefix: "[log] " steps: +- name: Build deterministic logger manifest + id: logger_manifest + run: | + set -euo pipefail + cache_dir="/tmp/gh-aw/cache-memory/go-logger" + out_dir="/tmp/gh-aw/agent/go-logger" + mkdir -p "$cache_dir" "$out_dir" + + current_sha="$(git rev-parse HEAD)" + current_files="$out_dir/current-files.txt" + processed_files="$cache_dir/processed-files.txt" + find pkg -name '*.go' -type f ! -name '*_test.go' | sort > "$current_files" + [ -f "$processed_files" ] || : > "$processed_files" + + new_files="$out_dir/new-files.txt" + comm -23 "$current_files" "$processed_files" > "$new_files" || true + + last_sha="" + if [ -f "$cache_dir/last-run.json" ]; then + last_sha="$(jq -r '.commit_sha // empty' "$cache_dir/last-run.json" 2>/dev/null || true)" + fi + + files_needing_logger="$out_dir/files-needing-logger.txt" + files_missing_logger_import="$out_dir/files-missing-logger-import.txt" + call_sites="$out_dir/call-sites.tsv" + : > "$files_needing_logger" + : > "$files_missing_logger_import" + : > "$call_sites" + + while IFS= read -r rel; do + [ -f "$rel" ] || continue + if ! grep -q "var log = logger.New" "$rel"; then + echo "$rel" >> "$files_needing_logger" + fi + if grep -q "log\\." "$rel" && ! grep -q '"github.com/github/gh-aw/pkg/logger"' "$rel"; then + echo "$rel" >> "$files_missing_logger_import" + fi + while IFS=: read -r line_number match_line; do + function_name="$(printf '%s' "$match_line" | sed -E 's/^[[:space:]]*func[[:space:]]+([A-Za-z0-9_]+).*/\\1/')" + printf "%s\\t%s\\t%s\\n" "$rel" "$line_number" "$function_name" >> "$call_sites" + done < <(grep -nE "^[[:space:]]*func[[:space:]]+[A-Za-z0-9_]+" "$rel" || true) + done < "$current_files" + + jq -n \ + --argjson files_needing_logger "$(jq -R -s 'split(\"\\n\") | map(select(length > 0))' "$files_needing_logger")" \ + --argjson missing_logger_import "$(jq -R -s 'split(\"\\n\") | map(select(length > 0))' "$files_missing_logger_import")" \ + --argjson candidate_call_sites "$(jq -R -s 'split(\"\\n\") | map(select(length > 0) | split(\"\\t\") | {file: .[0], line: (.[1] | tonumber), function: .[2]})' "$call_sites")" \ + '{files_needing_logger: $files_needing_logger, missing_logger_import: $missing_logger_import, candidate_call_sites: $candidate_call_sites}' \ + > "$out_dir/manifest.json" + + should_run=true + if [ "$current_sha" = "$last_sha" ] && [ ! -s "$new_files" ]; then + should_run=false + fi + echo "{\"should_run\": \"$should_run\", \"current_sha\": \"$current_sha\", \"last_sha\": \"$last_sha\", \"manifest\": \"$out_dir/manifest.json\", \"new_files\": \"$new_files\"}" > "$out_dir/preflight.json" + echo "should_run=$should_run" >> "$GITHUB_OUTPUT" - name: Setup Node.js uses: actions/setup-node@v6.4.0 with: @@ -34,15 +90,18 @@ steps: description: Analyzes and enhances Go logging practices across the codebase for improved debugging and observability emoji: 📝 engine: claude +if: needs.pre_activation.outputs.should_run == 'true' || github.event_name == 'workflow_dispatch' +jobs: + pre-activation: + outputs: + should_run: ${{ steps.logger_manifest.outputs.should_run }} name: Go Logger Enhancement timeout-minutes: 15 tools: bash: - - find pkg -name "*.go" -type f ! -name "*_test.go" - - grep -r "var log = logger.New" pkg --include="*.go" - - grep -n "func " pkg/*.go - - head -n * pkg/**/*.go - - wc -l pkg/**/*.go + - cat /tmp/gh-aw/agent/go-logger/preflight.json + - cat /tmp/gh-aw/agent/go-logger/manifest.json + - cat /tmp/gh-aw/agent/go-logger/new-files.txt - make build - make fmt - make recompile @@ -69,22 +128,17 @@ make build && make fmt # Build the project and check formatting make recompile # Recompile workflows only if you changed .md files ``` -## Efficiency First: Check Cache +## Efficiency First: Use Pre-flight Outputs -Before analyzing files: +Before analyzing files, read `/tmp/gh-aw/agent/go-logger/preflight.json` and `/tmp/gh-aw/agent/go-logger/manifest.json`. -1. Check `/tmp/gh-aw/cache-memory/go-logger/` for previous logging sessions -2. Read `processed-files.json` to see which files were already enhanced -3. Read `last-run.json` for the last commit SHA processed -4. If cache files are missing (cold cache / first run), initialize defaults and continue. This is expected and should **not** be reported as `missing_data`. -5. Only report `missing_data` for cache-memory when files exist but are unreadable/corrupted (for example malformed JSON that cannot be recovered). -6. If current commit SHA matches and no new .go files exist, exit early with success -7. Update cache after processing: - - Save list of processed files to `processed-files.json` - - Save current commit SHA to `last-run.json` - - Save summary of changes made - -This prevents re-analyzing already-processed files and reduces token usage significantly. +- The pre-flight step already computed whether this run should proceed. +- If cache files are missing (cold cache / first run), treat that as expected and continue. +- Only report `missing_data` when cache files exist but are unreadable/corrupted. +- Update cache after processing: + - Save list of processed files to `processed-files.txt` + - Save current commit SHA to `last-run.json` + - Save summary of changes made ## Mission @@ -103,17 +157,12 @@ Read the **Debug Logging** section of `AGENTS.md` with the read or bash tools, t ## Task Steps -### 1. Find Candidate Go Files - -Use bash to identify Go files that could benefit from additional logging: +### 1. Read Deterministic Candidate Manifest -```bash -# Find all non-test Go files in pkg/ -find pkg -name '*.go' -type f ! -name '*_test.go' - -# Check which files already have loggers -grep -r 'var log = logger.New' pkg --include='*.go' -``` +Use `/tmp/gh-aw/agent/go-logger/manifest.json` as the source of truth for: +- `files_needing_logger` +- `missing_logger_import` +- `candidate_call_sites` ### 2. Select Files for Enhancement @@ -196,6 +245,26 @@ Before creating the PR, verify: - Focus on quality over quantity - 5 well-logged files is better than 10 poorly-logged files - Remember: debug logs are for developers, not end users +## Structured Patch Output + +When proposing per-file logger changes, use this compact schema in your reasoning/output to reduce verbose prose: + +```json +{ + "patches": [ + { + "file": "pkg/path/file.go", + "logger_name": "pkg:filename", + "add_import": true, + "add_logger_var": true, + "call_sites": [ + {"line": 123, "function": "Run", "message": "enter Run"} + ] + } + ] +} +``` + Good luck enhancing the codebase with better logging! -{{#runtime-import shared/noop-reminder.md}} \ No newline at end of file +{{#runtime-import shared/noop-reminder.md}} diff --git a/.github/workflows/sergo.lock.yml b/.github/workflows/sergo.lock.yml index 4361279bf0b..9ecdaa044e0 100644 --- a/.github/workflows/sergo.lock.yml +++ b/.github/workflows/sergo.lock.yml @@ -1,4 +1,4 @@ -# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"f8e1bbeab46afe20ba5cdb7e200aa06d0ce376a1887edecfb4477ff2e777ad93","body_hash":"532cf7cd00820cdb8ae6c5eb24f67014440f739887daf6de6f19790390ed1d8c","strict":true,"agent_id":"claude"} +# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"f8e1bbeab46afe20ba5cdb7e200aa06d0ce376a1887edecfb4477ff2e777ad93","body_hash":"42c5bae40cba3a7a6dd8ecc0d8b3b8a7080103303912f0da2d6ed2134c24c570","strict":true,"agent_id":"claude"} # gh-aw-manifest: {"version":1,"secrets":["ANTHROPIC_API_KEY","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GH_AW_OTEL_GRAFANA_AUTHORIZATION","GH_AW_OTEL_GRAFANA_ENDPOINT","GH_AW_OTEL_SENTRY_AUTHORIZATION","GH_AW_OTEL_SENTRY_ENDPOINT","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.25.58"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.25.58"},{"image":"ghcr.io/github/gh-aw-firewall/cli-proxy:0.25.58"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.25.58"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.22","digest":"sha256:ce5c6f5461b077af0d8e8eb1763436e85153f8e9531117d58a7bdb23de71f00a","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.22@sha256:ce5c6f5461b077af0d8e8eb1763436e85153f8e9531117d58a7bdb23de71f00a"},{"image":"ghcr.io/github/github-mcp-server:v1.1.2","digest":"sha256:30197479d8036c7811892bc07e06f9a05c9ef3cdd79bc59f256d50647f95788c","pinned_image":"ghcr.io/github/github-mcp-server:v1.1.2@sha256:30197479d8036c7811892bc07e06f9a05c9ef3cdd79bc59f256d50647f95788c"},{"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:2bdb65ed1dab192432bc31c95f94155ca5ad7fc1392fb7eb7526ab682fa5bf14","pinned_image":"node:lts-alpine@sha256:2bdb65ed1dab192432bc31c95f94155ca5ad7fc1392fb7eb7526ab682fa5bf14"}]} # ___ _ _ # / _ \ | | (_) diff --git a/.github/workflows/sergo.md b/.github/workflows/sergo.md index 38264da56b1..68cadd03827 100644 --- a/.github/workflows/sergo.md +++ b/.github/workflows/sergo.md @@ -57,590 +57,83 @@ tracker-id: sergo-daily --- # Sergo 🔬 - The Serena Go Expert -You are **Sergo**, the ultimate expert in Go code quality and the Serena MCP (Model Context Protocol) language service expert. Your mission is to leverage Serena's powerful language service protocol tools to perform deep static analysis of the Go codebase and identify actionable improvements. +You are Sergo, focused on actionable Go static-analysis findings using Serena tools. ## Context -- **Repository**: ${{ github.repository }} -- **Run ID**: ${{ github.run_id }} -- **Memory Location**: `/tmp/gh-aw/repo-memory/default/` (the `default` subdirectory is the fixed repo-memory mount point) -- **Serena Memory**: `/tmp/gh-aw/repo-memory/default/serena/` +- Repository: ${{ github.repository }} +- Run ID: ${{ github.run_id }} +- Memory Location: `/tmp/gh-aw/repo-memory/default/` +- Serena Memory: `/tmp/gh-aw/repo-memory/default/serena/` -## Your Mission +## Mission -Each day, you will: -1. **Scan** the list of Serena tools available for Go analysis -2. **Detect and report** changes in the tools list (using cache) -3. **Pick** a static analysis strategy combining cached approaches (50%) with new exploration (50%) -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. **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 +Each day: scan Serena tools, detect tool changes, select a 50/50 cached+new strategy, run deep analysis, generate 1-3 tasks, create up to 3 non-duplicate issues, update cache metrics, and publish a comprehensive discussion. -## Step 1: Initialize Serena and Scan Available Tools +## Execution Plan -### 1.1 Ensure Serena Memory Directory Exists -```bash -mkdir -p /tmp/gh-aw/repo-memory/default/serena -``` +1) Initialize Serena memory and tool cache. +- Ensure `/tmp/gh-aw/repo-memory/default/serena` exists. +- Discover Serena tools and compare with `/tmp/gh-aw/repo-memory/default/sergo-tools-list.json`. +- Treat missing cache files as expected first-run behavior. +- Save updated tool snapshot to `/tmp/gh-aw/repo-memory/default/sergo-tools-list.json`. -### 1.2 List All Available Serena Tools -Use the Serena MCP server to discover all available tools for Go language analysis. The Serena MCP provides language service protocol capabilities including: -- Code navigation (go-to-definition, find-references) -- Symbol search and inspection -- Type information and hover documentation -- Code completion suggestions -- Diagnostics and linting -- Refactoring operations -- AST analysis +2) Load strategy history with bounded context. +- Read only the 3 most recent strategy entries from `/tmp/gh-aw/repo-memory/default/sergo-strategies.jsonl`. +- Compute usage counts, average success score, and least-recently-used strategy from that bounded window. -Document all available Serena tools by exploring the MCP server's tool list. +3) Select strategy using a strict 50/50 split. +- 50% cached reuse: prefer proven strategies with high success and stale recency. +- 50% new exploration: use underused Serena tools, novel combinations, or new target areas. +- Document strategy name, tools, targets, success criteria, and rationale. -### 1.3 Load Previous Tools List from Cache -Check if you have a cached tools list from previous runs: -```bash -if [ -f /tmp/gh-aw/repo-memory/default/sergo-tools-list.json ]; then - cat /tmp/gh-aw/repo-memory/default/sergo-tools-list.json -else - echo "No cached tools list found — this is a first run or the cache expired. Start fresh without a tools history." -fi -``` +4) Explain strategy and metrics. +- Explain cached component adaptation and expected outcomes. +- Explain new exploration component and expected findings. +- Set explicit run targets for findings, issue quality, and task generation. -The file should contain: -```json -{ - "last_updated": "2026-01-15T12:00:00Z", - "tools": [ - {"name": "tool-name-1", "description": "..."}, - {"name": "tool-name-2", "description": "..."} - ] -} -``` +5) Execute analysis and collect evidence. +- Use Serena tools systematically and cross-validate findings. +- Gather repository context: Go file count, package structure, dependency snapshot, largest files. +- For each finding capture: issue type, location, evidence, impact, and recommendation. -### 1.4 Detect and Report Tool Changes -Compare the current tools list with the cached version: -- **Added tools**: New capabilities since last run -- **Removed tools**: Tools no longer available -- **Modified tools**: Changes in tool descriptions or parameters +6) Generate 1-3 improvement tasks. +- Choose high-impact, actionable, non-overlapping issues. +- Include problem, locations, impact, recommendation, before/after intent, validation checklist, and effort. -Save the current tools list to cache: -```bash -# Save updated tools list -echo '{"last_updated": "", "tools": [...]}' > /tmp/gh-aw/repo-memory/default/sergo-tools-list.json -``` +7) Create up to 3 issues. +- Search existing open issues first (prioritize label `sergo`). +- Skip duplicates and explain skip rationale. +- Create 1-3 issues only when findings are strong and distinct. -## Step 2: Load Strategy History from Cache +8) Track success and update cache. +- Compute success score (0-10) using findings quality, coverage, and task quality. +- Append run summary to `sergo-strategies.jsonl`. +- Update aggregate stats in `sergo-stats.json`. -### 2.1 Load Previous Strategies -Read the strategy history to understand what analysis approaches have been used before: -```bash -if [ -f /tmp/gh-aw/repo-memory/default/sergo-strategies.jsonl ]; then - cat /tmp/gh-aw/repo-memory/default/sergo-strategies.jsonl -else - echo "No strategy history found — this is a first run or the cache expired. Start fresh with a new exploration strategy." -fi -``` +9) Publish discussion. +- Use title format: `Sergo Report: [Strategy Name] - [Date]`. +- Include executive summary, tool updates, strategy split details, findings, generated tasks, metrics, historical context, recommendations, and next-run focus. -Each line in this JSONL file represents a previous strategy execution: -```json -{"date": "2026-01-14", "strategy": "symbol-analysis", "tools": ["find-symbol", "get-definition"], "findings": 3, "tasks_created": 2, "success_score": 8} -{"date": "2026-01-13", "strategy": "type-inspection", "tools": ["get-hover", "get-type"], "findings": 5, "tasks_created": 3, "success_score": 9} -``` +## Formatting and Examples Skill -### 2.2 Calculate Strategy Usage Statistics -Analyze which strategies have been used and their success rates: -- Count how many times each strategy has been used -- Calculate average success scores per strategy -- Identify least-recently-used strategies -- Note strategies with high success scores for potential reuse +Do not inline large code/template examples in this workflow. Only when output-format guidance is needed, invoke skill `sergo-examples` and use its examples. -## Step 3: Pick Static Analysis Strategy (50% Cached Reuse, 50% New) +## Missing Data Rules -### 3.1 Strategy Selection Algorithm - -You must balance exploration (new strategies) with exploitation (proven strategies): - -**50% Cached Reuse (Exploitation):** -- Select from strategies that have been used before -- Prioritize strategies with: - - High success scores (>7/10) - - Not used recently (>7 days ago) - - Good findings-to-tasks ratio -- Adapt the strategy slightly (different file targets, deeper analysis) - -**50% New Exploration:** -- Design a novel analysis approach using: - - Underutilized Serena tools - - New combinations of tools - - Different areas of the codebase - - Emerging patterns or anti-patterns - -### 3.2 Available Strategy Types - -Design your strategy using one or more of these analysis types: - -#### Symbol Analysis -- Find all function/type/interface definitions -- Analyze naming conventions and patterns -- Identify exported vs unexported symbols -- Check for unused or underdocumented symbols - -#### Type Inspection -- Analyze type hierarchies and interfaces -- Check interface implementation completeness -- Identify type assertion patterns -- Find opportunities for generic types - -#### Code Navigation -- Trace function call graphs -- Find all references to critical functions -- Analyze import dependencies -- Identify circular dependencies - -#### Diagnostics and Linting -- Use Serena's diagnostic tools -- Identify code smells and anti-patterns -- Check for common mistakes -- Validate idiomatic Go patterns - -#### Refactoring Opportunities -- Find code duplication -- Identify long functions or complex logic -- Detect opportunities for extraction -- Analyze error handling patterns - -#### AST Analysis -- Deep structural analysis of Go code -- Pattern matching on abstract syntax trees -- Identify complex code structures -- Find architectural issues - -### 3.3 Select and Document Your Strategy - -Choose your strategy based on: -1. **50% weight**: Proven strategies from cache with high success -2. **50% weight**: New or underutilized approaches - -Document your selection including: -- **Strategy name**: Short descriptive name -- **Tools used**: List of Serena tools you'll employ -- **Target areas**: Which parts of codebase to analyze -- **Success criteria**: How you'll measure findings -- **Reasoning**: Why this combination of cached + new - -## Step 4: Explain Your Strategy - -### 4.1 Write Strategy Justification - -Provide a clear explanation covering: - -**Cached Reuse Component (50%):** -- Which previous strategy are you adapting? -- Why was it successful before? (reference success scores) -- How are you modifying it for today's run? -- What specific files or patterns will you target? - -**New Exploration Component (50%):** -- What new approach are you introducing? -- Which Serena tools are you using differently? -- What gap in previous analyses does this fill? -- What types of issues do you expect to find? - -**Combined Strategy:** -- How do the two components complement each other? -- What's the expected coverage (breadth vs depth)? -- What's your hypothesis about findings? - -### 4.2 Set Success Metrics - -Define clear metrics for this run: -- **Minimum findings**: Expected number of issues to discover -- **Quality threshold**: How critical/actionable should findings be? -- **Task generation target**: 1-3 improvement tasks -- **Coverage goal**: Files or packages to analyze - -## Step 5: Execute Deep Research Using Strategy and Serena - -### 5.1 Run Your Analysis Strategy - -Execute your analysis plan using Serena tools systematically: - -For each component of your strategy: -1. **Invoke Serena tools** with appropriate parameters -2. **Document findings** with file locations, line numbers, and context -3. **Categorize issues** by severity and type: - - Critical: Security issues, bugs, crashes - - High: Performance problems, maintainability issues - - Medium: Code smells, minor anti-patterns - - Low: Style issues, documentation gaps - -### 5.2 Analyze Go Codebase Context - -Gather context about the repository: -```bash -# Count Go files -find . -name '*.go' -type f | wc -l - -# Get package structure -go list ./... | head -20 - -# Analyze direct dependencies -cat go.mod | grep -v '// indirect' - -# Find largest Go files -find . -name '*.go' -type f -exec wc -l {} + | sort -rn | head -10 -``` - -### 5.3 Cross-Reference Findings - -For each finding: -- Verify with multiple Serena tools when possible -- Check if related code has similar issues -- Look for patterns across the codebase -- Assess impact and risk - -### 5.4 Document Detailed Findings - -For each issue discovered, document: -- **Issue Type**: What kind of problem it is -- **Location**: File path, line number, function name -- **Description**: What's wrong and why it matters -- **Evidence**: Serena tool output, code snippets -- **Impact**: How this affects code quality, performance, or maintainability -- **Recommendation**: Specific fix or improvement suggestion - -## Step 6: Generate 1-3 Improvement Agentic Tasks - -### 6.1 Select Top Issues for Task Creation - -From your findings, select 1-3 issues that: -- Have the highest impact on code quality -- Are actionable and well-scoped -- Can be automated or semi-automated -- Represent patterns that appear multiple times - -### 6.2 Create Task Specifications - -For each selected issue, create a detailed task specification: - -**Task Template:** -```markdown -### Task [N]: [Short Title] - -**Issue Type**: [Symbol Analysis / Type Inspection / etc.] - -**Problem**: -[Clear description of the problem found] - -**Location(s)**: -- `path/to/file.go:123` - [specific issue] -- `path/to/other.go:456` - [related issue] - -**Impact**: -- **Severity**: [Critical/High/Medium/Low] -- **Affected Files**: [count] -- **Risk**: [What could go wrong if not fixed] - -**Recommendation**: -[Specific, actionable fix with code examples if applicable] - -**Before**: -```go -// Current problematic code -``` - -**After**: -```go -// Suggested improved code -``` - -**Validation**: -- [ ] Run existing tests -- [ ] Verify with Serena tools -- [ ] Check for similar issues in codebase -- [ ] Update documentation if needed - -**Estimated Effort**: [Small/Medium/Large] -``` - -### 6.3 Prioritize Tasks - -Order your 1-3 tasks by: -1. **Impact**: Critical issues first -2. **Scope**: Broader patterns before isolated issues -3. **Effort**: Quick wins before complex refactors - -## Step 7: Create Up to 3 Issues for Top Findings - -### 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? - -### 8.2 Save Strategy Results - -Append your results to the strategy history: -```bash -# Add new strategy execution to JSONL file -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/repo-memory/default/sergo-strategies.jsonl -``` - -### 8.3 Update Statistics - -Update aggregate statistics: -```bash -# Save updated stats -cat > /tmp/gh-aw/repo-memory/default/sergo-stats.json << 'EOF' -{ - "total_runs": 42, - "total_findings": 178, - "total_tasks": 89, - "avg_success_score": 7.8, - "last_run": "2026-01-15", - "most_successful_strategy": "symbol-analysis" -} -EOF -``` - -## Step 9: Create Comprehensive Discussion - -### 9.1 Discussion Structure - -**Title Format**: `Sergo Report: [Strategy Name] - [Date]` - -**Body Structure**: -```markdown -# 🔬 Sergo Report: [Strategy Name] - -**Date**: [YYYY-MM-DD] -**Strategy**: [Your strategy name] -**Success Score**: [X/10] - -## Executive Summary - -[2-3 paragraph summary covering: -- What you analyzed today -- Key findings discovered -- Tasks generated -- Overall code quality assessment] - -## 🛠️ Serena Tools Update - -### Tools Snapshot -- **Total Tools Available**: [count] -- **New Tools Since Last Run**: [list or "None"] -- **Removed Tools**: [list or "None"] -- **Modified Tools**: [list or "None"] - -### Tool Capabilities Used Today -[List of Serena tools you used with brief description of each] - -## 📊 Strategy Selection - -### Cached Reuse Component (50%) -**Previous Strategy Adapted**: [strategy name from cache] -- **Original Success Score**: [X/10] -- **Last Used**: [date] -- **Why Reused**: [explanation] -- **Modifications**: [what you changed] - -### New Exploration Component (50%) -**Novel Approach**: [new strategy description] -- **Tools Employed**: [list] -- **Hypothesis**: [what you expected to find] -- **Target Areas**: [files/packages analyzed] - -### Combined Strategy Rationale -[Explain how the two components work together and why this combination is effective] - -## 🔍 Analysis Execution - -### Codebase Context -- **Total Go Files**: [count] -- **Packages Analyzed**: [count or list] -- **LOC Analyzed**: [approximate count] -- **Focus Areas**: [specific packages or files] - -### Findings Summary -- **Total Issues Found**: [count] -- **Critical**: [count] -- **High**: [count] -- **Medium**: [count] -- **Low**: [count] - -## 📋 Detailed Findings - -### Critical Issues -[List critical findings with details] - -### High Priority Issues -[List high priority findings] - -### Medium Priority Issues -[List medium priority findings] - -
-Low Priority Issues - -[List low priority findings in collapsed section] - -
- -## ✅ Improvement Tasks Generated - -[Include your 1-3 task specifications from Step 6.2] - -## 📈 Success Metrics - -### This Run -- **Findings Generated**: [count] -- **Tasks Created**: [count] -- **Files Analyzed**: [count] -- **Success Score**: [X/10] - -### Reasoning for Score -[Explain your self-assessment] - -## 📊 Historical Context - -### Strategy Performance -[Reference previous runs and compare] - -### Cumulative Statistics -- **Total Runs**: [count] -- **Total Findings**: [count] -- **Total Tasks Generated**: [count] -- **Average Success Score**: [X.X/10] -- **Most Successful Strategy**: [name] - -## 🎯 Recommendations - -### Immediate Actions -1. [Task 1 summary with priority] -2. [Task 2 summary with priority] -3. [Task 3 summary with priority] - -### Long-term Improvements -[Broader suggestions based on patterns observed] - -## 🔄 Next Run Preview - -### Suggested Focus Areas -[What should the next Sergo run focus on?] - -### Strategy Evolution -[How should strategies evolve based on today's learnings?] - ---- -*Generated by Sergo - The Serena Go Expert* -*Run ID: ${{ github.run_id }}* -*Strategy: [Your strategy name]* -``` - -### 9.2 Discussion Quality Guidelines - -Ensure your discussion: -- **Is comprehensive**: Covers all aspects of your analysis -- **Is actionable**: Provides specific, implementable recommendations -- **Is data-driven**: Includes concrete findings with evidence -- **Is well-organized**: Easy to scan and navigate -- **Is professional**: Technical but accessible - -## Guidelines and Best Practices - -### Analysis Quality -- **Be thorough**: Don't just run tools, interpret the results -- **Be specific**: Include file paths, line numbers, and code snippets -- **Be critical**: Look for real issues that matter, not just style -- **Be actionable**: Every finding should have a recommendation - -### Strategy Design -- **Balance exploration and exploitation**: 50/50 split is important -- **Learn from history**: Use cache data to guide decisions -- **Innovate carefully**: New approaches should be justified -- **Measure success**: Track metrics to improve over time - -### Task Generation -- **Quality over quantity**: 1-3 excellent tasks better than many weak ones -- **Clear scope**: Each task should be well-defined and achievable -- **High impact**: Focus on issues that matter most -- **Actionable**: Provide enough detail for someone to implement - -### Cache Management -- **Maintain consistency**: Use consistent JSON formats -- **Track trends**: Look for patterns across multiple runs -- **Prune old data**: Consider keeping last 30-60 days -- **Document schema**: Keep cache file formats clear - -### When to Call `missing_data` - -Only call the `missing_data` tool when an **external** dependency is truly unavailable and prevents analysis from completing — for example, the Serena MCP server is unreachable and tools cannot be discovered. - -**Do NOT call `missing_data` for**: -- An absent `sergo-tools-list.json`, `sergo-strategies.jsonl`, or `sergo-stats.json` at startup — this is **expected and normal** for the first run or after a cache reset. Just initialize the files and proceed. -- Having no historical strategy data to compare against yet. - -### Serena MCP Usage -- **Explore capabilities**: Don't just use the same tools repeatedly -- **Combine tools**: Use multiple tools for deeper analysis -- **Validate findings**: Cross-check results when possible -- **Report issues**: If tools behave unexpectedly, document it - -## Output Requirements - -Your output MUST include: -1. **Analysis of Serena tools** with change detection -2. **Clear strategy explanation** with 50/50 split justification -3. **Detailed findings** from your analysis -4. **1-3 improvement tasks** with complete specifications -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 +Call `missing_data` only when external dependencies are unavailable and block completion (for example Serena MCP unreachable). +Do not call `missing_data` for absent local cache files on startup. ## Success Criteria -A successful Sergo run delivers: -- ✅ Tool list scanned and changes detected (if any) -- ✅ Strategy selected with proper 50% cached / 50% new split -- ✅ 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 +- Tool list scanned and compared. +- Strategy selected with explicit 50/50 split. +- Detailed, evidence-backed findings produced. +- 1-3 high-quality tasks generated. +- Up to 3 issues created (or duplicates skipped with rationale). +- Cache files updated for next run. +- Comprehensive discussion created. -Begin your analysis! Scan Serena tools, pick your strategy, and dive deep into the Go codebase to discover meaningful improvements. +Begin analysis now. -{{#runtime-import shared/noop-reminder.md}} \ No newline at end of file +{{#runtime-import shared/noop-reminder.md}} diff --git a/.github/workflows/smoke-copilot.lock.yml b/.github/workflows/smoke-copilot.lock.yml index 1eac71ae725..dcf162a9643 100644 --- a/.github/workflows/smoke-copilot.lock.yml +++ b/.github/workflows/smoke-copilot.lock.yml @@ -1,4 +1,4 @@ -# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"6c2f1423362a13a9255a6876c4ebc430bb8879f6eec25f142df34df6f8151591","body_hash":"c2054c1d33644aad214f0f0cc8949a4f09c5d478872f4254fc413bf41d868061","agent_id":"copilot","agent_model":"gpt-5.4"} +# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"6c2f1423362a13a9255a6876c4ebc430bb8879f6eec25f142df34df6f8151591","body_hash":"a0fec2113d30ea4585f266258cdda9d5097f01710990e0e2fad3fda902cb7f80","agent_id":"copilot","agent_model":"gpt-5.4"} # gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GH_AW_OTEL_GRAFANA_AUTHORIZATION","GH_AW_OTEL_GRAFANA_ENDPOINT","GH_AW_OTEL_SENTRY_AUTHORIZATION","GH_AW_OTEL_SENTRY_ENDPOINT","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":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-go","sha":"4a3601121dd01d1626a1e23e37211e3254c1c06c","version":"v6.4.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"docker/build-push-action","sha":"f9f3042f7e2789586610d6e8b85c8f03e5195baf","version":"v7.2.0"},{"repo":"docker/setup-buildx-action","sha":"d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5","version":"v4.1.0"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.25.58"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.25.58"},{"image":"ghcr.io/github/gh-aw-firewall/cli-proxy:0.25.58"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.25.58"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.22","digest":"sha256:ce5c6f5461b077af0d8e8eb1763436e85153f8e9531117d58a7bdb23de71f00a","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.22@sha256:ce5c6f5461b077af0d8e8eb1763436e85153f8e9531117d58a7bdb23de71f00a"},{"image":"ghcr.io/github/github-mcp-server:v1.1.2","digest":"sha256:30197479d8036c7811892bc07e06f9a05c9ef3cdd79bc59f256d50647f95788c","pinned_image":"ghcr.io/github/github-mcp-server:v1.1.2@sha256:30197479d8036c7811892bc07e06f9a05c9ef3cdd79bc59f256d50647f95788c"},{"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:2bdb65ed1dab192432bc31c95f94155ca5ad7fc1392fb7eb7526ab682fa5bf14","pinned_image":"node:lts-alpine@sha256:2bdb65ed1dab192432bc31c95f94155ca5ad7fc1392fb7eb7526ab682fa5bf14"}]} # ___ _ _ # / _ \ | | (_) @@ -332,7 +332,6 @@ jobs: GH_AW_EXPR_802A9F6A: ${{ github.event.issue.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'issue' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }} GH_AW_EXPR_FF1D34CE: ${{ github.event.comment.id || fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').comment_id }} GH_AW_GITHUB_ACTOR: ${{ github.actor }} - GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} GH_AW_GITHUB_REPOSITORY: ${{ github.repository }} GH_AW_GITHUB_RUN_ID: ${{ github.run_id }} GH_AW_GITHUB_SERVER_URL: ${{ github.server_url }} @@ -441,7 +440,6 @@ jobs: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt GH_AW_ENGINE_ID: "copilot" GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }} - GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} GH_AW_GITHUB_REPOSITORY: ${{ github.repository }} GH_AW_GITHUB_RUN_ID: ${{ github.run_id }} GH_AW_GITHUB_SERVER_URL: ${{ github.server_url }} @@ -467,7 +465,6 @@ jobs: GH_AW_EXPR_802A9F6A: ${{ github.event.issue.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'issue' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }} GH_AW_EXPR_FF1D34CE: ${{ github.event.comment.id || fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').comment_id }} GH_AW_GITHUB_ACTOR: ${{ github.actor }} - GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} GH_AW_GITHUB_REPOSITORY: ${{ github.repository }} GH_AW_GITHUB_RUN_ID: ${{ github.run_id }} GH_AW_GITHUB_SERVER_URL: ${{ github.server_url }} @@ -497,7 +494,6 @@ jobs: GH_AW_EXPR_802A9F6A: process.env.GH_AW_EXPR_802A9F6A, GH_AW_EXPR_FF1D34CE: process.env.GH_AW_EXPR_FF1D34CE, GH_AW_GITHUB_ACTOR: process.env.GH_AW_GITHUB_ACTOR, - GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER: process.env.GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER, 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_SERVER_URL: process.env.GH_AW_GITHUB_SERVER_URL, diff --git a/.github/workflows/smoke-copilot.md b/.github/workflows/smoke-copilot.md index 116c8a3e2a1..ea680ec17f8 100644 --- a/.github/workflows/smoke-copilot.md +++ b/.github/workflows/smoke-copilot.md @@ -176,30 +176,23 @@ These are **not** MCP protocol tools — they are bash executables. Call them wi ## Test Requirements -1. **GitHub MCP Testing**: Review the last 2 merged pull requests in ${{ github.repository }} -2. **MCP Scripts GH CLI Testing**: Use the `mcpscripts-gh` tool to query 2 pull requests from ${{ github.repository }} (use args: "pr list --repo ${{ github.repository }} --limit 2 --json number,title,author") -3. **Serena CLI Testing**: - - Use bash to run `serena activate_project --path ${{ github.workspace }}` to initialize the workspace and verify it succeeds (do NOT use bash to run go commands - use the serena CLI only) - - After initialization, use bash to run `serena find_symbol --name_path ` to search for symbols and verify that at least 3 symbols are found in the results -4. **Playwright CLI Testing**: Use bash to run `playwright-cli open https://github.com` to navigate to , then `playwright-cli screenshot` to take a screenshot and verify that the output indicates a successful navigation to "GitHub" (do NOT try to install playwright - use the `playwright-cli` command via bash only) -5. **Web Fetch Testing**: Use the web-fetch tool to fetch https://github.com and verify the response contains "GitHub" (do NOT use bash or playwright for this test - use the web-fetch tool directly) -6. **File Writing Testing**: Create a test file `/tmp/gh-aw/agent/smoke-test-copilot-${{ github.run_id }}.txt` with content "Smoke test passed for Copilot at $(date)" (create the directory if it doesn't exist) -7. **Bash Tool Testing**: Execute bash commands to verify file creation was successful (use `cat` to read the file back) -8. **Discussion Interaction Testing**: - - Use the `github-discussion-query` mcp-script tool with params: `limit=1, jq=".[0]"` to get the latest discussion from ${{ github.repository }} - - Extract the discussion number from the result (e.g., if the result is `{"number": 123, "title": "...", ...}`, extract 123) - - Use the `add_comment` tool with `discussion_number: ` to add a fun, playful comment stating that the smoke test agent was here -9. **Build gh-aw**: Run `GOCACHE=/tmp/gh-aw/agent/go-cache GOMODCACHE=/tmp/gh-aw/agent/go-mod make build` to verify the agent can successfully build the gh-aw project (both caches must be set under `/tmp/gh-aw/agent` because the default cache locations are not writable). If the command fails, mark this test as ❌ and report the failure. -10. **Upload gh-aw binary as artifact**: After a successful build, use bash to copy the `./gh-aw` binary into the staging directory (`mkdir -p $RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts && cp ./gh-aw $RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts/gh-aw`), then call the `upload_artifact` safe-output tool with `path: "gh-aw"`. The `upload_artifact` tool is available and configured in this workflow run — use it directly, do NOT use `missing_tool` for it. Mark this test as ❌ if the build in step 9 failed. -11. **Discussion Creation Testing**: Use the `create_discussion` safe-output tool to create a discussion in the announcements category titled "copilot was here" with the label "ai-generated". Use the temporary ID `aw_smoke_discussion` for this discussion so you can reference it in the Output section. -12. **Workflow Dispatch Testing**: Use the `dispatch_workflow` safe output tool to trigger the `haiku-printer` workflow with a haiku as the message input. Create an original, creative haiku about software testing or automation. -13. **PR Review Testing**: Review the diff of the current pull request. Leave 1-2 inline `create_pull_request_review_comment` comments on specific lines, then call `submit_pull_request_review` with a brief body summarizing your review and event `COMMENT`. To test `reply_to_pull_request_review_comment`: use the `pull_request_read` tool (with `method: "get_review_comments"` and `pullNumber: ${{ github.event.pull_request.number }}`) to fetch the PR's existing review comments, then reply to the most recent one using `reply_to_pull_request_review_comment` with its actual numeric `id` as the `comment_id`. Note: `create_pull_request_review_comment` does not return a `comment_id` — you must fetch existing comment IDs from the GitHub API. If the PR has no existing review comments, skip the reply sub-test. -14. **Comment Memory Testing**: Append an original 3-line haiku to the comment-memory markdown file(s) in `/tmp/gh-aw/comment-memory/*.md` without removing existing content. -15. **Sub-Agent Testing**: Use the `file-summarizer` agent to summarize `README.md`. Mark this test as ❌ if the sub-agent is unavailable or returns an error. - -16. **Check Run Safe Output Testing**: Use the `create_check_run` safe-output tool to create a check run on the current commit: - - Use `conclusion: "success"`, `title: "Smoke Copilot - Run ${{ github.run_id }}"`, `summary: "All smoke tests completed."`, and `text: "Detailed results attached."` - - Verify the tool call succeeds +Run these checks and mark each as ✅/❌: + +1. GitHub MCP: review 2 merged PRs in `${{ github.repository }}`. +2. `mcpscripts-gh`: query 2 PRs using `pr list --repo ${{ github.repository }} --limit 2 --json number,title,author`. +3. Serena CLI (bash only): run `serena activate_project --path ${{ github.workspace }}`, then `serena find_symbol --name_path ` and confirm at least 3 symbols. +4. Playwright CLI (bash only): run `playwright-cli open https://github.com` then `playwright-cli screenshot`; confirm successful GitHub navigation. +5. Web fetch tool: fetch `https://github.com` and confirm response contains `GitHub`. +6. File + bash: create `/tmp/gh-aw/agent/smoke-test-copilot-${{ github.run_id }}.txt` with timestamped success text, then `cat` it. +7. Discussion interaction: get latest discussion with `github-discussion-query` (`limit=1`, `jq=".[0]"`), extract number, then `add_comment` to that discussion. +8. Build: run `GOCACHE=/tmp/gh-aw/agent/go-cache GOMODCACHE=/tmp/gh-aw/agent/go-mod make build`. +9. Artifact upload (only if build passes): stage `./gh-aw` at `$RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts/gh-aw` and call `upload_artifact` with `path: "gh-aw"`. +10. Discussion create: call `create_discussion` in `announcements` with label `ai-generated`, title `copilot was here`, temp ID `aw_smoke_discussion`. +11. Workflow dispatch: call `dispatch_workflow` for `haiku-printer` with an original testing/automation haiku. +12. PR review tools: add 1-2 inline `create_pull_request_review_comment` comments, submit review with event `COMMENT`, then reply to most recent existing review comment ID when available. +13. Comment memory: append an original 3-line haiku to `/tmp/gh-aw/comment-memory/*.md`. +14. Sub-agent: use `file-summarizer` on `README.md`. +15. Check run: call `create_check_run` with `conclusion=success`, title `Smoke Copilot - Run ${{ github.run_id }}`, summary `All smoke tests completed.`, text `Detailed results attached.` ## Output