-
Notifications
You must be signed in to change notification settings - Fork 94
fix(#4783): add in-progress action to triage agent for fixing PRs #5414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,12 @@ if [[ "\$1" == "issue" ]] && [[ "\$2" == "create" ]]; then | |
| echo "https://github.com/mock-org/mock-repo/issues/999" | ||
| exit 0 | ||
| fi | ||
| # Capture body content piped via --body-file - so tests can verify comment bodies. | ||
| if [[ "\$1" == "issue" ]] && [[ "\$2" == "comment" ]] && [[ "\$*" == *"--body-file -"* ]]; then | ||
| BODY=\$(cat) | ||
| echo "gh \$* <<BODY:\${BODY}:BODY>>" >> "${GH_LOG}" | ||
| exit 0 | ||
| fi | ||
| echo "gh \$*" >> "${GH_LOG}" | ||
| MOCKEOF | ||
| chmod +x "${MOCK_BIN}/gh" | ||
|
|
@@ -445,6 +451,39 @@ run_test "ready-to-code-applied-without-label-actions" \ | |
| '{"action":"sufficient","reasoning":"all clear","clarity_scores":{"symptom":0.9,"cause":0.85,"reproduction":0.9,"impact":0.8,"overall":0.87},"triage_summary":{"title":"Fix crash","severity":"high","category":"bug","problem":"Crash","root_cause_hypothesis":"Buffer overflow","reproduction_steps":["step 1"],"environment":"Linux","impact":"All users","recommended_fix":"Fix buffer","proposed_test_case":"test_crash"},"comment":"## Triage Summary\n\nReady."}' \ | ||
| "gh api repos/test-org/test-repo/issues/42/labels -f labels[]=ready-to-code --silent" | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [low] test-adequacy No test for the multiple-PR case (pull_requests array with 2+ entries). All 8 new tests use single-element arrays. |
||
| run_test "in-progress-posts-comment" \ | ||
| '{"action":"in-progress","reasoning":"PR fixes the reported bug","pull_requests":[{"url":"https://github.com/test-org/test-repo/pull/100"}],"comment":"This issue is already being addressed by an existing pull request."}' \ | ||
| "gh issue comment 42 --repo test-org/test-repo --body-file -" | ||
|
|
||
| run_test "in-progress-applies-pr-open-label" \ | ||
| '{"action":"in-progress","reasoning":"PR fixes the reported bug","pull_requests":[{"url":"https://github.com/test-org/test-repo/pull/100"}],"comment":"This issue is already being addressed by an existing pull request."}' \ | ||
| "gh api repos/test-org/test-repo/issues/42/labels -f labels[]=pr-open --silent" | ||
|
|
||
| run_test "in-progress-removes-blocked-label" \ | ||
| '{"action":"in-progress","reasoning":"PR fixes the reported bug","pull_requests":[{"url":"https://github.com/test-org/test-repo/pull/100"}],"comment":"This issue is already being addressed by an existing pull request."}' \ | ||
| "gh api repos/test-org/test-repo/issues/42/labels/blocked -X DELETE --silent" | ||
|
|
||
| run_test "in-progress-removes-ready-to-code-label" \ | ||
| '{"action":"in-progress","reasoning":"PR fixes the reported bug","pull_requests":[{"url":"https://github.com/test-org/test-repo/pull/100"}],"comment":"This issue is already being addressed by an existing pull request."}' \ | ||
| "gh api repos/test-org/test-repo/issues/42/labels/ready-to-code -X DELETE --silent" | ||
|
|
||
| run_test "in-progress-removes-needs-info-label" \ | ||
| '{"action":"in-progress","reasoning":"PR fixes the reported bug","pull_requests":[{"url":"https://github.com/test-org/test-repo/pull/100"}],"comment":"This issue is already being addressed by an existing pull request."}' \ | ||
| "gh api repos/test-org/test-repo/issues/42/labels/needs-info -X DELETE --silent" | ||
|
|
||
| run_test "in-progress-missing-comment-fails" \ | ||
| '{"action":"in-progress","reasoning":"PR fixes the reported bug","pull_requests":[{"url":"https://github.com/test-org/test-repo/pull/100"}]}' \ | ||
| "" \ | ||
| "true" | ||
|
|
||
| run_test "in-progress-appends-addressed-by" \ | ||
| '{"action":"in-progress","reasoning":"PR fixes the reported bug","pull_requests":[{"url":"https://github.com/test-org/test-repo/pull/100"}],"comment":"This issue is already being addressed."}' \ | ||
| "Addressed by:" | ||
|
|
||
| run_test_stdout "in-progress-control-label-refused" \ | ||
| '{"action":"in-progress","reasoning":"PR fixes the reported bug","pull_requests":[{"url":"https://github.com/test-org/test-repo/pull/100"}],"comment":"This issue is addressed.","label_actions":{"reason":"Tried to set pr-open label.","actions":[{"action":"add","label":"pr-open"}]}}' \ | ||
| "::warning::Refused to add control label 'pr-open' -- control labels are managed by the triage pipeline" | ||
|
|
||
| # --- Summary --- | ||
|
|
||
| echo "" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -79,7 +79,7 @@ remove_label() { | |
| # add or remove these via label_actions. This list covers labels that the | ||
| # pipeline itself applies (pre-triage.sh resets the first five; the action | ||
| # handlers apply blocked/triaged/feature). | ||
| CONTROL_LABELS=("needs-info" "ready-to-code" "duplicate" "feature" "blocked" "triaged" "question") | ||
| CONTROL_LABELS=("needs-info" "ready-to-code" "duplicate" "feature" "blocked" "triaged" "question" "pr-open") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [HIGH] Finding: Suggestion: Add Flagged independently by all three review passes. This refines and escalates a previously-posted |
||
|
|
||
| is_control_label() { | ||
| local label="$1" | ||
|
|
@@ -122,6 +122,38 @@ case "${ACTION}" in | |
| add_label "duplicate" | ||
| ;; | ||
|
|
||
| in-progress) | ||
| if [[ -z "${COMMENT}" ]]; then | ||
| echo "ERROR: action is 'in-progress' but no comment provided" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Collect PR URLs from the pull_requests array. | ||
| PR_COUNT=$(jq '.pull_requests // [] | length' "${RESULT_FILE}") | ||
| PR_URLS="" | ||
| for i in $(seq 0 $((PR_COUNT - 1))); do | ||
| URL=$(jq -r ".pull_requests[${i}].url" "${RESULT_FILE}") | ||
| PR_URLS="${PR_URLS} ${URL}" | ||
| done | ||
| PR_URLS=$(echo "${PR_URLS}" | xargs) # trim whitespace | ||
|
|
||
| if [[ -n "${PR_URLS}" ]]; then | ||
| PR_LIST="" | ||
| for url in ${PR_URLS}; do | ||
| PR_LIST="${PR_LIST} | ||
| - ${url}" | ||
| done | ||
| COMMENT="${COMMENT} | ||
|
|
||
| **Addressed by:**${PR_LIST}" | ||
| fi | ||
|
|
||
| remove_label "ready-to-code" | ||
| remove_label "needs-info" | ||
| remove_label "blocked" | ||
| add_label "pr-open" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [MEDIUM] premature-decision — Finding: Suggestion: Add Flagged in different forms by 2 of 3 independent review passes; severity/mechanism corrected here after empirically confirming GitHub's label-add API auto-creates rather than rejects unknown labels. |
||
| ;; | ||
|
|
||
| prerequisites) | ||
| if [[ -z "${COMMENT}" ]]; then | ||
| echo "ERROR: action is 'prerequisites' but no comment provided" >&2 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[MEDIUM] premature-decision — partial-fix and draft-PR edge cases dropped without guidance
Finding: The rewritten "Existing PR gate" splits existing-PR handling into "fixes this issue" (
in-progress) vs. "true prerequisite" (prerequisites), but drops the prior text's "even partially" qualifier without replacing it — a PR that only partially fixes the issue has no clear classification. Issue #4783's own triage analysis (which this PR closes) explicitly listed "PR partially addresses the issue" and "PR is in draft state" as edge cases to handle; neither is addressed here, and the Step 2bgh pr listquery this gate depends on doesn't fetchisDraft, so the agent has no signal to distinguish a draft PR from one ready for review. The existingsufficient/prerequisitesactions each have a dedicated "Anti-premature-*" hard-constraint rule in the clarity-scoring section; no analogous "Anti-premature-in-progress" rule was added for the new action.Suggestion: State how partial fixes should be classified (e.g., treat as
in-progressonly if the remaining scope is trivial, otherwiseprerequisites), addisDraftto the Step 2b query with guidance on how draft status affects classification, and add a matching "Anti-premature-in-progress" rule for consistency with the other two hard constraints.Flagged independently by 2 of 3 review passes; verified against issue #4783's own listed edge cases.