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 inspect the workspace structure and the existing Reborn/M3 contracts, then identify compile or test gaps before making the smallest facade-only implementation.
- Assistant
The module already exists, so I’ll read its implementation, public DTOs, the published inbound-turn contract, and all tests/references to determine which methods are stubs or semantically incomplete.
- Assistant
The initial output was truncated and
rgis unavailable. I’ll inspect the facade in numbered chunks and locate the TurnCoordinator definitions and relevant test files withgrep, paying particular attention to ownership checks and canonical DTO fields. - Assistant
Existing tests cover submit/cancel/gate behavior but not the newly required state method. I’ll now extract the mutation implementation, ownership helper, complete DTO file, and exact M3 state response types so the new mapping is based only on the published contract.
- Assistant
The mutation paths already call only
TurnCoordinator; the missing public method and DTO are the main gap. I need the exactTurnRunStatefield types (especially optional sanitized failure/gate/checkpoint) and request validators before editing exports and trait implementation. - Assistant
TurnRunStatecontains exactly the required canonical values plus forbidden internals, so the DTO can copy only the listed fields. Before coding, I’ll confirm identifier semantics and token validation conventions; the issue explicitly requires UUID validation and control-character rejection, which may be stricter than genericThreadId::new. - Assistant
The existing mutation DTO parser already appears designed for token validation; I’ll inspect its helper functions to verify all client-action, gate, and credential references reject control characters. Then I’ll add the state request/response, strict run UUID parsing, ownership-before-read, sanitized mapping, and crate exports.
- Assistant
All mutation token helpers already enforce non-empty values and reject every control character, while run IDs are UUID-parsed. I’ll implement the new API consistently:
thread_idvia the existing stable identifier validator,run_idvia UUID parsing with a field-specific sanitized 400, then ownership probing before invoking M3get_run_state. The response will contain only the nine documented fields. - Assistant
The diff exposed an accidental trait-style declaration inserted inside the implementation due a broad text replacement. I’ll remove it, then select an installed Rust toolchain (without changing repository configuration) and compile the affected package to catch type/API issues.
- Assistant
No Rust toolchain is installed in the environment. I’ll install the repository’s required stable toolchain via rustup, then format and run the focused contract tests.
- Assistant
The toolchain download completed, but rustup’s proxy is looking under a different home (
/root/.cargo) than the installed environment. I’ll locate the installed binaries/toolchain and invoke them with explicitRUSTUP_HOME/CARGO_HOME, then continue formatting and tests. - Assistant
The shell has an empty
HOME, explaining the proxy failure. I’ll run withHOME=/root, format, and execute the focused package tests. - Assistant
The minimal profile omitted rustfmt. I’ll install that component and rerun formatting and both focused test targets.
- Assistant
The implementation compiles and all focused tests pass. I’ll now audit the final diff and identifier constructors, check that formatting did not touch unrelated files, and consider hidden edge cases: control characters in the new string fields, malformed UUID behavior, and ensuring no forbidden internal fields serialize.
- Assistant
Only the three intended files changed and the diff is clean. I’ll verify
ThreadIdrejects controls and blanks; if not, I’ll make the new request validation explicit so malformed token fields always yield the required sanitizedInvalidRequest. - Assistant
The new fields reject controls through
ThreadIdand UUID parsing, and generic thread IDs are intentional (generated thread IDs are not necessarily bare UUIDs). One remaining contract concern is submit ownership: unlike cancel/gate/state, the existing submit path relies onensure_thread, which could map an ownership mismatch to 409 and leak existence. I’ll inspectensure_threadsemantics and existing submit cross-user coverage before deciding whether to strengthen that path. - Assistant
ensure_threadexplicitly returnsThreadScopeMismatch, currently mapped to 409 in submit. To meet the stated cross-user hiding contract, I’ll adjust only submit’s ensure step to map scope mismatch as 404 (using the existing ownership-safe mapper). This preserves first-message creation and avoids requiring a history probe on a not-yet-created thread. - Assistant
The ownership-safe submit mapping also passes all facade contract tests. I’ll run the entire product-workflow package test suite (including all integration tests), then perform a final source/API audit for forbidden dependencies and DTO serialization surface.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.