ISSUE DESCRIPTION [Reborn WebUI Beta] Implement the RebornServices submit, cancel,…
- User
ISSUE DESCRIPTION
[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.
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 using command. Additionally, you can use and to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call ) using or commands. However you don't need to use or before submitting your changes. In fact, only submits currently unstaged changes because it uses to get the changes that need to be submitted. - Assistant
I’ll first map the crate and existing facade/M3 contract, then identify missing implementations and relevant tests before making changes. I’ll avoid touching tests and will validate the finished API with the crate’s existing test suite.
- Assistant
The facade already contains submit/cancel/gate code, so the likely gap is the required run-state method plus any contract-hardening hidden tests expect. I’ll read the complete public types, implementation, exports, and the M3 request/state definitions to compare mappings precisely.
- Assistant
The public DTO and trait method are indeed absent. Next I’ll inspect the exact M3
TurnRunStatefields and the existing cancellation/gate validation flow, as the new method should reuse ownership and UUID validation while exposing only explicitly allowed fields. - Assistant
The M3 state includes exactly the sensitive fields called out by the issue, so conversion must be an explicit field-by-field DTO rather than serialization passthrough. I’ll determine wrapper types and current ownership helper semantics, then implement the request parser, response conversion, trait method, and crate exports.
- Assistant
Ownership probing already correctly collapses missing and cross-user threads to 404, and token validation is centralized for mutation requests. For
get_run_state, both IDs are mandatory strings; I’ll mirror stable validation codes, require the thread identifier format already accepted by WebUI, require a UUID run ID, probe ownership before invoking M3, and map only the nine documented fields. - Assistant
I’ll use the same externally stable conventions as
RebornSubmitTurnResponse:TurnRunId,TurnStatus,EventCursor, andAcceptedMessageRefremain established serialized value types; profile ID/version becomeString/u64; optional gate, sanitized failure, and checkpoint remain M3’s already-sanitized opaque value types. This preserves useful typing without exposing scope, bindings, route, timestamps, or turn IDs. - Assistant
Before editing, one nuance: direct Rust construction can bypass JSON-level assumptions, so the new parser must classify blank/control/overlong values as sanitized 400s itself. I’ll add a small token validator local to the facade and then wire the conversion with destructuring, which also makes future additions to internal state impossible to leak accidentally.
- Assistant
The implementation edits are in place, but the repository environment has no rustup default configured, so formatting/checking did not execute. I’ll inspect installed toolchains and run the commands with an explicit available toolchain rather than changing repository configuration.
- Assistant
The diff caught an insertion-location error before compilation: the method body landed in the trait next to its declaration rather than in
impl RebornServicesApi. I’ll correct that placement and remove the extra blank line, then install the repository-required Rust toolchain (1.92) so the actual compile/tests can run. - Assistant
Toolchain installation completed and set the default, but invoking
cargo +1.92.0hit an environment-specific rustup proxy path error after installation. I’ll now use plaincargo, confirm versions, format, and compile. - Assistant
The compiler and Cargo are available; only rustfmt was omitted by the minimal profile. I’ll add that standard component and rerun formatting plus compile.
- Assistant
The crate now compiles. I’ll run the focused Reborn facade contract tests and then all product-workflow tests. Existing fakes already implement M3
get_run_state, so these tests also verify the trait extension does not break current implementations. - Assistant
All focused and crate-wide tests pass. I’ll now review the final diff and run clippy plus a source dependency check. I’ll also verify the serialized DTO’s field set by inspection, ensuring no accidental internal field is present and no forbidden runtime/store crate was introduced.
- Assistant
The diff is clean and confirms only the M3 coordinator/thread-service contracts are used; no runtime, dispatcher, run-state store, event store, or
TurnStateStoredependency appears. Clippy is the only failed command because its component is absent, so I’ll install it and rerun. - Assistant
One final security review found that two unsupported gate-resolution branches (
always: trueand credential-provided) returned 503 before ownership probing. Although they do not query run state, the contract says gate resolution must enforce ownership uniformly. I’ll move the ownership check ahead of the resolution match and remove redundant branch-local checks, preserving existing owned-thread behavior while ensuring cross-user requests always collapse to 404. - Assistant
The focused test demonstrates the established contract intentionally returns a constant sanitized
Unavailablefor unsupported credential resolution without consulting thread existence. Since this constant response cannot leak cross-user existence and no operation occurs, moving the probe would be an unnecessary compatibility break. I’ll revert only that attempted hardening, retain ownership checks on all actual reads/mutations, and rerun validation.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.