Skip to content

Support name-based artifact upserts in update-issue - #75988

Merged
pelikhan merged 5 commits into
mainfrom
copilot/update-issue-attach-artifacts
Nov 9, 2026
Merged

pelikhan merged 5 commits into
mainfrom
copilot/update-issue-attach-artifacts

Conversation

Copilot AI commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Issue artifacts were limited to newly created issues. This change lets update_issue publish artifacts on an existing issue, adding a version for a matching name rather than creating a duplicate.

  • Inputs and limits: Accept inline body or guarded path inputs. Reuse create-issue sanitization and configurable count/UTF-8 byte limits.
  • Upsert behavior: Paginate existing artifacts, match exact sanitized names, then PATCH existing artifacts or POST new ones. Reject immutable-type mismatches.
  • Execution: Support artifact-only calls without editing the issue body. Preserve target authorization and staged mode; report partial failures without retrying the entire issue update.
  • Integration: Add regression coverage, update reference/specification documentation, and regenerate affected workflow locks.
safe-outputs:
  update-issue:
    target: triggering
    max-issue-artifacts: 3
    max-issue-artifact-size: 1mb
{
  "type": "update_issue",
  "artifacts": [
    { "name": "Plan", "type": "plan", "body": "Implementation plan" }
  ]
}

Copilot AI changed the title [WIP] Add ability to attach or update artifacts on existing issues Support name-based artifact upserts in update-issue Nov 8, 2026
Copilot AI requested a review from pelikhan November 8, 2026 22:33
@pelikhan
pelikhan marked this pull request as ready for review November 8, 2026 22:34
Copilot AI adaptive review requested due to automatic review settings November 8, 2026 22:34
@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Ponytail Reviewer · routed: gpt61 medium · ~6 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 181 · ◷

Generated by Ponytail Reviewer for #75988

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

❌ Design Decision Gate 🏗️ failed to deliver outputs during design decision gate check.

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

Generated by PR Specification Reviewer for #75988

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Test Quality Sentinel · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 7.2K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions github-actions Bot 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.

Reviewed PR head c83b55996829f638272d83d7230d883be35a48b6 against Safe Outputs MCP Gateway Specification v1.29.20, especially update_issue §7 (artifact upserts) and the shared Issue Artifact Requirements.

Blocking finding: the implementation records the first matching artifact by API/page order rather than the contract-required lowest-numbered matching artifact. This makes name-based updates nondeterministic when duplicate names exist; see the inline comment on actions/setup/js/issue_artifacts.cjs:237. Please select the minimum artifact number and add reversed-order regression coverage, or synchronize the contract if lowest-number selection is not intended.

No specification edits were applied. This was a static review; tests were not run per review instructions.

Generated by PR Specification Reviewer for #75988 · copilot · gpt50 · ~4 AIC · ⌖ ~2 AIC · ⊞ 1.7K
Comment /review-specs to run again

Comment thread actions/setup/js/issue_artifacts.cjs Outdated
if (typeof entry.name !== "string" || !["generic", "link", "plan", "embedded_html"].includes(entry.type)) {
throw new Error(`${ERR_API}: Invalid issue artifact list response; expected a name and supported type`);
}
if (!existing.has(entry.name)) existing.set(entry.name, { number: metadata.number, type: entry.type });

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.

The synchronized contract in docs/src/content/docs/specs/safe-outputs-specification.md §7 requires PATCHing the lowest-numbered artifact for a matching sanitized name. This stores only the first artifact encountered in API/page order, which is not guaranteed to be numeric order, so duplicate names can update a higher-numbered artifact and violate deterministic upsert semantics. Track the minimum metadata.number for each name (and add a regression test with reversed ordering), or revise the contract if lowest-number selection is not intentional.

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.

The upsert now tracks the lowest artifact number for each sanitized name and patches that entry. Commit: 37d15ca.

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Warning

