Skip to content

Promote dev to main: serialize backlog-manager + guard MoveWorkItem#1258

Merged
zbigniewsobiecki merged 1 commit intomainfrom
dev
May 6, 2026
Merged

Promote dev to main: serialize backlog-manager + guard MoveWorkItem#1258
zbigniewsobiecki merged 1 commit intomainfrom
dev

Conversation

@zbigniewsobiecki
Copy link
Copy Markdown
Member

Summary

Promotes #1257 to production.

  • fix(router): project-singleton lock for backlog-manager so two parallel auto-chains can't both move the same backlog item to TODO (live incident 2026-05-06, ucho/MNG-538: duplicate PRs Merge dev to main #287 and feat: agent runs dashboard with tRPC API and React frontend #288).
  • defense-in-depth: MoveWorkItem gains an optional expectedSourceState guard; backlog-manager prompt passes the provider-correct backlog label on every move-to-TODO.
  • chore(deps): npm audit fix bumps axios in the trello.js / jira.js subtrees (lockfile-only) to clear high-severity advisories that began failing CI after 2026-05-03.

Test plan

🤖 Generated with Claude Code

…arallel races (#1257)

* fix(router): serialize backlog-manager + guard MoveWorkItem against parallel races

Live incident 2026-05-06 (ucho): two `backlog-manager` runs auto-chained
in parallel — one from MNG-536's PR-merge, one from MNG-537's splitting
auto-chain — both scanned the same backlog, both selected MNG-538, both
moved it to TODO. The two `pm:status-changed` webhooks each fired the
implementation trigger, producing duplicate PRs (#287 and #288).

Two complementary defenses:

1. **Project-singleton lock for `backlog-manager`** (primary): the
   per-(projectId, workItemId, agentType) lock did NOT serialize the two
   runs because their nominal workItemId differed (MNG-536 vs MNG-537).
   `work-item-lock.ts` now collapses workItemId to a sentinel for
   project-singleton agents — both in-memory and the DB count — so a
   second backlog-manager dispatch on the same project is blocked while
   the first is in flight.

2. **MoveWorkItem `expectedSourceState` guard** (defense-in-depth): if a
   second run somehow proceeds (lock TTL expiry, restart, future
   regression), the gadget refuses to move an item whose current status
   doesn't match the caller's expectation, and treats already-at-
   destination as a silent no-op. The backlog-manager prompt now
   instructs the agent to pass `expectedSourceState: <%= backlogSourceLabel %>`
   on every move-to-TODO. The label is provider-correct (Trello list
   ID, JIRA/Linear status name) and case-insensitive matched.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore(deps): npm audit fix to clear high-severity axios advisories

Pre-existing dep drift on dev — `npm audit --omit=dev --audit-level=high`
started failing CI when new axios advisories were published since the
last dev push (2026-05-03). `npm audit fix` (no --force) bumps axios
1.15.0 → 1.16.0 inside the trello.js / jira.js subtrees via lockfile-
only updates; no package.json changes, no breaking-change cascade.

After: 5 moderate advisories remain (all transitive ip-address via
@modelcontextprotocol/sdk → express-rate-limit) but the high-severity
axios block is cleared, so the audit step exits 0.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@zbigniewsobiecki zbigniewsobiecki merged commit b70df2a into main May 6, 2026
15 of 17 checks passed
@codecov
Copy link
Copy Markdown

codecov Bot commented May 6, 2026

Codecov Report

❌ Patch coverage is 96.36364% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/gadgets/pm/core/moveWorkItem.ts 88.23% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

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