# Run Issue Regeneration

> Runs the issue-assigned @azure/ai-projects TypeSpec regeneration workflow from required issue-description inputs through a reviewable draft pull request.

- Skill: `azure-azure-sdk-for-js/run-issue-regeneration` (Agent Skill)
- Install (CLI): `npx skillmds@latest add azure-azure-sdk-for-js/run-issue-regeneration`
- Raw SKILL.md: https://api.skillmd.com/api/skills/azure-azure-sdk-for-js/run-issue-regeneration/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- Author: Azure (https://skillmd.com/u/azure-azure-sdk-for-js)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/azure-azure-sdk-for-js/run-issue-regeneration

---


# Run an issue-assigned TypeSpec regeneration

Run the `@azure/ai-projects` TypeSpec regeneration from its pinned upstream commit through a reviewable draft pull request. Work only in `sdk/ai/ai-projects/` except for repository setup commands.

## Validate the assignment

Before installing dependencies or editing files:

1. Read exactly one unambiguous value labeled `TypeSpec commit` and exactly one unambiguous value labeled `Base branch` from the issue description. If either value is missing, duplicated, or ambiguous, stop without making changes and report the required labels.
2. Require the TypeSpec commit to match `^[0-9a-f]{40}$` exactly.
3. Require the entire base branch to case-sensitively match the conservative ASCII pattern `^[A-Za-z0-9][A-Za-z0-9._/-]*\z` and pass `git check-ref-format --branch`. Treat it only as a quoted command argument.
4. Require a named working branch other than the base branch. Fetch `origin/<base-branch>` successfully before proceeding. Do not require `HEAD` to match the base branch tip; issue-assigned sessions run on a separate working branch that may already contain commits. Instead, require the working branch to be either (a) ahead of `origin/<base-branch>` or (b) able to merge or rebase cleanly onto `origin/<base-branch>`. If neither condition holds, stop without making changes and report the divergence details, including the merge base and ahead/behind state relative to `origin/<base-branch>`.

Do not derive either input from the issue title. Do not infer, shorten, or silently correct either input.

## Set up the repository

From the repository root:

```bash
npm --prefix eng/common/tsp-client ci
export PATH="$PWD/eng/common/tsp-client/node_modules/.bin:$PATH"
pnpm install --filter @azure/ai-projects...
pnpm turbo build --filter=@azure/ai-projects... --token 1
```

Then change to `sdk/ai/ai-projects/` and require `git status --short -- .` to be empty. Stop on setup or preflight failure.

## Run the skills

The package skills are intentionally nested and are not automatically loaded by the cloud-agent runtime. Read each `SKILL.md` in full immediately before executing it, and execute them in this exact order:

1. `.github/skills/regenerate-from-typespec/SKILL.md`
2. `.github/skills/apply-post-emitter-edits/SKILL.md`
3. `.github/skills/author-samples/SKILL.md`
4. `.github/skills/author-tests/SKILL.md`
5. `.github/skills/update-changelog/SKILL.md`
6. `.github/skills/open-regeneration-pr/SKILL.md`

Pass the validated 40-character commit explicitly to `regenerate-from-typespec`. Always restore `tsp-location.saved.yaml` in a `finally` path if generation fails. Do not proceed to the next skill until the current skill's success criteria pass.

Protected-file drift and diff3 conflict markers produced by customization are inputs to `apply-post-emitter-edits`, not reasons to publish partial emitter output. That skill must restore protected files, resolve all markers, and remove its listed stray files before the samples, tests, and changelog skills run.

Samples and GA tests are conditional. A step may be a documented no-op when the API diff contains no qualifying surface; state that explicitly in the pull request rather than creating placeholder files.

For the sixth skill, the issue assignment already owns the working branch and draft pull request. Prepare the logical commits without creating another branch, pushing manually, or opening another pull request:

```powershell
./.github/skills/open-regeneration-pr/scripts/open-pr.ps1 `
  -TspCommit '<validated-commit>' `
  -BaseBranch '<validated-base-branch>' `
  -ManagedAgentSession
```

Append `-SamplesNoOp` only when `author-samples` explicitly completed as a documented no-op, and append `-TestsNoOp` only when `author-tests` explicitly completed as a documented no-op.

The result may contain three to five non-empty regeneration commits, always in this relative order: emitter output, post-emitter edits, samples, tests, changelog. Empty sample or test groups require the corresponding explicit no-op switch; all other unexplained empty groups are failures.

## Finish the managed pull request

Keep the pull request in draft and use the title `[ai-projects] Regenerate from azure-rest-api-specs@<7-character-commit>`. Its description must link the full upstream commit, summarize public API changes, explain any sample/test no-ops, and report each validation command honestly.

Apply every STOP condition from the six skills. On failure, preserve the working tree for diagnosis, do not publish partial manual branches or pull requests, and report the failing command and its output.

Before finishing a managed session, verify that no conflict markers remain under `src/`, `src/restorePollerHelpers.ts` and `metadata.json` do not exist, and the changelog group is non-empty. Never report progress or commit emitter output as the completed regeneration while any required downstream skill is pending or failed.

