Skip to content

Merge dev → main: respond-to-review work-item-id fix#1221

Merged
zbigniewsobiecki merged 2 commits intomainfrom
dev
Apr 29, 2026
Merged

Merge dev → main: respond-to-review work-item-id fix#1221
zbigniewsobiecki merged 2 commits intomainfrom
dev

Conversation

@zbigniewsobiecki
Copy link
Copy Markdown
Member

Summary

Test plan

🤖 Generated with Claude Code

zbigniewsobiecki and others added 2 commits April 29, 2026 07:35
…-pr-comment runs

Both GitHub triggers set `workItemId` at the top level of their TriggerResult
but omitted it from `agentInput`. tryCreateRun reads workItemId from
agentInput, so 0/103 respond-to-review and 0/9 respond-to-pr-comment runs
had a non-null `agent_runs.work_item_id` — hiding every one of them from
the dashboard's work-item page (which filters by that column). Confirmed
on 2026-04-29 via `cascade runs list --project ucho`: four respond-to-review
runs for ucho/MNG-400 (PR #136) on 2026-04-28 were invisible despite firing
successfully.

The runtime safety net in `runAgentExecutionPipeline` was supposed to catch
this but only patched when re-resolution returned a value DIFFERENT from
`result.workItemId`. Since both triggers populated `result.workItemId`
correctly, the safety net no-op'd.

Three changes:

1. Add `workItemId` (shorthand) to the `agentInput` literal in
   `pr-review-submitted.ts:82` and `pr-comment-mention.ts:143`.

2. Widen the runtime patch in `agent-execution.ts:498` so it triggers on
   `agentInput.workItemId !== resolvedWorkItemId` rather than on
   `result.workItemId !== resolvedWorkItemId`. Now any future trigger that
   forgets the field still gets repaired before it reaches the DB.

3. Add `tests/unit/triggers/trigger-work-item-id-consistency.test.ts` —
   a static-analysis guard modeled on `trigger-event-consistency.test.ts`.
   Walks every TriggerHandler file via the TypeScript AST and asserts that
   any return literal with a top-level `workItemId` and a real `agentType`
   also includes `workItemId` inside `agentInput`. Fires loudly with
   `file:line` when violated.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…iew-work-item-id-missing

fix(triggers): persist workItemId on respond-to-review and respond-to-pr-comment runs
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@zbigniewsobiecki zbigniewsobiecki merged commit 4ed74b2 into main Apr 29, 2026
15 checks passed
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.

1 participant