Skip to content

fix(#4783): add in-progress action to triage agent for fixing PRs - #5414

Closed
fullsend-ai-coder[bot] wants to merge 1 commit into
mainfrom
agent/4783-triage-in-progress-action
Closed

fix(#4783): add in-progress action to triage agent for fixing PRs#5414
fullsend-ai-coder[bot] wants to merge 1 commit into
mainfrom
agent/4783-triage-in-progress-action

Conversation

@fullsend-ai-coder

Copy link
Copy Markdown
Contributor

Summary

The triage agent's "Existing PR gate" hard constraint forced all open PRs that address an issue into the prerequisites action, which applies the blocked label and uses "blocked by" framing. This is semantically incorrect when a PR directly fixes the reported problem — the issue is not blocked, it is being addressed. This PR adds a new in-progress action that correctly distinguishes between PRs that fix an issue and PRs that are true prerequisites.

Related Issue

Fixes fullsend-ai/agents#433

Changes

  • agents/triage.md: Updated the "Existing PR gate" to distinguish two cases: (1) PR fixes the issue → use in-progress action, (2) PR is a true prerequisite → use prerequisites action. Added in-progress action documentation with JSON format and hard constraint.
  • schemas/triage-result.schema.json: Added in-progress to the action enum, added pull_requests property (array of PR URLs restricted to /pull/ paths), added conditional validation requiring pull_requests when action is in-progress.
  • scripts/post-triage.sh: Added in-progress case handler that removes blocked/ready-to-code/needs-info labels, applies pr-open label, and appends "Addressed by:" section with PR links. Added pr-open to CONTROL_LABELS.
  • scripts/post-triage-test.sh: Added 8 test cases covering: comment posting, label application/removal, missing comment validation, "Addressed by:" content, and control label refusal. Updated mock gh to capture body content piped via --body-file -.

Testing

  • All 8 new in-progress tests pass
  • All 46 existing tests continue to pass (1 pre-existing failure due to missing yq in sandbox is unrelated)
  • Secret scan passes
  • Gitlint validates commit message

Closes fullsend-ai/agents#433

Post-script verification

  • Branch is not main/master (agent/4783-triage-in-progress-action)
  • Secret scan passed (gitleaks — c088a3c72eabffcc350196a71b6351fb7d6af659..HEAD)
  • PR body secret scan passed (gitleaks — no-git)
  • Pre-commit hooks passed (authoritative run on runner)
  • Tests ran inside sandbox

The triage agent's "Existing PR gate" forced all open PRs that address
an issue into the prerequisites action, applying the blocked label.
This is semantically wrong when a PR directly fixes the issue — the
issue is not blocked, it is being addressed.

Add a new in-progress action that distinguishes PRs that fix an issue
(addressed by) from PRs that are true prerequisites (blocked by). The
post-script applies a pr-open label instead of blocked and uses
"Addressed by:" framing in the comment.

Changes:
- triage.md: split Existing PR gate into two cases (fix vs prerequisite),
  add in-progress action documentation
- triage-result.schema.json: add in-progress to action enum, add
  pull_requests property with URL validation
- post-triage.sh: add in-progress handler, add pr-open to control labels
- post-triage-test.sh: add 8 tests for in-progress action, update mock
  gh to capture comment body content

Closes #4783
@fullsend-ai-coder
fullsend-ai-coder Bot requested a review from a team as a code owner July 21, 2026 13:24
@fullsend-ai-coder fullsend-ai-coder Bot added the ready-for-review Triggers review agent dispatch label Jul 21, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Jul 21, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 1:25 PM UTC · Completed 1:43 PM UTC
Commit: d2860fe · View workflow run →

@github-actions

Copy link
Copy Markdown

Site preview

Preview: https://bacb610c-site.fullsend-ai.workers.dev

Commit: d2860fe852127483b2d33a4d3f3da5b761c48722

@fullsend-ai-review

Copy link
Copy Markdown

Review

Findings

High

  • [consumer-completeness] internal/scaffold/fullsend-repo/scripts/validate-output-schema-test.sh:295 — The test additional-properties-lists-known-keys expects the allowed properties string action, clarity_scores, comment, duplicate_of, label_actions, prerequisites, reasoning, triage_summary. The PR adds pull_requests as a new top-level schema property, so the sorted validator output will now include it. This test will fail deterministically.
    Remediation: Update the expected string to include pull_requests in alphabetical order: action, clarity_scores, comment, duplicate_of, label_actions, prerequisites, pull_requests, reasoning, triage_summary.

Medium

  • [consumer-completeness] internal/scaffold/fullsend-repo/scripts/validate-output-schema-test.sh — No test case for the in-progress action's conditional schema rule (requiring pull_requests). All other actions (insufficient, duplicate, sufficient, prerequisites) have both valid and conditional-requirement-failure test cases in this file.
    Remediation: Add valid-in-progress and in-progress-missing-pull-requests test cases.

  • [missing-new-feature] docs/agents/triage.md:44 — The control labels table (lines 44–51) and inline list (line 125) do not include the new pr-open label. Since agents read this file as behavioral instructions, the omission could cause the triage agent to include pr-open in label_actions, which post-triage.sh would then refuse as a control label.
    Remediation: Add pr-open to the control labels table and the inline list at line 125.

Low

  • [consumer-completeness] internal/scaffold/fullsend-repo/scripts/pre-triage.sh:30pr-open is not in pre-triage.sh's label reset list. If an issue goes from in-progress (gets pr-open) to another state on re-triage, the stale pr-open label persists. This follows the same pattern as blocked (also not reset by pre-triage.sh), but adding pr-open removal to relevant handlers would improve consistency.

  • [missing-new-feature] docs/guides/user/bugfix-workflow.md:38 — The labels table in "Labels are the state machine" does not include the new pr-open label.

  • [incomplete-behavior-description] docs/guides/user/bugfix-workflow.md:112 — The Stage 1: Triage description says "If a prerequisite is found, it labels blocked" but does not mention the new in-progress action for PRs that directly fix issues (labeled pr-open).

  • [test-adequacy] internal/scaffold/fullsend-repo/scripts/post-triage-test.sh:453 — No test for the multiple-PR case (pull_requests array with 2+ entries). All 8 new tests use single-element arrays.


Labels: PR modifies triage agent behavior (agent definition, schema, post-script) and fixes a bug in issue classification.

@fullsend-ai-review fullsend-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the review comment for full details.

@@ -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"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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.

@waynesun09 waynesun09 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent multi-agent review pass (3 agents). Three new findings posted inline above (1 HIGH, 2 MEDIUM); several other issues these agents rediscovered were already covered by the existing automated review and are not repeated here.

One additional finding has no valid inline location since the file isn't part of this diff:

[MEDIUM] docs/architecture.md:316,321 — The "Label state machine guard" and "triage agent runtime" building-block descriptions still describe only blocked/duplicate label semantics and the mutual-exclusion guarantee, without mentioning the new pr-open label or in-progress action. This is the doc that documents the very invariant the pr-open-cleanup finding above shows is now incomplete in code. Suggest updating both the mutual-exclusion sentence and the triage-runtime description to include pr-open/in-progress alongside blocked.

A couple of items independently rediscovered by these agents were verified and found to be false positives after empirical testing (e.g., a claim that adding a not-yet-existing label would hard-fail the script — confirmed GitHub's labels API auto-creates missing labels rather than erroring, so that specific failure mode doesn't occur) and are omitted accordingly.

remove_label "ready-to-code"
remove_label "needs-info"
remove_label "blocked"
add_label "pr-open"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MEDIUM] premature-decision — pr-open label creation skips this repo's established branding convention

Finding: add_label "pr-open" goes straight to the generic labels-API helper without first calling gh label create, unlike every other place this codebase introduces a label outside GitHub's defaults — e.g. pre-code.sh creates this exact pr-open label with --description "An open PR already addresses this issue" --color "D4C5F9" --force before applying it, and post-fix.sh/post-retro.sh/post-review.sh do the same for their respective labels. I verified empirically that GitHub's "Add labels to an issue" endpoint auto-creates a missing label (default gray color, no description) rather than erroring, so this won't break the handler — but on any repo where pre-code.sh's human-PR-detection branch hasn't already created pr-open (triage/Stage 1 always runs before code/Stage 2), the first in-progress triage result will create pr-open with GitHub's default styling instead of the intended purple, described label. That's an unverified assumption about label state shipped without the fallback step the rest of the codebase consistently uses.

Suggestion: Add gh label create "pr-open" --repo "${REPO}" --description "An open PR already addresses this issue" --color "D4C5F9" --force 2>/dev/null || true immediately before add_label "pr-open", matching pre-code.sh's handling of the same label.

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.

# 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")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[HIGH] pr-open control label is never cleared when an issue leaves the in-progress state

Finding: pr-open is added to CONTROL_LABELS here and applied by the new in-progress handler, but none of the other five action handlers (insufficient, duplicate, prerequisites, sufficient, question) ever call remove_label "pr-open" — each of them already clears blocked on this kind of transition, but pr-open has no equivalent. pre-triage.sh's label-reset loop (line 30) and its remaining-labels verification query weren't extended to include pr-open either. Once an issue is marked in-progress and later re-triaged to a different outcome (e.g. the linked PR closes unmerged, a case this PR's own updated gate anticipates), the stale pr-open label persists permanently and can't even be cleared through label_actions, since is_control_label() now refuses to touch it. This breaks the mutual-exclusion guarantee docs/architecture.md's label-state-machine section describes for blocked, which this PR doesn't extend to the new label.

Suggestion: Add remove_label "pr-open" alongside the existing remove_label "blocked" calls in the insufficient, duplicate, prerequisites, sufficient, and question branches, and add pr-open to pre-triage.sh's reset list and its verification --jq filter.

Flagged independently by all three review passes. This refines and escalates a previously-posted pre-triage.sh:30 note that rated the same underlying gap as low-severity consistency polish — the missing handlers plus the label_actions lockout make it a functional gap rather than a nice-to-have.

- The issue's fix requires a design decision that is being discussed in another issue

**Existing PR gate (HARD CONSTRAINT):** If an open PR already addresses this issue — even partially — treat it as a prerequisite. Use `action: "prerequisites"` with the PR URL in the `existing` array. Do not emit `action: "sufficient"` when an open PR covers the reported problem; dispatching a second implementation would create duplicates. Only skip this rule if the PR is closed without merging (the work was abandoned) or if the PR is clearly unrelated despite mentioning the issue number.
**Existing PR gate (HARD CONSTRAINT):** If an open PR already addresses this issue, do not emit `action: "sufficient"` — dispatching a second implementation would create duplicates. Instead, distinguish between two cases:

Copy link
Copy Markdown
Member

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 2b gh pr list query this gate depends on doesn't fetch isDraft, so the agent has no signal to distinguish a draft PR from one ready for review. The existing sufficient/prerequisites actions 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-progress only if the remaining scope is trivial, otherwise prerequisites), add isDraft to 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.

@rh-hemartin

Copy link
Copy Markdown
Member

This shouldn't go here. @waynesun09 could you take care of porting this to fullsend-ai/agents?

@waynesun09

Copy link
Copy Markdown
Member

Closing — this change targets the wrong repo.

The triage agent was extracted out of the scaffold into fullsend-ai/agents (ADR 0058; ADR 0045 Phase 4 — triage is the first agent to move out of the scaffold). At runtime the triage agent is resolved from fullsend-ai/agents, so edits to the copy under internal/scaffold/fullsend-repo/agents/, schemas/, and scripts/ here no longer take effect for triage — that copy is a transitional fallback slated for removal.

The in-progress action is a good change and is still needed: fullsend-ai/agents's agents/triage.md still carries the old "Existing PR gate" that forces every open PR into prerequisites, and its schemas/triage-result.schema.json action enum has no in-progress value. It should be redone as a PR against fullsend-ai/agents, touching the equivalents there:

  • agents/triage.md
  • schemas/triage-result.schema.json
  • scripts/post-triage.sh
  • scripts/post-triage-test.sh

Issue fullsend-ai/agents#433 stays open to track it. Re-dispatch against fullsend-ai/agents.

@waynesun09 waynesun09 closed this Jul 24, 2026
@fullsend-ai-retro

fullsend-ai-retro Bot commented Jul 24, 2026

Copy link
Copy Markdown

🤖 Finished Retro · ✅ Success · Started 1:40 PM UTC · Completed 1:56 PM UTC
Commit: d2860fe · View workflow run →

@fullsend-ai-retro

Copy link
Copy Markdown

Retro: PR #5414 — Code agent targeted deprecated scaffold instead of agents repo

Timeline

  1. Jul 14: fullsend-ai/agents#433 filed — triage agent incorrectly marks issues as blocked when an open PR fixes them.
  2. Jul 21 13:13 UTC: Code agent run 29833476130 dispatched against fullsend-ai/fullsend (wrong repo). Branch agent/4783-triage-in-progress-action references issue #4783, which does not exist in fullsend — suggesting a transferred or cross-repo dispatched issue.
  3. Jul 21 13:24 UTC: PR #5414 created, modifying 4 files under internal/scaffold/fullsend-repo/ — stale copies superseded by fullsend-ai/agents per ADR 0058.
  4. Jul 21 13:25–13:43 UTC: Review agent run 29834288560 produced 7 findings (1 HIGH, 2 MEDIUM, 4 LOW) — all valid code-quality issues, but none flagging the deprecated location.
  5. Jul 22 12:28 UTC: Human reviewer waynesun09 ran a 3-agent independent review, posting 3 additional findings (1 HIGH, 2 MEDIUM) and filtering out empirically-verified false positives. Still did not catch the wrong-repo issue.
  6. Jul 24 09:25 UTC: Human reviewer rh-hemartin identified the fundamental problem: the change targets the wrong repo.
  7. Jul 24 13:37 UTC: PR closed without merge after 3 days. Issue agents#433 updated with fix-location guidance.

What went well

  • The review agent's technical findings were substantive — the HIGH finding (broken validate-output-schema-test.sh expectation after adding pull_requests to the schema) was a genuine deterministic test failure that would be relevant when the fix is re-implemented correctly.
  • waynesun09's multi-agent review escalated a label-cleanup gap from LOW to HIGH after connecting dots across multiple handler branches — finding that pr-open is never cleared when an issue leaves in-progress state.
  • The code agent's implementation itself was well-crafted (8 new tests, schema validation, handler logic) — the only problem was location.

Root cause and existing coverage

This is the 4th+ documented instance of agent work targeting stale scaffold copies instead of fullsend-ai/agents. AGENTS.md contains zero guidance about the migration — the code agent has no signal that internal/scaffold/fullsend-repo/ files are deprecated. The pattern has extensive existing issue coverage:

Layer Issue Status
Documentation #3157 — AGENTS.md should document migration Open, ready-to-code, unassigned, no PRs (18 days)
Documentation #5215 — Expand #3157 to include scripts/ Open
Triage gate #465 — Gate PR creation for cross-repo fixes Open
Triage gate agents#224 — Detect scaffold paths in issue bodies Open
Code gate agents#327 — pre-code.sh detect transferred issues Open
Code agent #4657 — Escalate cross-repo fix targets Open
Review agent #3476 — Detect PRs modifying deprecated paths Open, triaged, unassigned, no PRs (16 days)
Removal #5552 — Remove scaffold fallback entirely Open, partially done via PR #5425

All improvement opportunities from this retro are already covered by existing issues. No new proposals are warranted.

New evidence from this PR

Cost of inaction

This single PR consumed ~30 minutes of agent compute (code + review), substantial human review effort across two reviewers over 3 days, and the fix for agents#433 remains unimplemented. Each instance of this pattern repeats the same waste until one of the defensive layers (#3157, #3476, or #5552) is implemented.

Autonomy assessment

The review agent's code-quality findings were valid — on a correctly-targeted PR, they would have improved the code. However, the review agent lacks architectural awareness to detect location-level misalignment. Implementing #3476 (path-based deprecated-location check) would close this gap. Until then, PRs touching internal/scaffold/fullsend-repo/ require human architectural review.

waynesun09 added a commit to fullsend-ai/agents that referenced this pull request Jul 24, 2026
The re-ported fix for #433 (agents/triage.md, the triage-result
schema, post-triage.sh, and their tests) carried over the same gaps
that were flagged during review of the original attempt at this fix,
fullsend-ai/fullsend#5414, which targeted a
deprecated scaffold copy and was closed in favor of this PR.

- Fix additional-properties-lists-known-keys: the expected sorted
  property list didn't include the new pull_requests field, so this
  test failed deterministically in CI.
- Add valid-in-progress / in-progress-missing-pull-requests schema
  validation coverage for the in-progress conditional rule.
- Clear pr-open in every handler that already clears blocked
  (insufficient, duplicate, prerequisites, sufficient, question,
  not-planned), and add pr-open to pre-triage.sh's label reset list
  and verification query. Without this, pr-open stuck permanently
  once an issue left the in-progress state, and label_actions
  couldn't remove it either since it's a control label.
- Create the pr-open label with its intended description/color
  before applying it, matching the convention pre-code.sh already
  uses for the same label.
- Document pr-open in the triage agent's control-label reference
  (the table and the issue-labels skill example).
- Add isDraft to the PR search query and give the agent guidance on
  classifying partial fixes and draft PRs, plus a matching
  Anti-premature-in-progress hard constraint alongside the other
  action's constraints.
- Add a multi-PR test case for the in-progress action.

Assisted-by: Claude
Signed-off-by: Wayne Sun <gsun@redhat.com>
@github-actions
github-actions Bot deleted the agent/4783-triage-in-progress-action branch August 23, 2026 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent/triage Triage agent bug ready-for-review Triggers review agent dispatch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Triage agent incorrectly marks issue as blocked

3 participants