stackblitz-labs / stackblitz-labs/pkg.pr.new
Error `no workflow defined for` when workflow is triggered by `Approve and run`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.9k
- Forks
- 127
- PR merge metrics
- No merged PRs in 30d
Description
When a workflow is triggered by maintainer clicking Approve and run for first time contributoros, pkg.pr.new fails with There is no workflow defined for ... error.
🤖 analysis of the root cause indicating mis-match between GITHUB_ACTOR_ID and sender.id:
/check404s on re-runs and approval-gated fork PRs: CLI keys onGITHUB_ACTOR_IDbut webhook keys onsender.id
pkg-pr-newpublish fails withCheck failed (404): There is no workflow defined for <key>whenever the person who caused the current workflow attempt to run is not the original triggering actor — i.e. a maintainer re-running a fork PR's jobs, or approving a first-time contributor's run.Cause
The CLI and the webhook handler compute the storage key from different actor IDs:
- CLI (
packages/cli/index.ts) hashes{ owner, repo, run, attempt, actor: GITHUB_ACTOR_ID }. Per GitHub's docs,GITHUB_ACTORis the user who triggered the initial run — on a re-run it stays the original actor and does not become the re-runner (GITHUB_TRIGGERING_ACTORdoes).- The server (
packages/app/server/routes/webhook.post.ts) stores the workflow entry under{ owner, repo, run, attempt, actor: payload.sender.id }. On aworkflow_runwebhook for a re-run/approved run, sender is the maintainer who clicked re-run/approve.So for attempt N of a re-run: webhook stores under
hash(..., actor: maintainer_id), CLI looks uphash(..., actor: pr_author_id)→ key not found → 404.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing actor-ID handling in packages/cli/index.ts with packages/app/server/routes/webhook.post.ts, focusing on how the workflow storage key is built. Reproduce or trace an approved or re-run fork pull request and verify that the CLI and webhook use the same key so pkg.pr.new no longer returns the 404 workflow error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend, ci-cd, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100