Skip to content

Treat empty add_labels list as a no-op instead of a job failure - #61429

Merged
pelikhan merged 8 commits into
mainfrom
copilot/issue-should-add-labels-fail-workflow
Sep 17, 2026
Merged

pelikhan merged 8 commits into
mainfrom
copilot/issue-should-add-labels-fail-workflow

Conversation

Copilot AI commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

An agent emitting add_labels with labels: [] caused the safe-output job to fail (partial_success, 1 failed) and triggered an automatic failure-report issue, even though there was simply nothing to label.

The handler was already inconsistent here: a list whose entries all get filtered out by validation returns success with labelsAdded: [], while an empty list returned an error.

Changes

  • actions/setup/js/add_labels.cjs — an empty/missing labels list now logs core.warning(...) and returns { success: true, number, labelsAdded: [], message } rather than { success: false, error }. The message still names the allowed list (or the repository's available labels) so the agent gets corrective feedback.
  • actions/setup/js/add_labels.test.cjs — the three empty/missing-labels cases assert the no-op success result.
  • .changeset/add-labels-empty-list-no-op.md — patch changeset.

Unchanged: missing/invalid issue numbers, disallowed or blocked label names, label-count limits, and API/permission errors all remain failures.

// labels: [] — before: { success: false, error: "No labels provided..." }  → job fails
// after:
{ success: true, number: 100, labelsAdded: [], message: "No labels provided. Skipping add_labels. Provide at least one label from ..." }

Run: https://github.com/github/gh-aw/actions/runs/35174719104

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • github.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "github.com"

See Network Configuration for more information.

Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 54.4 AIC · ⊞ 9K · ◷
Comment /souschef to run again


pr-sous-chef run https://github.com/github/gh-aw/actions/runs/35183135294

Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 30 AIC · ⊞ 9.2K · ◷
Comment /souschef to run again

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix workflow failure when add_labels is called with empty list Treat empty add_labels list as a no-op instead of a job failure Sep 16, 2026
Copilot AI requested a review from pelikhan September 16, 2026 23:26
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot the tools.json spec of the field should set min 1

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

@copilot the tools.json spec of the field should set min 1

Added "minItems": 1 to the add_labels labels array in safe_outputs_tools.json (both the pkg/workflow/js source and the actions/setup/js runtime copy), matching schemas/agent-output.json, and updated the field description accordingly. Commit 0745225.

@pelikhan
pelikhan marked this pull request as ready for review September 17, 2026 00:36
Copilot AI balanced review requested due to automatic review settings September 17, 2026 00:36

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 no-op is currently counted as an applied mutation rather than a skipped operation.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Makes empty add_labels requests non-fatal while guiding agents toward non-empty input.

Changes:

  • Returns successful no-op results for empty or missing labels.
  • Adds minItems: 1 to both tool schemas.
  • Updates tests and release notes.
File summaries
File Description
pkg/workflow/js/safe_outputs_tools.json Updates compiler schema constraints.
actions/setup/js/safe_outputs_tools.json Updates runtime schema constraints.
actions/setup/js/add_labels.cjs Implements empty-label no-op handling.
actions/setup/js/add_labels.test.cjs Updates no-op expectations.
.changeset/add-labels-empty-list-no-op.md Documents the patch.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment on lines +399 to +404
return {
success: true,
number: itemNumber,
labelsAdded: [],
message,
};

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 9ebe596 and 3c0e220: the empty-labels path now returns { success: true, skipped: true, reasonCode: "NO_LABELS_PROVIDED", reason: "No labels provided", ... }. classifySafeOutputResult checks skipped before success, so it is counted in items_skipped rather than items_applied, and the summary renders the reason code. Tests assert result.skipped === true, the reason code, and classifySafeOutputResult(result) === "skipped".

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot this PR still needs forward progress before a maintainer can investigate quickly. Please update the empty-label no-op so it is reported as a skipped operation rather than an applied mutation, refresh the branch if needed, and then run the pr-finisher skill.

Latest blocking review points:

  • make the no-op count as skipped work instead of an applied mutation

Run URL: https://github.com/github/gh-aw/actions/runs/35174719104

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • github.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "github.com"

See Network Configuration for more information.

Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 54.4 AIC · ⊞ 9K · ◷
Comment /souschef to run again

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

@copilot this PR still needs forward progress before a maintainer can investigate quickly. Please update the empty-label no-op so it is reported as a skipped operation rather than an applied mutation,...

Fixed in 9ebe596: the empty-labels no-op now returns success: true, skipped: true, reason: <message>, which classifySafeOutputResult picks up before success, so it's counted as a skipped item rather than an applied mutation. Tests updated to assert result.skipped === true.

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

pr-sous-chef
@copilot this PR looks close, but it still needs a fresh review pass before a maintainer can investigate quickly. The earlier no-op accounting fix appears to be in place, so please request a fresh Copilot review, refresh the branch if needed, and then run the pr-finisher skill.

Previously raised review point to re-check:

  • count the empty add_labels path as skipped work rather than an applied mutation

Run URL: https://github.com/github/gh-aw/actions/runs/35176271104

Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 48.6 AIC · ⊞ 9K · ◷
Comment /souschef to run again

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

pr-sous-chef
@copilot this PR looks close, but it still needs a fresh review pass before a maintainer can investigate quickly. The earlier no-op accounting fix appears to be in place, so please requ...

Re-verified and refreshed in 3c0e220. The empty-add_labels path returns { success: true, skipped: true, reasonCode: "NO_LABELS_PROVIDED", reason: "No labels provided", labelsAdded: [] }, so classifySafeOutputResult classifies it as skipped (checked before success) and it is never counted in items_applied. Tests now assert the skip flag, the reason code, and the classification directly.

A fresh Copilot review pass returned no comments, and the earlier review thread has been replied to. Ran pr-finisher:

  • ✅ Reviews — the only unresolved thread (empty-label accounting) is addressed and replied to; it needs a maintainer click to mark resolved since the agent cannot resolve threads.
  • ✅ Checks (local) — make agent-report-progress passes (format, JS lint, schema freshness, impacted tests: 81/81 in add_labels.test.cjs).
  • ❓ Checks (CI) — stale after the agent push; no prior CI failures were attributable to this change. A maintainer needs to re-trigger CI.
  • ✅ Mergeable — open, not draft, no conflicts, branch already contains current main (290730b); mergeable_state: blocked only reflects the pending required review.

Hand-off: CI must be re-triggered by a maintainer (close/reopen, workflow_dispatch, or a maintainer push) before merge.
Still needed: human review approval and thread resolution.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

pr-sous-chef
@copilot this PR looks close, but it still needs maintainer-ready follow-through before investigation is quick. Please ensure the resolved empty-label no-op fix has a fresh review/check pass, refresh the branch if needed, and then run the pr-finisher skill.

Latest points to close out:

  • the empty add_labels path now appears fixed; get a fresh review/check signal on the current head
  • if CI is stale after the latest push, coordinate the smallest branch refresh or maintainer re-trigger needed

Run URL: https://github.com/github/gh-aw/actions/runs/35183135294

Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 30 AIC · ⊞ 9.2K · ◷
Comment /souschef to run again

Copilot AI commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

pr-sous-chef
@copilot this PR looks close, but it still needs maintainer-ready follow-through before investigation is quick. Please ensure the resolved empty-label no-op fix has a fresh review/check...

Fresh review found no issues, and make fmt, make lint, make test-unit, make test, and make recompile all pass. The branch already contains the current base (9073417); the latest Sous Chef run succeeded but evaluated main, so CI on this agent-pushed head remains pending a maintainer re-trigger.

@pelikhan
pelikhan merged commit aa5b1cc into main Sep 17, 2026
2 checks passed
@pelikhan
pelikhan deleted the copilot/issue-should-add-labels-fail-workflow branch September 17, 2026 06:44
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.89.17

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Should add_labels with an empty list fail the workflow?

4 participants