Repository navigation
CR-10: Idempotency-Key header on start, publish and complete-task - #21
Merged
ObaidulKabir merged 1 commit intoOct 27, 2026
Merged
Conversation
…e-task
Learning OS retries writes after network failures and from offline sync, so
these calls must be safe to repeat.
- POST /api/workflows/start, /api/events/publish and /api/tasks/{id}/complete
read the Idempotency-Key header (max 200 characters). A repeat after
completion returns the first result; a header that differs from the body
key, two header values, or an over-long key is 400.
- A repeat while the first request is still running is 409 with code
IDEMPOTENCY-IN-PROGRESS (ConcurrencyConflictException) instead of 400/500.
- IdempotencyService.TryBeginAsync: two first requests racing on the same key
no longer fail with a unique-index error; the loser is treated as in
progress.
- Complete-task now passes the key through (it never did).
- docs/14-api-reference.md: safe retries section and 409 in the error table.
- Tests: end-to-end over HTTP (same instance on repeated start, event applied
once on repeated publish, 409 while in progress, 400 for bad keys),
header unit tests, and a PostgreSQL race test for TryBeginAsync.
Refs: FlowOS Modification Proposal v1.0, CR-10.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Db5nX38Equ6fWErg3oD32F
This was referenced Oct 27, 2026
ObaidulKabir
merged commit Oct 27, 2026
bff44d3
into
feat/cr-06-instance-concurrency
3 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CR-10 (part 1):
Idempotency-Keyheader on start, publish and complete-taskStacked on #20 (CR-06). Merge #9, then #20, then this PR.
Learning OS retries writes after network failures and from offline sync, so these calls must be safe to repeat.
Changes
POST /api/workflows/start,/api/events/publishand/api/tasks/{id}/completeread theIdempotency-Keyheader (at most 200 characters).workflowInstanceIdfor start, and no second event applied.idempotencyKey, two header values, or a key over 200 characters.IDEMPOTENCY-IN-PROGRESS. Before, it was a generic 400 or 500.IdempotencyService.TryBeginAsync. Two first requests arriving together with the same key used to hit the unique index and return a 500. The second one is now treated as "in progress".docs/14-api-reference.md, and 409 added to the error table.Tests
Refs: FlowOS Modification Proposal v1.0, CR-10.
Generated by Claude Code