The push_to_pull_request_branch operation failed: Cannot verify branch protection rules for "copilot/update-issue-attach-artifacts": Resource not accessible by integration - https://docs.github.com/rest/branches/branch-protection\#get-branch-protection. Reading classic branch protection requires a GitHub App installation token or fine-grained PAT with Administration: read repository permission; GITHUB_TOKEN cannot provide this permission. Push blocked to prevent accidental writes to protected branches.. The code changes were not applied.

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (343 added lines under pkg/) but does not have a linked Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/75988-upsert-update-issue-artifacts-by-name.md. Review and complete it before merging.

🔒 This PR cannot merge until an ADR is linked in the PR body.

🔍 Evidence checked
  • PR body: no ADR link or ADR section. The only issue reference is Fixes #75973.
  • Linked issue update-issue: attach or update issue artifacts on an existing issue #75973: a feature request with an implementation plan. It has no Context, Decision, Alternatives Considered, or Consequences section, so it does not count as an ADR.
  • Branch docs/adr/: no 75988-* file existed before this draft.
  • Volume: 343 added lines under pkg/, above the 100-line threshold. The PR does not carry the implementation label.
📋 What to do next
  1. Review the draft ADR committed to your branch. It was generated from the PR diff.

  2. Complete the missing sections. Add context the gate could not infer, confirm the decision rationale, and resolve the [TODO: verify] markers. Decide whether a separate add-issue-artifact output is the better option (see Alternative 1 in the draft).

  3. Commit the finalized ADR to docs/adr/ on your branch.

  4. Reference the ADR in this PR body by adding a line such as:

    ADR: ADR-75988: Upsert Issue Artifacts by Name in update-issue (link unavailable: invalid HTTPS URL)

Once an ADR is linked in the PR body, this gate will re-run and verify that the implementation matches the decision.

❓ Why ADRs Matter

ADRs create a searchable, permanent record of why the codebase looks the way it does. Future contributors, including your future self, will rely on it.

📋 Michael Nygard ADR Format Reference

An ADR must contain these four sections to be considered complete:

  • Context: What is the problem? What forces are at play?
  • Decision: What did you decide, and why?
  • Alternatives Considered: What else could have been done?
  • Consequences: What are the trade-offs, both positive and negative?

ADRs are stored in docs/adr/ as Markdown files numbered by PR number (for example, 75773-... for PR #75773).

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 8.6K · ◷
Comment /review to run again

}

