mirror of
https://github.com/Z3Prover/z3
synced 2026-08-02 20:23:27 +00:00
Optimize build-warning-fixer prebuild flow and issue-context patch handoff (#10347)
This updates the `build-warning-fixer` agentic workflow to reduce
avoidable setup overhead and improve handoff quality when triggered from
GitHub issues. It also hardens repository targeting so the workflow
operates only against `Z3Prover/z3`, not other repos.
- **Scope and intent**
- Restricts agent behavior to `Z3Prover/z3` via explicit prompt
guardrails.
- Clarifies issue-context output requirements so Copilot gets a complete
patch context for PR generation.
- **Prebuild efficiency**
- Replaces unconditional `apt-get update/install` with tool presence
checks.
- Installs build dependencies only when one or more required tools are
missing (`clang`, `clang-tidy`, `cmake`, `ninja`, `python3`).
- **Issue-context diff payload**
- Expands required patch reporting for issue-dispatched runs:
- `git status --short`
- `git diff --stat`
- `git diff`
- Requires explicit changed-file summary plus full unified diff block
when edits exist.
- **Lockfile synchronization**
- Regenerates `build-warning-fixer.lock.yml` from the updated workflow
source so runtime behavior matches prompt/step updates.
```bash
missing_tools=0
command -v clang >/dev/null 2>&1 || missing_tools=1
command -v clang-tidy >/dev/null 2>&1 || missing_tools=1
command -v cmake >/dev/null 2>&1 || missing_tools=1
command -v ninja >/dev/null 2>&1 || missing_tools=1
command -v python3 >/dev/null 2>&1 || missing_tools=1
if [ "$missing_tools" -eq 1 ]; then
sudo apt-get update -y
sudo apt-get install -y clang clang-tidy cmake ninja-build python3
fi
```
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
parent
47ec61793c
commit
d86b591368
2 changed files with 26 additions and 6 deletions
11
.github/workflows/build-warning-fixer.lock.yml
generated
vendored
11
.github/workflows/build-warning-fixer.lock.yml
generated
vendored
|
|
@ -1,5 +1,5 @@
|
|||
# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"1b50e68f9e9b814e39eacdf32639ccd137eb7dce7f0a13296ee1d364d08ab089","body_hash":"4dedf9a2b5bbadc75aa0ca83c86c53aad28f55bb414b599cbdffae0ed428f910","compiler_version":"v0.83.4","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.75"}}
|
||||
# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_CI_TRIGGER_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"55cc8345863c7cc4c66a329aec7e433d2d1c52a9","version":"v6.1.0"},{"repo":"actions/cache/save","sha":"55cc8345863c7cc4c66a329aec7e433d2d1c52a9","version":"v6.1.0"},{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"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":"820762786026740c76f36085b0efc47a31fe5020","version":"v7.0.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"v0.83.4","version":"v0.83.4"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.42","digest":"sha256:26a8af4e5566485b02f52af59ee03803ae798271a9619d4767e94d07806deb9b","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.42@sha256:26a8af4e5566485b02f52af59ee03803ae798271a9619d4767e94d07806deb9b"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.42","digest":"sha256:944f2686c9ab9bec338fd14b662461662f77cd12cd0ea8a3e7cb8c0987cd1607","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.42@sha256:944f2686c9ab9bec338fd14b662461662f77cd12cd0ea8a3e7cb8c0987cd1607"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.42","digest":"sha256:42dfeb649c680a8558cd5423dbc530b653a69413e35ffbe5e71da5d48c94bdf0","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.42@sha256:42dfeb649c680a8558cd5423dbc530b653a69413e35ffbe5e71da5d48c94bdf0"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.4.6","digest":"sha256:fecabec51bbc41f2ad61076d6bcd9a36ef23b142e672a444e054d37fc29de93c","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.4.6@sha256:fecabec51bbc41f2ad61076d6bcd9a36ef23b142e672a444e054d37fc29de93c"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:a8082161d7dceda14b68f32eb39d0eaa96b825d07f5895b096afab9d9e0c7748","pinned_image":"ghcr.io/github/gh-aw-node@sha256:a8082161d7dceda14b68f32eb39d0eaa96b825d07f5895b096afab9d9e0c7748"},{"image":"ghcr.io/github/github-mcp-server:v1.7.0","digest":"sha256:c491ffdf6f4c85cb5397021bc655edb8ab825c6f5f568e7597d77a1bd7c4d308","pinned_image":"ghcr.io/github/github-mcp-server:v1.7.0@sha256:c491ffdf6f4c85cb5397021bc655edb8ab825c6f5f568e7597d77a1bd7c4d308"}]}
|
||||
# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"00e3e90ad443f3bdf1e1d64cfde76a1a99e664033ebdb1c9632209f80a76c70a","body_hash":"849ec2c9cf00feb97d4bec3c03bff1e8ffe720f5f93d3a4c8e87fccee54656db","compiler_version":"v0.83.4","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.75"}}
|
||||
# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_CI_TRIGGER_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"55cc8345863c7cc4c66a329aec7e433d2d1c52a9","version":"v6.1.0"},{"repo":"actions/cache/save","sha":"55cc8345863c7cc4c66a329aec7e433d2d1c52a9","version":"v6.1.0"},{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"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":"820762786026740c76f36085b0efc47a31fe5020","version":"v7.0.0"},{"repo":"actions/setup-python","sha":"5fda3b95a4ea91299a34e894583c3862153e4b97","version":"v7.0.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"v0.83.4","version":"v0.83.4"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.42","digest":"sha256:26a8af4e5566485b02f52af59ee03803ae798271a9619d4767e94d07806deb9b","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.42@sha256:26a8af4e5566485b02f52af59ee03803ae798271a9619d4767e94d07806deb9b"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.42","digest":"sha256:944f2686c9ab9bec338fd14b662461662f77cd12cd0ea8a3e7cb8c0987cd1607","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.42@sha256:944f2686c9ab9bec338fd14b662461662f77cd12cd0ea8a3e7cb8c0987cd1607"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.42","digest":"sha256:42dfeb649c680a8558cd5423dbc530b653a69413e35ffbe5e71da5d48c94bdf0","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.42@sha256:42dfeb649c680a8558cd5423dbc530b653a69413e35ffbe5e71da5d48c94bdf0"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.4.6","digest":"sha256:fecabec51bbc41f2ad61076d6bcd9a36ef23b142e672a444e054d37fc29de93c","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.4.6@sha256:fecabec51bbc41f2ad61076d6bcd9a36ef23b142e672a444e054d37fc29de93c"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:a8082161d7dceda14b68f32eb39d0eaa96b825d07f5895b096afab9d9e0c7748","pinned_image":"ghcr.io/github/gh-aw-node@sha256:a8082161d7dceda14b68f32eb39d0eaa96b825d07f5895b096afab9d9e0c7748"},{"image":"ghcr.io/github/github-mcp-server:v1.7.0","digest":"sha256:c491ffdf6f4c85cb5397021bc655edb8ab825c6f5f568e7597d77a1bd7c4d308","pinned_image":"ghcr.io/github/github-mcp-server:v1.7.0@sha256:c491ffdf6f4c85cb5397021bc655edb8ab825c6f5f568e7597d77a1bd7c4d308"}]}
|
||||
# This file was automatically generated by gh-aw (v0.83.4). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md
|
||||
#
|
||||
# ___ _ _
|
||||
|
|
@ -40,6 +40,7 @@
|
|||
# - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
# - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9)
|
||||
# - actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||
# - actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
# - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
# - github/gh-aw-actions/setup@v0.83.4
|
||||
#
|
||||
|
|
@ -464,8 +465,12 @@ jobs:
|
|||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
with:
|
||||
python-version: '3.12'
|
||||
- name: Prebuild and collect clang diagnostics
|
||||
run: "set -o pipefail\nmkdir -p /tmp/gh-aw/agent\n\nsudo apt-get update -y\nsudo apt-get install -y clang clang-tidy cmake ninja-build python3\n\nrm -rf build\n\nconfigure_status=0\nbuild_status=0\n\nCC=clang CXX=clang++ cmake -GNinja -S . -B build \\\n -DCMAKE_BUILD_TYPE=Debug \\\n -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \\\n -DCMAKE_CXX_CLANG_TIDY=clang-tidy \\\n 2>&1 | tee /tmp/gh-aw/agent/clang-tidy-configure.log || configure_status=$?\n\nif [ \"$configure_status\" -eq 0 ]; then\n cmake --build build --target shell test-z3 -k 0 \\\n 2>&1 | tee /tmp/gh-aw/agent/clang-tidy-build.log || build_status=$?\nelse\n printf 'configure failed; build skipped\\n' | tee /tmp/gh-aw/agent/clang-tidy-build.log\n build_status=125\nfi\n\ngrep -nE 'warning:|error:|clang-tidy' /tmp/gh-aw/agent/clang-tidy-build.log \\\n > /tmp/gh-aw/agent/clang-tidy-diagnostics.txt || true\n\n{\n echo \"configure_status=$configure_status\"\n echo \"build_status=$build_status\"\n} > /tmp/gh-aw/agent/prebuild-status.txt\n"
|
||||
run: "set -o pipefail\nmkdir -p /tmp/gh-aw/agent\n\nmissing_tools=0\ncommand -v clang >/dev/null 2>&1 || missing_tools=1\ncommand -v clang-tidy >/dev/null 2>&1 || missing_tools=1\ncommand -v cmake >/dev/null 2>&1 || missing_tools=1\ncommand -v ninja >/dev/null 2>&1 || missing_tools=1\ncommand -v python3 >/dev/null 2>&1 || missing_tools=1\nif [ \"$missing_tools\" -eq 1 ]; then\n sudo apt-get update -y\n sudo apt-get install -y clang clang-tidy cmake ninja-build python3\nfi\n\nrm -rf build\n\nconfigure_status=0\nbuild_status=0\n\nCC=clang CXX=clang++ cmake -GNinja -S . -B build \\\n -DCMAKE_BUILD_TYPE=Debug \\\n -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \\\n -DCMAKE_CXX_CLANG_TIDY=clang-tidy \\\n 2>&1 | tee /tmp/gh-aw/agent/clang-tidy-configure.log || configure_status=$?\n\nif [ \"$configure_status\" -eq 0 ]; then\n cmake --build build --target shell test-z3 -k 0 \\\n 2>&1 | tee /tmp/gh-aw/agent/clang-tidy-build.log || build_status=$?\nelse\n printf 'configure failed; build skipped\\n' | tee /tmp/gh-aw/agent/clang-tidy-build.log\n build_status=125\nfi\n\ngrep -nE 'warning:|error:|clang-tidy' /tmp/gh-aw/agent/clang-tidy-build.log \\\n > /tmp/gh-aw/agent/clang-tidy-diagnostics.txt || true\n\n{\n echo \"configure_status=$configure_status\"\n echo \"build_status=$build_status\"\n} > /tmp/gh-aw/agent/prebuild-status.txt\n"
|
||||
shell: bash
|
||||
|
||||
- name: Configure Git credentials
|
||||
|
|
|
|||
21
.github/workflows/build-warning-fixer.md
vendored
21
.github/workflows/build-warning-fixer.md
vendored
|
|
@ -43,8 +43,16 @@ steps:
|
|||
set -o pipefail
|
||||
mkdir -p /tmp/gh-aw/agent
|
||||
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y clang clang-tidy cmake ninja-build python3
|
||||
missing_tools=0
|
||||
command -v clang >/dev/null 2>&1 || missing_tools=1
|
||||
command -v clang-tidy >/dev/null 2>&1 || missing_tools=1
|
||||
command -v cmake >/dev/null 2>&1 || missing_tools=1
|
||||
command -v ninja >/dev/null 2>&1 || missing_tools=1
|
||||
command -v python3 >/dev/null 2>&1 || missing_tools=1
|
||||
if [ "$missing_tools" -eq 1 ]; then
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y clang clang-tidy cmake ninja-build python3
|
||||
fi
|
||||
|
||||
rm -rf build
|
||||
|
||||
|
|
@ -90,6 +98,12 @@ You are an AI agent that uses pre-collected clang-tidy diagnostics, reviews warn
|
|||
|
||||
## Your Task
|
||||
|
||||
### 0. Verify repository target
|
||||
|
||||
This workflow is only for `Z3Prover/z3`.
|
||||
|
||||
If `${{ github.repository }}` is not `Z3Prover/z3`, call `noop` immediately with a short explanation.
|
||||
|
||||
### 1. Review prebuild results before taking action
|
||||
|
||||
This workflow already ran a prebuild with clang-tidy before agent mode. Start by inspecting:
|
||||
|
|
@ -167,11 +181,12 @@ If the rebuilt logs still contain actionable warnings, you may fix another small
|
|||
When this workflow is dispatched from a GitHub issue context (for example via `aw_context` with `item_type == "issue"`), always include patch details to make PR creation easy:
|
||||
|
||||
```bash
|
||||
git status --short
|
||||
git diff --stat
|
||||
git diff
|
||||
```
|
||||
|
||||
If changes were made, include the full unified diff in your final response in a fenced `diff` block.
|
||||
If changes were made, include the full unified diff in your final response in a fenced `diff` block and summarize changed files explicitly.
|
||||
|
||||
### 7. Create the pull request
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue