Skip to content

Fix agentic triage comment submission and reject incomplete summaries - #4706

Open
priyankatiwari08 wants to merge 9 commits into
mainfrom
dev/automation/fix-triage-safe-output
Open

priyankatiwari08 wants to merge 9 commits into
mainfrom
dev/automation/fix-triage-safe-output

Conversation

@priyankatiwari08

@priyankatiwari08 priyankatiwari08 commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Repair the safe-output submission failure behind #4704. In the recorded run for #4193, jq payload preparation was denied by the shell allowlist. The agent then submitted a diagnostic test message please ignore comment, consumed the one-comment quota, and could not publish its real triage summary.

  • Allow jq and document separate, checked JSON payload preparation followed by exactly one safeoutputs add_comment . submission. Explicitly prohibit diagnostic writes, -/@- body experiments, and retries after a submission error.
  • Add a trusted pre-publication validation step that checks the entire safe-output batch before any comments or labels are applied. Reject placeholder/unfinished comments, quoted or fenced templates, missing check rows or sections, multiple comments, label-only results, and mixed success/incomplete outcomes. Preserve explicit no-op and failure reporting.
  • Keep the existing trigger conditions, one-comment quota, label allowlist, on-demand label behavior, and read-only agent permissions. Checkout only the trusted validator at the event SHA, with persisted credentials disabled.
  • Regenerate the workflow lock with the existing gh-aw v0.88.2 compiler and add regression coverage to the lock-verification workflow.

Validation

  • All 24 Node.js validator regression tests pass, covering complete summaries, diagnostic and unfinished content, duplicate rows/sections, generic/XML/comparison prose, error and incomplete batches, operation ordering, and mode/Environment-consistent label operations. This suite does not test jq payload encoding.
  • The original Entra ID authentication broken under NativeAOT in v7.0 — Extensions.Azure reflection-based discovery is AOT-incompatible #4193 agent output is rejected both with its incomplete report and as a placeholder-only batch.
  • gh aw compile succeeds; repeating compilation leaves the generated lock byte-for-byte unchanged.
  • git diff --check passes.

Rollout and recovery

Related to #4704; intentionally do not close that tracker on merge. The previously reported completion count included workflow-attributed placeholders and is being re-audited. This PR fixes the workflow, not the existing backlog results.

After this reaches the default branch, verify a small representative pilot, retry only genuinely incomplete issues in completion-gated batches within the existing daily credit budget, and delete confirmed placeholder comments only after replacement summaries succeed. Keep #4704 open until recovery is verified. No backlog retries or comment deletions are included in this PR.

Checklist

  • Tests added or updated
  • Public API changes documented — N/A; workflow-only change
  • Verified against customer repro (if applicable) — recorded workflow failure replayed; no product repro applies
  • Ensure no breaking changes introduced — no public API changes; malformed triage output is intentionally rejected

Allow jq payload preparation, document one-shot JSON submission, and validate triage summaries before safe-output writes. Preserve comment limits, label restrictions, and incomplete-result reporting.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The validator still accepts collector errors, embedded placeholders, and contradictory no-op/incomplete batches.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Repairs issue-triage safe-output submission and adds pre-publication validation.

Changes:

  • Enables safe JSON payload creation with jq.
  • Validates triage summaries before publishing comments or labels.
  • Adds regression tests and regenerates the workflow lock.
File summaries
File Description
.github/workflows/verify-aw-lock.yml Runs validator tests during lock verification.
.github/workflows/issue-triage.md Adds safe submission guidance and validation steps.
.github/workflows/issue-triage.lock.yml Regenerates the executable workflow.
.github/scripts/validate-triage-output.cjs Implements output validation.
.github/scripts/tests/validate-triage-output.test.cjs Adds validator regression coverage.
.github/scripts/tests/README.md Documents test execution and scope.
Review details

Suppressed comments (2)

.github/scripts/validate-triage-output.cjs:36

  • The validator ignores the collector's top-level errors array. gh-aw records rejected/over-quota safe-output calls there while retaining any valid items, so a valid-looking comment plus a failed label or second submission is currently published as success. Reject any non-empty output.errors before processing items, and cover that mixed batch in the regression tests.
