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 usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /ironclaw, current file: none) bash-$
- Assistant
I’ll first inspect the workspace and the existing
reborn_servicesmodule, then trace the published M3 facade contract and relevant tests before implementing anything. - Assistant
The target module already exists, so I’ll read its implementation and public types alongside the coordinator’s published facade traits and search for all usages/tests to identify missing behavior and exact canonical mappings.
- Assistant
ripgrepis unavailable, but the initial source shows direct dependency onTurnCoordinator, which likely violates the “published turn facade” requirement. I’ll inspect the remainder and locate the facade contract withgrep, including workspace crate APIs and tests. - Assistant
The current code’s public M3 contract appears to be
ironclaw_turns::TurnCoordinator; the issue may mean use only that trait (not concrete coordinator/runtime/store internals), despite the wording “without importing TurnCoordinator” referring to WebUI routes rather than this facade itself. I’ll verify exports and response fields, then inspect the dedicated facade contract tests and ownership semantics. - Assistant
Existing tests cover the three original methods and include a source-level forbidden-import check; the new evaluator likely adds
get_run_statecontract tests. I’ll read the complete test scaffolding andTurnRunStateshape so the DTO conversion is exhaustive and sanitized. - Assistant
The M3 state already contains exactly the source fields plus sensitive scope/binding/model-route data. I’ll isolate its definition and helper/error mappings in
reborn_services.rs, becauseget_run_stateshould reuse validation, ownership hiding, and error sanitization consistently. - Assistant
I’ll verify inbound credential validation and all
TurnError/thread error mappings before editing. The requested DTO can safely expose canonical opaque IDs andSanitizedFailure, while destructuringTurnRunStateexplicitly ensures sensitive fields cannot accidentally enter serialization. - Assistant
I found one ownership leak in submit:
ensure_threadmaps an existing foreign-owned thread to 409 rather than hidden 404. I’ll fix that call’s mapping while addingget_run_statewith UUID validation, an ownership probe before M3 access, canonicalGetRunStateRequest, and an explicit sanitized DTO conversion. - Assistant
I’ll now patch the DTO module, facade exports/trait/implementation, validation helper, and the submit ownership-error mapping. I’ll retain canonical M3 ID/value types in responses, matching existing facade response conventions and preventing lossy remapping.
- Assistant
The patch is in place.
cargo fmtcould not run because rustup has no default configured; I’ll inspect installed toolchains and use an explicitly installed one rather than downloading unnecessarily. - Assistant
No Rust toolchain is installed. Since the crate declares Rust 1.92, I’ll install that toolchain, then format and run the focused package tests.
- Assistant
The toolchain downloaded successfully, but the chained invocation hit an environment path mismatch (
rustupexpects/root/.cargowhile this shell uses another home). I’ll locate the installed binaries and invoke them with explicitRUSTUP_HOME/CARGO_HOME. - Assistant
I’ll run with
HOME=/root,RUSTUP_HOME=/root/.rustup, and the existing/usr/local/cargocache. - Assistant
The minimal profile omitted rustfmt. I’ll add it, then format and execute the focused tests.
- Assistant
The existing facade contract passes. I’ll now run the package’s full test suite and inspect the formatted diff plus host identifier validation to catch hidden edge cases (especially control characters and ownership/error behavior).
- Assistant
All package tests pass. Before finalizing, I’ll check every implementation/call site of
RebornServicesApi, inspect serialization shape and the final diff, and consider whether unauthorized M3 responses after a successful ownership probe should be hidden as 404 for the read endpoint. - Assistant
A hidden edge case remains: unlike cancel/gate parsing, the new string-based state request currently classifies control characters merely as
InvalidId. The contract explicitly requires token control-character rejection, so I’ll align direct facade parsing with existing inbound validation (Blank,TooLong,InvalidControlCharacter, thenInvalidId) for both thread and run fields. - Assistant
The focused tests still pass after token-validation hardening. I’ll perform one final full package run, verify only intended source files changed, and inspect for forbidden dependencies/sensitive DTO fields before submission.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →