refactor: update cursor request handling and improve parent request management

- Changed `run_id` to `request_id` in `CursorParent` struct for clarity.
- Enhanced the `prepare` function to handle parent requests asynchronously, ensuring proper error handling for active runs.
- Updated database interactions to include `cursor_request_id` for better tracking of requests.
- Added tests to verify the behavior of reused cursor request IDs and their mapping to distinct executions.
This commit is contained in:
leookun
2026-08-26 01:46:30 +08:00
parent ae31757635
commit 847e92c7ea
20 changed files with 271 additions and 57 deletions
+2 -2
View File
@@ -89,7 +89,7 @@ async fn selected_image_bytes_flow_from_run_request_to_history_providers_and_che
let user = requests[0]
.history
.iter()
.find(|message| message.message_id == "runtime:run-request:image-run")
.find(|message| message.message_id == "runtime:cursor:user:image-user")
.unwrap();
let ProjectedContent::Parts(parts) = &user.content else {
panic!("runtime user message must retain typed parts")
@@ -128,7 +128,7 @@ async fn selected_image_bytes_flow_from_run_request_to_history_providers_and_che
let id = BlobId::from_bytes(raw_id).unwrap();
let bytes = store.get_blob(&id).await.unwrap().unwrap();
let value: serde_json::Value = serde_json::from_slice(&bytes).unwrap();
if value["id"] == "runtime:run-request:image-run" {
if value["id"] == "runtime:cursor:user:image-user" {
user_root = Some(value);
break;
}