function validateTriageOutput(output) {
    if (!output || !Array.isArray(output.items) || output.items.length === 0 ||
        output.items.some(item => !item || typeof item.type !== 'string')) {
        throw new Error('Missing or malformed triage output: expected non-empty result items.');

.github/scripts/validate-triage-output.cjs:50

  • A batch containing both noop and report_incomplete has no comment, enters this branch, and returns successfully. Those are contradictory completed/no-action and failed outcomes, so this still permits a mixed success/incomplete batch. Reject incomplete && noop before the no-comment return and add a regression test.
    if (comments.length === 0) {
        if (!incomplete && !noop) {
            throw new Error('Triage output has no summary or explicit no-op/incomplete result.');
        }
        if (output.items.some(item => ['add_labels', 'remove_labels'].includes(item.type))) {
  • Files reviewed: 6/6 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/scripts/validate-triage-output.cjs Outdated
paulmedynski
paulmedynski previously approved these changes Sep 25, 2026
Carry forward the merged safe-output preparation guidance and reject embedded template placeholders in triage rows and prose sections.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The validator ignores ingestion errors, rejects valid generic syntax, and the workflow prompt still permits retries after submission errors.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 3 Medium severity

Open (3)
Resolved since last review (1)

Comment thread .github/scripts/validate-triage-output.cjs Outdated
Comment thread .github/scripts/validate-triage-output.cjs
Comment thread .github/workflows/issue-triage.md
Reject partial safe-output batches, preserve valid C# generics while detecting embedded template placeholders, and prohibit comment resubmission after any attempt. Remove redundant payload-encoding coverage now provided by merged triage preparation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 28, 2026 10:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Duplicate template rows can bypass whole-comment placeholder validation.

Review effort: Balanced
Findings: None

Resolved since last review (3)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Validate placeholders across duplicate rows and all prose

.github/​scripts/​validate-triage-output.cjs:92

find validates only the first occurrence of each required row, and the placeholder scan is limited to that selected value. A completed row followed by | Issue type | <fill in> | is therefore accepted, so an unfinished template can still be published despite the PR's whole-comment validation goal. After validating the required rows and sections, scan all non-quoted/non-fenced prose for placeholders; add a duplicate-row regression case as well.

@priyankatiwari08
priyankatiwari08 requested review from paulmedynski and a balanced review from Copilot September 28, 2026 14:44

@paulmedynski paulmedynski left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, with one Copilot suggestion remaining.

benrr101
benrr101 previously approved these changes Oct 8, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 9, 2026 08:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Placeholder detection still rejects valid code syntax and accepts bracket-free template instructions.

0 open findings

1 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Medium severity Placeholder matcher rejects valid generics and XML tags

.github/​scripts/​validate-triage-output.cjs:11

This field-name matcher also rejects legitimate C# generics and XML tags whenever their type/tag name is one of these words. For example, a completed Analysis containing Task<Result>, List<Item>, or an XML <summary> tag is classified as unfinished (the current validator throws for Task<Result>), so valid triage output can be blocked. Make placeholder detection context-aware or restrict it to the workflow's actual template forms, and add regressions for these common code/documentation forms.

This issue also appears on line 43 of the same file.

🧠 Review effort: Balanced

@paulmedynski paulmedynski left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yet another Copilot suggestion.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 9, 2026 17:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Leading whitespace is stripped before heading validation, allowing an indented code-block heading to pass.

0 open findings

Previously missed (1)

In code that hasn't changed since last review

Medium severity Validate heading before trimming leading indentation

.github/​scripts/​validate-triage-output.cjs:95

Checking the heading against body.trim() removes leading indentation before validation. A body whose first line is ## 🔍 Triage Summary therefore passes this check (and the remaining checks when its rows/sections are unindented), even though Markdown renders that first line as a code block rather than the required heading. Validate the original string start instead, and add an indented-heading regression case.

🧠 Review effort: Balanced

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 12, 2026 06:29
@priyankatiwari08

Copy link
Copy Markdown
Contributor Author

Validate heading before trimming leading indentation

Fixed in af74dd4. The heading is now checked without trimming leading whitespace. Added regressions for spaces and tabs; all 20 validator tests pass.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The validator accepts label actions that contradict the summary and on-demand triage rules.

0 open findings

Previously missed (1)

In code that hasn't changed since last review

Medium severity Validate label actions against summary and Environment state

.github/​scripts/​validate-triage-output.cjs:90

The gate only checks that label actions follow the comment; it does not verify that they match the summary. A missing/partial Environment with remove_labels, a complete environment with add_labels, and an on-demand summary with either label action are all accepted, even though the workflow requires the opposite behavior (lines 321-328). This can corrupt the Waiting for Author state that controls future activations. Validate the number and type of label operations against the heading variant and parsed Environment row, and add regressions for these contradictory batches.

🧠 Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The validator still accepts a known placeholder and incomplete or mode-inconsistent label batches.

2 open findings

🧠 Review effort: Balanced

Comment thread .github/scripts/validate-triage-output.cjs Outdated
Comment thread .github/scripts/validate-triage-output.cjs
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 12, 2026 09:27
@priyankatiwari08

Copy link
Copy Markdown
Contributor Author

Addressed the current Copilot findings and remaining related gaps in 42d95c2:

  • Reject test simple body in required rows and sections.
  • Require Environment-consistent waiting-label operations for initial/follow-up triage; reject label mutations for on-demand triage.
  • Reject duplicate required rows/sections and unfinished templates in additional prose, covering the older review finding.
  • The generic/XML false-positive finding was already fixed in fd13931; its acceptance regressions remain intact.

All 24 validator tests pass. The new regression cases failed before the fixes. Both current inline threads have replies and are resolved. These checks validate the output batch; they do not make comment/label publication atomic.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The implementation and generated workflow are coherent; only the PR’s validation wording is stale.

1 open finding
2 resolved since last review

🧠 Review effort: Balanced

Comment thread .github/workflows/verify-aw-lock.yml

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Waiting for customer

Development

Successfully merging this pull request may close these issues.

7 participants