Untitled conversation
- User
[Reborn WebUI Beta] Add WebUI idempotency and accepted-message ledger Parent tracker: #3607 Module: M2 — Native Product Workflow / Inbound Facade Priority: P0
Goal
Make WebUI mutations idempotent so duplicate browser submits do not create duplicate turns/messages.
Scope
- Use client action id / idempotency key for create-thread and send-message.
- Preserve accepted-message ref/outcome for duplicate requests.
- Handle concurrent duplicate submissions safely.
Acceptance criteria
- Duplicate send returns the same accepted ref/outcome.
- Concurrent duplicate send creates at most one accepted message/turn.
- Failed validation does not create a ghost turn/message.
- Retry after transient unavailable state has deterministic behavior.
- Tests cover same-thread duplicate, cross-thread duplicate rejection, and concurrent duplicate behavior.
Interface
No new interfaces are introduced.
- Assistant
There's already partial infrastructure here. Let me look at the threads crate and existing contract tests to see what's implemented vs missing.
- Assistant
Now let me check the turn coordinator's idempotency contract in
ironclaw_turns. - Assistant
Let me check the response types quickly.
- Assistant
Now make
mark_message_submittedan idempotent no-op when re-marking with identical turn refs (needed for deterministic concurrent duplicates), in both backends: - Assistant
Now check the error type fields before writing tests:
- Assistant
Now add the threads-crate contract test for the idempotent remark:
- Assistant
Now update the facade contract tests. First the fake coordinator:
- Assistant
Now strengthen the same-thread duplicate test to assert same ref/outcome:
- Assistant
Now add the new tests — cross-thread rejection, concurrent duplicates (with a barrier wrapper forcing both submits past the replay check), validation ghost, and transient retry:
- Assistant
All types check out. Now build and run the affected crates' tests:
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.