mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-12-01 09:15:33 +08:00
fix: shell
This commit is contained in:
1 parent
df053c3720
commit
5450fc76e2
25 files changed
+1367
-101
No files matched your search
+50
-14
@@ -151,15 +151,39 @@ impl CursorActor {
|
||||
context.dynamic_tools.keys().cloned().collect(),
|
||||
context.turn_user.clone(),
|
||||
);
|
||||
if context.background_completion
|
||||
&& dependencies
|
||||
.run_registry
|
||||
.insert_messages(
|
||||
&prepared.conversation_id,
|
||||
prepared.initial_messages.clone(),
|
||||
)
|
||||
.await
|
||||
{
|
||||
crate::cursor::lifecycle::finish_success(
|
||||
&handle,
|
||||
);
|
||||
let _ = handle
|
||||
.command(CursorCommand::Finished)
|
||||
.await;
|
||||
return;
|
||||
}
|
||||
let cancellation = handle.cancellation();
|
||||
let (port, core) = crate::client::session(256);
|
||||
let core_commands = core.commands.clone();
|
||||
let actor = RunActor::new(
|
||||
dependencies.store.clone(),
|
||||
dependencies.provider,
|
||||
dependencies.run_registry,
|
||||
);
|
||||
let core_run =
|
||||
actor.spawn(prepared, port, cancellation).await;
|
||||
let core_run = actor
|
||||
.spawn(
|
||||
prepared,
|
||||
port,
|
||||
core_commands,
|
||||
cancellation,
|
||||
)
|
||||
.await;
|
||||
let session = CursorSession::new(
|
||||
handle.clone(),
|
||||
dependencies.store,
|
||||
@@ -181,7 +205,6 @@ impl CursorActor {
|
||||
%error,
|
||||
"Cursor session failed"
|
||||
);
|
||||
handle.cancel();
|
||||
let _ = crate::cursor::lifecycle::fail(
|
||||
&handle, &error,
|
||||
);
|
||||
@@ -235,12 +258,14 @@ impl CursorActor {
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if tool_runtime.take_exec(close.id).await.is_some()
|
||||
match codec::stream_closed(close.id, &tool_runtime)
|
||||
.await
|
||||
{
|
||||
results_tx.send_error(crate::Error::Protocol(format!(
|
||||
"Exec stream closed before result for id: {}",
|
||||
close.id
|
||||
)));
|
||||
Ok(Some(completion)) => {
|
||||
results_tx.send(completion)
|
||||
}
|
||||
Ok(None) => {}
|
||||
Err(error) => results_tx.send_error(error),
|
||||
}
|
||||
}
|
||||
Some(Message::Throw(throw)) => {
|
||||
@@ -311,13 +336,12 @@ impl CursorActor {
|
||||
//
|
||||
// The remaining unimplemented Action variants are
|
||||
// ShellCommandAction, StartPlanAction,
|
||||
// AsyncAskQuestionCompletionAction, CancelSubagentAction,
|
||||
// BackgroundShellAction, BackgroundSubagentAction,
|
||||
// AsyncAskQuestionCompletionAction, BackgroundShellAction,
|
||||
// BackgroundSubagentAction,
|
||||
// SubscriptionNotificationAction and GoalContinuationAction.
|
||||
// CancelSubagentAction must not start an LLM; variants whose wire
|
||||
// behavior is not captured yet need evidence before assigning
|
||||
// semantics. Every unsupported runtime Action must return an explicit
|
||||
// Protocol Error rather than falling through silently.
|
||||
// Variants whose wire behavior is not captured yet need evidence
|
||||
// before assigning semantics. Every unsupported runtime Action must
|
||||
// return an explicit Protocol Error rather than falling through silently.
|
||||
Some(
|
||||
pb::agent_client_message::Message::ConversationAction(
|
||||
action,
|
||||
@@ -341,6 +365,18 @@ impl CursorActor {
|
||||
));
|
||||
}
|
||||
}
|
||||
Some(
|
||||
pb::conversation_action::Action::CancelSubagentAction(
|
||||
action,
|
||||
),
|
||||
) => {
|
||||
if let Some(id) = tool_runtime
|
||||
.running_task_exec_id(&action.subagent_id)
|
||||
.await
|
||||
{
|
||||
let _ = handle.emit(&codec::abort(id));
|
||||
}
|
||||
}
|
||||
Some(action) => {
|
||||
results_tx.send_error(crate::Error::Protocol(format!(
|
||||
"unsupported runtime ConversationAction: {}",
|
||||
|
||||
@@ -87,8 +87,15 @@ pub(super) fn project(
|
||||
}
|
||||
pb::BackgroundTaskKind::Unspecified => unreachable!(),
|
||||
};
|
||||
let identity = agent_id.unwrap_or(&completion.task_id);
|
||||
let identity = format!("{}:{identity}", kind.as_str_name());
|
||||
let tool_call_id = completion
|
||||
.tool_call_id
|
||||
.as_deref()
|
||||
.filter(|id| !id.is_empty())
|
||||
.ok_or_else(|| {
|
||||
Error::Protocol("background task completion has no tool_call_id".into())
|
||||
})?;
|
||||
let task_identity = agent_id.unwrap_or(&completion.task_id);
|
||||
let identity = format!("{}:{task_identity}:{tool_call_id}", kind.as_str_name());
|
||||
let context = completion_context(completion, kind, agent_id)?;
|
||||
if completions
|
||||
.insert(identity.clone(), (completion, context))
|
||||
@@ -307,6 +314,30 @@ mod tests {
|
||||
assert_eq!(forward.context, reversed.context);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resumed_subagent_completions_use_the_task_call_as_part_of_their_identity() {
|
||||
let first = project(
|
||||
&pb::BackgroundTaskCompletionAction {
|
||||
completions: vec![completion()],
|
||||
},
|
||||
pb::AgentMode::Multitask as i32,
|
||||
)
|
||||
.unwrap();
|
||||
let mut resumed = completion();
|
||||
resumed.tool_call_id = Some("task-call-2".into());
|
||||
let second = project(
|
||||
&pb::BackgroundTaskCompletionAction {
|
||||
completions: vec![resumed],
|
||||
},
|
||||
pb::AgentMode::Multitask as i32,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert_ne!(first.turn_user.message_id, second.turn_user.message_id);
|
||||
assert!(first.turn_user.message_id.ends_with(":task-call"));
|
||||
assert!(second.turn_user.message_id.ends_with(":task-call-2"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn completion_requires_the_captured_subagent_identity_and_terminal_reason() {
|
||||
let mut value = completion();
|
||||
|
||||
@@ -41,6 +41,7 @@ pub struct CursorRunContext {
|
||||
pub dynamic_tools: BTreeMap<String, pb::McpToolDefinition>,
|
||||
pub checkpoint_prompt: PromptSpec,
|
||||
pub compacting: bool,
|
||||
pub background_completion: bool,
|
||||
}
|
||||
|
||||
pub(crate) struct PrepareDependencies<'a> {
|
||||
@@ -123,7 +124,7 @@ pub(crate) async fn prepare(
|
||||
mode: mode_number,
|
||||
mut turn_user,
|
||||
action_context,
|
||||
event_id,
|
||||
mut event_id,
|
||||
input_id,
|
||||
starts_turn,
|
||||
compacting,
|
||||
@@ -172,14 +173,43 @@ pub(crate) async fn prepare(
|
||||
}
|
||||
Some(_) | None => store.ensure_conversation(&conversation_id).await?,
|
||||
};
|
||||
let base_revision_id = match input_id {
|
||||
let base_revision_id = match input_id.as_deref() {
|
||||
Some(input_id) => {
|
||||
store
|
||||
.anchor_input(&conversation_id, &input_id, proposed_base_revision_id)
|
||||
.anchor_input(&conversation_id, input_id, proposed_base_revision_id)
|
||||
.await?
|
||||
}
|
||||
None => proposed_base_revision_id,
|
||||
};
|
||||
let mut projected_user_context = if input_id.is_some() && !compacting && !background_completion
|
||||
{
|
||||
runtime::compile_request_context(
|
||||
"identity",
|
||||
&request_context,
|
||||
base_messages.as_deref().unwrap_or_default(),
|
||||
)?
|
||||
} else {
|
||||
None
|
||||
};
|
||||
if event_id.is_none() {
|
||||
if let (Some(input_id), Some(user)) = (input_id.as_deref(), turn_user.as_ref()) {
|
||||
event_id = Some(
|
||||
runtime::user_event_id(
|
||||
input_id,
|
||||
checkpoint_mode,
|
||||
user,
|
||||
&request_context,
|
||||
&action_context,
|
||||
projected_user_context
|
||||
.as_ref()
|
||||
.map(|message| &message.content),
|
||||
compiler,
|
||||
blob_sync,
|
||||
)
|
||||
.await?,
|
||||
);
|
||||
}
|
||||
}
|
||||
let existing_runtime = match event_id.as_deref() {
|
||||
Some(event_id) => {
|
||||
store
|
||||
@@ -193,6 +223,10 @@ pub(crate) async fn prepare(
|
||||
let message_id = format!("request-context:{event_id}");
|
||||
match store.message(&conversation_id, &message_id).await? {
|
||||
Some(message) => Some(message),
|
||||
None if input_id.is_some() => projected_user_context.take().map(|mut message| {
|
||||
message.message_id = message_id;
|
||||
message
|
||||
}),
|
||||
None => runtime::compile_request_context(
|
||||
event_id,
|
||||
&request_context,
|
||||
@@ -202,7 +236,7 @@ pub(crate) async fn prepare(
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
let initial_messages = if compacting {
|
||||
let mut initial_messages = if compacting {
|
||||
Vec::new()
|
||||
} else {
|
||||
match (turn_user.clone(), event_id) {
|
||||
@@ -256,6 +290,10 @@ pub(crate) async fn prepare(
|
||||
}
|
||||
}
|
||||
};
|
||||
let (base_revision_id, reused) = store
|
||||
.match_revision_prefix(&conversation_id, base_revision_id, &initial_messages)
|
||||
.await?;
|
||||
initial_messages.drain(..reused);
|
||||
let action = if compacting {
|
||||
RunAction::Compact
|
||||
} else if starts_turn {
|
||||
@@ -310,6 +348,7 @@ pub(crate) async fn prepare(
|
||||
.collect(),
|
||||
checkpoint_prompt,
|
||||
compacting,
|
||||
background_completion,
|
||||
},
|
||||
))
|
||||
}
|
||||
@@ -434,13 +473,13 @@ fn action(request: &pb::AgentRunRequest) -> Result<ActionProjection> {
|
||||
.filter(|text| !text.is_empty())
|
||||
.cloned(),
|
||||
);
|
||||
let event_id = format!("cursor:user:{}", user.message_id);
|
||||
let input_id = format!("cursor:user:{}", user.message_id);
|
||||
Ok(ActionProjection {
|
||||
mode,
|
||||
turn_user: Some(user.clone()),
|
||||
action_context: context.join("\n\n"),
|
||||
event_id: Some(event_id.clone()),
|
||||
input_id: Some(event_id),
|
||||
event_id: None,
|
||||
input_id: Some(input_id),
|
||||
starts_turn: true,
|
||||
compacting: false,
|
||||
background_completion: false,
|
||||
@@ -703,7 +742,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn queued_messages_reusing_a_request_id_keep_distinct_runtime_identities() {
|
||||
fn queued_messages_keep_distinct_input_anchors_until_runtime_identity_is_compiled() {
|
||||
let request = |message_id: &str| pb::AgentRunRequest {
|
||||
action: Some(pb::ConversationAction {
|
||||
action: Some(pb::conversation_action::Action::UserMessageAction(
|
||||
@@ -725,9 +764,11 @@ mod tests {
|
||||
let first = action(&request("message-one")).unwrap();
|
||||
let second = action(&request("message-two")).unwrap();
|
||||
|
||||
assert_eq!(first.event_id.as_deref(), Some("cursor:user:message-one"));
|
||||
assert_eq!(second.event_id.as_deref(), Some("cursor:user:message-two"));
|
||||
assert_ne!(first.event_id, second.event_id);
|
||||
assert_eq!(first.event_id, None);
|
||||
assert_eq!(second.event_id, None);
|
||||
assert_eq!(first.input_id.as_deref(), Some("cursor:user:message-one"));
|
||||
assert_eq!(second.input_id.as_deref(), Some("cursor:user:message-two"));
|
||||
assert_ne!(first.input_id, second.input_id);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -10,6 +10,7 @@ use crate::{
|
||||
proto::agent::v1 as pb,
|
||||
},
|
||||
model::{CanonicalMessage, MessageContent, Origin, Role},
|
||||
store::BlobId,
|
||||
Error, Result,
|
||||
};
|
||||
|
||||
@@ -80,12 +81,66 @@ pub async fn compile(
|
||||
compiler: &PromptCompiler,
|
||||
blobs: &BlobSynchronizer,
|
||||
) -> Result<CanonicalMessage> {
|
||||
let time = Time::now(
|
||||
let timestamp = Time::now(
|
||||
request_context
|
||||
.env
|
||||
.as_ref()
|
||||
.map(|env| env.time_zone.as_str()),
|
||||
)?;
|
||||
)?
|
||||
.timestamp;
|
||||
compile_with_timestamp(
|
||||
event_id,
|
||||
mode,
|
||||
user,
|
||||
request_context,
|
||||
action_context,
|
||||
timestamp,
|
||||
compiler,
|
||||
blobs,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub(super) async fn user_event_id(
|
||||
input_id: &str,
|
||||
mode: Mode,
|
||||
user: &pb::UserMessage,
|
||||
request_context: &pb::RequestContext,
|
||||
action_context: &str,
|
||||
projected_request_context: Option<&MessageContent>,
|
||||
compiler: &PromptCompiler,
|
||||
blobs: &BlobSynchronizer,
|
||||
) -> Result<String> {
|
||||
let runtime = compile_with_timestamp(
|
||||
"identity".into(),
|
||||
mode,
|
||||
user,
|
||||
request_context,
|
||||
action_context,
|
||||
String::new(),
|
||||
compiler,
|
||||
blobs,
|
||||
)
|
||||
.await?;
|
||||
let semantic = serde_json::to_vec(&(projected_request_context, runtime.content))?;
|
||||
Ok(format!(
|
||||
"{input_id}:{}",
|
||||
BlobId::digest(&semantic).to_base64()
|
||||
))
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
async fn compile_with_timestamp(
|
||||
event_id: String,
|
||||
mode: Mode,
|
||||
user: &pb::UserMessage,
|
||||
request_context: &pb::RequestContext,
|
||||
action_context: &str,
|
||||
timestamp: String,
|
||||
compiler: &PromptCompiler,
|
||||
blobs: &BlobSynchronizer,
|
||||
) -> Result<CanonicalMessage> {
|
||||
let mut values = BTreeMap::from([
|
||||
("OPEN_FILES", section(open_files(user))),
|
||||
(
|
||||
@@ -98,7 +153,7 @@ pub async fn compile(
|
||||
),
|
||||
),
|
||||
("ACTION_CONTEXT", section(action_context.to_string())),
|
||||
("TIMESTAMP", time.timestamp),
|
||||
("TIMESTAMP", timestamp),
|
||||
("USER_QUERY", user.text.clone()),
|
||||
("DEBUG_SERVER_ENDPOINT", String::new()),
|
||||
("DEBUG_LOG_PATH", String::new()),
|
||||
|
||||
@@ -9,7 +9,11 @@ use tokio_stream::StreamExt;
|
||||
use tokio_util::sync::CancellationToken;
|
||||
|
||||
use crate::{
|
||||
cursor::{connect::END_STREAM_FLAG, observability::CursorTraceRecorder, CursorSessionRegistry},
|
||||
cursor::{
|
||||
connect::{self, END_STREAM_FLAG},
|
||||
observability::CursorTraceRecorder,
|
||||
CursorSessionRegistry,
|
||||
},
|
||||
Result,
|
||||
};
|
||||
|
||||
@@ -49,7 +53,7 @@ fn local_body_stream(
|
||||
trace.chunk(&chunk);
|
||||
if terminal {
|
||||
guard.complete();
|
||||
trace.finish(None);
|
||||
trace.finish(end_stream_error(&chunk));
|
||||
}
|
||||
yield Ok::<Bytes, Infallible>(chunk);
|
||||
if terminal {
|
||||
@@ -67,6 +71,30 @@ fn is_end_stream_frame(frame: &Bytes) -> bool {
|
||||
.is_some_and(|flags| flags & END_STREAM_FLAG != 0)
|
||||
}
|
||||
|
||||
fn end_stream_error(frame: &Bytes) -> Option<String> {
|
||||
connect::decode_frames(frame)
|
||||
.ok()?
|
||||
.into_iter()
|
||||
.find_map(|(flags, payload)| {
|
||||
if flags & END_STREAM_FLAG == 0 {
|
||||
return None;
|
||||
}
|
||||
let value = serde_json::from_slice::<serde_json::Value>(&payload).ok()?;
|
||||
let error = value.get("error")?;
|
||||
let code = error.get("code").and_then(serde_json::Value::as_str);
|
||||
let message = error
|
||||
.get("message")
|
||||
.and_then(serde_json::Value::as_str)
|
||||
.filter(|message| !message.is_empty());
|
||||
Some(match (code, message) {
|
||||
(Some(code), Some(message)) => format!("{code}: {message}"),
|
||||
(Some(code), None) => code.to_string(),
|
||||
(None, Some(message)) => message.to_string(),
|
||||
(None, None) => error.to_string(),
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
struct LocalRunGuard {
|
||||
cancellation: CancellationToken,
|
||||
completed: bool,
|
||||
@@ -233,4 +261,67 @@ mod tests {
|
||||
drop(stream);
|
||||
assert!(!cancellation.is_cancelled());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn connect_error_end_stream_exposes_the_trace_error() {
|
||||
let frame = connect::encode_error_end_stream(&connect::ConnectStreamError {
|
||||
code: connect::ConnectCode::InvalidArgument,
|
||||
message: "unsupported runtime action".into(),
|
||||
details: Vec::new(),
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(
|
||||
end_stream_error(&frame).as_deref(),
|
||||
Some("invalid_argument: unsupported runtime action")
|
||||
);
|
||||
assert_eq!(end_stream_error(&connect::encode_end_stream()), None);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn connect_error_end_stream_marks_the_local_trace_as_error() {
|
||||
let store = crate::store::Store::connect("sqlite::memory:")
|
||||
.await
|
||||
.unwrap();
|
||||
store.set_detailed_logging(true).await.unwrap();
|
||||
let trace = CursorTraceRecorder::begin(
|
||||
store.clone(),
|
||||
"error-trace",
|
||||
Some("conversation"),
|
||||
"local_byok",
|
||||
Some("model"),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let (sender, receiver) = mpsc::unbounded_channel();
|
||||
let cancellation = CancellationToken::new();
|
||||
sender
|
||||
.send(
|
||||
connect::encode_error_end_stream(&connect::ConnectStreamError {
|
||||
code: connect::ConnectCode::InvalidArgument,
|
||||
message: "unsupported runtime action".into(),
|
||||
details: Vec::new(),
|
||||
})
|
||||
.unwrap(),
|
||||
)
|
||||
.unwrap();
|
||||
let mut stream = Box::pin(local_body_stream(receiver, cancellation, Some(trace)));
|
||||
|
||||
stream.next().await.unwrap().unwrap();
|
||||
|
||||
let deadline = tokio::time::Instant::now() + std::time::Duration::from_secs(1);
|
||||
let trace = loop {
|
||||
let trace = store.cursor_trace("error-trace").await.unwrap().unwrap();
|
||||
if trace.status != "running" {
|
||||
break trace;
|
||||
}
|
||||
assert!(tokio::time::Instant::now() < deadline);
|
||||
tokio::time::sleep(std::time::Duration::from_millis(10)).await;
|
||||
};
|
||||
assert_eq!(trace.status, "error");
|
||||
assert_eq!(
|
||||
trace.error_message.as_deref(),
|
||||
Some("invalid_argument: unsupported runtime action")
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -88,6 +88,23 @@ impl CursorSession {
|
||||
}
|
||||
|
||||
pub async fn run(mut self) -> Result<()> {
|
||||
let result = self.run_inner().await;
|
||||
if let Err(error) = &result {
|
||||
self.abort_execs().await;
|
||||
let error = match error {
|
||||
Error::Protocol(message) => message.clone(),
|
||||
error => error.to_string(),
|
||||
};
|
||||
let _ = self
|
||||
.core
|
||||
.commands
|
||||
.send(ClientCommand::ClientClosed { error })
|
||||
.await;
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
async fn run_inner(&mut self) -> Result<()> {
|
||||
if self.context.compacting {
|
||||
self.handle.emit(&interaction::summary_started())?;
|
||||
}
|
||||
|
||||
@@ -5,4 +5,4 @@ pub use request::{abort, mcp_request, mcp_state_request, request};
|
||||
pub(crate) use request::{
|
||||
await_read_request, edit_read_request, json_object_to_prost, mcp_meta_request,
|
||||
};
|
||||
pub use response::{client_event, ClientExecEvent};
|
||||
pub use response::{client_event, stream_closed, ClientExecEvent};
|
||||
@@ -130,6 +130,53 @@ pub async fn client_event(
|
||||
Ok(event)
|
||||
}
|
||||
|
||||
pub async fn stream_closed(id: u32, pending: &CursorToolRuntime) -> Result<Option<ToolCompletion>> {
|
||||
let Some(entry) = pending.take_exec(id).await else {
|
||||
return Ok(None);
|
||||
};
|
||||
let error = "Cursor Exec stream closed before returning a terminal result";
|
||||
if entry.call.name.eq_ignore_ascii_case("Shell") {
|
||||
let command = entry
|
||||
.call
|
||||
.arguments
|
||||
.get("command")
|
||||
.and_then(serde_json::Value::as_str)
|
||||
.unwrap_or_default()
|
||||
.to_string();
|
||||
let working_directory = entry
|
||||
.call
|
||||
.arguments
|
||||
.get("working_directory")
|
||||
.and_then(serde_json::Value::as_str)
|
||||
.unwrap_or_default()
|
||||
.to_string();
|
||||
return Ok(Some(result::from_exec(
|
||||
entry,
|
||||
&pb::exec_client_message::Message::ShellResult(pb::ShellResult {
|
||||
result: Some(pb::shell_result::Result::SpawnError(pb::ShellSpawnError {
|
||||
command,
|
||||
working_directory,
|
||||
error: error.into(),
|
||||
})),
|
||||
..Default::default()
|
||||
}),
|
||||
)?));
|
||||
}
|
||||
let rendered = match &entry.stage {
|
||||
ExecStage::DynamicMcp(definition) => {
|
||||
interaction::render_dynamic_mcp(&entry.call, definition, false)
|
||||
}
|
||||
_ => interaction::render_tool_call(&entry.call, false)?,
|
||||
};
|
||||
Ok(Some(ToolCompletion::from_rendered(
|
||||
&entry.call,
|
||||
entry.started_at_ms,
|
||||
error.into(),
|
||||
true,
|
||||
rendered,
|
||||
)?))
|
||||
}
|
||||
|
||||
async fn advance_await(
|
||||
entry: PendingExec,
|
||||
result: &pb::exec_client_message::Message,
|
||||
|
||||
@@ -338,6 +338,18 @@ impl CursorToolRuntime {
|
||||
ids
|
||||
}
|
||||
|
||||
pub async fn running_task_exec_id(&self, call_id: &str) -> Option<u32> {
|
||||
self.execs
|
||||
.lock()
|
||||
.await
|
||||
.iter()
|
||||
.filter_map(|(id, entry)| {
|
||||
(entry.call.call_id == call_id && entry.call.name.eq_ignore_ascii_case("Task"))
|
||||
.then_some(*id)
|
||||
})
|
||||
.min()
|
||||
}
|
||||
|
||||
fn next_id(&self) -> Result<u32> {
|
||||
self.next_id
|
||||
.fetch_add(1, Ordering::Relaxed)
|
||||
|
||||
Reference in new issue
Block a user