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
Let me look at the webui_inbound_contract tests and how the composition layer consumes these binding refs.
- Assistant
Now let me check the DB-backed thread service's behavior for
mark_message_submittedon an already-submitted message, to ensure the error variant I'll recover on is consistent across backends. - Assistant
Both backends emit
InvalidMessageTransition. Now I'll implement the changes inreborn_services.rs. - Assistant
Now the submit/mark section with concurrent-race convergence:
- Assistant
The
scopeis moved intoSubmitTurnRequest, so I need to clone it. Let me fix that and add the helper methods: - Assistant
Compiles. Now let me verify the exports needed for the tests:
- Assistant
Now I'll add the tests. First, strengthen the existing duplicate test to assert ref/outcome preservation:
- Assistant
Now add the new tests. I'll insert them after the duplicate-submit test:
- Assistant
All 22 pass. Now run the full crate suite plus dependents, clippy, and fmt:
- Assistant
Clippy is clean. Let me check whether any other test asserts the old binding-id format:
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.