Skip to content
TheChatArchiveThe Chat Archive
fable-5· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

Untitled conversation

  1. User

    [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.

  2. Assistant

    Now let me examine the DB-backed thread service to understand the durable ledger keying:

  3. Assistant

    Now I'll implement. First, the facade changes in reborn_services.rs:

  4. Assistant

    Now the binding id helpers:

  5. Assistant

    Now the idempotent mark_message_submitted in both thread-service backends:

  6. Assistant

    The durable wrapper is transactional, so that's safe. Now document the contract on the trait:

  7. Assistant

    Now build to check compilation before writing tests:

  8. Assistant

    Now the tests. First check whether IdempotencyKey derives Hash:

  9. Assistant

    Now update the contract tests. First the FakeTurnCoordinator to model the real coordinator's scoped submit idempotency:

  10. Assistant

    Now strengthen the duplicate test and add the new coverage:

  11. Assistant

    Now add the thread-service level test for the idempotent mark_message_submitted:

  12. Assistant

    ironclaw_conversations also implements the trait — check whether its mark_message_submitted needs the same replay semantics:

  13. Assistant

    ironclaw_conversations defines its own separate trait — not affected. Now check the dependent crates compile and their tests pass:

  14. Assistant

    All dependents pass. Update the crate spec to document the idempotency contract:

  15. Assistant

    All checks pass. The work is complete — here's a summary of the implementation:

    Changes

    WebUI idempotency facade — crates/ironclaw_product_workflow/src/reborn_services.rs

    • Thread-independent ledger key: webui_source_binding_id now identifies the submitting caller (surface, tenant, agent, project, actor) and deliberately excludes the thread. Since the accepted-message ledger dedupes on (source_binding_id, client_action_id), a reused client_action_id is now detected across threads, not just within one.
    • Cross-thread duplicate rejection: submit_turn's replay branch rejects with 409 Conflict when the ledger record's thread (or scope) doesn't match the request, instead of silently accepting a second copy or replaying another thread's outcome. The concurrent-race variant of the same case is caught by the thread store's IdempotentReplayThreadMismatch (also → 409).
    • New webui_reply_binding_id: reply routing stays thread-scoped (source binding + thread segment), so dedupe identity and reply-target identity are no longer conflated.

    Accepted-message ledger convergence — crates/ironclaw_threads

    • mark_message_submitted is now an idempotent replay when the message is already Submitted with the same turn_id/turn_run_id (both in_memory.rs and the durable db.rs backend). This is what makes concurrent duplicates converge: both racers resolve the same message from the ledger and the same run from the coordinator's scoped submit idempotency, so the second mark must return the record rather than an invalid-transition 409. Mismatched turn/run still fails. Contract documented on the trait (service.rs).

    Tests

    • session_thread_contract.rs: same-turn re-mark replays; mismatched turn/run rejected; single transcript row preserved.
    • reborn_services_contract.rs (drives the facade, per the test-through-the-caller rule):
      • FakeTurnCoordinator now models the real coordinator's (scope, idempotency_key) submit idempotency.
      • Duplicate send returns the same accepted ref/run (strengthened existing test).
      • Cross-thread duplicate → 409, no second submission, no ghost thread.
      • Concurrent duplicates (multi-thread runtime, tokio::spawn) → both succeed with identical refs, exactly one submission and one transcript message (stable across 8 runs).
      • Failed validation → 400 with no thread/message/turn created.
      • Retry after transient Unavailable → replays the ledger's accepted message (one transcript row) and submits exactly one turn, with matching msg: ref.

    Verified: cargo test on ironclaw_threads (incl. --features libsql), ironclaw_product_workflow, and the dependents ironclaw_loop_support, ironclaw_reborn_composition, ironclaw_reborn — all green; cargo clippy --all-features --tests clean; cargo fmt --check clean. Spec updated in crates/ironclaw_product_workflow/CLAUDE.md.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.