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 analyze the issue. I need to implement facade methods in
RebornServicesfor:submit- submit turnscancel- cancel runsresolve-gate- resolve gatesrun-state/get_run_state- read current run state
Let me start by exploring the repository structure to understand the codebase.
Assistant
I need to use the open command properly without extra arguments.
Assistant
Let me see the full file since it was truncated:
Assistant
Now let me look at the test file to understand what's expected:
Assistant
Now let me look at the
TurnRunStatetype to understand the data returned byget_run_state:Assistant
Now let me look at the
webui_inbound.rsfile to understand the request types:Assistant
Now let me look at the error types and the lib.rs to understand the module structure:
Assistant
Now let me look at what types are exported from
ironclaw_turnsfor theTurnRunState:Assistant
Let me also check what types are in
ironclaw_turnsto see what's available:Assistant
Now I have a good understanding of the codebase. Let me summarize what I need to implement:
- Add
RebornGetRunStateRequestandRebornGetRunStateResponsetypes intypes.rs - Add
get_run_statemethod to theRebornServicesApitrait - Implement
get_run_stateinRebornServices - Export the new types from
lib.rs
The
RebornGetRunStateResponsemust be a sanitized DTO containing:run_idstatusevent_cursoraccepted_message_refresolved_run_profile_idresolved_run_profile_versiongate_ref(optional)failure(optional)checkpoint_id(optional)
It must NOT expose internal scopes, binding references, model routes, or raw internal failures.
Let me also check what the
TurnCheckpointIdtype looks like:- Add
Assistant
Now let me run the existing tests to understand the baseline:
Assistant
All 17 existing tests pass. Now I understand the codebase. Let me implement the
get_run_statemethod.Here's my plan:
- Add
RebornGetRunStateRequestandRebornGetRunStateResponsetotypes.rs - Add
get_run_statemethod toRebornServicesApitrait inreborn_services.rs - Implement
get_run_stateinRebornServices- validate inputs, enforce ownership, callturn_coordinator.get_run_state(), return sanitized DTO - Export the new types from
lib.rs
Let me start implementing:
- Add
Assistant
Now let me update the
types.rsfile to add the necessary import forTurnCheckpointId:Assistant
Good. Now I need to update the
reborn_services.rsfile to:- Add the new types to the
pub useexport - Add
get_run_statemethod to theRebornServicesApitrait - Implement
get_run_stateinRebornServices
Let me first update the public exports:
- Add the new types to the
Assistant
Now I need to add the
get_run_statemethod to theRebornServicesApitrait. Let me find the exact location:Assistant
I need to add the
get_run_statemethod to the trait. Let me find the right spot and add it:Assistant
Let me check if it was added correctly:
Assistant
Good, the trait method is added. Now I need to find where
resolve_gateends in the impl block to add theget_run_stateimplementation. Let me find the end of theresolve_gateimplementation:Assistant
Line 420 is where the
impl RebornServicesApi for RebornServicesblock ends with}. I need to add theget_run_stateimplementation before that closing brace. Let me find the exact line:Assistant
Line 420 is the closing of the
impl RebornServicesApi for RebornServicesblock. I need to insert theget_run_stateimplementation before that closing brace. Let me look at the lines around it:Assistant
I need to insert the
get_run_stateimplementation before line 420 (the closing}). I'll use theeditcommand:Assistant
I need to also add the import for the types used by
get_run_state. Let me check what imports are needed:Assistant
The
GetRunStateRequestis already imported. I also needTurnCheckpointIdandSanitizedFailure. Let me check what's available fromironclaw_turns:Assistant
I need to add
TurnCheckpointIdto the import fromironclaw_turns. Let me also check ifSanitizedFailureis imported:Assistant
Good. Now I need to update the imports and add the implementation. Let me first add
TurnCheckpointIdto the imports:Assistant
Now let me add the
get_run_stateimplementation. I'll insert it just before line 420 (the closing}of the impl block):Assistant
I need to add the
get_run_stateimplementation after line 419 (}closingresolve_gate) and before line 420 (}closing the impl block). Let me use the edit command:Assistant
Now I need to add the
parse_run_id_for_statehelper function. Let me check where the existingparse_run_idfunction is and add a similar one:Assistant
I see that
parse_run_iddoesn't exist inreborn_services.rs- it's inwebui_inbound.rs. I need to create aparse_run_id_for_statehelper that validates the run_id as a UUID. Let me add it near the other helper functions:Assistant
I need to add a
parse_run_id_for_statehelper. Let me add it afterparse_thread_id_field:Assistant
Now I need to update
lib.rsto export the new types:Assistant
Now let me verify the build compiles:
Assistant
It compiles with just a warning about unused import
TurnCheckpointId. I actually don't needTurnCheckpointIdsince I'm converting to string. Let me remove it:Assistant
Clean build. Now let me run the existing tests:
Assistant
All 17 tests pass. Now let me verify the implementation by looking at the full code I've written:
Assistant
Let me also check the helper function:
Assistant
Let me verify the types file:
Assistant
Let me also verify the lib.rs exports:
Assistant
Let me now run the full test suite for the product workflow crate to make sure everything works:
Assistant
Looking at the test output, I see 17 tests passed for
reborn_services_contractand 17 forwebui_inbound_contract. But I notice there's no test specifically forget_run_statein the existing test file. Let me check the test file more carefully to see if there are any tests I should be aware of:Assistant
The
FakeTurnCoordinatoralready has aget_run_stateimplementation for testing purposes. Now let me verify my implementation handles all the edge cases mentioned in the issue:Assistant
All 67 tests pass (4 + 13 + 1 + 15 + 17 + 17 = 67). Let me now verify the final state of the files I've changed:
Assistant
The implementation looks clean and correct. Let me now review the checklist from the issue:
Checklist Review
-
If an error was reported in the issue description, I have successfully reproduced it.
- The issue is a feature request (implement
get_run_stateand related facade methods), not an error report. Thesubmit,cancel, andresolve_gatemethods already existed. The missing piece wasget_run_stateand the associated types. I confirmed this by examining the codebase and seeing the types and were not defined.
- The issue is a feature request (implement
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.