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
Let me start by exploring the repository structure to understand the codebase.
Assistant
Let me explore the relevant crate structure.
Assistant
Let me see the full file with line numbers.
Assistant
Now let me look at the TurnCoordinator trait and GetRunState types.
Assistant
Now I understand the
TurnRunStatestructure. I need to create aRebornGetRunStateResponsethat contains sanitized fields:- run_id
- status
- event_cursor
- accepted_message_ref
- resolved_run_profile_id
- resolved_run_profile_version
- gate_ref
- failure
- checkpoint_id
And NOT expose: scope, source_binding_ref, reply_target_binding_ref, resolved_model_route, turn_id (maybe?), received_at.
Let me look at the relevant types:
GateRef,SanitizedFailure,TurnCheckpointId,EventCursor,AcceptedMessageRef,TurnRunId,TurnStatus,RunProfileId,RunProfileVersion.Let me check what types are available. Let me look at the existing test files for reborn_services to understand expectations.
Assistant
Let me check if there are tests that reference
get_run_statefacade method. Let me search the whole repo for references toRebornGetRunStateor aget_run_statefacade method onRebornServicesApi.Assistant
No tests yet reference
RebornGetRunState. The test contract file at line 851 has "ironclaw_run_state" - let me look at that context.Assistant
There's a test
facade_source_avoids_forbidden_runtime_dependenciesthat checks the source does not contain certain strings. Let me look at the WebUi inbound module to understand the request types and validation.Assistant
Now let me look at the relevant types:
RunProfileId,RunProfileVersion,SanitizedFailure,TurnCheckpointId,EventCursor,GateRef.Assistant
Let me look at the bounded_ref macro fully and EventCursor/TurnStatus.
Assistant
Let me look at the
TurnCoordinatortrait.Assistant
Let me look at the
GetRunStateRequestdefinition.Assistant
Let me check what's re-exported from ironclaw_turns.
Assistant
Let me look at ThreadId validation and the existing facade helpers more carefully.
Assistant
Let me look at the full reborn_services_contract.rs test to understand the patterns used.
Assistant
Let me check if there are other implementations of the
RebornServicesApitrait.Assistant
Let me check the other test files that reference get_run_state.
Assistant
Let me check the recent git history for style context.
Assistant
Let me first build the crate to ensure a baseline compile.
Assistant
Baseline compiles. Now let me make my changes. First, let me add the types to
types.rs.Assistant
Let me refine the import to include
TurnRunStatefor cleaner code.Assistant
Now let me update the module exports and the trait/impl in
reborn_services.rs. First, thepub use types::{...}.Assistant
Now let me add the
get_run_statemethod to theRebornServicesApitrait. Let me view the trait section.Assistant
Now let me add the
get_run_statemethod to the trait.Assistant
Now let me implement the
get_run_statemethod in the impl block. Let me view the end of the resolve_gate method.Assistant
Now let me insert the
get_run_stateimplementation. I'll match the unique end of the impl block.Assistant
Now I need to add the
parse_run_id_fieldhelper. I'll reuse the existingparse_run_idvalidation fromwebui_inboundby making itpub(crate). Let me check it.Assistant
I'll make
parse_run_idpub(crate)so the facade reuses identical validation semantics ascancel_run/resolve_gate.Assistant
Now let me add the
parse_run_id_fieldhelper in the facade nearparse_thread_id_field.Assistant
I'll add
parse_run_id_fieldright afterparse_thread_id_field. Let me insert it after theparse_thread_id_fieldfunction's closing brace (line 588).Let me use the edit/replace command. I'll match the end of parse_thread_id_field and add the new helper.
Assistant
Now let me update
lib.rsto export the new types.Assistant
Now let me build to check for compile errors.
Assistant
Compiles. Now let me write a temporary test to verify the behavior of
get_run_state. Let me create a temporary test file.Assistant
Now let me create a temporary test file to verify the behavior.
Assistant
Let me run the temporary tests.
Assistant
All 6 tests pass. Now let me run the existing contract tests to ensure nothing is broken.
Assistant
All 17 existing tests pass. Let me run the full crate test suite to make sure nothing else broke.
Assistant
Let me see the full test output summary.
Assistant
All tests pass. Now let me ensure dependent crates still build. Let me check which crates depend on
ironclaw_product_workflow.Assistant
The
ironclaw_rebornusage is theTurnCoordinator::get_run_statemethod, unrelated to the facade. No other workspace crate depends onironclaw_product_workflow. Let me remove the temporary test file.Assistant
Let me run clippy to ensure no new warnings/lints are introduced.
Assistant
Clippy passes cleanly. Let me do a final review of all my changes via git diff.
Assistant
Let me clean up the double blank line and run
cargo fmtto ensure formatting is consistent.Assistant
Let me apply
cargo fmtto fix all formatting.Assistant
Let me verify the formatted helper functions and re-run the full test suite once more after formatting.
Assistant
Now let me re-run the full test suite for the crate after formatting to confirm everything still passes.
Assistant
All tests pass. Let me do a final check across the entire repository for any other implementors of the
RebornServicesApitrait (to ensure adding a method doesn't break anything).Assistant
The implementation works, but for clarity and robustness let me bind the actor to a local variable rather than borrowing a temporary across the await (matching the pattern used by
cancel_run/resolve_gate).Assistant
Let me re-create the temporary test one more time to verify the final version, then remove it.
Assistant
All 4 tests pass. Let me remove the temporary test file.
Assistant
Let me run the full crate test suite one final time to confirm everything passes.
Assistant
Let me run a final clippy check to confirm no warnings.
Assistant
No warnings or errors. Let me review the final complete diff.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.