Skip to content

Commit 6340aba

Browse files
ayushtr-awsclaude
andauthored
fix(jira): pin coding/new-task-v1 workflow_ref in webhook processor (#547)
A label-triggered Jira task submitted no workflow_ref, so createTaskCore resolved it down the ladder to the platform default default/agent-v1 — an artifact-delivery workflow whose prompt forbids branching and PRs. The agent completed 'successfully' without committing, and the Jira issue got '✅ finished. No pull request was opened.' Pin workflow_ref: 'coding/new-task-v1' at the submission site: a Jira-triggered task always targets a mapped repo, so the coding workflow's requiresRepo/requiredInputs contract is always satisfiable. Assert the pinned ref in the processor happy-path test and document the workflow in JIRA_SETUP_GUIDE.md (+ Starlight mirror). Fixes #546 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 19f4e52 commit 6340aba

4 files changed

Lines changed: 9 additions & 2 deletions

File tree

cdk/src/handlers/jira-webhook-processor.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,10 @@ export async function handler(event: ProcessorEvent): Promise<void> {
367367
{
368368
repo,
369369
task_description: taskDescription,
370+
// Explicit coding workflow: a label-triggered Jira task always targets a
371+
// mapped repo, so it must not fall through the resolution ladder to the
372+
// repo-less default/agent-v1 (which never commits or opens a PR). #546
373+
workflow_ref: 'coding/new-task-v1',
370374
...(attachments.length > 0 && { attachments }),
371375
},
372376
{

cdk/test/handlers/jira-webhook-processor.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,9 @@ describe('jira-webhook-processor handler', () => {
297297
expect(reqBody.repo).toBe('org/repo');
298298
expect(reqBody.task_description).toContain('ENG-42: Fix the login bug');
299299
expect(reqBody.task_description).toContain('Users cannot log in.');
300+
// Must pin the coding workflow — an absent workflow_ref falls through the
301+
// resolution ladder to default/agent-v1, which never opens a PR (#546).
302+
expect(reqBody.workflow_ref).toBe('coding/new-task-v1');
300303
expect(ctx.userId).toBe('cognito-user-1');
301304
expect(ctx.channelSource).toBe('jira');
302305
expect(ctx.channelMetadata).toMatchObject({

docs/guides/JIRA_SETUP_GUIDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Set up the ABCA Jira Cloud integration so that adding a label to a Jira issue tr
1313
1414
## How it works
1515

16-
A Jira-site admin creates an Atlassian OAuth 2.0 (3LO) app and authorizes it on the site. The OAuth token bundle is stored in a per-tenant Secrets Manager secret (`bgagent-jira-oauth-<cloudId>`). When a user adds the trigger label to a Jira issue, Jira fires a webhook to ABCA; the receiver verifies the `X-Hub-Signature` HMAC, dedupes, and async-invokes the processor, which resolves the tenant, looks up the project→repo mapping, and creates a task. The agent clones the repo, opens a PR, and comments on the Jira issue via the Jira REST v3 API (using the same stored OAuth token).
16+
A Jira-site admin creates an Atlassian OAuth 2.0 (3LO) app and authorizes it on the site. The OAuth token bundle is stored in a per-tenant Secrets Manager secret (`bgagent-jira-oauth-<cloudId>`). When a user adds the trigger label to a Jira issue, Jira fires a webhook to ABCA; the receiver verifies the `X-Hub-Signature` HMAC, dedupes, and async-invokes the processor, which resolves the tenant, looks up the project→repo mapping, and creates a task. Jira-triggered tasks always run the `coding/new-task-v1` workflow (the processor pins `workflow_ref` explicitly, since a label-triggered task always targets a mapped repo). The agent clones the repo, opens a PR, and comments on the Jira issue via the Jira REST v3 API (using the same stored OAuth token).
1717

1818
**Tenant key.** Everything is indexed on `cloudId` — the Atlassian tenant UUID, *not* the site domain or name. Webhook payloads and the OAuth flow both surface `cloudId`; it is the join key across the project-mapping, user-mapping, and workspace-registry tables.
1919

docs/src/content/docs/using/Jira-setup-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Set up the ABCA Jira Cloud integration so that adding a label to a Jira issue tr
1717
1818
## How it works
1919

20-
A Jira-site admin creates an Atlassian OAuth 2.0 (3LO) app and authorizes it on the site. The OAuth token bundle is stored in a per-tenant Secrets Manager secret (`bgagent-jira-oauth-<cloudId>`). When a user adds the trigger label to a Jira issue, Jira fires a webhook to ABCA; the receiver verifies the `X-Hub-Signature` HMAC, dedupes, and async-invokes the processor, which resolves the tenant, looks up the project→repo mapping, and creates a task. The agent clones the repo, opens a PR, and comments on the Jira issue via the Jira REST v3 API (using the same stored OAuth token).
20+
A Jira-site admin creates an Atlassian OAuth 2.0 (3LO) app and authorizes it on the site. The OAuth token bundle is stored in a per-tenant Secrets Manager secret (`bgagent-jira-oauth-<cloudId>`). When a user adds the trigger label to a Jira issue, Jira fires a webhook to ABCA; the receiver verifies the `X-Hub-Signature` HMAC, dedupes, and async-invokes the processor, which resolves the tenant, looks up the project→repo mapping, and creates a task. Jira-triggered tasks always run the `coding/new-task-v1` workflow (the processor pins `workflow_ref` explicitly, since a label-triggered task always targets a mapped repo). The agent clones the repo, opens a PR, and comments on the Jira issue via the Jira REST v3 API (using the same stored OAuth token).
2121

2222
**Tenant key.** Everything is indexed on `cloudId` — the Atlassian tenant UUID, *not* the site domain or name. Webhook payloads and the OAuth flow both surface `cloudId`; it is the join key across the project-mapping, user-mapping, and workspace-registry tables.
2323

0 commit comments

Comments
 (0)