Skip to content

Commit 3d1d142

Browse files
fix: end-to-end agent testing on this PR
- Fix system prompt: use concrete example instead of <filepath> placeholder (LLM was interpreting angle brackets literally) - Fix filepath parsing: handle remaining edge cases - Remove hardcoded test values, use PR's own CI failures - Add aiohttp==3.9.0 to Dockerfile to trigger CVE scan failure - Skip branch validation for pull_request events TODO after validation: remove pull_request trigger, remove aiohttp, restore branch validation
1 parent 9d519f6 commit 3d1d142

3 files changed

Lines changed: 55 additions & 17 deletions

File tree

.github/workflows/agent-currency-fix.yml

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,21 @@ on:
88
workflow_run:
99
workflows: ["Merge Conditions"]
1010
types: [completed]
11+
# Manual trigger for testing (remove after validation)
12+
workflow_dispatch:
13+
inputs:
14+
branch:
15+
description: "PR branch (e.g., auto-update/vllm-99.99.99)"
16+
required: true
17+
run_id:
18+
description: "Failed workflow run ID"
19+
required: true
20+
# PR trigger for testing (remove after validation)
21+
pull_request:
22+
branches: [main]
23+
paths:
24+
- "scripts/autocurrency/agent-fix.py"
25+
- ".github/workflows/agent-currency-fix.yml"
1126

