Skip to content

Make backup terminal reports idempotent - #264

Merged
arjunkomath merged 2 commits into
mainfrom
fix/idempotent-backup-terminal-reports
Aug 2, 2026
Merged

Make backup terminal reports idempotent#264
arjunkomath merged 2 commits into
mainfrom
fix/idempotent-backup-terminal-reports

Conversation

@arjunkomath

@arjunkomath arjunkomath commented Aug 2, 2026

Copy link
Copy Markdown
Member

Summary

  • atomically transition backup completion, failure, and timeout only from nonterminal states
  • make the backup state machine consistently follow a first-terminal-write-wins rule
  • treat repeated or late terminal reports as successful no-ops
  • add deterministic Inngest event IDs to prevent duplicate delivery
  • cover successful agent transitions and replay behavior with focused route tests

A timeout is terminal: if it wins first, a later completion does not replace the failure. If completion or agent-reported failure wins first, the timeout handler cannot overwrite it.

Verification

  • pnpm test — 59 files, 386 tests passed
  • pnpm exec vitest run tests/agent-backup-complete-route.test.ts tests/agent-backup-failed-route.test.ts — 4 tests passed
  • ./node_modules/.bin/tsc --noEmit
  • npx biome check --write ...

Basecamp: https://app.basecamp.com/5890597/buckets/47439993/todos/10146625754

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown

React Doctor found no issues. 🎉

⚠️ Warning: .github/workflows/react-doctor.yml is configured incorrectly. See below to fix.

React Doctor compares against main to report only the issues this pull request introduces. This run couldn't complete that comparison (usually a shallow CI checkout with no merge base), so it listed every issue in the changed files, including ones that already existed on main.

Add fetch-depth: 0 to the actions/checkout step in .github/workflows/react-doctor.yml so the checkout includes the history React Doctor needs:

 jobs:
   react-doctor:
     steps:
       - uses: actions/checkout@v5
+        with:
+          fetch-depth: 0

       - uses: millionco/react-doctor@v2

To silence this warning, set silence-missing-baseline-warning: true on the React Doctor action.

Reviewed by React Doctor for commit fe820a8.

Amp-Thread-ID: https://ampcode.com/threads/T-019fc4be-cc5a-73ca-bfb5-c7c94ae8029b
Co-authored-by: Arjun Komath <arjunkomath@gmail.com>
@arjunkomath
arjunkomath added this pull request to the merge queue Aug 2, 2026
Merged via the queue into main with commit c3c57a0 Aug 2, 2026
8 checks passed
@arjunkomath
arjunkomath deleted the fix/idempotent-backup-terminal-reports branch August 2, 2026 23:36
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.

2 participants