mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-10-05 04:07:36 +08:00
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:
@@ -289,7 +289,7 @@ async fn text_turn_runs_from_bidi_request_through_checkpoint_and_end_stream() {
|
||||
.unwrap();
|
||||
assert!(messages[0].message_id.starts_with("request-context:"));
|
||||
assert_eq!(messages[0].role, Role::User);
|
||||
assert_eq!(messages[1].message_id, "runtime:run-request:request");
|
||||
assert_eq!(messages[1].message_id, "runtime:cursor:user:user");
|
||||
assert_eq!(messages[1].role, Role::User);
|
||||
assert_eq!(
|
||||
messages.len(),
|
||||
@@ -300,11 +300,14 @@ async fn text_turn_runs_from_bidi_request_through_checkpoint_and_end_stream() {
|
||||
.fetch_all(store.pool())
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
stored_runs,
|
||||
vec!["request"],
|
||||
"the concrete request_id, not Cursor's reusable wire run_id, owns the execution"
|
||||
);
|
||||
assert_eq!(stored_runs.len(), 1);
|
||||
let execution_suffix = stored_runs[0]
|
||||
.strip_prefix("request:")
|
||||
.expect("the local Run keeps the Cursor request id as a readable prefix");
|
||||
assert_eq!(execution_suffix.len(), 8);
|
||||
assert!(execution_suffix
|
||||
.bytes()
|
||||
.all(|byte| byte.is_ascii_hexdigit()));
|
||||
}
|
||||
|
||||
fn client_run(conversation_id: &str, text: &str, model_id: &str) -> pb::AgentClientMessage {
|
||||
|
||||
Reference in New Issue
Block a user