Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(agents): trace cold startup and first streamed text latency (#7523)
Wolf Mermelsteinb12d55415052
diff --git a/crates/agent_harness/src/domain/service/open.rs b/crates/agent_harness/src/domain/service/open.rsindex 1bb837d0ad..f55614b115 100644--- a/crates/agent_harness/src/domain/service/open.rs+++ b/crates/agent_harness/src/domain/service/open.rs@@ -155,6 +155,7 @@ where/// originating mention and no thread to answer back into. The runtime is/// spawned before the session is attached because there is nothing to/// attach to until it exists.+ #[tracing::instrument(skip_all, err, fields(agent.session.id = tracing::field::Empty, agent.harness = tracing::field::Empty))]async fn open_managed_session(&self,request: agent_session::domain::ports::OpenManagedSession,@@ -199,12 +200,15 @@ wherelet model = request.model.unwrap_or(model);let kind = AgentKind::for_session(bot_id, &harness);let harness = kind.harness_slug().map_or(harness, str::to_owned);+ tracing::Span::current().record("agent.harness", &harness);if kind == AgentKind::CodexCloud {mcp_servers = AgentMcpServers::Selected {servers: Vec::new(),};}let owner_user = session_owner_user(&request.owner)?;+ let session_id = request.id.unwrap_or_else(AgentSessionId::new);+ tracing::Span::current().record("agent.session.id", tracing::field::display(session_id));// Explicit source choices are a domain decision, before any session or egress grant exists.let selected_repo = if let Some(url) = request.repo_url.as_deref() {if kind != AgentKind::Cursor {@@ -249,11 +253,18 @@ where};self.inner.admit_open(bot_id, &harness, &owner_user)+ .instrument(tracing::info_span!("agent.init.admission", agent.session.id = %session_id)).await.map_err(into_session_error)?;let defaults = self.inner.defaults.for_bot(bot_id);- let sandbox_size = self.inner.sessions.user_sandbox_size(&owner_user).await?;- let session_id = request.id.unwrap_or_else(AgentSessionId::new);+ let sandbox_size = self+ .inner+ .sessions+ .user_sandbox_size(&owner_user)+ .instrument(+ tracing::info_span!("agent.init.preferences", agent.session.id = %session_id),+ )+ .await?;// Same ordering as the trigger path's open: the token has to be minted// before the row, because the row is what carries the hash that makes// it mean anything.@@ -261,6 +272,7 @@ where.inner.egress.provision(session_id, &owner_user, &mcp_servers)+ .instrument(tracing::info_span!("agent.init.egress", agent.session.id = %session_id)).await.map_err(into_session_error)?;let session = self@@ -290,8 +302,12 @@ wheremcp_servers,egress_token_hash: Some(egress.session_token_hash),})+ .instrument(tracing::info_span!("agent.init.persist", agent.session.id = %session_id)).await?;- self.inner.publish_opened(&session).await;+ self.inner+ .publish_opened(&session)+ .instrument(tracing::info_span!("agent.init.publish", agent.session.id = %session_id))+ .await;let mcp_servers = if kind == AgentKind::CodexCloud {Vec::new()@@ -307,6 +323,7 @@ wheresize: sandbox_size,egress: egress.sandbox,})+ .instrument(tracing::info_span!("agent.init.runtime", agent.session.id = %session_id)).await{Ok(container) => container,@@ -329,7 +346,13 @@ wherereturn Err(into_session_error(error));}};- let permission_policy = self.inner.permission_policy_for(session.bot_id).await;+ let permission_policy = self+ .inner+ .permission_policy_for(session.bot_id)+ .instrument(+ tracing::info_span!("agent.init.permissions", agent.session.id = %session_id),+ )+ .await;self.inner.sessions.attach_session(@@ -338,6 +361,7 @@ where.mcp_servers(mcp_servers).permission_policy(permission_policy),)+ .instrument(tracing::info_span!("agent.init.attach", agent.session.id = %session_id)).await?;// Raw, through the session's own command worker: dispatch is where adiff --git a/crates/agent_inmem/src/domain/agent.rs b/crates/agent_inmem/src/domain/agent.rsindex 124d586957..25914e2f67 100644--- a/crates/agent_inmem/src/domain/agent.rs+++ b/crates/agent_inmem/src/domain/agent.rs@@ -11,7 +11,7 @@use std::collections::HashSet;use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};use std::sync::{Arc, Mutex};-use std::time::Duration;+use std::time::{Duration, Instant};use agent::ReasoningEffort;use agent::types::{AssistantMessagePart, ChatMessage};@@ -67,6 +67,11 @@ mod test;/// a stop, or the connection going away.const TURN_IDLE_TIMEOUT: Duration = Duration::from_secs(5 * 60);+/// Whole milliseconds since `started`, saturating; a span field, not a clock.+fn elapsed_ms(started: Instant) -> u64 {+ u64::try_from(started.elapsed().as_millis()).unwrap_or(u64::MAX)+}+/// What this agent calls itself in the `initialize` response. The fold/// recognizes the harness by this name, so it is a contract, not a label.pub const AGENT_NAME: &str = "macro-inmem";@@ -142,7 +147,16 @@ impl AgentState {/// same moment a sandboxed harness connects its servers, so the first/// turn already has them.async fn connect_mcp(&self, servers: Vec<AcpMcpServer>) {- let tools = self.mcp.connect_dyn(dialable_servers(servers)).await;+ let servers = dialable_servers(servers);+ let requested = servers.len();+ let started = Instant::now();+ let tools = self.mcp.connect_dyn(servers).await;+ tracing::info!(+ servers = requested,+ tools = tools.as_ref().map_or(0, |tools| tools.len()),+ elapsed_ms = elapsed_ms(started),+ "connected the session's MCP servers"+ );*self.mcp_tools.lock()@@ -585,6 +599,10 @@ pub async fn serve(state: Arc<AgentState>, acp: AcpChannel) -> Result<(), AcpErr"agent.acp.prompt",agent.session.id = %state.session_id,gen_ai.conversation.id = %state.session_id,+ agent.turn.ttft_ms = tracing::field::Empty,+ agent.turn.first_text_ms = tracing::field::Empty,+ agent.turn.admission_wait_ms = tracing::field::Empty,+ agent.turn.lock_wait_ms = tracing::field::Empty,);genai_telemetry::propagation::set_parent(&span, request.meta.as_ref());let prompt = UserPrompt::from_request(&request);@@ -738,6 +756,8 @@ async fn run_turn(prompt: UserPrompt,cancel: CancellationToken,) -> Result<StopReason, AiAdmissionError> {+ // Include lock and admission waits in time to first output.+ let started = Instant::now();// Mark every exit (including denial or a dropped connection) complete so// cancelled/failed requests do not remain outstanding.let _completed = cancel.clone().drop_guard();@@ -746,6 +766,9 @@ async fn run_turn(_ = cancel.cancelled() => return Ok(StopReason::Cancelled),turn = state.turn_lock.lock() => turn,};+ let span = tracing::Span::current();+ span.record("agent.turn.lock_wait_ms", elapsed_ms(started));+ let admission_started = Instant::now();// Check at execution time, not enqueue time. Cancellation stays responsive// even if billing is slow, and neither denial nor cancellation adds history.tokio::select! {@@ -753,6 +776,10 @@ async fn run_turn(_ = cancel.cancelled() => return Ok(StopReason::Cancelled),result = admit_turn(state.admission.as_ref(), &state.owner) => result?,}+ span.record(+ "agent.turn.admission_wait_ms",+ elapsed_ms(admission_started),+ );let TurnInput {messages,model,@@ -780,9 +807,31 @@ async fn run_turn(let mut accumulator = StreamAccumulator::new();let mut failure = None;let mut was_cancelled = false;+ let mut first_part_seen = false;+ let mut first_text_seen = false;loop {match tokio::time::timeout(TURN_IDLE_TIMEOUT, parts.recv()).await {Ok(Some(Ok(part))) => {+ let is_output = match &part {+ StreamPart::Content(text) | StreamPart::Thinking(text) => {+ !text.trim().is_empty()+ }+ StreamPart::ToolCall(_) => true,+ StreamPart::ToolResponse(_) | StreamPart::Usage(_) => false,+ };+ if !first_part_seen && is_output {+ first_part_seen = true;+ let ttft_ms = elapsed_ms(started);+ span.record("agent.turn.ttft_ms", ttft_ms);+ tracing::info!(ttft_ms, "the turn streamed its first part");+ }+ if !first_text_seen+ && let StreamPart::Content(text) = &part+ && !text.trim().is_empty()+ {+ first_text_seen = true;+ span.record("agent.turn.first_text_ms", elapsed_ms(started));+ }if let Some(update) = update_for_part(&part) {let notification = SessionNotification::new(acp_session_id.clone(), update);if connection.send_notification(notification).is_err() {diff --git a/crates/agent_inmem/src/outbound/acp_mcp.rs b/crates/agent_inmem/src/outbound/acp_mcp.rsindex 71cab72498..29c721b53f 100644--- a/crates/agent_inmem/src/outbound/acp_mcp.rs+++ b/crates/agent_inmem/src/outbound/acp_mcp.rs@@ -11,6 +11,8 @@ use rmcp::transport::streamable_http_client::{StreamableHttpClient, StreamableHttpClientTransportConfig,};+use tracing::Instrument as _;+use crate::domain::mcp::McpToolConnector;#[cfg(test)]@@ -65,6 +67,7 @@ whereSelf { client }}+ #[tracing::instrument(skip_all, fields(server = %server.name))]async fn connect_one(&self, server: McpServerHttp) -> Option<ConnectedServer> {let mut config = StreamableHttpClientTransportConfig::with_uri(server.url.clone());let mut custom = HashMap::new();@@ -84,7 +87,11 @@ whereconfig.custom_headers = custom;let transport = StreamableHttpClientTransport::with_client(self.client.clone(), config);- match client_info().serve(transport).await {+ match client_info()+ .serve(transport)+ .instrument(tracing::info_span!("agent.mcp.initialize", server = %server.name))+ .await+ {Ok(client) => Some(ConnectedServer {name: server.name,client,@@ -103,21 +110,34 @@ impl<Client> McpToolConnector for AcpMcpConnector<Client>whereClient: StreamableHttpClient + Send + Sync,{- #[tracing::instrument(skip_all, fields(servers = servers.len()))]+ #[tracing::instrument(skip_all, fields(servers = servers.len(), dialed = tracing::field::Empty, failed = tracing::field::Empty, elapsed_ms = tracing::field::Empty))]async fn connect(&self, servers: Vec<McpServerHttp>) -> Option<RemoteMcpToolSet> {if servers.is_empty() {return None;}+ let started = std::time::Instant::now();+ let requested = servers.len();let connected: Vec<ConnectedServer> =futures::future::join_all(servers.into_iter().map(|server| self.connect_one(server))).await.into_iter().flatten().collect();+ let span = tracing::Span::current();+ span.record("dialed", connected.len());+ span.record("failed", requested - connected.len());if connected.is_empty() {+ span.record(+ "elapsed_ms",+ u64::try_from(started.elapsed().as_millis()).unwrap_or(u64::MAX),+ );return None;}let tools = RemoteMcpToolSet::from_connected(connected, None).await;+ span.record(+ "elapsed_ms",+ u64::try_from(started.elapsed().as_millis()).unwrap_or(u64::MAX),+ );if tools.is_empty() {return None;}diff --git a/crates/agent_session/README.md b/crates/agent_session/README.mdindex 726470bf0f..fd6f80783d 100644--- a/crates/agent_session/README.md+++ b/crates/agent_session/README.md@@ -41,3 +41,43 @@ harnesses do not currently publish authoritative working branch facts. Soupretains the last captured linked-PR branch as a fallback for those sessions andolder rows only while its captured repository matches the session's current one;it never substitutes the starting branch.++## Initialization and first streamed text latency++On each `invoke_agent` span, the session actor records independent millisecond+measurements from sending ACP `session/prompt`:++- `macro.genai.turn.time_to_first_text_ms`: first non-whitespace agent message+ text; excludes reasoning, tool calls, and empty chunks.+- `macro.genai.turn.time_to_first_reasoning_ms`: first non-whitespace thought.+- `macro.genai.turn.time_to_first_tool_call_ms`: first tool call.+- `macro.genai.turn.time_to_first_output_ms`: the existing combined metric,+ which also counts thought/tool events and is not answer-text latency.++Each milestone is recorded once per turn, regardless of content-capture policy.+Turns without text have no text-latency measurement, rather than a zero. A+correlated `agent first output milestone` log emits immediately with+`output_kind` and `elapsed_ms`, so a turn need not finish before it is observable.+These are server-observed timings, not browser render measurements, and they+exclude work before the prompt reaches the runtime.++For that preceding work, inspect `agent.init.*` spans in the harness: admission,+preferences, egress, persistence, publishing, runtime creation, permissions, and+attachment. `agent.init.acp` spans measure actual request-to-response time for+`initialize`, `session/new`, `session/load`, and `session/resume`, with+`rpc.method`, `agent.session.id`, and `outcome` (success/error/stopped). Runtime+attachment alone is not a readiness measurement.++The in-memory connector exposes `agent.mcp.initialize` and+`agent.mcp.list_tools` durations per `server`, alongside the aggregate connector+`dialed`, `failed`, and `elapsed_ms` fields. Servers initialize in+parallel: compare the critical path, not the sum of their durations. In-memory+prompt spans also split `agent.turn.lock_wait_ms`, `agent.turn.admission_wait_ms`,+and `agent.turn.first_text_ms`; their legacy `ttft_ms` can include reasoning or+a tool call, but excludes usage and tool-result events.++To investigate a slow first session in Datadog, correlate by `agent.session.id`,+report sample counts and+p50/p95 for initialization and first text by harness/model. Include the fraction+of turns with no text rather than silently counting them as fast answers. None+of these new fields supplies historical measurements before its deployment.diff --git a/crates/agent_session/src/domain/session/telemetry.rs b/crates/agent_session/src/domain/session/telemetry.rsindex ba6797f994..698b49c521 100644--- a/crates/agent_session/src/domain/session/telemetry.rs+++ b/crates/agent_session/src/domain/session/telemetry.rs@@ -36,6 +36,7 @@ mod test;use std::collections::{HashMap, HashSet};use std::sync::{Arc, OnceLock};+use std::time::Instant;use agent_client_protocol::schema::v1::{ContentBlock, EmbeddedResourceResource, InitializeRequest, InitializeResponse,@@ -94,6 +95,8 @@ pub(crate) struct GenAiProjector {tool_definitions: SharedToolDefinitions,/// The `initialize` request whose response names the harness.initialize: Option<RequestId>,+ /// ACP initialization requests, kept open until their matching response.+ initialization_spans: HashMap<RequestId, tracing::Span>,/// Requests whose responses carry the session's config options (and so/// its model): `session/new`, `session/load`, `session/resume`, and every/// `session/set_config_option`.@@ -114,6 +117,13 @@ pub(crate) struct GenAiProjector {struct Turn {request_id: RequestId,span: tracing::Span,+ /// When the prompt went out, so the first output back dates the turn's+ /// time to first output.+ started: Instant,+ first_output_recorded: bool,+ first_text_recorded: bool,+ first_reasoning_recorded: bool,+ first_tool_call_recorded: bool,/// The agent's output, in order: prose, reasoning and tool calls.parts: Vec<OutputPart>,/// Facts recorded at open so they are not recorded twice at close. Each@@ -123,6 +133,13 @@ struct Turn {definitions_recorded: bool,}+/// Independent milestones: a tool call must not stop the answer-text clock.+enum OutputKind {+ Text,+ Reasoning,+ ToolCall,+}+enum OutputPart {Text(String),Reasoning(String),@@ -186,6 +203,7 @@ impl GenAiProjector {model: None,tool_definitions,initialize: None,+ initialization_spans: HashMap::new(),config_requests: HashSet::new(),turn: None,tools: HashMap::new(),@@ -210,6 +228,20 @@ impl GenAiProjector {return;};let method = &request.method;+ if InitializeRequest::matches_method(method)+ || NewSessionRequest::matches_method(method)+ || LoadSessionRequest::matches_method(method)+ || ResumeSessionRequest::matches_method(method)+ {+ let span = tracing::info_span!(+ parent: parent.and_then(tracing::Span::id),+ "agent.init.acp",+ agent.session.id = %self.session,+ rpc.method = %method,+ outcome = tracing::field::Empty,+ );+ self.initialization_spans.insert(request.id.clone(), span);+ }if InitializeRequest::matches_method(method) {self.initialize = Some(request.id.clone());} else if NewSessionRequest::matches_method(method)@@ -240,9 +272,16 @@ impl GenAiProjector {};match frame {RawJsonRpcMessage::Response(Response::Result { id, result }) => {+ if let Some(span) = self.initialization_spans.remove(id) {+ span.record("outcome", "success");+ }self.on_result(id, result);}RawJsonRpcMessage::Response(Response::Error { id, error }) => {+ if let Some(span) = self.initialization_spans.remove(id) {+ span.record("outcome", "error");+ span.set_error("acp_initialization_failed", "ACP initialization failed");+ }if self.turn.as_ref()@@ -268,6 +307,13 @@ impl GenAiProjector {/// The connection is over. A turn in flight ends in error; tool calls/// still open are marked abandoned.pub(crate) fn on_stopped(&mut self, reason: &StopReason) {+ for (_, span) in self.initialization_spans.drain() {+ span.record("outcome", "stopped");+ span.set_error(+ "session_stopped",+ "Session stopped during ACP initialization",+ );+ }if let Some(turn) = self.turn.take() {self.end_turn(turn, Outcome::Stopped(reason));}@@ -310,9 +356,29 @@ impl GenAiProjector {fn on_update(&mut self, update: SessionUpdate) {match update {- SessionUpdate::AgentMessageChunk(chunk) => self.append_output(&chunk.content, false),- SessionUpdate::AgentThoughtChunk(chunk) => self.append_output(&chunk.content, true),- SessionUpdate::ToolCall(call) => self.open_tool(call),+ SessionUpdate::AgentMessageChunk(chunk) => {+ self.note_first_output();+ if let ContentBlock::Text(text) = &chunk.content+ && !text.text.trim().is_empty()+ {+ self.note_output_kind(OutputKind::Text);+ }+ self.append_output(&chunk.content, false);+ }+ SessionUpdate::AgentThoughtChunk(chunk) => {+ self.note_first_output();+ if let ContentBlock::Text(text) = &chunk.content+ && !text.text.trim().is_empty()+ {+ self.note_output_kind(OutputKind::Reasoning);+ }+ self.append_output(&chunk.content, true);+ }+ SessionUpdate::ToolCall(call) => {+ self.note_first_output();+ self.note_output_kind(OutputKind::ToolCall);+ self.open_tool(call);+ }SessionUpdate::ToolCallUpdate(update) => self.patch_tool(update),SessionUpdate::ConfigOptionUpdate(update) => {self.apply_config_options(update.config_options);@@ -331,6 +397,52 @@ impl GenAiProjector {}}+ /// Date the turn's first streamed output once; later chunks are the+ /// model talking, not the harness waking up.+ fn note_first_output(&mut self) {+ let Some(turn) = &mut self.turn else {+ return;+ };+ if turn.first_output_recorded {+ return;+ }+ turn.first_output_recorded = true;+ let elapsed_ms = u64::try_from(turn.started.elapsed().as_millis()).unwrap_or(u64::MAX);+ turn.span+ .set_u64(attr::MACRO_TIME_TO_FIRST_OUTPUT_MS, elapsed_ms);+ }++ fn note_output_kind(&mut self, kind: OutputKind) {+ let Some(turn) = &mut self.turn else {+ return;+ };+ let (recorded, attribute, kind) = match kind {+ OutputKind::Text => (+ &mut turn.first_text_recorded,+ attr::MACRO_TIME_TO_FIRST_TEXT_MS,+ "text",+ ),+ OutputKind::Reasoning => (+ &mut turn.first_reasoning_recorded,+ attr::MACRO_TIME_TO_FIRST_REASONING_MS,+ "reasoning",+ ),+ OutputKind::ToolCall => (+ &mut turn.first_tool_call_recorded,+ attr::MACRO_TIME_TO_FIRST_TOOL_CALL_MS,+ "tool_call",+ ),+ };+ if *recorded {+ return;+ }+ *recorded = true;+ let elapsed_ms = u64::try_from(turn.started.elapsed().as_millis()).unwrap_or(u64::MAX);+ turn.span.set_u64(attribute, elapsed_ms);+ // Emit immediately as well: an unfinished turn's span may not be exported yet.+ tracing::info!(parent: &turn.span, output_kind = kind, elapsed_ms, "agent first output milestone");+ }+fn apply_config_options(&mut self, options: Vec<SessionConfigOption>) {let model = options.into_iter()@@ -373,6 +485,11 @@ impl GenAiProjector {let mut turn = Turn {request_id,span,+ started: Instant::now(),+ first_output_recorded: false,+ first_text_recorded: false,+ first_reasoning_recorded: false,+ first_tool_call_recorded: false,parts: Vec::new(),agent_name_recorded: false,model_recorded: false,diff --git a/crates/agent_session/src/domain/session/telemetry/test.rs b/crates/agent_session/src/domain/session/telemetry/test.rsindex 20a3d7b8c0..405331751b 100644--- a/crates/agent_session/src/domain/session/telemetry/test.rs+++ b/crates/agent_session/src/domain/session/telemetry/test.rs@@ -344,6 +344,33 @@ fn a_refused_prompt_ends_the_turn_in_error() {string_array_attribute(agent[0], attr::RESPONSE_FINISH_REASONS),Some(vec!["error".to_owned()]));+ assert_eq!(+ int_attribute(agent[0], attr::MACRO_TIME_TO_FIRST_OUTPUT_MS),+ None,+ "a turn that streamed nothing has no time to first output"+ );+}++#[test]+fn time_to_first_output_dates_the_first_streamed_chunk() {+ let (exporter, provider, _guard) = otel_test_pipeline();+ let mut projector = projector(ContentPolicy::enabled());+ replay(&mut projector, fixtures::TURN);+ let spans = finished(&exporter, &provider);++ let agent = spans_named(&spans, "invoke_agent");+ assert_eq!(agent.len(), 1);+ let ttfo = int_attribute(agent[0], attr::MACRO_TIME_TO_FIRST_OUTPUT_MS)+ .expect("a turn with output records its time to first output");+ // A replay streams instantly; what matters is the value is a sane,+ // non-negative duration recorded once on the turn span.+ assert!((0..1_000).contains(&ttfo), "replay is instant: {ttfo}ms");+ let tools = spans_named(&spans, "execute_tool Bash");+ assert_eq!(+ int_attribute(tools[0], attr::MACRO_TIME_TO_FIRST_OUTPUT_MS),+ None,+ "tool spans do not carry the turn's time to first output"+ );}#[test]@@ -774,3 +801,108 @@ fn tool_error_text_follows_the_content_policy() {other => panic!("expected an error status, got {other:?}"),}}++/// Text latency must survive earlier tool/thought/empty chunks, even when+/// content capture is disabled. Move the clock instead of sleeping.+#[test]+fn first_text_is_independent_of_tools_reasoning_and_empty_chunks() {+ let (exporter, provider, _guard) = otel_test_pipeline();+ let mut projector = projector(ContentPolicy::disabled());+ projector.begin_turn(RequestId::Str("timing".to_owned()), None, None);+ let turn = projector.turn.as_mut().expect("turn");+ turn.started = Instant::now() - std::time::Duration::from_secs(1);+ let update = |value| serde_json::from_value::<SessionUpdate>(value).expect("update");+ projector.on_update(update(json!({+ "sessionUpdate": "tool_call", "toolCallId": "tool", "title": "Read", "status": "pending"+ })));+ projector.on_update(update(json!({+ "sessionUpdate": "agent_thought_chunk", "content": {"type": "text", "text": "Thinking"}+ })));+ projector.on_update(update(json!({+ "sessionUpdate": "agent_message_chunk", "content": {"type": "text", "text": " \n"}+ })));+ let turn = projector.turn.as_mut().expect("turn");+ assert!(!turn.first_text_recorded);+ turn.started = Instant::now() - std::time::Duration::from_secs(5);+ projector.on_update(update(json!({+ "sessionUpdate": "agent_message_chunk", "content": {"type": "text", "text": "Hello"}+ })));+ projector.turn.as_mut().expect("turn").started =+ Instant::now() - std::time::Duration::from_secs(30);+ projector.on_update(update(json!({+ "sessionUpdate": "agent_message_chunk", "content": {"type": "text", "text": " again"}+ })));+ projector.on_stopped(&StopReason::Closed(CloseReason::TransportClosed));+ let spans = finished(&exporter, &provider);+ let turn = spans_named(&spans, "invoke_agent")[0];+ assert!(+ (5_000..10_000)+ .contains(&int_attribute(turn, attr::MACRO_TIME_TO_FIRST_TEXT_MS).expect("text"))+ );+ for attr in [+ attr::MACRO_TIME_TO_FIRST_REASONING_MS,+ attr::MACRO_TIME_TO_FIRST_TOOL_CALL_MS,+ ] {+ assert!((1_000..5_000).contains(&int_attribute(turn, attr).expect("milestone")));+ }+ assert!(attribute(turn, attr::OUTPUT_MESSAGES).is_none());+}++#[test]+fn tool_only_turn_has_no_first_text_measurement() {+ let (exporter, provider, _guard) = otel_test_pipeline();+ let mut projector = projector(ContentPolicy::disabled());+ projector.begin_turn(RequestId::Str("tool-only".to_owned()), None, None);+ projector.on_update(+ serde_json::from_value(json!({+ "sessionUpdate": "tool_call", "toolCallId": "tool", "title": "Read", "status": "pending"+ }))+ .expect("tool call"),+ );+ projector.on_stopped(&StopReason::Closed(CloseReason::TransportClosed));+ let spans = finished(&exporter, &provider);+ let turn = spans_named(&spans, "invoke_agent")[0];+ assert!(int_attribute(turn, attr::MACRO_TIME_TO_FIRST_TOOL_CALL_MS).is_some());+ assert!(int_attribute(turn, attr::MACRO_TIME_TO_FIRST_TEXT_MS).is_none());+}++#[test]+fn initialization_spans_end_at_response_or_disconnect() {+ let (exporter, provider, _guard) = otel_test_pipeline();+ let mut projector = projector(ContentPolicy::disabled());+ for id in ["ready", "interrupted"] {+ let request = RawJsonRpcMessage::request(+ "session/new".to_owned(),+ json!({"cwd": "/w", "mcpServers": []}),+ RequestId::Str(id.to_owned()),+ )+ .expect("request");+ projector.on_outbound(&mut ToRuntimeMessage::Acp(AcpMessage(request)), None);+ }+ assert_eq!(projector.initialization_spans.len(), 2);+ projector.on_inbound(&ToServerMessage::Acp(AcpMessage(+ RawJsonRpcMessage::response(+ RequestId::Str("ready".to_owned()),+ Ok(json!({"sessionId": "s"})),+ ),+ )));+ assert_eq!(projector.initialization_spans.len(), 1);+ projector.on_stopped(&StopReason::Closed(CloseReason::TransportClosed));+ assert!(projector.initialization_spans.is_empty());+ let spans = finished(&exporter, &provider);+ let initialization = spans_named(&spans, "agent.init.acp");+ assert_eq!(initialization.len(), 2);+ let outcomes: HashSet<_> = initialization+ .iter()+ .filter_map(|span| string_attribute(span, "outcome"))+ .collect();+ assert_eq!(+ outcomes,+ HashSet::from(["success".to_owned(), "stopped".to_owned()])+ );+ assert!(+ initialization+ .iter()+ .all(|span| string_attribute(span, "rpc.method").as_deref() == Some("session/new"))+ );+}diff --git a/crates/genai_telemetry/src/attr.rs b/crates/genai_telemetry/src/attr.rsindex 45e5de5afa..f72afee441 100644--- a/crates/genai_telemetry/src/attr.rs+++ b/crates/genai_telemetry/src/attr.rs@@ -72,6 +72,20 @@ pub const MACRO_CONTEXT_USED_TOKENS: &str = "macro.genai.context.used_tokens";/// Macro-specific: the agent's context window size in tokens (ACP/// `usage_update.size`).pub const MACRO_CONTEXT_SIZE_TOKENS: &str = "macro.genai.context.size_tokens";+/// Macro-specific: milliseconds from sending `session/prompt` to the first+/// output the harness streamed back (prose, reasoning or a tool call), as the+/// session actor observed it. Absent when the turn ended without output.+pub const MACRO_TIME_TO_FIRST_OUTPUT_MS: &str = "macro.genai.turn.time_to_first_output_ms";+/// Milliseconds from sending `session/prompt` to the first non-whitespace+/// agent message text observed by the session actor. Excludes thoughts and+/// tool calls; absent for turns with no answer text. This is server-observed,+/// not browser render latency, and excludes session initialization.+pub const MACRO_TIME_TO_FIRST_TEXT_MS: &str = "macro.genai.turn.time_to_first_text_ms";+/// Milliseconds from sending `session/prompt` to the first non-whitespace thought.+pub const MACRO_TIME_TO_FIRST_REASONING_MS: &str = "macro.genai.turn.time_to_first_reasoning_ms";+/// Milliseconds from sending `session/prompt` to the first tool call.+pub const MACRO_TIME_TO_FIRST_TOOL_CALL_MS: &str = "macro.genai.turn.time_to_first_tool_call_ms";+/// Macro-specific: the coarse ACP tool kind (`execute`, `edit`, `read`, …).pub const MACRO_TOOL_KIND: &str = "macro.genai.tool.kind";/// Macro-specific: the human-readable title the harness gave a tool call.diff --git a/crates/mcp_toolset/src/toolset.rs b/crates/mcp_toolset/src/toolset.rsindex 26ffe317de..922b774db5 100644--- a/crates/mcp_toolset/src/toolset.rs+++ b/crates/mcp_toolset/src/toolset.rs@@ -1,5 +1,7 @@//! The toolset over connected servers.+use tracing::Instrument as _;+use crate::McpServer;use crate::call_tool_result::CallToolResultExt;use crate::mangle::{Mangled, MangledName};@@ -67,7 +69,12 @@ impl RemoteMcpToolSet {#[tracing::instrument(skip_all, fields(servers = servers.len(), subject = ?subject))]pub async fn from_connected(servers: Vec<ConnectedServer>, subject: Option<String>) -> Self {let listings = futures::future::join_all(servers.into_iter().map(|server| async move {- match server.client.list_all_tools().await {+ match server+ .client+ .list_all_tools()+ .instrument(tracing::info_span!("agent.mcp.list_tools", server = %server.name))+ .await+ {Ok(tools) => Some((server.name, server.client, tools)),Err(error) => {tracing::warn!(@@ -130,6 +137,11 @@ impl RemoteMcpToolSet {}))}+ /// How many tools were discovered across every connected server.+ pub fn len(&self) -> usize {+ self.0.tools.len()+ }+/// Returns `true` when no tools were discovered.pub fn is_empty(&self) -> bool {self.0.tools.is_empty()diff --git a/packages/sdk/generated/auth/index.ts b/packages/sdk/generated/auth/index.tsindex e211e7fab5..0019e17488 100644--- a/packages/sdk/generated/auth/index.ts+++ b/packages/sdk/generated/auth/index.ts@@ -1,4 +1,4 @@// This file is auto-generated by @hey-api/openapi-tsexport { type Options, Sdk } from './sdk.gen';-export type { AbGroup, AiBillingErrorBody, AppleLoginData, AppleLoginError, AppleLoginErrors, AppleLoginRequest, AppleLoginResponse, AppleLoginResponses, CancelCodexLoginData, CancelCodexLoginResponse, CancelCodexLoginResponses, ChangePlanData, ChangePlanError, ChangePlanErrors, ChangePlanRequest, ChangePlanResponse, ChangePlanResponse2, ChangePlanResponses, CheckGithubLinkStatusData, CheckGithubLinkStatusError, CheckGithubLinkStatusErrors, CheckGithubLinkStatusResponse, CheckGithubLinkStatusResponses, CheckGmailLinkStatusData, CheckGmailLinkStatusError, CheckGmailLinkStatusErrors, CheckGmailLinkStatusResponse, CheckGmailLinkStatusResponses, CheckoutSessionMetadata, ClientOptions, CodexConfigRequest, CodexConnectionStatus, CodexEnvironment, CodexEnvironmentRepository, CodexLoginPoll, CodexLoginStart, CodexLoginState, ConfigureCodexData, ConfigureCodexResponse, ConfigureCodexResponses, CreateAccountMergeRequest, CreateAiCreditCheckoutData, CreateAiCreditCheckoutError, CreateAiCreditCheckoutErrors, CreateAiCreditCheckoutResponse, CreateAiCreditCheckoutResponses, CreateCheckoutSessionV2Data, CreateCheckoutSessionV2Error, CreateCheckoutSessionV2Errors, CreateCheckoutSessionV2Request, CreateCheckoutSessionV2Response, CreateCheckoutSessionV2Responses, CreateGtmInviteLinkData, CreateGtmInviteLinkError, CreateGtmInviteLinkErrors, CreateGtmInviteLinkRequest, CreateGtmInviteLinkResponse, CreateGtmInviteLinkResponses, CreateInProgressLinkData, CreateInProgressLinkError, CreateInProgressLinkErrors, CreateInProgressLinkResponse, CreateInProgressLinkResponse2, CreateInProgressLinkResponses, CreateMergeRequestData, CreateMergeRequestError, CreateMergeRequestErrors, CreateMergeRequestResponse, CreateMergeRequestResponses, CreatePortalSessionData, CreatePortalSessionError, CreatePortalSessionErrors, CreatePortalSessionRequest, CreatePortalSessionResponse, CreatePortalSessionResponses, CreateTeamData, CreateTeamError, CreateTeamErrors, CreateTeamRequest, CreateTeamResponse, CreateTeamResponses, CreateUserData, CreateUserError, CreateUserErrors, CreateUserRequest, CreateUserResponse, CreateUserResponses, CreditCheckoutRequestBody, CreditCheckoutResponse, CursorApiKeyStatus, CursorModelOption, CursorModelsResponse, DeleteCursorApiKeyData, DeleteCursorApiKeyError, DeleteCursorApiKeyErrors, DeleteCursorApiKeyResponse, DeleteCursorApiKeyResponses, DeleteGithubLinkData, DeleteGithubLinkError, DeleteGithubLinkErrors, DeleteGithubLinkResponse, DeleteGithubLinkResponses, DeleteTeamData, DeleteTeamError, DeleteTeamErrors, DeleteTeamInviteHandlerData, DeleteTeamInviteHandlerError, DeleteTeamInviteHandlerErrors, DeleteTeamInviteHandlerResponses, DeleteTeamResponses, DeleteUserData, DeleteUserError, DeleteUserErrors, DeleteUserResponse, DeleteUserResponses, DenyReason, DisconnectCodexData, DisconnectCodexResponse, DisconnectCodexResponses, EmptyResponse, EnrichedGithubPullRequest, EnrichGithubPullRequestsData, EnrichGithubPullRequestsError, EnrichGithubPullRequestsErrors, EnrichGithubPullRequestsProxyRequest, EnrichGithubPullRequestsResponse, EnrichGithubPullRequestsResponse2, EnrichGithubPullRequestsResponses, ErrorResponse, GenerateEmailLinkData, GenerateEmailLinkError, GenerateEmailLinkErrors, GenerateEmailLinkRequest, GenerateEmailLinkResponse, GenerateEmailLinkResponses, GenericSuccessResponse, GetAiBillingPlansData, GetAiBillingPlansResponse, GetAiBillingPlansResponses, GetAiBillingSummaryData, GetAiBillingSummaryError, GetAiBillingSummaryErrors, GetAiBillingSummaryResponse, GetAiBillingSummaryResponses, GetCodexConnectionData, GetCodexConnectionResponse, GetCodexConnectionResponses, GetCursorApiKeyData, GetCursorApiKeyError, GetCursorApiKeyErrors, GetCursorApiKeyResponse, GetCursorApiKeyResponses, GetGtmInviteOfferData, GetGtmInviteOfferError, GetGtmInviteOfferErrors, GetGtmInviteOfferResponse, GetGtmInviteOfferResponses, GetLegacyUserPermissionsData, GetLegacyUserPermissionsError, GetLegacyUserPermissionsErrors, GetLegacyUserPermissionsResponse, GetLegacyUserPermissionsResponse2, GetLegacyUserPermissionsResponses, GetNamesWithEmailRequestBody, GetPermissionsData, GetPermissionsError, GetPermissionsErrors, GetPermissionsResponse, GetPermissionsResponses, GetProfilePicturesRequestBody, GetReferralCodeData, GetReferralCodeError, GetReferralCodeErrors, GetReferralCodeResponse, GetReferralCodeResponses, GetTeamData, GetTeamError, GetTeamErrors, GetTeamInvitesData, GetTeamInvitesError, GetTeamInvitesErrors, GetTeamInvitesResponse, GetTeamInvitesResponses, GetTeamResponse, GetTeamResponses, GetUserInfo, GetUserInfoData, GetUserInfoError, GetUserInfoErrors, GetUserInfoResponse, GetUserInfoResponses, GetUserInvitesData, GetUserInvitesError, GetUserInvitesErrors, GetUserInvitesResponse, GetUserInvitesResponses, GetUserLinkExistsData, GetUserLinkExistsError, GetUserLinkExistsErrors, GetUserLinkExistsResponse, GetUserLinkExistsResponses, GetUserNameData, GetUserNameError, GetUserNameErrors, GetUserNameResponse, GetUserNameResponses, GetUserNamesData, GetUserNamesError, GetUserNamesErrors, GetUserNamesResponse, GetUserNamesResponses, GetUserNamesWithEmailData, GetUserNamesWithEmailError, GetUserNamesWithEmailErrors, GetUserNamesWithEmailResponse, GetUserNamesWithEmailResponses, GetUserOrganizationData, GetUserOrganizationError, GetUserOrganizationErrors, GetUserOrganizationResponse, GetUserOrganizationResponses, GetUserPermissionsData, GetUserPermissionsError, GetUserPermissionsErrors, GetUserPermissionsResponse, GetUserPermissionsResponses, GetUserQuotaData, GetUserQuotaError, GetUserQuotaErrors, GetUserQuotaResponse, GetUserQuotaResponses, GetUserTeamsData, GetUserTeamsError, GetUserTeamsErrors, GetUserTeamsResponse, GetUserTeamsResponses, GithubLinkStatusResponse, GithubMergeMethod, GithubPullRequestCheckRun, GithubPullRequestComment, GithubPullRequestLabel, GithubPullRequestRef, GithubPullRequestReview, GithubPullRequestReviewState, GithubPullRequestStatus, GithubPullRequestUser, GmailLinkStatusResponse, GtmInviteLink, GtmInviteLinkList, GtmInviteLinkStatus, GtmInviteOffer, GtmInviteOfferStatus, HealthHandlerData, HealthHandlerResponse, HealthHandlerResponses, InitGithubLinkData, InitGithubLinkError, InitGithubLinkErrors, InitGithubLinkResponse, InitGithubLinkResponse2, InitGithubLinkResponses, InitGmailLinkData, InitGmailLinkError, InitGmailLinkErrors, InitGmailLinkResponse, InitGmailLinkResponse2, InitGmailLinkResponses, InitOutlookLinkData, InitOutlookLinkError, InitOutlookLinkErrors, InitOutlookLinkResponse, InitOutlookLinkResponse2, InitOutlookLinkResponses, InviteEntry, InviteToTeamData, InviteToTeamError, InviteToTeamErrors, InviteToTeamRequest, InviteToTeamResponses, JoinTeamData, JoinTeamError, JoinTeamErrors, JoinTeamResponses, LinkShare, ListCodexEnvironmentsData, ListCodexEnvironmentsResponse, ListCodexEnvironmentsResponses, ListCursorModelsData, ListCursorModelsError, ListCursorModelsErrors, ListCursorModelsResponse, ListCursorModelsResponses, ListGtmInviteLinksData, ListGtmInviteLinksError, ListGtmInviteLinksErrors, ListGtmInviteLinksResponse, ListGtmInviteLinksResponses, LogoutData, LogoutResponse, LogoutResponses, MacroApiTokenData, MacroApiTokenError, MacroApiTokenErrors, MacroApiTokenResponse, MacroApiTokenResponse2, MacroApiTokenResponses, MergeGithubPullRequestData, MergeGithubPullRequestError, MergeGithubPullRequestErrors, MergeGithubPullRequestRequest, MergeGithubPullRequestResponse, MergeGithubPullRequestResponse2, MergeGithubPullRequestResponses, Oauth2CallbackData, Oauth2CallbackError, Oauth2CallbackErrors, Oauth2CallbackResponses, OauthRedirectData, OauthRedirectError, OauthRedirectErrors, OauthRedirectResponses, PasswordlessCallbackData, PasswordlessCallbackError, PasswordlessCallbackErrors, PasswordlessCallbackResponse, PasswordlessCallbackResponses, PasswordlessLoginData, PasswordlessLoginError, PasswordlessLoginErrors, PasswordlessLoginResponse, PasswordlessLoginResponses, PasswordlessRequest, PasswordlessStartedResponse, PasswordLoginData, PasswordLoginError, PasswordLoginErrors, PasswordLoginResponse, PasswordLoginResponses, PasswordRequest, PatchTeamCrmSettingsData, PatchTeamCrmSettingsError, PatchTeamCrmSettingsErrors, PatchTeamCrmSettingsRequest, PatchTeamCrmSettingsResponse, PatchTeamCrmSettingsResponse2, PatchTeamCrmSettingsResponses, PatchTeamData, PatchTeamError, PatchTeamErrors, PatchTeamMemberPlanData, PatchTeamMemberPlanError, PatchTeamMemberPlanErrors, PatchTeamMemberPlanRequest, PatchTeamMemberPlanResponse, PatchTeamMemberPlanResponses, PatchTeamRequest, PatchTeamResponses, PatchTeamUserRole, PatchUserGroupData, PatchUserGroupError, PatchUserGroupErrors, PatchUserGroupRequest, PatchUserGroupResponse, PatchUserGroupResponses, PatchUserOnboardingData, PatchUserOnboardingError, PatchUserOnboardingErrors, PatchUserOnboardingRequest, PatchUserOnboardingResponse, PatchUserOnboardingResponses, PatchUserTutorialData, PatchUserTutorialError, PatchUserTutorialErrors, PatchUserTutorialRequest, PatchUserTutorialResponse, PatchUserTutorialResponses, Permission, PlanCatalogEntry, PlanCatalogResponse, PlanTier, PollCodexLoginData, PollCodexLoginResponse, PollCodexLoginResponses, PostGetNamesRequestBody, PostProfilePicturesData, PostProfilePicturesError, PostProfilePicturesErrors, PostProfilePicturesResponse, PostProfilePicturesResponses, ProfilePictureQueryParams, ProfilePictures, PublicGtmInviteLink, PutCursorApiKeyData, PutCursorApiKeyError, PutCursorApiKeyErrors, PutCursorApiKeyRequest, PutCursorApiKeyResponse, PutCursorApiKeyResponses, PutCursorDefaultModelData, PutCursorDefaultModelError, PutCursorDefaultModelErrors, PutCursorDefaultModelRequest, PutCursorDefaultModelResponse, PutCursorDefaultModelResponses, PutProfilePictureData, PutProfilePictureError, PutProfilePictureErrors, PutProfilePictureResponse, PutProfilePictureResponses, PutUserNameData, PutUserNameError, PutUserNameErrors, PutUserNameQueryParams, PutUserNameResponse, PutUserNameResponses, RedeemGtmInviteLinkData, RedeemGtmInviteLinkError, RedeemGtmInviteLinkErrors, RedeemGtmInviteLinkRequest, RedeemGtmInviteLinkResponse, RedeemGtmInviteLinkResponses, RefreshData, RefreshError, RefreshErrors, RefreshResponse, RefreshResponses, RejectInvitationData, RejectInvitationError, RejectInvitationErrors, RejectInvitationResponses, RemoveUserFromTeamData, RemoveUserFromTeamError, RemoveUserFromTeamErrors, RemoveUserFromTeamResponses, ResendFusionauthVerifyUserEmailData, ResendFusionauthVerifyUserEmailError, ResendFusionauthVerifyUserEmailErrors, ResendFusionauthVerifyUserEmailRequest, ResendFusionauthVerifyUserEmailResponse, ResendFusionauthVerifyUserEmailResponses, ResolveGtmInviteLinkData, ResolveGtmInviteLinkError, ResolveGtmInviteLinkErrors, ResolveGtmInviteLinkResponse, ResolveGtmInviteLinkResponses, RevokeGtmInviteLinkData, RevokeGtmInviteLinkError, RevokeGtmInviteLinkErrors, RevokeGtmInviteLinkResponse, RevokeGtmInviteLinkResponses, SeatPlan, SendInviteBody, SendMobileWelcomeEmailData, SendMobileWelcomeEmailError, SendMobileWelcomeEmailErrors, SendMobileWelcomeEmailRequest, SendMobileWelcomeEmailResponse, SendMobileWelcomeEmailResponse2, SendMobileWelcomeEmailResponses, SendReferralCodeData, SendReferralCodeError, SendReferralCodeErrors, SendReferralCodeResponse, SendReferralCodeResponses, SessionCreationData, SessionCreationError, SessionCreationErrors, SessionCreationResponse, SessionCreationResponses, SessionLoginData, SessionLoginError, SessionLoginErrors, SessionLoginResponse, SessionLoginResponses, SsoLoginData, SsoLoginError, SsoLoginErrors, SsoLoginResponses, SsoRequiredResponse, StartCodexLoginData, StartCodexLoginResponse, StartCodexLoginResponses, StripeSessionResponse, Team, TeamInviteDetails, TeamInvitesResponse, TeamMember, TeamPlan, TeamRole, TeamWithMembers, ToggleAutoJoinDomainResponse, ToggleNonAdminInvitesResponse, ToggleTeamAutoJoinDomainData, ToggleTeamAutoJoinDomainError, ToggleTeamAutoJoinDomainErrors, ToggleTeamAutoJoinDomainResponse, ToggleTeamAutoJoinDomainResponses, ToggleTeamNonAdminInvitesData, ToggleTeamNonAdminInvitesError, ToggleTeamNonAdminInvitesErrors, ToggleTeamNonAdminInvitesResponse, ToggleTeamNonAdminInvitesResponses, UpdateAiBillingOverageData, UpdateAiBillingOverageError, UpdateAiBillingOverageErrors, UpdateAiBillingOverageResponse, UpdateAiBillingOverageResponses, UpdateOverageRequest, UsageSnapshot, UserLinkResponse, UserName, UserNames, UserOrganizationResponse, UserProfilePicture, UserQuota, UserTokensResponse, VerifyEmailLinkData, VerifyEmailLinkError, VerifyEmailLinkErrors, VerifyEmailLinkResponse, VerifyEmailLinkResponses, VerifyFusionauthUserEmailData, VerifyFusionauthUserEmailError, VerifyFusionauthUserEmailErrors, VerifyFusionauthUserEmailResponse, VerifyFusionauthUserEmailResponses, VerifyMergeRequestData, VerifyMergeRequestError, VerifyMergeRequestErrors, VerifyMergeRequestResponse, VerifyMergeRequestResponses } from './types.gen';+export type { AbGroup, AiBillingErrorBody, AppleLoginData, AppleLoginError, AppleLoginErrors, AppleLoginRequest, AppleLoginResponse, AppleLoginResponses, CancelCodexLoginData, CancelCodexLoginResponse, CancelCodexLoginResponses, ChangePlanData, ChangePlanError, ChangePlanErrors, ChangePlanRequest, ChangePlanResponse, ChangePlanResponse2, ChangePlanResponses, CheckGithubLinkStatusData, CheckGithubLinkStatusError, CheckGithubLinkStatusErrors, CheckGithubLinkStatusResponse, CheckGithubLinkStatusResponses, CheckGmailLinkStatusData, CheckGmailLinkStatusError, CheckGmailLinkStatusErrors, CheckGmailLinkStatusResponse, CheckGmailLinkStatusResponses, CheckoutSessionMetadata, CheckoutSessionV2Response, ClientOptions, CodexConfigRequest, CodexConnectionStatus, CodexEnvironment, CodexEnvironmentRepository, CodexLoginPoll, CodexLoginStart, CodexLoginState, ConfigureCodexData, ConfigureCodexResponse, ConfigureCodexResponses, CreateAccountMergeRequest, CreateAiCreditCheckoutData, CreateAiCreditCheckoutError, CreateAiCreditCheckoutErrors, CreateAiCreditCheckoutResponse, CreateAiCreditCheckoutResponses, CreateCheckoutSessionV2Data, CreateCheckoutSessionV2Error, CreateCheckoutSessionV2Errors, CreateCheckoutSessionV2Request, CreateCheckoutSessionV2Response, CreateCheckoutSessionV2Responses, CreateGtmInviteLinkData, CreateGtmInviteLinkError, CreateGtmInviteLinkErrors, CreateGtmInviteLinkRequest, CreateGtmInviteLinkResponse, CreateGtmInviteLinkResponses, CreateInProgressLinkData, CreateInProgressLinkError, CreateInProgressLinkErrors, CreateInProgressLinkResponse, CreateInProgressLinkResponse2, CreateInProgressLinkResponses, CreateMergeRequestData, CreateMergeRequestError, CreateMergeRequestErrors, CreateMergeRequestResponse, CreateMergeRequestResponses, CreatePortalSessionData, CreatePortalSessionError, CreatePortalSessionErrors, CreatePortalSessionRequest, CreatePortalSessionResponse, CreatePortalSessionResponses, CreateTeamData, CreateTeamError, CreateTeamErrors, CreateTeamRequest, CreateTeamResponse, CreateTeamResponses, CreateUserData, CreateUserError, CreateUserErrors, CreateUserRequest, CreateUserResponse, CreateUserResponses, CreditCheckoutRequestBody, CreditCheckoutResponse, CursorApiKeyStatus, CursorModelOption, CursorModelsResponse, DeleteCursorApiKeyData, DeleteCursorApiKeyError, DeleteCursorApiKeyErrors, DeleteCursorApiKeyResponse, DeleteCursorApiKeyResponses, DeleteGithubLinkData, DeleteGithubLinkError, DeleteGithubLinkErrors, DeleteGithubLinkResponse, DeleteGithubLinkResponses, DeleteTeamData, DeleteTeamError, DeleteTeamErrors, DeleteTeamInviteHandlerData, DeleteTeamInviteHandlerError, DeleteTeamInviteHandlerErrors, DeleteTeamInviteHandlerResponses, DeleteTeamResponses, DeleteUserData, DeleteUserError, DeleteUserErrors, DeleteUserResponse, DeleteUserResponses, DenyReason, DisconnectCodexData, DisconnectCodexResponse, DisconnectCodexResponses, EmptyResponse, EnrichedGithubPullRequest, EnrichGithubPullRequestsData, EnrichGithubPullRequestsError, EnrichGithubPullRequestsErrors, EnrichGithubPullRequestsProxyRequest, EnrichGithubPullRequestsResponse, EnrichGithubPullRequestsResponse2, EnrichGithubPullRequestsResponses, ErrorResponse, GenerateEmailLinkData, GenerateEmailLinkError, GenerateEmailLinkErrors, GenerateEmailLinkRequest, GenerateEmailLinkResponse, GenerateEmailLinkResponses, GenericSuccessResponse, GetAiBillingPlansData, GetAiBillingPlansResponse, GetAiBillingPlansResponses, GetAiBillingSummaryData, GetAiBillingSummaryError, GetAiBillingSummaryErrors, GetAiBillingSummaryResponse, GetAiBillingSummaryResponses, GetCodexConnectionData, GetCodexConnectionResponse, GetCodexConnectionResponses, GetCursorApiKeyData, GetCursorApiKeyError, GetCursorApiKeyErrors, GetCursorApiKeyResponse, GetCursorApiKeyResponses, GetGtmInviteOfferData, GetGtmInviteOfferError, GetGtmInviteOfferErrors, GetGtmInviteOfferResponse, GetGtmInviteOfferResponses, GetLegacyUserPermissionsData, GetLegacyUserPermissionsError, GetLegacyUserPermissionsErrors, GetLegacyUserPermissionsResponse, GetLegacyUserPermissionsResponse2, GetLegacyUserPermissionsResponses, GetNamesWithEmailRequestBody, GetPermissionsData, GetPermissionsError, GetPermissionsErrors, GetPermissionsResponse, GetPermissionsResponses, GetProfilePicturesRequestBody, GetReferralCodeData, GetReferralCodeError, GetReferralCodeErrors, GetReferralCodeResponse, GetReferralCodeResponses, GetTeamData, GetTeamError, GetTeamErrors, GetTeamInvitesData, GetTeamInvitesError, GetTeamInvitesErrors, GetTeamInvitesResponse, GetTeamInvitesResponses, GetTeamResponse, GetTeamResponses, GetUserInfo, GetUserInfoData, GetUserInfoError, GetUserInfoErrors, GetUserInfoResponse, GetUserInfoResponses, GetUserInvitesData, GetUserInvitesError, GetUserInvitesErrors, GetUserInvitesResponse, GetUserInvitesResponses, GetUserLinkExistsData, GetUserLinkExistsError, GetUserLinkExistsErrors, GetUserLinkExistsResponse, GetUserLinkExistsResponses, GetUserNameData, GetUserNameError, GetUserNameErrors, GetUserNameResponse, GetUserNameResponses, GetUserNamesData, GetUserNamesError, GetUserNamesErrors, GetUserNamesResponse, GetUserNamesResponses, GetUserNamesWithEmailData, GetUserNamesWithEmailError, GetUserNamesWithEmailErrors, GetUserNamesWithEmailResponse, GetUserNamesWithEmailResponses, GetUserOrganizationData, GetUserOrganizationError, GetUserOrganizationErrors, GetUserOrganizationResponse, GetUserOrganizationResponses, GetUserPermissionsData, GetUserPermissionsError, GetUserPermissionsErrors, GetUserPermissionsResponse, GetUserPermissionsResponses, GetUserQuotaData, GetUserQuotaError, GetUserQuotaErrors, GetUserQuotaResponse, GetUserQuotaResponses, GetUserTeamsData, GetUserTeamsError, GetUserTeamsErrors, GetUserTeamsResponse, GetUserTeamsResponses, GithubLinkStatusResponse, GithubMergeMethod, GithubPullRequestCheckRun, GithubPullRequestComment, GithubPullRequestLabel, GithubPullRequestRef, GithubPullRequestReview, GithubPullRequestReviewState, GithubPullRequestStatus, GithubPullRequestUser, GmailLinkStatusResponse, GtmInviteLink, GtmInviteLinkList, GtmInviteLinkStatus, GtmInviteOffer, GtmInviteOfferStatus, HealthHandlerData, HealthHandlerResponse, HealthHandlerResponses, InitGithubLinkData, InitGithubLinkError, InitGithubLinkErrors, InitGithubLinkResponse, InitGithubLinkResponse2, InitGithubLinkResponses, InitGmailLinkData, InitGmailLinkError, InitGmailLinkErrors, InitGmailLinkResponse, InitGmailLinkResponse2, InitGmailLinkResponses, InitOutlookLinkData, InitOutlookLinkError, InitOutlookLinkErrors, InitOutlookLinkResponse, InitOutlookLinkResponse2, InitOutlookLinkResponses, InviteEntry, InviteToTeamData, InviteToTeamError, InviteToTeamErrors, InviteToTeamRequest, InviteToTeamResponses, JoinTeamData, JoinTeamError, JoinTeamErrors, JoinTeamResponses, LinkShare, ListCodexEnvironmentsData, ListCodexEnvironmentsResponse, ListCodexEnvironmentsResponses, ListCursorModelsData, ListCursorModelsError, ListCursorModelsErrors, ListCursorModelsResponse, ListCursorModelsResponses, ListGtmInviteLinksData, ListGtmInviteLinksError, ListGtmInviteLinksErrors, ListGtmInviteLinksResponse, ListGtmInviteLinksResponses, LogoutData, LogoutResponse, LogoutResponses, MacroApiTokenData, MacroApiTokenError, MacroApiTokenErrors, MacroApiTokenResponse, MacroApiTokenResponse2, MacroApiTokenResponses, MergeGithubPullRequestData, MergeGithubPullRequestError, MergeGithubPullRequestErrors, MergeGithubPullRequestRequest, MergeGithubPullRequestResponse, MergeGithubPullRequestResponse2, MergeGithubPullRequestResponses, Oauth2CallbackData, Oauth2CallbackError, Oauth2CallbackErrors, Oauth2CallbackResponses, OauthRedirectData, OauthRedirectError, OauthRedirectErrors, OauthRedirectResponses, PasswordlessCallbackData, PasswordlessCallbackError, PasswordlessCallbackErrors, PasswordlessCallbackResponse, PasswordlessCallbackResponses, PasswordlessLoginData, PasswordlessLoginError, PasswordlessLoginErrors, PasswordlessLoginResponse, PasswordlessLoginResponses, PasswordlessRequest, PasswordlessStartedResponse, PasswordLoginData, PasswordLoginError, PasswordLoginErrors, PasswordLoginResponse, PasswordLoginResponses, PasswordRequest, PatchTeamCrmSettingsData, PatchTeamCrmSettingsError, PatchTeamCrmSettingsErrors, PatchTeamCrmSettingsRequest, PatchTeamCrmSettingsResponse, PatchTeamCrmSettingsResponse2, PatchTeamCrmSettingsResponses, PatchTeamData, PatchTeamError, PatchTeamErrors, PatchTeamMemberPlanData, PatchTeamMemberPlanError, PatchTeamMemberPlanErrors, PatchTeamMemberPlanRequest, PatchTeamMemberPlanResponse, PatchTeamMemberPlanResponses, PatchTeamRequest, PatchTeamResponses, PatchTeamUserRole, PatchUserGroupData, PatchUserGroupError, PatchUserGroupErrors, PatchUserGroupRequest, PatchUserGroupResponse, PatchUserGroupResponses, PatchUserOnboardingData, PatchUserOnboardingError, PatchUserOnboardingErrors, PatchUserOnboardingRequest, PatchUserOnboardingResponse, PatchUserOnboardingResponses, PatchUserTutorialData, PatchUserTutorialError, PatchUserTutorialErrors, PatchUserTutorialRequest, PatchUserTutorialResponse, PatchUserTutorialResponses, Permission, PlanCatalogEntry, PlanCatalogResponse, PlanTier, PollCodexLoginData, PollCodexLoginResponse, PollCodexLoginResponses, PostGetNamesRequestBody, PostProfilePicturesData, PostProfilePicturesError, PostProfilePicturesErrors, PostProfilePicturesResponse, PostProfilePicturesResponses, ProfilePictureQueryParams, ProfilePictures, PublicGtmInviteLink, PutCursorApiKeyData, PutCursorApiKeyError, PutCursorApiKeyErrors, PutCursorApiKeyRequest, PutCursorApiKeyResponse, PutCursorApiKeyResponses, PutCursorDefaultModelData, PutCursorDefaultModelError, PutCursorDefaultModelErrors, PutCursorDefaultModelRequest, PutCursorDefaultModelResponse, PutCursorDefaultModelResponses, PutProfilePictureData, PutProfilePictureError, PutProfilePictureErrors, PutProfilePictureResponse, PutProfilePictureResponses, PutUserNameData, PutUserNameError, PutUserNameErrors, PutUserNameQueryParams, PutUserNameResponse, PutUserNameResponses, RedeemGtmInviteLinkData, RedeemGtmInviteLinkError, RedeemGtmInviteLinkErrors, RedeemGtmInviteLinkRequest, RedeemGtmInviteLinkResponse, RedeemGtmInviteLinkResponses, RefreshData, RefreshError, RefreshErrors, RefreshResponse, RefreshResponses, RejectInvitationData, RejectInvitationError, RejectInvitationErrors, RejectInvitationResponses, RemoveUserFromTeamData, RemoveUserFromTeamError, RemoveUserFromTeamErrors, RemoveUserFromTeamResponses, ResendFusionauthVerifyUserEmailData, ResendFusionauthVerifyUserEmailError, ResendFusionauthVerifyUserEmailErrors, ResendFusionauthVerifyUserEmailRequest, ResendFusionauthVerifyUserEmailResponse, ResendFusionauthVerifyUserEmailResponses, ResolveGtmInviteLinkData, ResolveGtmInviteLinkError, ResolveGtmInviteLinkErrors, ResolveGtmInviteLinkResponse, ResolveGtmInviteLinkResponses, RevokeGtmInviteLinkData, RevokeGtmInviteLinkError, RevokeGtmInviteLinkErrors, RevokeGtmInviteLinkResponse, RevokeGtmInviteLinkResponses, SeatPlan, SendInviteBody, SendMobileWelcomeEmailData, SendMobileWelcomeEmailError, SendMobileWelcomeEmailErrors, SendMobileWelcomeEmailRequest, SendMobileWelcomeEmailResponse, SendMobileWelcomeEmailResponse2, SendMobileWelcomeEmailResponses, SendReferralCodeData, SendReferralCodeError, SendReferralCodeErrors, SendReferralCodeResponse, SendReferralCodeResponses, SessionCreationData, SessionCreationError, SessionCreationErrors, SessionCreationResponse, SessionCreationResponses, SessionLoginData, SessionLoginError, SessionLoginErrors, SessionLoginResponse, SessionLoginResponses, SsoLoginData, SsoLoginError, SsoLoginErrors, SsoLoginResponses, SsoRequiredResponse, StartCodexLoginData, StartCodexLoginResponse, StartCodexLoginResponses, StripeSessionResponse, Team, TeamInviteDetails, TeamInvitesResponse, TeamMember, TeamPlan, TeamRole, TeamWithMembers, ToggleAutoJoinDomainResponse, ToggleNonAdminInvitesResponse, ToggleTeamAutoJoinDomainData, ToggleTeamAutoJoinDomainError, ToggleTeamAutoJoinDomainErrors, ToggleTeamAutoJoinDomainResponse, ToggleTeamAutoJoinDomainResponses, ToggleTeamNonAdminInvitesData, ToggleTeamNonAdminInvitesError, ToggleTeamNonAdminInvitesErrors, ToggleTeamNonAdminInvitesResponse, ToggleTeamNonAdminInvitesResponses, UpdateAiBillingOverageData, UpdateAiBillingOverageError, UpdateAiBillingOverageErrors, UpdateAiBillingOverageResponse, UpdateAiBillingOverageResponses, UpdateOverageRequest, UsageSnapshot, UserLinkResponse, UserName, UserNames, UserOrganizationResponse, UserProfilePicture, UserQuota, UserTokensResponse, VerifyEmailLinkData, VerifyEmailLinkError, VerifyEmailLinkErrors, VerifyEmailLinkResponse, VerifyEmailLinkResponses, VerifyFusionauthUserEmailData, VerifyFusionauthUserEmailError, VerifyFusionauthUserEmailErrors, VerifyFusionauthUserEmailResponse, VerifyFusionauthUserEmailResponses, VerifyMergeRequestData, VerifyMergeRequestError, VerifyMergeRequestErrors, VerifyMergeRequestResponse, VerifyMergeRequestResponses } from './types.gen';diff --git a/packages/sdk/generated/auth/types.gen.ts b/packages/sdk/generated/auth/types.gen.tsindex 1c3d7c8baf..9dd5b8ff35 100644--- a/packages/sdk/generated/auth/types.gen.ts+++ b/packages/sdk/generated/auth/types.gen.ts@@ -59,6 +59,20 @@ export type CheckoutSessionMetadata = {gaClientId?: string | null;};+/**+ * Hosted checkout with the billing terms the server actually granted.+ */+export type CheckoutSessionV2Response = {+ /**+ * Trial duration, absent for an immediately paid checkout.+ */+ trialDays?: number | null;+ /**+ * The opaque URL returned by Stripe.+ */+ url: string;+};+/*** Explicit remote environment for future Codex sessions.*/@@ -191,6 +205,10 @@ export type CreateCheckoutSessionV2Request = {* Tracking metadata for conversion attribution*/metadata?: CheckoutSessionMetadata;+ /**+ * Request the automatic, first-subscription 30-day Premium trial.+ */+ onboardingTrial?: boolean;plan?: null | SeatPlan;/*** The URL to redirect to on successful checkout@@ -3609,7 +3627,7 @@ export type CreateCheckoutSessionV2Errors = {export type CreateCheckoutSessionV2Error = CreateCheckoutSessionV2Errors[keyof CreateCheckoutSessionV2Errors];export type CreateCheckoutSessionV2Responses = {- 200: StripeSessionResponse;+ 200: CheckoutSessionV2Response;};export type CreateCheckoutSessionV2Response = CreateCheckoutSessionV2Responses[keyof CreateCheckoutSessionV2Responses];diff --git a/packages/sdk/specs/auth.json b/packages/sdk/specs/auth.jsonindex 44d18cdf1f..a238cf27a8 100644--- a/packages/sdk/specs/auth.json+++ b/packages/sdk/specs/auth.json@@ -4568,7 +4568,7 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/StripeSessionResponse"+ "$ref": "#/components/schemas/CheckoutSessionV2Response"}}}@@ -4884,6 +4884,23 @@}}},+ "CheckoutSessionV2Response": {+ "type": "object",+ "description": "Hosted checkout with the billing terms the server actually granted.",+ "required": ["url"],+ "properties": {+ "trialDays": {+ "type": ["integer", "null"],+ "format": "int32",+ "description": "Trial duration, absent for an immediately paid checkout.",+ "minimum": 0+ },+ "url": {+ "type": "string",+ "description": "The opaque URL returned by Stripe."+ }+ }+ },"CodexConfigRequest": {"type": "object","description": "Explicit remote environment for future Codex sessions.",@@ -5040,6 +5057,10 @@"$ref": "#/components/schemas/CheckoutSessionMetadata","description": "Tracking metadata for conversion attribution"},+ "onboardingTrial": {+ "type": "boolean",+ "description": "Request the automatic, first-subscription 30-day Premium trial."+ },"plan": {"oneOf": [{