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.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /ironclaw, current file: none) bash-$
- Assistant
I’ll first map the repository and locate the WebUI mutation handlers, existing tests, and any persistence/concurrency abstractions. Then I’ll trace create-thread/send-message behavior, implement idempotency at the narrowest durable boundary, and run the relevant test suite plus focused temporary checks.
- Assistant
The repository is a Rust workspace with a dedicated product-workflow area, so I’m narrowing the search to Reborn/WebUI routes and conversation persistence rather than changing generic channel behavior. I’ll also inspect local guidance files before editing.
- Assistant
The crate guidance explicitly says this crate owns inbound staging, idempotency, busy/deferred handling, and the WebUI facade, and points to contract tests. I’ll read those APIs and tests now; this likely contains a partially implemented ledger where the missing behavior can be completed without touching transport storage internals.
- Assistant
I found the concrete race: message acceptance is atomic in the thread service, but two concurrent WebUI calls can both observe an
Acceptedmessage and submit two turns. I also found the cross-thread hole: the replay lookup key currently embedsthread_id, so reusing an action id on another thread is treated as new. I’ll fix both in the facade: serialize identical client actions, use a caller-scoped WebUI binding independent of thread, reject a replay whose stored thread differs, and retain create-thread action identity so conflicting explicit thread ids are rejected. Validation remains before any lock or mutation. - Assistant
The source change is in place, but the environment has no configured Rust toolchain, so formatting/tests cannot run yet. Before attempting installation or further edits, I’ll inspect the diff and compile-sensitive sections for syntax/API mistakes (especially the shared async lock and identifier methods), then use the available toolchain if one exists.
- Assistant
The diff review exposed one necessary correction:
tokiois currently only a dev-dependency, so the production facade cannot use its mutex until it is promoted to normal dependencies. I’ll also compare the full stored scope (not just thread id) on replay, preventing reuse across projects/agents with coincidentally equal thread identifiers. - Assistant
Compilation reached the changed crate and found two straightforward issues: the binding format string still had the old five-slot count after removing thread, and
thread_idwas moved intoEnsureThreadRequestbefore being cached. I’ll correct those, format, and rerun the focused contract test. - Assistant
The focused WebUI contract suite now passes all 17 tests, including existing duplicate create/send behavior and validation/no-mutation coverage. The implementation also compiles with the promoted Tokio dependency. I’ll run the full product-workflow tests and clippy, then inspect the final diff for unintended formatting or dependency changes.
- Assistant
All product-workflow tests pass. Clippy found one style-only
collapsible_ifin the new create-thread conflict check; I’ll apply its suggested equivalent and rerun formatting/clippy plus a final status/diff check. - Assistant
Verification is clean: formatting check, full product-workflow tests, and clippy with
-D warningsall pass, andgit diff --checkreports no whitespace errors. The final change is limited to the workflow crate’s normal Tokio dependency and the Reborn WebUI facade. I’m submitting now; the final response will include the requested checklist rationale.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-lunaCompare side by side →
- gpt-5.6-lunaCompare side by side →