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
Now let me look at how turn coordinator handles idempotency keys and where the WebUI routes call this facade.
- Assistant
Let me look at the turns crate's in-memory coordinator, error types, and the threads db backend.
- Assistant
Now the durable backend in
db.rs: - Assistant
Now let me check the facade error type and the threads contract test helpers:
- Assistant
Now add the facade contract tests:
- Assistant
Now append the new tests to the facade contract file:
- Assistant
Now add the thread-service contract tests for the idempotent re-mark:
- Assistant
All pass, including the new concurrent test. Now run the durable-backend contract tests (libSQL) and lint:
- Assistant
All consumers pass. Let me update the module doc to record the new invariant:
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.