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
I’ll trace the web mutation handlers and persistence contracts first, then implement the ledger at the narrowest ownership boundary and test through the actual callers.
- Assistant
rgisn’t installed in this workspace, so I’m switching tofind/grep. The gateway spec identifies chat as the owning slice; I’m also checking the database spec because concurrency-safe deduplication may need a shared-backend atomic operation. - Assistant
There’s already an
ironclaw_product_workflow::webui_inboundmodule and contract tests in this checkout. I’m inspecting that before designing anything—the requested “Inbound Facade” likely belongs there, with the gateway acting as its caller. - Assistant
The existing facade has most of the right seams, but I found two concrete gaps: the dedupe binding includes the thread ID (so the same action key can be reused on another thread), and a concurrent replay can submit twice at the facade boundary or race while marking the accepted message. I’m tightening those semantics while preserving the current DTO/API surface.
- Assistant
The facade-level regression coverage now exercises exact replay equality, cross-thread conflict, concurrent duplicate submission, pre-side-effect validation, and retry after a transient coordinator outage. I’m running those tests now, then I’ll run the thread-store contracts because the safe concurrent completion depends on idempotent message-state marking.
- Assistant
The focused facade suite and zero-warning clippy check are clean. I’m doing the final backend pass against the libSQL thread store plus the full product-workflow crate; no schema or public wire-shape changes were needed.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.