ISSUE DESCRIPTION [Reborn WebUI Beta] Add WebUI idempotency and accepted-message ledger…
- User
ISSUE DESCRIPTION
[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.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
- Assistant
I’ll inspect the repository structure and locate the WebUI mutation handlers, existing tests, and any idempotency or message-ledger abstractions. Then I’ll trace the send/create flows, implement concurrency-safe persistence at the appropriate boundary, and run focused plus broader tests.
- Assistant
The active WebUI is the existing Axum gateway rather than a separate frontend service. Its current send path generates a fresh UUID and forwards directly to the channel, so duplicates race before any durable turn processing. I’ll add an authenticated, process-wide action ledger at this facade: validation occurs first, reservation is atomic, successful submissions retain the accepted response, mismatched reuse is rejected, and reservations are removed when the channel is unavailable or closed. This avoids ghost messages and preserves compatibility with existing direct handler tests.
- Assistant
The repository already contains the intended Reborn workflow primitives: the thread service atomically records
(source binding, client action)and the turn coordinator carries the same idempotency key. I found the remaining facade defect: replay lookup could return an accepted message from a different requested thread and proceed with it. I’ve added an explicit conflict guard, plus a concurrency guard for explicit create-thread IDs so the same create action cannot resolve to two threads. I’m removing an initially explored legacy gateway change because it is outside the Reborn facade and would introduce process-local semantics where the durable workflow contract is the source of truth. - Assistant
The final implementation now uses the durable inbound-message idempotency record across the authenticated WebUI actor (not per-thread), allowing a reused action ID on another thread to be detected and rejected rather than creating a second message. Concurrent same-thread sends are serialized by the thread service’s atomic acceptance; retries replay the accepted message reference and turn outcome. Create-thread retries are additionally guarded in the facade for concurrent explicit-ID requests, with failed creation reservations released for deterministic retry. The environment has no configured Rust toolchain, so compilation/tests cannot run here; I verified the diff and whitespace statically.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.