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
I'll start by exploring the repository structure and searching for WebUI-related code around idempotency and message handling.
- Assistant
I'll search for WebUI, idempotency keys, and related tracker materials next.
- Assistant
rg is not found, let me use grep instead.
- Assistant
I'll inspect the product workflow, inbound adapters, and related docs for idempotency design.
- Assistant
Found
webui_inbound.rsandledger.rs— reading those and related tests next. - Assistant
There's already a webui_inbound.rs and webui_inbound_contract.rs test. Let me read these files and the AGENTS.md to understand what's implemented and what's missing.
- Assistant
Reading the full contract tests and workflow path to see what's already covered versus missing.
- Assistant
The DTOs already parse
client_action_id; next I'll inspectRebornServicesfor create-thread and send-message handling. - Assistant
Looking at create_thread and the acceptance-related tests for gaps against the issue criteria.
- Assistant
I'll search docs and the threads crate for remaining gaps around concurrent duplicates and accepted-message ledger behavior.
- Assistant
Let me look for TODOs related to WebUI, accepted message ledger further, and also check git branches or any incomplete stubs.
- Assistant
Looking for parent tracker details and any incomplete M2 WebUI facade work.
- Assistant
Examining concurrent idempotency in the threads service and whether WebUI tests cover race cases.
- Assistant
Running the product_workflow tests to see what's failing.
- Assistant
Need to set up rustup.
- Assistant
The crate wants edition 2024 and rust-version 1.92. Should be fine with 1.97.
- Assistant
Existing tests already pass — checking conversations ledger and open design notes for the intended WebUI behavior.
- Assistant
I'll dig through design docs and PR notes for the intended WebUI idempotency behavior.
- Assistant
Let me look at git stash / branches and also FEATURE_PARITY for WebUI. Also check ironclaw_product_adapters for WebUI related code.
- Assistant
Let me look at git log specifically for webui and product_workflow commits, and also check if there's a branch with more work.
- Assistant
Found the parent tracker numbering; next I'll look at WS follow-up briefs for the accepted-message ledger design.
- Assistant
Let me look at the docs that mention WS-10..WS-14 follow-up briefs
- Assistant
Inspecting turn coordinator idempotency and whether WebUI needs a dedicated outcome ledger.
- Assistant
Checking how product workflow uses the ledger and whether WebUI should reuse it.
- Assistant
I'll reproduce concurrent duplicate and cross-thread behavior with a temporary script.
- Assistant
Confirmed concurrent duplicates law-break turn submission. Checking cross-thread next.
- Assistant
Checking real turn coordinator duplicate submit handling:
- Assistant
I changed directory to /tmp. Need to go back.
- Assistant
Checking SubmitIdempotencyKey scope fields:
- Assistant
Inspecting product inbound turn handoff and source-binding keying for concurrency patterns.
- Assistant
Checking error types for transient/unavailable handling:
- Assistant
Implementing a WebUI client-action ledger for concurrent-safe begin/settle/replay and cross-thread rejection, then wiring it into
RebornServices. - Assistant
Creating the client-action ledger module and wiring it into the facade.
- Assistant
The create command might have wiped or not written properly? Let me check.
- Assistant
The create with heredoc didn't work properly through the tool. Let me use a different approach - write via shell.
- Assistant
Updating
reborn_services.rsto integrate the ledger. - Assistant
I'll rewrite
reborn_services.rscarefully from the current version. - Assistant
Applying structured edits with a careful Python script.
- Assistant
Replacing
submit_turnand addingsubmit_turn_innernext. - Assistant
Compiling and running tests to verify the changes.
- Assistant
Converting ledger replays of
SubmittedtoAlreadySubmittedso existing contract tests keep passing. - Assistant
Re-running tests, then verifying concurrent and cross-thread behavior.
- Assistant
Verifying concurrent, cross-thread, validation, and transient-retry behavior with a temporary harness.
- Assistant
All acceptance criteria verified. Running the full product_workflow test suite and clippy next.
- Assistant
Boxing large enum variants to satisfy clippy.
- Assistant
Fixing broken match braces in submit_turn and create_thread.
- Assistant
Updating the create_thread docs and doing a final review of the changed files.
- Assistant
submitonly picks upgit diff, so untracked files would be dropped — embedding the ledger module into the tracked file. - Assistant
Replacing Condvar waits with retryable
Unavailableso we don't deadlock on single-threaded tokio tests. - Assistant
The replace failed — inspecting the ledger section and applying the fix.
- Assistant
Let me read the begin_or_replay section fully to get exact text.
- Assistant
Replacing the Condvar-based ledger with exact indented text.
- Assistant
All acceptance criteria verified. Submitting the changes.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.