Skip to content

Commit 78972bb

Browse files
committed
fix: address PR review feedback and update nightly scanner docs budget
Triage workflow: - Add continue-on-error to agent, push, and PR steps - Add fallback notification step so issue authors always get feedback - Parse result marker from last line only (prevents false positives) Nightly scanner: - Always run documentation sub-agent regardless of bug/security findings - Separate issue budgets: 2 bug/security + 1 documentation per run
1 parent 7baf239 commit 78972bb

2 files changed

Lines changed: 34 additions & 19 deletions

File tree

‎.github/agents/nightly-scanner.yaml‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ agents:
5353
- `security` - for security vulnerabilities (HIGHEST PRIORITY)
5454
- If fails: log error, continue to bugs
5555
- `bugs` - for logic errors, resource leaks, race conditions
56-
- If fails: log error, continue to documentation check
57-
- `documentation` - for missing docs
58-
- ONLY run if BOTH security AND bugs returned `NO_ISSUES`
59-
- (Rationale: documentation issues are lower priority; we avoid noise when real bugs exist)
56+
- If fails: log error, continue to documentation
57+
- `documentation` - for missing docs (ALWAYS run, regardless of other findings)
6058
- If fails: log error, continue to reporting
6159
4. Collect findings from each sub-agent (they return text format or `NO_ISSUES`)
6260
5. Filter out any issues where FILE matches patterns from memory
63-
6. Sort by SEVERITY (critical > high > medium) and select top 1-2 issues
61+
6. Select findings for the reporter using separate budgets:
62+
- Up to 2 security/bug findings (sorted by SEVERITY: critical > high > medium)
63+
- Up to 1 documentation finding (the highest severity one)
6464
7. Add CATEGORY field to each finding based on source agent:
6565
- From security agent → `CATEGORY: security`
6666
- From bugs agent → `CATEGORY: bug`
@@ -358,9 +358,10 @@ agents:
358358
359359
## Workflow
360360
361-
**ENFORCE: Process at most 2 findings. If you receive more, only process the first 2.**
361+
**ENFORCE: Process at most 2 security/bug findings AND at most 1 documentation finding per run.**
362+
(Maximum 3 issues total: 2 bug/security + 1 documentation.)
362363
363-
For each finding (up to 2 maximum):
364+
For each finding (within the limits above):
364365
365366
1. Check if a similar issue already exists by searching for the same file AND line:
366367
```bash
@@ -447,7 +448,7 @@ agents:
447448
448449
## Important
449450
450-
- **STRICT LIMIT: Maximum 2 issues per run** - Stop after creating 2 issues, even if more findings exist
451+
- **STRICT LIMIT: Maximum 2 security/bug issues + 1 documentation issue per run** (3 total max)
451452
- Skip duplicates (search by file path AND line number in issue body)
452453
- Use exact code snippets from the findings
453454
- If creation fails, log FAILED and continue with remaining findings

‎.github/workflows/auto-issue-triage.yml‎

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ jobs:
8383
8484
- name: Run triage agent
8585
id: agent
86+
continue-on-error: true
8687
uses: docker/cagent-action@latest
8788
env:
8889
GH_TOKEN: ${{ steps.app-token.outputs.token || github.token }}
@@ -104,20 +105,20 @@ jobs:
104105
exit 0
105106
fi
106107
107-
CONTENT=$(cat "$OUTPUT_FILE")
108108
echo "--- Agent output ---"
109-
echo "$CONTENT"
109+
cat "$OUTPUT_FILE"
110110
echo "--------------------"
111111
112-
# Check for result markers (search from the end of output)
113-
if echo "$CONTENT" | grep -q "RESULT:NEEDS_INFO"; then
112+
# The agent contract requires the result marker on the last line
113+
LAST_LINE=$(tail -n 1 "$OUTPUT_FILE" | tr -d '[:space:]')
114+
if [[ "$LAST_LINE" == "RESULT:NEEDS_INFO" ]]; then
114115
echo "action=needs_info" >> "$GITHUB_OUTPUT"
115-
elif echo "$CONTENT" | grep -q "RESULT:FIXED"; then
116+
elif [[ "$LAST_LINE" == "RESULT:FIXED" ]]; then
116117
echo "action=fixed" >> "$GITHUB_OUTPUT"
117-
elif echo "$CONTENT" | grep -q "RESULT:NO_CHANGES"; then
118+
elif [[ "$LAST_LINE" == "RESULT:NO_CHANGES" ]]; then
118119
echo "action=none" >> "$GITHUB_OUTPUT"
119120
else
120-
echo "No recognized result marker found"
121+
echo "::warning::No recognized result marker on last line: $LAST_LINE"
121122
echo "action=none" >> "$GITHUB_OUTPUT"
122123
fi
123124
@@ -135,6 +136,7 @@ jobs:
135136
- name: Commit and push fix
136137
if: steps.result.outputs.action == 'fixed' && steps.changes.outputs.has_changes == 'true'
137138
id: push
139+
continue-on-error: true
138140
shell: bash
139141
env:
140142
GITHUB_TOKEN: ${{ steps.app-token.outputs.token || github.token }}
@@ -152,14 +154,13 @@ jobs:
152154
Automated fix generated by issue triage agent.
153155
Resolves #${ISSUE_NUMBER}"
154156
155-
git push origin "$BRANCH_NAME" || {
156-
echo "::error::Failed to push branch $BRANCH_NAME"
157-
exit 1
158-
}
157+
git push origin "$BRANCH_NAME"
159158
echo "branch=$BRANCH_NAME" >> "$GITHUB_OUTPUT"
160159
161160
- name: Create draft PR and comment on issue
162161
if: steps.push.outputs.branch != ''
162+
id: pr
163+
continue-on-error: true
163164
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
164165
env:
165166
BRANCH_NAME: ${{ steps.push.outputs.branch }}
@@ -209,3 +210,16 @@ jobs:
209210
});
210211
211212
core.info(`Created draft PR #${pr.data.number}: ${pr.data.html_url}`);
213+
214+
- name: Notify issue on failure
215+
if: failure() || (steps.result.outputs.action == 'fixed' && steps.changes.outputs.has_changes == 'true' && (steps.push.outcome == 'failure' || steps.pr.outcome == 'failure'))
216+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
217+
with:
218+
github-token: ${{ steps.app-token.outputs.token || github.token }}
219+
script: |
220+
await github.rest.issues.createComment({
221+
owner: context.repo.owner,
222+
repo: context.repo.repo,
223+
issue_number: context.payload.issue.number,
224+
body: 'I analyzed this bug report and attempted to create an automated fix, but encountered an error during the process. A maintainer will review this manually.',
225+
});

0 commit comments

Comments
 (0)