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 handlers and persistence contracts first, then implement the ledger at the narrowest authoritative layer and test through the actual callers.
- Assistant
rgisn’t installed in this checkout, so I’m usingfind/grepfor discovery. This touches the web gateway, agent turn creation, and likely persistence, so I’m reading those subsystem contracts before editing. - Assistant
The facade already has partial deduplication through the thread service, but two gaps line up with the report: the dedupe namespace currently includes
thread_id(so the same browser action can be reused across threads), and a replay is returned as a different outcome shape. I’m checking the thread-store atomicity now so the fix composes with both durable backends instead of adding a process-local lock. - Assistant
The thread service’s accepted-message index is atomic in memory, libSQL, and PostgreSQL, and the turn coordinator already serializes a scoped idempotency key. I’ll use those durable guarantees directly: make the browser action namespace caller-scoped (not thread-scoped), replay the original submitted outcome shape, and make ledger settlement idempotent so concurrent callers can both receive the same result.
- Assistant
The new concurrency test caught an important detail: reconstructing a replay from current run state changes the event cursor, so it is not the original accepted outcome. I’m switching the replay path to the turn coordinator’s durable idempotency record, which returns the originally accepted response rather than a later snapshot.
- Assistant
The caller-level suite now covers same-thread replay, cross-thread rejection without creating the second thread, concurrent duplicates, and retry after an unavailable turn service. All product-workflow and thread-service tests pass; I’m doing the final lint/diff review and checking whether parity/docs track this beta behavior.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.