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 understanding the repository structure and the issue at hand. The issue is about implementing
RebornServicesfacade methods: submit, cancel, resolve-gate, and run-state. Let me explore the repository to understand its structure and find the relevant files.Assistant
Now let me look at the types file to understand the existing types and what's needed:
Assistant
Now let me see the error types and understand more about the structure:
Assistant
Now let me understand the library's public API, the lib.rs, and the related types:
Assistant
Let me look at the turns crate to understand the GetRunStateRequest, GetRunStateResponse, and TurnCoordinator interfaces:
Assistant
Let me look at the TurnRunState type to understand what fields are available:
Assistant
Now I have a good understanding of the
TurnRunStatestruct. Let me look at the request type forget_run_state:Assistant
Now I have a clear picture. Let me look for any tests or test files related to the reborn_services:
Assistant
So
RebornGetRunStateRequestandRebornGetRunStateResponsedon't exist yet. Let me also look for tests related to reborn_services:Assistant
Now I have a very good understanding of what's needed. Let me look at the remaining part of the test file and also check for RunProfileId/RunProfileVersion:
Assistant
Now let me look at the full test file to see what tests exist and if there's anything about
get_run_state:Assistant
Now I need to understand the full scope. Based on my analysis:
- The
RebornServicesApitrait inreborn_services.rscurrently has methods:submit_turn,get_timeline,stream_events,cancel_run,resolve_gate - The issue requires adding a
get_run_statemethod - I need to add
RebornGetRunStateRequestandRebornGetRunStateResponsetypes intypes.rs - The response must be a sanitized DTO that does not expose internal scopes, binding references, model routes, or raw internal failures
Let me now check what
TurnCheckpointIdlooks like and understand the sanitized DTO fields needed:- The
Assistant
Now let me understand the exact response format needed. The issue says the response must include:
run_id,status,event_cursor,accepted_message_ref,resolved_run_profile_id,resolved_run_profile_version,gate_ref,failure,checkpoint_id
Let me also check how
SanitizedFailureis exposed and theGateRefDisplay trait:Assistant
Now I have a good understanding of the codebase. Let me look at the Cargo.toml to understand the dependencies and then run the tests to see the current state.
Let me now look at the TurnStatus Display and how TurnCheckpointId is displayed:
Assistant
I need to check each file separately. Let me search for Display implementations.
Assistant
Let me start implementing. First, I'll modify the types.rs file to add the new request and response types:
Assistant
Now I'll add the new types to the types.rs file. Let me first add the new imports and then the new structs:
Assistant
Let me now create the updated types.rs file with the new
RebornGetRunStateRequestandRebornGetRunStateResponse:Assistant
Now I need to update the
reborn_services.rsfile to:- Add the
get_run_statemethod to theRebornServicesApitrait - Implement the method in
RebornServices - Export the new types from
types.rs
Let me first update the exports in
reborn_services.rs:- Add the
Assistant
Now I need to:
- Update the pub use for types to include
RebornGetRunStateRequestandRebornGetRunStateResponse - Add the
get_run_statemethod to theRebornServicesApitrait - Implement the method in
RebornServices - Also update the lib.rs to export the new types
Let me update the pub use statement in
reborn_services.rs:- Update the pub use for types to include
Assistant
Good, the exports are updated. Now I need to add the
get_run_statemethod to theRebornServicesApitrait. Let me see the current trait definition:Assistant
I need to add the
get_run_statemethod to the trait. Let me add it afterresolve_gate:Assistant
Good, the trait method is added. Now I need to implement it in
RebornServices. Let me find where the impl block ends and add the implementation:Assistant
Let me look at the structure of the implementation to find the right place to add the new method:
Assistant
Now I can see the impl block ends at line 423 with
}. I need to add theget_run_stateimplementation just before the closing}of the impl block. Let me find the exact line:Assistant
Line 422 is the end of the impl block. Let me verify:
Assistant
Now I need to add the
get_run_stateimplementation before line 422. Let me craft it carefully. The method needs to:- Parse and validate
thread_idandrun_id(UUID) - Assert thread ownership by the caller
- Call
TurnCoordinator::get_run_statethrough the M3 contract - Map the
TurnRunStateto a sanitizedRebornGetRunStateResponse(no scope, no binding refs, no model route) - Return
NotFound(404) for cross-user access to hide thread existence
- Parse and validate
Assistant
Let me verify the implementation was added correctly:
Assistant
Now I need to update the
lib.rsto export the new types:Assistant
Now I need to add
RebornGetRunStateRequestandRebornGetRunStateResponseto thepub use reborn_services::{...}list:Assistant
Now let me try to compile to see if there are any issues:
Assistant
The compilation is starting. Let me wait for it to complete:
Assistant
The code compiles successfully. Now let me run the existing tests to make sure everything works:
Assistant
All 17 tests pass. Now let me also verify the full file looks correct by checking the key sections:
Assistant
Let me also verify the key parts of the reborn_services.rs implementation:
Assistant
Good. Now let me verify the trait definition includes the
get_run_statemethod:Assistant
Now let me run all the tests in the workspace to ensure nothing is broken:
Assistant
All 34 tests pass. Let me also verify the
lib.rsexports are correct:Assistant
Let me now verify the complete diff to make sure all changes are correct:
Assistant
The diff looks correct. Let me verify all the requirements from the issue are met:
- RebornGetRunStateRequest - ✅ Added with
pub thread_id: Stringandpub run_id: String - RebornGetRunStateResponse - ✅ Added with all required fields:
run_id,status,event_cursor,accepted_message_ref,resolved_run_profile_id,resolved_run_profile_version,gate_ref,failure,checkpoint_id
- Sanitized DTO - ✅ Does not expose internal scope, binding references, model routes, or raw internal failures
- get_run_state method - ✅ Added to
RebornServicesApitrait and implemented inRebornServices - Validates UUIDs - ✅ Parses
run_idas UUID and returnsInvalidRequest(400) for invalid IDs - Enforces authenticated thread ownership - ✅ Uses
assert_thread_owned_byto check ownership - - ✅ Ownership check returns /404 for cross-user access
- RebornGetRunStateRequest - ✅ Added with
Assistant
All tests pass. Let me now provide the checklist summary:
Checklist Review
1. If an error was reported in the issue description, I have successfully reproduced it.
- N/A: The issue description was a feature request, not an error report. There was no existing error to reproduce. The issue described the need to implement new functionality (the
get_run_statemethod and associated types).
2. If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- N/A: No error to fix. The implementation adds new functionality as specified in the issue.
- N/A: The issue description was a feature request, not an error report. There was no existing error to reproduce. The issue described the need to implement new functionality (the
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.