Untitled conversation
- 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_stateis 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_statethrough 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 stableNotFound/HTTP 404 responses; malformed requests use stable sanitizedInvalidRequest/HTTP 400 responses. Preserve idempotent replay and canonical request mappings.get_run_statemust 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.
- Assistant
Now let me look at the
ironclaw_turnscontract — specifically the run state response type: - Assistant
Now let me check for other implementors of
RebornServicesApiand where the facade is consumed: - Assistant
2. Add the trait method and implementation in
reborn_services.rs: - Assistant
3. Export the new types from
lib.rs: - Assistant
Check
ironclaw_turnsexports the types I referenced: - Assistant
Good. Now build the crate:
- Assistant
Update the test imports and add the new tests at the end (before the source-scan test):
- Assistant
All 20 tests pass. Now run format, clippy, and the rest of the crate's tests:
- Assistant
No downstream dependents — the trait change is self-contained. Update the crate's CLAUDE.md description to reflect the new read path:
- Assistant
All checks pass. Summary of the implementation:
What was done
The
RebornServicesfacade already hadsubmit_turn,cancel_run, andresolve_gate(with idempotent replay, canonical request mapping, ownership gates, and sanitized error mapping). The missing piece was the requiredget_run_statemethod and its DTOs.crates/ironclaw_product_workflow/src/reborn_services/types.rsRebornGetRunStateRequest—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 optionalgate_ref,failure(SanitizedFailure), andcheckpoint_id.From<TurnRunState>uses exhaustive destructuring so any future field added toTurnRunStatefails compilation here, forcing an explicit expose/withhold decision —scope,turn_id,source_binding_ref,reply_target_binding_ref,resolved_model_route, andreceived_atare explicitly withheld.
crates/ironclaw_product_workflow/src/reborn_services.rs- Added
get_run_stateto theRebornServicesApitrait and implemented it onRebornServices:- Validates
thread_idviaThreadId::new(rejects empty/control chars/path separators) andrun_idvia UUID parse — malformed input returns the stableInvalidRequest/400 withfield+InvalidIdvalidation code. - Enforces authenticated thread ownership through the same
assert_thread_owned_byprobe ascancel_run/resolve_gate— cross-user probes collapse to stableNotFound/404 before the coordinator is ever consulted, hiding cross-user existence. - Calls
TurnCoordinator::get_run_stateonly through the published M3 contract;TurnErrormaps through the existing sanitizedmap_turn_error.
- Validates
- New
parse_run_id_fieldhelper alongsideparse_thread_id_field.
Exports —
RebornGetRunStateRequest/RebornGetRunStateResponsere-exported from the module andlib.rs; no forbidden runtime/store crates touched (the existingfacade_source_avoids_forbidden_runtime_dependenciesscan test still passes).Tests (
tests/reborn_services_contract.rs) — extendedFakeTurnCoordinatorwith 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, orreceived_at.get_run_state_rejects_cross_user_access— 404 with zero coordinator reads.get_run_state_rejects_malformed_identifiers_with_stable_validation_errors— non-UUIDrun_idand control-characterthread_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-featuresclean;cargo fmt --checkclean.
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
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare 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 →
- fable-5Compare side by side →
- fable-5Compare side by side →