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 what we're working with.
Assistant
Let me see more of the file and understand what's been donealready.
Assistant
Now let me look at the rest of the reborn_services.rs file and understand the structure. Let me also look at the test files.
Assistant
Now let me look at the middle part of reborn_services.rs to see the cancel_run and resolve_gate implementations:
Assistant
Now let me look at the ironclaw_turns crate to see what's available for get_run_state:
Assistant
Now I understand the structure. Let me look at what the parent tracker issue says and existing parent code (reborrn_services test contract) more thoroughly:
Assistant
Now I have a good understanding of the existing structure. Let me look at the request.rs to understand the GetRunStateRequest structure:
Assistant
Now I have a full understanding. Let me understand the task at hand:
- I need to implement
get_run_statefacade method that returns a sanitized WebUI DTO containing: run_id, status, event_cursor, accepted_message_ref, resolved_run_profile_id, resolved_run_profile_version, gate_ref, failure, and checkpoint_id. - The DTO must NOT expose M3 scopes, binding references, or model-routing details.
- I need to add
RebornGetRunStateRequestandRebornGetRunStateResponsetypes incrates/ironclaw_product_workflow/src/reborn_services/types.rs. - I need to add the
get_run_statemethod to theRebornServicesApitrait. - I need to enforce thread ownership, validate UUIDs, etc.
Let me check the existing types module exports and the lib.rs:
- I need to implement
Assistant
Now let me check the test for
get_run_stateto make sure I understand what's needed:Assistant
Let me look at the rest of the test file to see what assertions are needed:
Assistant
Now let me run the existing tests to make sure they pass:
Assistant
All existing tests pass. Now I understand the task. Let me check the parent issue tracker to understand if there's a context about the existing tests:
Assistant
Let me look at the existing parent webui_service.rs that was referenced in commit history to understand the original design and whether
get_run_statealready exists there:Assistant
Now let me look at the description more carefully. The issue mentions:
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.And from the interface:
Name: RebornGetRunStateRequest, Path: crates/ironclaw_product_workflow/src/reborn_services/types.rs, Public API:
pub thread_id: String, pub run_id: StringName: 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_idNow let me look at the existing turn module imports for TurnCheckpointId and SanitizedFailure:
Assistant
Now let me also check the existing types module to see how to structure the new types:
Assistant
Now I have a complete picture. Let me also look at the
RebornServicesApitrait to confirm where I need to addget_run_state:Assistant
Now I have a complete understanding of the code. Let me look at how the tests handle the existing patterns:
Assistant
Now I have a complete understanding of the code. Let me make a plan:
Plan:
- Add
RebornGetRunStateRequestandRebornGetRunStateResponsetocrates/ironclaw_product_workflow/src/reborn_services/types.rs - Add
get_run_statemethod to theRebornServicesApitrait incrates/ironclaw_product_workflow/src/reborn_services.rs - Implement
get_run_stateinRebornServicesstruct - Export the new types from
lib.rs - Write tests for the new functionality
Let me first look at the
accepted_message_reffield onAcceptedMessageRef:- Add
Assistant
Good. Now I have all the information I need. Let me start implementing.
Step 1: Update
types.rsto add the new types:Assistant
Now let me add the new types. First, let me update the imports:
Assistant
Step 2: Now I need to update
reborn_services.rsto add the trait method and implementation:Assistant
Oh, I see - the file is using
RebornServicesis not in this re-export (it's the struct itself in this file). Let me look again carefully at the imports and re-exports:Assistant
Let me now verify my changes:
Assistant
Step 3: Now let me update lib.rs to export the new types:
Assistant
Now let me try compiling to see if there are any errors:
Assistant
The issue is that I added the
get_run_stateimpl block AFTER theimpl RebornServicesApi for RebornServicesblock closes. Let me re-check the structure:Assistant
I need to fix this. Let me revert the wrong placement and add the method properly:
Assistant
Now let me also check the trait section is right:
Assistant
Now let me try to build it:
Assistant
The library compiles. The unused imports are not actually unused — they're used in the type signature, but Rust's warning thinks they're unused because we only use them in
Ok(RebornGetRunStateResponse { ... })field assignments, where the type is inferred. Let me check this:Assistant
Let me remove the unused imports since the field types in
RebornGetRunStateResponseare inferred:Assistant
Now let me run the existing tests:
Assistant
All 17 existing tests still pass. Now let me write some tests to verify my new functionality:
Assistant
Let me create a test file in the tests directory to verify my new functionality (but we need to be careful since the instructions say not to add new tests to the repository):
Assistant
Let me write a temporary test to verify the implementation works correctly, then I'll remove it before submitting:
Assistant
The test setup needs the fake coordinator to also handle submit_turn. Let me fix my tests:
Assistant
All 10 tests pass! Now let me clean up the test file and also remove the import warnings:
Assistant
Good, test file removed. Now let me verify my changes don't break any existing tests and don't add new ones:
Assistant
All 17 existing tests pass. Let me also run the full test suite of
ironclaw_product_workflow:Assistant
All tests pass. Let me also make sure the build is clean by running clippy:
Assistant
No clippy warnings. Let me also check the broader build for any issues:
Assistant
Now let me also run the
facade_source_avoids_forbidden_runtime_dependenciestest specifically to make sure my changes don't violate that contract:Assistant
Let me look at the full file again to ensure the structure is correct:
Assistant
Now let me also verify by looking at the entire flow of my changes:
Assistant
Let me think about consistency. The existing
parse_run_idin webui_inbound.rs does NOT trim whitespace before parsing. Let me make myparse_run_id_fieldconsistent with it. Actually, let me check more carefully:Assistant
Let me update my
parse_run_id_fieldto match the existing pattern. Looking at therequired_textfunction in webui_inbound.rs, the blank check is onvalue.trim().is_empty()but the value is NOT trimmed for length checks or control char checks or UUID parsing. Let me match that behavior:Assistant
Now let me verify it still compiles and tests pass:
Assistant
All tests pass. Now let me also re-run my temporary tests to make sure my changes still work:
Assistant
All 10 tests pass. Now let me remove the test file:
Assistant
Now let me also think about additional edge cases. Let me look at the issue requirements once more:
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 stable
NotFound/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.Let me make sure I handle:
- ✅ UUID validation (run_id)
- ✅ Non-empty thread_id and run_id
- ✅ Control character rejection
- ✅ Thread ownership enforcement
- ✅ Cross-user returns NotFound
- ✅ Malformed requests return InvalidRequest
- ✅ DTO has all required fields
- ✅ DTO doesn't expose M3 scopes, binding refs, routes, raw failures
Let me also verify that I'm not breaking the original
facade_source_avoids_forbidden_runtime_dependenciestest:Assistant
All tests still pass. Let me also run the entire workspace tests:
Assistant
Let me also run the broader build to make sure I haven't broken anything:
Assistant
Everything compiles. Let me also check the entire test suite to make sure no tests are broken:
Assistant
All 67 tests pass (4+13+1+15+17+17).
Let me also do a final sanity check on the file structure:
Assistant
Now let me run the test for the existing tests once more, in case my parse_run_id change broke anything:
Assistant
All tests pass.
Let me also check if there's anything else that uses
RebornServicesApior related code that might need to know about the new method:Assistant
There's another implementation of
RebornServicesinironclaw_reborn_composition/src/factory.rs. Let me check if it implementsRebornServicesApi:Assistant
This is a different
RebornServices(composition-level) - it doesn't implementRebornServicesApitrait. My changes are isolated to the workflow-levelRebornServices.Let me also check that there's no other place that constructs
RebornServicesfrom the workflow crate:Assistant
Nothing outside
ironclaw_product_workflowuses theRebornServicesApitrait. My changes are well-contained.Let me also verify the final file is correct:
Assistant
Now let me also look at the final reborn_services.rs file:
Assistant
Now let me also verify that the implementation is complete. Let me run all tests in the workflow crate one more time:
Assistant
All tests pass. Let me also verify the diff is clean and minimal:
Assistant
The diff is clean and only modifies the three files I expected:
crates/ironclaw_product_workflow/src/lib.rs- exports the new typescrates/ironclaw_product_workflow/src/reborn_services.rs- addsget_run_statetrait method, implementation, andparse_run_id_fieldhelpercrates/ironclaw_product_workflow/src/reborn_services/types.rs- addsRebornGetRunStateRequestandRebornGetRunStateResponse
Let me think one more time about whether there's anything else to consider.
The issue mentions:
Preserve idempotent replay and canonical request mappings.
This is for
submit_turnspecifically. Theget_run_statedoesn't have idempotency since it's a read operation. So this is already covered by the existing submit_turn logic.Let me also look at what
parse_thread_id_fielddoes to ensure my function is consistent:Assistant
Let me check
ThreadId::new:Assistant
Good. Now let me verify the full test suite runs cleanly:
Assistant
All 67 tests pass.
Let me also run clippy to make sure no warnings are introduced:
Assistant
No warnings. Let me also ensure the code is properly formatted:
Assistant
Formatting is now clean. Let me also verify the tests still pass after formatting:
Assistant
All 67 tests still pass after formatting. Let me view the final state of the file:
Assistant
The changes look clean and well-organized. Let me now do a final comprehensive test to make sure everything works end-to-end:
Assistant
All tests pass. Let me also do one more sanity check - rebuild from scratch:
Assistant
Let me also check the tests on the broader workspace just to make sure my changes don't break anything outside the workflow crate:
Assistant
Workspace builds clean. Let me also re-verify the diff one more time:
Assistant
Only 3 files modified, exactly the ones I expected. Let me also verify the full set of test outcomes once more:
Assistant
All 67 tests pass.
Now let me go over the checklist:
Checklist:
-
✅ If an error was reported in the issue description, I have successfully reproduced it.
- The issue was about implementing a new method (
get_run_state) and types (, ). There was no error to reproduce, but I did write temporary tests that would have failed if my implementation was incorrect (e.g., , , etc.).
- The issue was about implementing a new method (
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.