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 existing workflow/reborn modules, then identify the published M3 facade contract and relevant tests before making changes.
- Assistant
The target module already exists, so I’ll read its implementation and types alongside the M3 inbound facade and search for usage/tests that define expected mappings and error behavior.
- Assistant
The current facade directly imports
TurnCoordinator, which appears contrary to the issue’s “published turn facade” requirement. Output was truncated, so I’ll inspect the complete implementation in sections and locate theironclaw_turnspublic contracts and package tests usinggrep. - Assistant
I found existing contract tests for this module and the turns crate currently exposes
TurnCoordinator. I’ll inspect crate exports, full coordinator request/response DTOs, WebUI validation, and the reborn contract fakes to infer whether a separate M3 facade exists or must be introduced/aliased at this boundary. - Assistant
The turns crate has no separate facade name; its published adapter-safe M3 API is the
TurnCoordinatortrait itself. Thus “without importing TurnCoordinator” likely means WebUI routes must not import it—theRebornServicescomposition layer necessarily holds the published trait. The concrete missing contract isget_run_state; I’ll now inspect all facade helpers and current tests around validation/ownership/error mapping, plus DTO field types (SanitizedFailure, checkpoint IDs), before implementing it consistently. - Assistant
Implementation plan: add the two requested public DTOs, export them from both module and crate, add
get_run_statetoRebornServicesApi, validate both IDs as UUID-backed canonical IDs, perform the same owner-scoped thread-history probe before calling M3, map the canonical state into only the documented safe fields, and preserve existing sanitized error mapping. I’ll verify identifier constructors and ownership helper details before editing. - Assistant
The existing ownership helper is reusable and already collapses scope mismatch/unknown thread to 404.
ThreadIdis not necessarily UUID-backed in this codebase (existing tests use names such asthread-cancel), so “validate UUIDs” applies to run IDs while thread IDs use the canonicalThreadIdvalidator. I’ll make the focused API/DTO implementation now, using canonical M3 types for values while omitting scope, bindings, routes, timestamps, and turn IDs. - Assistant
The edit is in place, but
cargo fmtcould not run because this environment has rustup installed without a selected toolchain. Before installing/selecting one, I’ll check available toolchains and inspectThreadIdvalidation to ensure control-character and blank-token requirements are met. I’ll also check allRebornServicesApiimplementations for compatibility. - Assistant
No Rust toolchain is installed. The repository requires Rust 1.92, so I’ll install that non-interactively to format and run the affected crate’s tests. In parallel, I’ll locate the host API ID macro implementation because
get_run_statemust reject malformed thread token fields with stable validation codes rather than relying on permissive constructors. - Assistant
The combined shell command hit Bash history expansion on the macro search pattern before installation started. I’ll rerun with safe quoting.
- Assistant
Rust 1.92 installed successfully despite a trailing rustup self-path warning. I’ll inspect the ID validator, run formatting, then compile/test the affected crate.
- Assistant
The existing 17 facade contract tests pass, and host
ThreadIdvalidation already rejects blanks, controls, and non-canonical characters. I still need rustfmt, then I’ll add a temporary (non-repository-test) integration check exercising the new method’s sanitized serialization, ownership hiding, and malformed run ID behavior. First I’ll inspect the existing source-dependency assertion to ensure the architecture requirement is interpreted correctly. - Assistant
Formatting and all-target compilation now pass. The architecture test confirms the intended prohibition is on runtime/store dependencies and public leakage, not on the private published
TurnCoordinatorport. I’ll review the final diff for accidental broad formatting, run the complete product-workflow test suite and Clippy, and verify the DTO source contains none of the prohibited internal fields. - Assistant
The full crate suite passes (67 tests total), and the DTO exclusion check passes. Clippy was unavailable rather than failing code, so I’ll install its component and rerun. I’ll also inspect the error maps one final time to ensure
ScopeNotFoundand foreign/unknown ownership both become sanitized 404s, then check the working tree contains only the intended three source files.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.