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

Untitled conversation

  1. User

    [Reborn WebUI Beta] Implement the RebornServices submit, cancel, resolve-gate, and run-state facade methods

    Parent tracker: #3607 Module: M2 — Native Product Workflow / Inbound Facade Priority: P0

    Provide one stable facade that WebUI routes can use to submit turns, cancel runs, resolve gates, and read current run state without importing TurnCoordinator, HostRuntime, dispatchers, run-state stores, or database stores.

    The facade must call TurnCoordinator only through the published M3 contract, enforce authenticated thread ownership, validate identifiers and token fields, preserve idempotent replay behavior, map canonical requests correctly, and return sanitized M2 errors.

    get_run_state is required. It must return a stable WebUI DTO containing the run ID, status, event cursor, accepted message reference, resolved run-profile ID and version, and optional gate, failure, and checkpoint data. It must not expose internal scopes, binding references, model routes, or raw internal failures.

    Evaluation contract

    The facade must implement submit, cancel, gate resolution, and get_run_state through the published turn facade without importing forbidden runtime/store dependencies. Validate UUIDs, non-empty client action and credential references, and reject control characters in token fields. Enforce authenticated thread ownership and hide cross-user existence as stable NotFound/HTTP 404 responses; malformed requests use stable sanitized InvalidRequest/HTTP 400 responses. Preserve idempotent replay and canonical request mappings. get_run_state must return the documented sanitized DTO, including cursor, accepted-message, resolved-profile, gate, failure, and checkpoint fields, without exposing M3 scopes, binding references, routes, or raw failures.

    Interface

    Type: Struct Name: RebornGetRunStateRequest Path: crates/ironclaw_product_workflow/src/reborn_services/types.rs Public API: pub thread_id: String, pub run_id: String Description: WebUI request identifying the owned thread and run whose current state must be returned.

    Type: Struct Name: RebornGetRunStateResponse Path: crates/ironclaw_product_workflow/src/reborn_services/types.rs Public API: run_id, status, event_cursor, accepted_message_ref, resolved_run_profile_id, resolved_run_profile_version, gate_ref, failure, checkpoint_id Description: Stable sanitized WebUI DTO for the current run state. It must not expose internal turn scope, binding references, or model-routing details.

  2. Assistant

    Now let me look at the ironclaw_turns contract — specifically the run state response type:

  3. Assistant

    Now let me check for other implementors of RebornServicesApi and where the facade is consumed:

  4. Assistant

    2. Add the trait method and implementation in reborn_services.rs:

  5. Assistant

    3. Export the new types from lib.rs:

  6. Assistant

    Check ironclaw_turns exports the types I referenced:

  7. Assistant

    Good. Now build the crate:

  8. Assistant

    Update the test imports and add the new tests at the end (before the source-scan test):

  9. Assistant

    All 20 tests pass. Now run format, clippy, and the rest of the crate's tests:

  10. Assistant

    No downstream dependents — the trait change is self-contained. Update the crate's CLAUDE.md description to reflect the new read path:

  11. Assistant

    All checks pass. Summary of the implementation:

    What was done

    The RebornServices facade already had submit_turn, cancel_run, and resolve_gate (with idempotent replay, canonical request mapping, ownership gates, and sanitized error mapping). The missing piece was the required get_run_state method and its DTOs.

    crates/ironclaw_product_workflow/src/reborn_services/types.rs

    • RebornGetRunStateRequest — pub thread_id: String, pub run_id: String.
    • RebornGetRunStateResponse — the sanitized DTO: run_id, status, event_cursor, accepted_message_ref, resolved_run_profile_id (string), resolved_run_profile_version (u64), plus optional gate_ref, failure (SanitizedFailure), and checkpoint_id.
    • From<TurnRunState> uses exhaustive destructuring so any future field added to TurnRunState fails compilation here, forcing an explicit expose/withhold decision — scope, turn_id, source_binding_ref, reply_target_binding_ref, resolved_model_route, and received_at are explicitly withheld.

    crates/ironclaw_product_workflow/src/reborn_services.rs

    • Added get_run_state to the RebornServicesApi trait and implemented it on RebornServices:
      • Validates thread_id via ThreadId::new (rejects empty/control chars/path separators) and run_id via UUID parse — malformed input returns the stable InvalidRequest/400 with field + InvalidId validation code.
      • Enforces authenticated thread ownership through the same assert_thread_owned_by probe as cancel_run/resolve_gate — cross-user probes collapse to stable NotFound/404 before the coordinator is ever consulted, hiding cross-user existence.
      • Calls TurnCoordinator::get_run_state only through the published M3 contract; TurnError maps through the existing sanitized map_turn_error.
    • New parse_run_id_field helper alongside parse_thread_id_field.

    Exports — RebornGetRunStateRequest/RebornGetRunStateResponse re-exported from the module and lib.rs; no forbidden runtime/store crates touched (the existing facade_source_avoids_forbidden_runtime_dependencies scan test still passes).

    Tests (tests/reborn_services_contract.rs) — extended FakeTurnCoordinator with programmable failure/checkpoint state and a read counter, plus three new contract tests:

    • get_run_state_returns_sanitized_dto_without_internal_refs — asserts all documented fields (cursor, accepted-message, resolved profile, gate, failure, checkpoint) and that the serialized wire DTO contains no scope, binding refs, model route, turn_id, or received_at.
    • get_run_state_rejects_cross_user_access — 404 with zero coordinator reads.
    • get_run_state_rejects_malformed_identifiers_with_stable_validation_errors — non-UUID run_id and control-character thread_id → 400 with stable field/code, zero coordinator reads.

    Verification: cargo test -p ironclaw_product_workflow — all 70 tests across 7 binaries pass (20/20 in the contract suite); cargo clippy --tests --all-features clean; cargo fmt --check clean.

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