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 is very promising - there's already a
webui_inbound.rsfile. Let's look at it.Assistant
Now let's update the
webui_source_binding_idfunction to remove the thread segment and add project segment, and rename to reflect it's the actor-scoped idempotency binding id.Assistant
Let's use line-based edit instead.
Assistant
Now there's a duplicate line 149-150. Let me remove it.
Assistant
Now let's build the crate to catch compile errors.
Assistant
Good, now it works after setting env vars. Let's persist those exports for this session and try building.
Assistant
Compiles cleanly. Now let's run the existing test suite for this crate to check nothing broke.
Assistant
All existing tests pass. Now let's write a temporary reproduction script to verify cross-thread rejection and concurrent duplicate behavior.
Assistant
Good,
DefaultTurnCoordinator::new(Arc::new(InMemoryTurnStateStore::default()))is the real in-memory coordinator to use for realistic concurrent tests. Let's update the temp test file.Assistant
Confirmed: before the fix, the cross-thread duplicate was silently accepted as a brand new message (proving the bug). Let's restore the fix.
Assistant
Let's write the additional two temp tests using a wrapping fake coordinator for transient failure, and a validation-failure test.
Assistant
Good, temp test removed. Let's view the final diff and re-run the full test suite for the crate one more time.
Assistant
This is a clean, minimal, well-targeted fix. Let's run the full test suite once more to be safe.
Assistant
All 62 tests pass. Now let's check dependent crates that might rely on this crate (e.g.,
ironclaw_reborn_composition) to make sure nothing else in the workspace breaks.Assistant
Good, no other crate depends on it yet. Let's also do a full workspace build check to ensure no breakage elsewhere.
Assistant
Whole workspace builds cleanly with only a pre-existing unrelated warning. Let's confirm final
git diffand clean state.Assistant
Only the intended file is modified, and the temp test file was cleaned up. Now let's go through the checklist.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.