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 look at one file at a time.
Assistant
Let me read the full file. Let me open it in the editor.
Assistant
Now let me look at the
GetRunStateRequestandGetRunStateResponsetypes from the turns crate.Assistant
Now I understand the
TurnRunStatestructure. It has many fields includingscope,source_binding_ref,reply_target_binding_ref,resolved_model_route,received_at, which the issue says must NOT be exposed. Let me look at the types I need to expose:The
RebornGetRunStateResponseshould have:- 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, received_at, turn_id (maybe? Actually the issue says "turn_id" isn't in the list, but accepted message ref is... let me re-read).
The issue says the DTO must contain: run ID, status, event cursor, accepted message reference, resolved run-profile ID and version, and optional gate, failure, and checkpoint data.
So the fields are:
- run_id
- status
Assistant
Let me look at the lib.rs of the product workflow crate and the types I need.
Assistant
Let me look at the existing tests for reborn_services to understand the conventions and what's expected.
Assistant
Let me see the middle part of the test file that was truncated.
Assistant
Let me look at the types I need to expose in the response:
GateRef,SanitizedFailure,TurnCheckpointId,EventCursor,RunProfileId,RunProfileVersion.Assistant
GateRef is re-exported. Let me find where it's actually defined.
Assistant
Let me look at
SanitizedFailureandTurnStatus.Assistant
Let me search for any existing references to
get_run_statein the test file or elsewhere.Assistant
Let me check the Cargo.toml for the product workflow crate to understand the test setup.
Assistant
Let me first build the existing tests to ensure things compile before my changes.
Assistant
The repo uses edition 2024 and rust-version 1.92. The stable toolchain is 1.97.1 which should be fine. Let me build.
Assistant
The build works. Now let me implement the changes. First, let me add the new types to
types.rs.Assistant
Let me add the new types. First, update the imports in types.rs.
Assistant
Now let me update
reborn_services.rs. First, thepub usestatement and imports.Assistant
Now let me add the
get_run_statemethod to the trait. Let me look at the trait definition.Assistant
Now I need to implement the
get_run_statemethod in the impl. Let me find whereresolve_gateimpl ends.Assistant
Now let me insert the
get_run_stateimpl method. I'll add it right before the impl block's closing brace.Assistant
Now I need to add the
parse_run_id_fieldhelper. Let me add it nearparse_thread_id_field.Assistant
Now let me export the new types from
lib.rs.Assistant
Now let me build to check for compilation errors.
Assistant
The method was inserted outside the impl block. Let me check the structure.
Assistant
The method was inserted after the impl closing brace. Let me fix the placement. Let me find exact line numbers now.
Assistant
I need to move the method inside the impl block. Let me open the file and fix the placement with the edit tool.
Assistant
I'll replace lines 421-461 to move the method inside the impl block.
Assistant
My indexing was off by one. Let me redo.
Assistant
Now the structure looks correct. Let me rebuild.
Assistant
The library compiles. Now let me build the tests to ensure they still compile (the test file uses
RebornServicesApitrait, so adding a method to the trait would require implementations to add it too — but the test'sFakeTurnCoordinatoris aTurnCoordinator, notRebornServicesApi, so it should be fine).Assistant
Now let me run the existing tests to ensure nothing is broken.
Assistant
All existing tests pass. Now let me write a temporary test script to verify the new
get_run_statefacade method works correctly, including validation, ownership enforcement, and sanitization.Assistant
Let me check
RunProfileId::default_profile()to verify the expected string value.Assistant
default_profile()returns "default". Let me create the temporary test file in the tests directory (I'll remove it before submitting).Assistant
The "has spaces" thread id is accepted by
ThreadId::new. Let me checkThreadId's validation rules to use a genuinely invalid value.Assistant
ThreadIdallows spaces; it rejects path separators and control chars. Let me update my smoke test to use a genuinely invalid thread id (with a path separator).Assistant
All smoke tests pass. Let me run clippy to ensure no warnings, and check the forbidden-dependencies test still passes.
Assistant
The only clippy warning is in my temporary test file. The library has no warnings. Let me remove the temporary test file.
Assistant
All tests pass. Let me review the final diff to confirm my changes.
Assistant
Let me refine
parse_run_id_fieldto use the precise validation codes (Blank/TooLong/InvalidControlCharacter/InvalidId) consistent with the existingwebui_inboundtoken validation conventions.Assistant
Let me rebuild and re-run a quick verification of the refined validation.
Assistant
Let me add one more test for the run-not-found (coordinator
ScopeNotFound) mapping to NotFound.Assistant
All 8 smoke tests pass. Now let me remove the temporary test file and run the full test suite one final time.
Assistant
All tests pass. Let me run clippy on the library itself (no temp tests now) to confirm no warnings.
Assistant
Let me check if any other crates implement
RebornServicesApi(adding a trait method could break downstream implementors).Assistant
Only the one implementation in the same crate. Let me verify the broader workspace compiles (at least crates that depend on
ironclaw_product_workflow).Assistant
No other crate depends on
ironclaw_product_workflow. Let me do a final review of the new types file.Assistant
Everything looks good. Let me verify there are no leftover temporary files and confirm the final git status.
Assistant
The temporary test file is gone, and only the three intended source files are modified. Let me run the broader test suite once more to be certain nothing is broken (the contract test file especially).
Assistant
All 17 contract tests pass, including the
facade_source_avoids_forbidden_runtime_dependenciestest.Let me do a final full check of the complete
get_run_stateimplementation in the facade.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.