1227
permissions:
1328
contents: read
@@ -23,19 +38,27 @@ env:
2338
jobs:
2439
fix-agent:
2540
if: >-
26-
github.event.workflow_run.conclusion == 'failure' &&
27-
startsWith(github.event.workflow_run.head_branch, 'auto-update/')
41+
github.event_name == 'workflow_dispatch' ||
42+
github.event_name == 'pull_request' || (
43+
github.event.workflow_run.conclusion == 'failure' &&
44+
startsWith(github.event.workflow_run.head_branch, 'auto-update/')
45+
)
2846
runs-on:
2947
- codebuild-runner-${{ github.run_id }}-${{ github.run_attempt }}
3048
fleet:default-runner
3149
buildspec-override:true
3250
env:
33-
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
34-
RUN_ID: ${{ github.event.workflow_run.id }}
35-
RUN_URL: ${{ github.event.workflow_run.html_url }}
51+
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch || inputs.branch || github.head_ref }}
52+
RUN_ID: ${{ github.event.workflow_run.id || inputs.run_id || '' }}
53+
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
3654
steps:
3755
- name: Validate branch name
3856
run: |
57+
# Skip validation for pull_request testing
58+
if [ "${{ github.event_name }}" = "pull_request" ]; then
59+
echo "Skipping branch validation for PR testing"
60+
exit 0
61+
fi
3962
if [[ ! "$HEAD_BRANCH" =~ ^auto-update/[a-z]+-[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
4063
echo "::error::Branch '${HEAD_BRANCH}' does not match expected pattern."
4164
exit 1
@@ -57,7 +80,14 @@ jobs:
5780
GH_TOKEN: ${{ github.token }}
5881
run: |
5982
TRACKED="PR - vLLM EC2|PR - vLLM SageMaker|PR - SGLang EC2|PR - SGLang SageMaker"
60-
SHA=$(gh api "/repos/${{ github.repository }}/actions/runs/${RUN_ID}" --jq '.head_sha')
83+
84+
# Get HEAD SHA depending on event type
85+
if [ -n "$RUN_ID" ]; then
86+
SHA=$(gh api "/repos/${{ github.repository }}/actions/runs/${RUN_ID}" --jq '.head_sha')
87+
else
88+
SHA="${{ github.event.pull_request.head.sha || github.sha }}"
89+
fi
90+
echo "SHA: $SHA"
6191
6292
FAILED_RUN_IDS=$(gh api "/repos/${{ github.repository }}/actions/runs?head_sha=${SHA}&status=completed&per_page=50" \
6393
--jq "[.workflow_runs[] | select(.conclusion == \"failure\" and (.name | test(\"${TRACKED}\")))] | .[].id" \
@@ -93,16 +123,19 @@ jobs:
93123
if: steps.failures.outputs.has_failures == 'true'
94124
uses: actions/checkout@v5
95125
with:
96-
ref: main
126+
ref: ${{ github.event_name == 'pull_request' && github.head_ref || 'main' }}
97127
fetch-depth: 0
98128
token: ${{ steps.app-token.outputs.token }}
99129

100130
- name: Prepare workspace
101131
if: steps.failures.outputs.has_failures == 'true'
102132
run: |
103133
cp scripts/autocurrency/agent-fix.py /tmp/agent-fix.py
104-
git fetch origin "$HEAD_BRANCH"
105-
git checkout "origin/$HEAD_BRANCH" -B pr-branch
134+
# For pull_request testing, we're already on the right branch
135+
if [ "${{ github.event_name }}" != "pull_request" ]; then
136+
git fetch origin "$HEAD_BRANCH"
137+
git checkout "origin/$HEAD_BRANCH" -B pr-branch
138+
fi
106139
107140
- name: Count previous attempts
108141
if: steps.failures.outputs.has_failures == 'true'

docker/vllm/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ RUN uv pip install --system \
3838
"PyJWT>=2.12.0" \
3939
"model-hosting-container-standards>=0.1.15,<1.0.0" \
4040
"pyasn1>=0.6.3" \
41+
"aiohttp==3.9.0" \
4142
&& uv cache clean
4243

4344
COPY ./scripts/telemetry/deep_learning_container.py /usr/local/bin/deep_learning_container.py

scripts/autocurrency/agent-fix.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,21 @@
4343
If the failure is TRANSIENT (capacity, timeout, runner crash), respond with exactly:
4444
TRANSIENT: <brief reason>
4545
46-
Otherwise, respond with search/replace blocks:
46+
Otherwise, respond with search/replace blocks. Use this EXACT format:
4747
48-
<filepath>
48+
path/to/file.ext
4949
<<<<<<< SEARCH
50-
<exact text to find in the file>
50+
exact text to find in the file
5151
=======
52-
<replacement text>
52+
replacement text
5353
>>>>>>> REPLACE
5454
55+
IMPORTANT: Write the file path as plain text (e.g., docker/vllm/Dockerfile). Do NOT wrap it in angle brackets, backticks, or any other formatting.
56+
5557
Include 1-2 surrounding lines in SEARCH for unique anchoring.
5658
For JSON arrays (allowlists), SEARCH the last few lines and REPLACE with those lines plus the new entry.
5759
58-
End with: DESCRIPTION: <one-line commit message>"""
60+
End with: DESCRIPTION: one-line commit message"""
5961

6062

6163
def parse_args():
@@ -193,8 +195,9 @@ def parse_blocks(response: str) -> list:
193195
blocks = []
194196
for m in SEARCH_REPLACE_PATTERN.finditer(response):
195197
filepath = m.group(1).strip().strip("`").strip()
196-
# Strip common LLM artifacts: <filepath>, **filepath**, `filepath`
197-
filepath = re.sub(r"^<\w+>|<\/\w+>$", "", filepath).strip()
198+
# Strip all common LLM artifacts: <filepath>path, <path>, **path**, `path`
199+
filepath = re.sub(r"^<[^>]*>", "", filepath).strip() # strips <filepath>, <file>, etc.
200+
filepath = re.sub(r"^<|>$", "", filepath).strip() # strips bare < >
198201
filepath = filepath.strip("*").strip("`").strip()
199202
blocks.append({"path": filepath, "search": m.group(2), "replace": m.group(3)})
200203
return blocks
@@ -336,7 +339,8 @@ def main():
336339

337340
blocks = parse_blocks(response)
338341
if blocks:
339-
print(f"Parsed {len(blocks)} block(s): {[b["path"] for b in blocks]}")
342+
paths = [b["path"] for b in blocks]
343+
print(f"Parsed {len(blocks)} block(s): {paths}")
340344
if not blocks:
341345
retry_context = (
342346
f"Could not parse search/replace blocks from response.\n"

0 commit comments

Comments
 (0)