Skip to content

fix: resolve #temporary_id references in dispatch_workflow inputs before dispatching#25693

Merged
pelikhan merged 4 commits into
mainfrom
copilot/fix-dispatch-workflow-handler
Apr 10, 2026
Merged

fix: resolve #temporary_id references in dispatch_workflow inputs before dispatching#25693
pelikhan merged 4 commits into
mainfrom
copilot/fix-dispatch-workflow-handler

Conversation

Copilot AI commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

dispatch_workflow was passing #temporary_id references (e.g. #aw_slosync) as literal strings in workflow inputs instead of resolving them to actual issue numbers before dispatch.

Changes

  • dispatch_workflow.cjs: Import loadTemporaryIdMapFromResolved, resolveIssueNumber, and replaceTemporaryIdReferences from temporary_id.cjs. In the inputs loop, apply two-stage resolution:
    • Pure temp ID values resolved via resolveIssueNumber (retains {repo, number} context):
      • Same-repo temp ID → bare number ("#aw_slosync""6499")
      • Cross-repo temp ID → "owner/repo#number" format (consistent with embedded reference behavior)
    • Embedded references in text ("See #aw_xxx""See owner/repo#number") via replaceTemporaryIdReferences
    • Unresolved temp IDs emit a warning and retain the original value
  • dispatch_workflow.test.cjs: New describe block covering pure temp ID resolution, bare form (no #), embedded text references, unresolved IDs, unchanged non-temp-ID values, multiple temp IDs in one dispatch, and cross-repo temp ID resolution
{
  "type": "dispatch_workflow",
  "workflow": "create-pr",
  "inputs": {
    "issue_number": "#aw_slosync"
  }
}

Previously dispatched issue_number: "#aw_slosync" — now dispatches issue_number: "6499" (same-repo) or issue_number: "owner/repo#6499" (cross-repo).

…ore dispatching

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/91f6e2a0-d8c5-43ae-a2b9-b8760ef6161d

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix dispatch_workflow handler to resolve temporary_id references fix: resolve #temporary_id references in dispatch_workflow inputs before dispatching Apr 10, 2026
Copilot AI requested a review from pelikhan April 10, 2026 19:20
@pelikhan
pelikhan marked this pull request as ready for review April 10, 2026 20:38
Copilot AI review requested due to automatic review settings April 10, 2026 20:38

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.

Pull request overview

Fixes dispatch_workflow so workflow-dispatch inputs no longer pass #temporary_id values literally, but instead resolve them to real issue numbers (and replace embedded references) before dispatching.

Changes:

  • Update dispatch_workflow.cjs to resolve pure temporary-ID inputs and replace embedded #aw_... references in text inputs.
  • Add dispatch_workflow.test.cjs coverage for resolving pure IDs, bare IDs, embedded references, unresolved IDs, and multiple IDs in one dispatch.
Show a summary per file
File Description
actions/setup/js/dispatch_workflow.cjs Adds two-stage temporary ID resolution for workflow_dispatch inputs before calling createWorkflowDispatch.
actions/setup/js/dispatch_workflow.test.cjs Adds a new test suite validating input-level temporary ID resolution behavior.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 2

Comment thread actions/setup/js/dispatch_workflow.cjs Outdated
Comment on lines +204 to +208
if (pureIdResult.wasTemporaryId) {
if (pureIdResult.errorMessage) {
core.warning(`Unresolved temporary ID in input "${key}": ${pureIdResult.errorMessage}`);
} else {
strValue = String(pureIdResult.resolved);
Comment on lines +864 to +868
describe("temporary ID resolution in inputs", () => {
const baseConfig = {
workflows: ["create-pr"],
workflow_files: { "create-pr": ".lock.yml" },
};
@github-actions github-actions Bot added the lgtm label Apr 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hey @Copilot 👋 — great work fixing the #temporary_id resolution in dispatch_workflow inputs! This is a meaningful correctness fix that prevents literal temporary ID strings (e.g. "#aw_slosync") from leaking into dispatched workflow inputs instead of being resolved to real issue numbers.

The PR is well-scoped, clearly described, follows the project's agentic contribution process, and ships full test coverage for the new resolution logic. This looks ready for maintainer review! 🎉

Generated by Contribution Check · ● 2.3M ·

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot review all comments

…tch_workflow inputs

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/71ad961b-3ecc-4a79-aa5d-48afa6f3725a

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

Copilot AI commented Apr 10, 2026

Copy link
Copy Markdown
Contributor Author

@copilot review all comments

Addressed both review points in commit 8df1ed8:

  1. Cross-repo awareness for pure temp ID inputs: Switched from resolveNumberFromTemporaryId (loses repo info) to resolveIssueNumber (returns {repo, number}). Same-repo temp IDs still resolve to a bare number; cross-repo temp IDs now emit owner/repo#number — consistent with how replaceTemporaryIdReferences handles embedded references.

  2. Cross-repo test: Added a test case where #aw_crossrepo resolves to {repo: "other-org/other-repo", number: 999} and verifies the dispatched input becomes "other-org/other-repo#999" rather than a bare "999" that would be misinterpreted.

@pelikhan

Copy link
Copy Markdown
Collaborator

Copilot AI commented Apr 10, 2026

Copy link
Copy Markdown
Contributor Author

@copilot fix https://github.com/github/gh-aw/actions/runs/24264681846/job/70857018249#step:7:1

Fixed in a5b62b8. The typecheck errors (TS18047: 'pureIdResult.resolved' is possibly 'null') were caused by accessing .resolved.repo/.resolved.number without a null check. Added || !pureIdResult.resolved to the guard condition so TypeScript narrows the type correctly in the branches that access it.

@pelikhan
pelikhan merged commit f37a6e7 into main Apr 10, 2026
56 checks passed
@pelikhan
pelikhan deleted the copilot/fix-dispatch-workflow-handler branch April 10, 2026 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dispatch_workflow handler does not resolve #temporary_id references in input values

3 participants