Skip to content

ami-drift: closer v2.2 — idempotent close, comment only confirmed transitions - #24

Open
geisbruch wants to merge 1 commit into
mainfrom
feat/ami-drift-closer-v2.2
Open

ami-drift: closer v2.2 — idempotent close, comment only confirmed transitions#24
geisbruch wants to merge 1 commit into
mainfrom
feat/ami-drift-closer-v2.2

Conversation

@geisbruch

Copy link
Copy Markdown
Contributor

Ports the post-incident closer fix (2026-07-28) from the engine repo's workflow corpus.

Incident: on a customer org, 8 already-closed ami-drift items collected 54 duplicate "Closing automatically" comments between 2026-07-18 and 2026-07-22, and the nightly run then failed outright.

Fixes (each link of the failure chain, independently):

  1. close_items now sets ignoreInvalidTransition: true — closing an already-closed item (NP API 400 "Invalid action item status transition") becomes a per-item no-op (skipped: true) instead of taking down the whole page's forEach.
  2. Ordering inverted: close first, then comment, and only for the ids that actually transitioned. Attribution is by response actionItem.id, with a length-guarded positional fallback so a non-echoing API can never mis-attribute (it just yields no comment for that slot).
  3. output_projection on close_items keeps only actionItem.id + skipped per item.

E2E suite updated to the v2.2 contract: 53 tests green (npx vitest run ami-drift).

🤖 Generated with Claude Code

…d transitions

Post-incident fix (2026-07-28): 8 already-closed items collected 54
duplicate closing comments and the nightly sweep failed outright.

- close_items: ignoreInvalidTransition — an already-closed item no-ops
  (skipped: true) instead of failing the whole page's forEach
- ordering inverted: close FIRST, then comment ONLY the ids that
  actually transitioned (attribution by response actionItem.id, with a
  length-guarded positional fallback)
- output_projection on close_items trims the per-item payload
- E2E suite updated to the v2.2 contract (53 tests green)
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