if (normalizedArgs.artifacts !== undefined) {
normalizedArgs.artifacts = resolveIssueArtifactPaths(normalizedArgs.artifacts, updateIssueConfig.max_issue_artifacts, updateIssueConfig.max_issue_artifact_size, "update_issue");
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-11-08T22:38:05Z
review_event: REQUEST_CHANGES
top_themes: partial-success retry semantics; non-idempotent artifact POST retries; inconsistent artifact sanitization and temporary-ID handling
files_reviewed: actions/setup/js/update_issue.cjs, actions/setup/js/issue_artifacts.cjs, pkg/workflow/update_issue.go, pkg/workflow/safe_outputs_validation_config.go, docs/src/content/docs/reference/safe-outputs.md
comment_count: 3

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~7 AIC · ⌖ ~1 AIC · ⊞ 1.6K · ◷
Comment /review to run again

@github-actions github-actions Bot 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.

Found three merge-blocking correctness risks in the artifact upsert path: partial issue updates are reported as generic failures and can be retried, POST retries can duplicate artifacts after ambiguous responses, and update artifacts do not share create_issue temporary-ID/mention sanitization behavior. Inline comments provide details. Static review only; tests were not run per review instructions.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~7 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again

Comment thread actions/setup/js/issue_artifacts.cjs Outdated
for (const artifact of artifacts) {
artifactName = artifact.name;
const match = existing.get(artifact.name);
const { data } = await withRetry(

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.

This newly added upsert path retries POST via withRetry. If the server accepts the create but the response is lost or a transient 5xx is returned, the retry can create a second artifact with the same name. Subsequent listing only selects the first matching artifact, so the duplicate remains and history diverges. Please avoid automatic retries for non-idempotent POSTs or reconcile by name before retrying.

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.

The upsert POST now makes one request without automatic retries; PATCH and listing retain retry handling. Commit: 37d15ca.

Comment thread actions/setup/js/update_issue.cjs Outdated
function buildIssueUpdateData(item, config) {
let artifacts;
try {
artifacts = sanitizeIssueArtifacts(normalizeIssueArtifacts(item.artifacts, config.max_issue_artifacts, config.max_issue_artifact_size, HANDLER_TYPE), {});

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.

The update path sanitizes artifact bodies with an empty options object, unlike the existing create-issue pipeline, and it never applies the temporary-ID replacement performed for ordinary issue bodies. Consequently artifact content can retain unresolved #aw_... references and can use different mention/alias handling than create_issue, despite the stated requirement to reuse its sanitization. Please share the same replacement and sanitizer options (with regression coverage).

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.

Artifact preparation now uses the configured mention sanitizer options and replaces temporary issue references using the resolved map and effective target repository before the final UTF-8 limit check. Commit: 37d15ca.

Comment thread actions/setup/js/update_issue.cjs Outdated
formatSuccessResult: (issueNumber, issue) => ({
...formatIssueSuccessResult(issueNumber, issue),
...(issue.artifacts?.length ? { artifacts: issue.artifacts } : {}),
...(issue._artifactError ? { success: false, error: issue._artifactError } : {}),

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.

A failed artifact attachment is converted into success: false even after executeIssueUpdate has already committed the issue edit (and possibly some artifact writes). A caller that retries this result will re-append the body or repeat other non-idempotent updates, while the returned error omits the attached artifacts and gives no reliable partial-success signal. Please expose the partial result explicitly (and make retry behavior unambiguous) rather than reporting the whole update as a generic failure.

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.

Artifact failures now return an explicit partial result with the attached artifacts, issueUpdated, and retryable: false, rather than inviting a blind retry of the full issue update. Commit: 37d15ca.

@github-actions github-actions Bot 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.

Skills-Based Review 🧠

Applied /diagnosing-bugs, /tdd, and /codebase-design. Requesting changes on one correctness bug and one missing regression test.

📋 Key Themes & Highlights

Key Themes

  • Correctness: duplicate existing artifact names PATCH the first list entry, not the lowest-numbered one the docs promise. Reproduced with a mock client.
  • Test gap: no coverage for duplicate names.
  • Readability: artifacts are normalized twice in buildIssueUpdateData.

Positive Highlights

  • ✅ Type mismatches fail before any writes, which protects HTML artifacts from sanitized Markdown.
  • ✅ Artifact failures are soft, so the issue edit is preserved and reported as partial.
  • ✅ Pagination stops on a short page, and the Go and JS tests cover limits and config parsing.

Not Raised

  • Artifact sanitization with {} matches the existing update body path (update_handler_factory.cjs), so it is consistent.

Limits

JS and Go test suites were not run; actions/setup/js/node_modules is absent. Findings are from source reading and a mock-client repro.

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~8 AIC · ⌖ ~2 AIC · ⊞ 6.3K
Comment /matt to run again

Comment thread actions/setup/js/update_issue.cjs Outdated
let artifacts;
try {
artifacts = sanitizeIssueArtifacts(normalizeIssueArtifacts(item.artifacts, config.max_issue_artifacts, config.max_issue_artifact_size, HANDLER_TYPE), {});
artifacts = normalizeIssueArtifacts(artifacts, config.max_issue_artifacts, config.max_issue_artifact_size, HANDLER_TYPE);

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.

[/codebase-design] buildIssueUpdateData normalizes artifacts twice: once before and once after sanitization. The second call is the post-sanitization size check, but that intent is not visible at the call site, so the pair reads as redundant. Either add a short comment saying so, or move both steps into one named helper such as prepareIssueArtifacts(item, config).

@copilot please address this.

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.

Moved artifact normalization, sanitization, temporary-ID replacement, and the final size check into the named prepareIssueArtifacts helper. Commit: 37d15ca.

});
});

it("adds a version by PATCH on the second run instead of creating a duplicate", async () => {

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.

[/tdd] No test covers duplicate existing names, so the lowest-numbered rule is unverified. Add a case where the list returns two plan artifacts (for example #9 then #3) and assert the PATCH targets #3.

💡 Example test

Arrange: the list returns [{number: 9, name: "plan"}, {number: 3, name: "plan"}]. Act: call upsertIssueArtifacts with one plan artifact. Assert: one PATCH to artifact_number: 3 and no POST.

@copilot please address this.

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.

Added a regression with existing Plan artifacts #9 then #3 and verified the PATCH targets #3. Commit: 37d15ca.

Comment thread actions/setup/js/issue_artifacts.cjs Outdated
if (typeof entry.name !== "string" || !["generic", "link", "plan", "embedded_html"].includes(entry.type)) {
throw new Error(`${ERR_API}: Invalid issue artifact list response; expected a name and supported type`);
}
if (!existing.has(entry.name)) existing.set(entry.name, { number: metadata.number, type: entry.type });

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.

[/diagnosing-bugs] Duplicate-name selection contradicts the documented contract. if (!existing.has(entry.name)) keeps the first entry in list order, not the lowest-numbered one. The docs (safe-outputs.md and spec item 7) say to PATCH the lowest-numbered match. A mock-client repro with existing plan artifacts #9 then #3 PATCHes #9.

💡 Suggested fix
const current = existing.get(entry.name);
if (!current || metadata.number < current.number) {
  existing.set(entry.name, { number: metadata.number, type: entry.type });
}

Add a regression test with duplicates returned out of order.

@copilot please address this.

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.

Duplicate-name selection now explicitly chooses the minimum artifact number, and the reversed-order regression verifies the documented contract. Commit: 37d15ca.

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 change leaves an HTML sanitization vulnerability, breaks existing validation and schema tests, and can mutate issues before rejecting invalid artifact input.

5 open issues
What changed in this PR

Extends gh-aw’s update-issue safe output to publish versioned artifacts on existing issues, reusing the artifact handling available for create-issue.

Changes:

  • Adds name-based artifact creation and updates, including artifact-only calls.
  • Extends configuration, schemas, types, and guarded file inputs with artifact limits.
  • Adds regression coverage, documents the contract, and regenerates affected workflow locks.
File Description
pkg/​workflow/​update_issue.go Parses artifact count and size limits.
pkg/​workflow/​update_issue_artifacts_test.go Tests limits, compilation, and artifact-only tool support.
pkg/​workflow/​tool_description_enhancer.go Adds agent-facing artifact constraints.
pkg/​workflow/​safe_outputs_validation_config.go Accepts artifacts as an issue update field.
pkg/​workflow/​safe_outputs_max_validation.go Propagates artifact-size parsing errors.
pkg/​workflow/​safe_outputs_handler_registry_issues.go Emits artifact limits into handler configuration.
pkg/​workflow/​safe_output_validation_config_test.go Updates artifact validation assertions.
pkg/​workflow/​safe_output_blank_fields_test.go Updates blank-request validation expectations.
pkg/​workflow/​js/​safe_outputs_tools.json Extends the embedded tool schema with artifact inputs.
pkg/​parser/​schemas/​main_workflow_schema.json Defines update-issue artifact configuration options.
docs/​src/​content/​docs/​specs/​safe-outputs-specification.md Specifies artifact upserts, validation, and failure handling.
docs/​src/​content/​docs/​reference/​safe-outputs.md Documents artifact configuration and usage.
actions/​setup/​js/​update_issue.cjs Prepares artifacts and integrates publication results.
actions/​setup/​js/​update_issue_artifacts.test.cjs Tests upserts, pagination, limits, staging, and failures.
actions/​setup/​js/​types/​safe-outputs.d.ts Adds body-only artifacts to recorded update requests.
actions/​setup/​js/​types/​safe-outputs-config.d.ts Adds typed artifact configuration options.
actions/​setup/​js/​types/​issue-artifacts.type-test.ts Checks update artifact types and helper contracts.
actions/​setup/​js/​safe_outputs_tools.json Exposes runtime artifact inputs and guidance.
actions/​setup/​js/​safe_outputs_mcp_wrapped_arguments.test.cjs Updates required-field error expectations.
actions/​setup/​js/​safe_outputs_handlers.test.cjs Tests guarded artifact paths and input limits.
actions/​setup/​js/​safe_outputs_handlers.cjs Resolves artifact paths before recording updates.
actions/​setup/​js/​issue_artifacts.cjs Adds paginated name-based POST/PATCH handling.
.github/​workflows/​workflow-health-manager.lock.yml Refreshes artifact limits and validation metadata.
.github/​workflows/​workflow-generator.lock.yml Refreshes artifact limits and validation metadata.
.github/​workflows/​sub-issue-closer.lock.yml Refreshes artifact limits and validation metadata.
.github/​workflows/​smoke-ci.lock.yml Refreshes artifact limits and validation metadata.
.github/​workflows/​pr-sous-chef.lock.yml Refreshes embedded update-issue validation.
.github/​workflows/​poem-bot.lock.yml Refreshes artifact limits and validation metadata.
.github/​workflows/​lint-monster.lock.yml Refreshes artifact limits and validation metadata.
.github/​workflows/​eslint-monster.lock.yml Refreshes artifact limits and validation metadata.
.github/​workflows/​daily-squid-image-scan.lock.yml Refreshes artifact limits and validation metadata.
.github/​workflows/​bot-detection.lock.yml Refreshes artifact limits and validation metadata.
.github/​workflows/​aw-failure-investigator.lock.yml Refreshes artifact limits and validation metadata.
.github/​skills/​agentic-workflows/​SKILL.md Lists the index-search documentation reference.

Review effort: Max (auto)

{
"name": "update_issue",
"description": "Update an existing GitHub issue's title, body, labels, assignees, or milestone WITHOUT closing it. This tool is primarily for editing issue metadata and content. REQUIRED: Provide at least one of: status, title, body, labels, assignees, or milestone. While it supports changing status between 'open' and 'closed', use close_issue instead when you want to close an issue with a closing comment. Body updates support replacing, appending to, prepending content, or updating a per-run \"island\" section. IMPORTANT: The behavior of this tool depends on the workflow's `update-issue: target:` configuration. When `target: triggering` (the default), the tool always updates the issue that triggered the workflow and `issue_number` is ignored. When `target: '*'`, the `issue_number` field controls which issue is updated. The tool will fail (not skip silently) when `target: triggering` and there is no triggering issue (e.g., in scheduled or workflow_dispatch workflows).",
"description": "Update an existing GitHub issue's title, body, labels, assignees, milestone, or artifacts WITHOUT closing it. This tool is primarily for editing issue metadata and content. REQUIRED: Provide at least one of: status, title, body, labels, assignees, milestone, or artifacts. While it supports changing status between 'open' and 'closed', use close_issue instead when you want to close an issue with a closing comment. Body updates support replacing, appending to, prepending content, or updating a per-run \"island\" section. IMPORTANT: The behavior of this tool depends on the workflow's `update-issue: target:` configuration. When `target: triggering` (the default), the tool always updates the issue that triggered the workflow and `issue_number` is ignored. When `target: '*'`, the `issue_number` field controls which issue is updated. The tool will fail (not skip silently) when `target: triggering` and there is no triggering issue (e.g., in scheduled or workflow_dispatch workflows).",
Comment thread actions/setup/js/update_issue.cjs Outdated
function buildIssueUpdateData(item, config) {
let artifacts;
try {
artifacts = sanitizeIssueArtifacts(normalizeIssueArtifacts(item.artifacts, config.max_issue_artifacts, config.max_issue_artifact_size, HANDLER_TYPE), {});

if config.CustomValidation != "requiresOneOf:status,title,body,labels,assignees,milestone" {
t.Errorf("update_issue customValidation = %q, want %q", config.CustomValidation, "requiresOneOf:status,title,body,labels,assignees,milestone")
if config.CustomValidation != "requiresOneOf:status,title,body,labels,assignees,milestone,artifacts" {
Comment thread actions/setup/js/update_issue.cjs Outdated

if (artifacts?.length) {
try {
const attached = await upsertIssueArtifacts(github, context.repo.owner, context.repo.repo, issueNumber, artifacts, _maxIssueArtifactSize);
Comment thread actions/setup/js/update_issue.cjs Outdated
Comment on lines +189 to +190
artifacts = sanitizeIssueArtifacts(normalizeIssueArtifacts(item.artifacts, config.max_issue_artifacts, config.max_issue_artifact_size, HANDLER_TYPE), {});
artifacts = normalizeIssueArtifacts(artifacts, config.max_issue_artifacts, config.max_issue_artifact_size, HANDLER_TYPE);
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (actions/setup/js/issue_artifacts.cjs:237): The synchronized contract in docs/src/content/docs/specs/safe-outputs-specification.md §7 requires PATCHing the lowest-numbered artifact for a matching sanitized name. This stores only the first artifact encountered in API/page order, which is not guaranteed to be numeric order, so duplicate names can update a higher-numbered artifact and violate deterministic upsert semantics. Track the minimum metadata.number for each name (and add a regression test with reversed ordering), or revise the contract if lowest-number selection is not intentional. - Support name-based artifact upserts in update-issue #75988 (comment)
  3. Review (actions/setup/js/issue_artifacts.cjs:255): This newly added upsert path retries POST via withRetry. If the server accepts the create but the response is lost or a transient 5xx is returned, the retry can create a second artifact with the same name. Subsequent listing only selects the first matching artifact, so the duplicate remains and history diverges. Please avoid automatic retries for non-idempotent POSTs or reconcile by name before retrying. - Support name-based artifact upserts in update-issue #75988 (comment)
  4. Review (actions/setup/js/update_issue.cjs:189): The update path sanitizes artifact bodies with an empty options object, unlike the existing create-issue pipeline, and it never applies the temporary-ID replacement performed for ordinary issue bodies. Consequently artifact content can retain unresolved #aw_... references and can use different mention/alias handling than create_issue, despite the stated requirement to reuse its sanitization. Please share the same replacement and sanitizer options (with regression coverage). - Support name-based artifact upserts in update-issue #75988 (comment)
  5. Review (actions/setup/js/update_issue.cjs:270): A failed artifact attachment is converted into success: false even after executeIssueUpdate has already committed the issue edit (and possibly some artifact writes). A caller that retries this result will re-append the body or repeat other non-idempotent updates, while the returned error omits the attached artifacts and gives no reliable partial-success signal. Please expose the partial result explicitly (and make retry behavior unambiguous) rather than reporting the whole update as a generic failure. - Support name-based artifact upserts in update-issue #75988 (comment)
  6. Review (actions/setup/js/update_issue.cjs:190): [/codebase-design] buildIssueUpdateData normalizes artifacts twice: once before and once after sanitization. The second call is the post-sanitization size check, but that intent is not visible at the call site, so the pair reads as redundant. Either add a short comment saying so, or move both steps into one named helper such as prepareIssueArtifacts(item, config). - Support name-based artifact upserts in update-issue #75988 (comment)
  7. Review (actions/setup/js/update_issue_artifacts.test.cjs:52): [/tdd] No test covers duplicate existing names, so the lowest-numbered rule is unverified. Add a case where the list returns two plan artifacts (for example #9 then #3) and assert the PATCH targets #3. - Support name-based artifact upserts in update-issue #75988 (comment)
  8. Review (actions/setup/js/issue_artifacts.cjs:237): [/diagnosing-bugs] Duplicate-name selection contradicts the documented contract. if (!existing.has(entry.name)) keeps the first entry in list order, not the lowest-numbered one. The docs (safe-outputs.md and spec item 7) say to PATCH the lowest-numbered match. A mock-client repro with existing plan artifacts #9 then #3 PATCHes #9. - Support name-based artifact upserts in update-issue #75988 (comment)
  9. Fix failing check impacted-go-tests (FAILURE): https://github.com/github/gh-aw/actions/runs/42530915481/job/128884771938.
  10. Fix failing check JS Tests (shard 6/8) (FAILURE): https://github.com/github/gh-aw/actions/runs/42530915425/job/128884773659.
  11. Fix failing check safe_outputs (FAILURE): https://github.com/github/gh-aw/actions/runs/42530915703/job/128886273498.

Once you start work, post this work summary as a PR comment without the leading Copilot mention, including the Sous-chef head, work, and state lines below, to record that the assignment is running. Apply the necessary fixes on this PR's existing branch, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved; stop when only human review or CI remains. Do not merge or trigger CI.

Sous-chef requested-head: c83b559
Sous-chef requested-work: 316ba3e3af4be6b37ab717bd2658bf216d0b4a4ce31dc8d808c36c26e252bdab 42e5d572d9d75b7168fe7d0aeda0717cc07e65ed240f6d299e6fec661214f1ac 4fa0402bd5650ed7e3b09c70a06c081c3a440d87d78d9b083e8e325a07dd96b1 6813b810574293d93a3c9c5ffcb12a35f01251e3271554cb0d61f7185990e2e6 73fb9ea82ac4ddbd95f872f80d40e7a5195003646db3ec57fc2015a670b52e0a 85a09cc71cead32d22eaa8350544380c38b57842ababeb7a07767449e6c8380f 9ed83dbcd4a77a11982fa6c499d4ee5c8281cb0d1f3c48cfb6b5a4c20e53f386 c7cf93e497befdd5e698d00101b0703e4101fe4133d86d433f7c170d07402b7e d9cc08d9273b4c5b8d8d29ecce0602e2a5a0920d5e3db1a3425b6dbafc01d7bc ee226a74f74301a6d387fa7f9d3b18726748b5bf317c7fcb2a2deb7787423f2c
Sous-chef requested-state: 5111cc845076e77417236a7eb2511579c33d76da27ccf9aab5dba3bd5f22326f

Generated by 👨🍳 PR Sous Chef · pi · haiku45 · ~14 AIC · ⌖ ~18 AIC · ⊞ 1.2K · ◷
Comment /souschef to run again

Copilot AI commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

@copilot

Copilot assignment requested for the following outstanding work:...

Sous-chef requested-head: c83b559
Sous-chef requested-work: 316ba3e3af4be6b37ab717bd2658bf216d0b4a4ce31dc8d808c36c26e252bdab 42e5d572d9d75b7168fe7d0aeda0717cc07e65ed240f6d299e6fec661214f1ac 4fa0402bd5650ed7e3b09c70a06c081c3a440d87d78d9b083e8e325a07dd96b1 6813b810574293d93a3c9c5ffcb12a35f01251e3271554cb0d61f7185990e2e6 73fb9ea82ac4ddbd95f872f80d40e7a5195003646db3ec57fc2015a670b52e0a 85a09cc71cead32d22eaa8350544380c38b57842ababeb7a07767449e6c8380f 9ed83dbcd4a77a11982fa6c499d4ee5c8281cb0d1f3c48cfb6b5a4c20e53f386 c7cf93e497befdd5e698d00101b0703e4101fe4133d86d433f7c170d07402b7e d9cc08d9273b4c5b8d8d29ecce0602e2a5a0920d5e3db1a3425b6dbafc01d7bc ee226a74f74301a6d387fa7f9d3b18726748b5bf317c7fcb2a2deb7787423f2c
Sous-chef requested-state: 5111cc845076e77417236a7eb2511579c33d76da27ccf9aab5dba3bd5f22326f

Copilot AI requested a review from gh-aw-bot November 9, 2026 00:02
@pelikhan
pelikhan merged commit be0c999 into main Nov 9, 2026
130 checks passed
@pelikhan
pelikhan deleted the copilot/update-issue-attach-artifacts branch November 9, 2026 00:13
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.2.2

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.

update-issue: attach or update issue artifacts on an existing issue

5 participants