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 WebUI mutation path and persistence abstractions first, then implement the ledger at the narrowest authoritative layer and test through the actual handlers/callers.
- Assistant
rgisn’t installed in this workspace, so I’m switching to targetedfind/grepinspection. I’ll read the web and database subsystem contracts before editing. - Assistant
The durable thread service already contains the accepted-message ledger and atomic duplicate acceptance; the WebUI facade was weakening its scope by embedding the thread ID into the source binding. I found two concrete races to close: cross-thread keys could diverge, and concurrent replayed submissions could race while marking the same message as submitted.
- Assistant
The core fix is in place: WebUI action identity is now caller/project scoped rather than thread scoped, replay is verified against the requested thread and actor, and settling the same accepted message with the same turn/run is idempotent. I’m compiling the focused contract now, then I’ll add the concurrency and retry regressions.
- Assistant
The caller-level regressions now pass, including forced overlap where both browser submits reach turn submission concurrently. That test confirms identical responses, one durable transcript message, and one idempotent turn result; cross-thread reuse returns 409 without creating the second thread, and transient retry reuses the accepted message.
- Assistant
Both in-memory and durable libSQL contract suites are green. I also checked parity tracking: this change doesn’t alter a status row in
FEATURE_PARITY.md, and no public interface or setup behavior changed, so no documentation/status update is needed.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.