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.
Interface
No new interfaces are introduced.
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
This looks very relevant. Let's examine
webui_inbound.rsand the test file.Assistant
Good, that works now. Let's build/test the relevant crate.
Assistant
All pass. Let's check other related tests - product_workflow_contract, reborn_services tests, and search for existing tests covering idempotency ledger for webui specifically.
Assistant
Now let's implement the fix. First, update
webui_source_binding_idto remove the thread segment.Assistant
Good, matches.
SessionThreadErroris already imported in reborn_services.rs. Now let's apply the two changes.Assistant
Now add the cross-thread mismatch check in
submit_turn.Assistant
Now let's build and re-run the scratch probe test to confirm the fix works, then run the full test suite.
Assistant
Builds fine. Now let's re-add the scratch probe test temporarily to confirm behavior, then run full existing test suite.
Assistant
Cross-thread duplicate is now correctly rejected with a 409 Conflict. Now remove the scratch test and run the full test suite for the affected crates.
Assistant
Good, the test file scratch content is reverted. Now let's run the full existing test suite for the crate.
Assistant
All existing tests pass. Let's check the beginning of the test run output to be sure nothing failed earlier.
Assistant
All pass. Now let's check if
webui_source_binding_idorwebui_gate_binding_idis used/tested elsewhere in the repo (e.g., web channel routes tests) that might assert on the exact format including "thread" segment.Assistant
Not critical; skip clippy. Let's view the final diff.
Assistant
Now let's do a final full review of the diff and re-run tests once more.
Assistant
All tests pass. Let's confirm no leftover scratch test artifacts remain and check final status.
Assistant
No scratch test remains (grep found nothing, exit code 1 confirms). Now let's go through the checklist.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.