Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(agents): keep waiting on live Cursor runs and announce under the right parent (#6656)

Wolf Mermelstein0404818ffd2b
diff --git a/.github/workflows/web-app-check-main.yml b/.github/workflows/web-app-check-main.yml
index b19980880c..5ed045ad05 100644
--- a/.github/workflows/web-app-check-main.yml
+++ b/.github/workflows/web-app-check-main.yml
@@ -110,6 +110,9 @@ jobs:
- name: Check Collaboration Package Types
run: bun run type-check
working-directory: packages/collaboration
+ - name: Check Lexical Service Types
+ run: bun run check
+ working-directory: services/lexical-service
- name: Teardown Nix
if: always()
uses: './.github/actions/teardown-nix'
diff --git a/apps/web/src/features/block-agent/component/AgentMessage.tsx b/apps/web/src/features/block-agent/component/AgentMessage.tsx
index 0ac326b61f..91e1030d8c 100644
--- a/apps/web/src/features/block-agent/component/AgentMessage.tsx
+++ b/apps/web/src/features/block-agent/component/AgentMessage.tsx
@@ -38,6 +38,14 @@ import { type ToolUsePart, toolCallDetail, toolLabel } from './parts/shared';
import { TextPart } from './parts/TextPart';
import { ToolCallPart } from './parts/ToolCallPart';
+/**
+ * What a turn the runtime errored asks of the reader. Every such failure
+ * leaves the session usable - the next message starts a fresh turn - so the
+ * instruction is the same whatever the runtime said went wrong.
+ */
+const TURN_FAILED_LABEL =
+ 'An error was encountered with your session. Send another message to continue';
+
function AgentMessagePart(props: {
part: MessagePart;
message: FoldedMessage;
@@ -289,11 +297,13 @@ export function Message(props: {
</Show>
{/* A turn the runtime errored is something that happened to the
session, like a model change or a stop — so it reads as one,
- at the foot of whatever the agent managed to say first. */}
+ at the foot of whatever the agent managed to say first. The
+ line says what to do about it; the runtime's own account of
+ what happened is the detail. */}
<Show when={failure()}>
{(message) => (
<ActionLine
- label={`The agent couldn't answer — ${message()}`}
+ label={`${TURN_FAILED_LABEL} — ${message()}`}
detail={message()}
failed
/>
diff --git a/apps/web/src/features/block-agent/debug/Gallery.tsx b/apps/web/src/features/block-agent/debug/Gallery.tsx
index ddde67ddf9..8b0be09eb5 100644
--- a/apps/web/src/features/block-agent/debug/Gallery.tsx
+++ b/apps/web/src/features/block-agent/debug/Gallery.tsx
@@ -815,7 +815,7 @@ export default function AgentUiGallery() {
detail="no credentials configured for provider openai"
/>
<ActionLine
- label="The agent couldn't answer — Internal error: Bad Request: bad request: Authorization header is badly formatted"
+ label="An error was encountered with your session. Send another message to continue — Internal error: Bad Request: bad request: Authorization header is badly formatted"
detail="Internal error: Bad Request: bad request: Authorization header is badly formatted"
failed
/>
diff --git a/crates/cursor_cloud_agents/src/domain/service.rs b/crates/cursor_cloud_agents/src/domain/service.rs
index 63e0e7174b..3af02d6961 100644
--- a/crates/cursor_cloud_agents/src/domain/service.rs
+++ b/crates/cursor_cloud_agents/src/domain/service.rs
@@ -59,12 +59,54 @@ use std::collections::HashMap;
use std::path::{Path, PathBuf};
use std::sync::{Arc, Mutex};
-/// How often the fallback poll asks after a run's outcome.
+/// How often a wait that is not about the run's outcome asks again: the
+/// busy-agent queue, and a poll retried after a transport error.
const POLL_INTERVAL: std::time::Duration = std::time::Duration::from_secs(2);
-/// Polls before a turn is abandoned — fifteen minutes, comfortably past any
-/// run in the recorded corpus while still an ending.
-const POLL_ATTEMPTS: usize = 450;
+/// The fallback poll's cadence: quick at first, when a run that has just gone
+/// quiet is most likely about to end, then settling at [`POLL_INTERVAL_CEILING`].
+///
+/// Two facts from the journals set the shape. `GET /v1/agents/{id}/runs/{run}`
+/// is limited to 300 requests a minute per API key, shared by every session
+/// this deployment drives, and a two-second poll from a dozen stalled
+/// sessions was enough to draw a 429 (dev, 2026-09-19). And a run's record
+/// carries no liveness signal while it is `RUNNING` — `updatedAt` moves only
+/// on status transitions — so asking more often learns nothing sooner.
+const POLL_DELAYS: [std::time::Duration; 11] = [
+ std::time::Duration::from_secs(2),
+ std::time::Duration::from_secs(2),
+ std::time::Duration::from_secs(2),
+ std::time::Duration::from_secs(2),
+ std::time::Duration::from_secs(2),
+ std::time::Duration::from_secs(3),
+ std::time::Duration::from_secs(5),
+ std::time::Duration::from_secs(8),
+ std::time::Duration::from_secs(12),
+ std::time::Duration::from_secs(20),
+ std::time::Duration::from_secs(30),
+];
+
+/// Where the poll cadence settles: two requests a minute per waiting session.
+const POLL_INTERVAL_CEILING: std::time::Duration = std::time::Duration::from_secs(30);
+
+/// Polls before a turn stops waiting — about two hours along [`POLL_DELAYS`].
+///
+/// This is a ceiling for a run that Cursor still calls `RUNNING`, not an
+/// estimate of how long one takes. The old fifteen-minute budget was sized
+/// to a recorded corpus of short runs; live, a run that opened its pull
+/// request at 19:55 had its turn abandoned at 19:54, and every "gave up
+/// waiting" in three days of production logs was a run that was merely
+/// slow. A turn that stops waiting cannot be resumed, so the budget errs
+/// long: the chip shows the session working the whole time.
+const POLL_ATTEMPTS: usize = 250;
+
+/// How long the fallback poll sleeps before its `attempt`-th ask.
+fn poll_delay(attempt: usize) -> std::time::Duration {
+ POLL_DELAYS
+ .get(attempt)
+ .copied()
+ .unwrap_or(POLL_INTERVAL_CEILING)
+}
/// Consecutive poll failures tolerated before the turn takes the error.
const POLL_ERROR_TOLERANCE: usize = 5;
@@ -73,11 +115,29 @@ const POLL_ERROR_TOLERANCE: usize = 5;
/// final text arrives and the stream then hangs open, its terminal `result`
/// minutes behind — and the client shows a turn still "writing" long after
/// the answer is on screen. Long enough to never fire during ordinary
-/// streaming; short enough that a finished run closes its turn promptly. A
-/// still-running run (quiet tool work) just costs one status read per
-/// interval.
+/// streaming; short enough that a finished run closes its turn promptly.
const STREAM_QUIET_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(10);
+/// How long a stream that has already been found quiet waits between the
+/// next checks of its run's record. Slower than the first check on purpose:
+/// the record endpoint's rate limit is shared by every session (see
+/// [`POLL_DELAYS`]), and a run that was still going ten seconds ago is most
+/// likely still going now.
+const STREAM_QUIET_RECHECK: std::time::Duration = std::time::Duration::from_secs(30);
+
+/// Silence on an open stream before its connection is replaced.
+///
+/// Cursor does not heartbeat an open stream: the journals show runs saying
+/// nothing for many minutes while their record stays `RUNNING` — a tool call
+/// waiting on CI (`await`, `blockUntilMs: 120000`), a long build — and every
+/// reconnect in that window resumed zero records. So silence on a run the
+/// record still calls live is the agent working, and the connection is
+/// kept. Only silence this long buys a fresh connection, as insurance
+/// against a socket that died without saying so, and it costs nothing
+/// from the reconnect budget: that budget is for a transport that is
+/// failing, and this one merely has nothing to say.
+const STREAM_SILENCE_BEFORE_RECONNECT: std::time::Duration = std::time::Duration::from_secs(120);
+
/// Backoff before each reconnect of an interrupted stream.
///
/// Observed twice in production: the SSE body fails mid-run during a long tool
@@ -156,6 +216,25 @@ async fn sleep_unless_cancelled(
}
}
+/// Why a stream connection ended without the run's outcome.
+struct Interruption {
+ reason: String,
+ /// Whether a fresh connection could still deliver the run.
+ recoverable: bool,
+ /// The connection was replaced for saying nothing, not for failing.
+ quiet: bool,
+}
+
+impl Interruption {
+ fn failed(reason: String) -> Self {
+ Self {
+ reason,
+ recoverable: true,
+ quiet: false,
+ }
+ }
+}
+
/// The run's content records already durable in this session's journal.
///
/// What a stream read from the beginning is reconciled against: every record
@@ -1293,8 +1372,12 @@ where
}
// Past the retention window there is no stream left to resume,
// so the run record is the only remaining account of the run.
- Err(StreamConnectError::Expired(detail)) => Some((detail, false)),
- Err(error) => Some((error.to_string(), true)),
+ Err(StreamConnectError::Expired(detail)) => Some(Interruption {
+ reason: detail,
+ recoverable: false,
+ quiet: false,
+ }),
+ Err(error) => Some(Interruption::failed(error.to_string())),
Ok(connected) => {
let resumed = resuming.is_some();
ever_connected = true;
@@ -1304,20 +1387,31 @@ where
let mut received = 0usize;
let mut received_content = 0usize;
let mut sticky_status_pending = resumed;
+ // How long this connection has said nothing, across the
+ // record checks that found its run still going.
+ let mut silence = std::time::Duration::ZERO;
let interruption = loop {
- let record = match tokio::time::timeout(
- STREAM_QUIET_TIMEOUT,
- records.next(),
- )
- .await
+ let quiet_timeout = if silence.is_zero() {
+ STREAM_QUIET_TIMEOUT
+ } else {
+ STREAM_QUIET_RECHECK
+ };
+ let record = match tokio::time::timeout(quiet_timeout, records.next()).await
{
- Ok(Some(Ok(record))) => record,
- Ok(Some(Err(error))) => break Some((error.to_string(), true)),
+ Ok(Some(Ok(record))) => {
+ silence = std::time::Duration::ZERO;
+ record
+ }
+ Ok(Some(Err(error))) => {
+ break Some(Interruption::failed(error.to_string()));
+ }
// Cursor closes the stream after `done`, which
// breaks below with an outcome. Reaching here
// without one is a close mid-run.
Ok(None) if terminal.is_some() => break None,
- Ok(None) => break Some(("stream closed".to_owned(), true)),
+ Ok(None) => {
+ break Some(Interruption::failed("stream closed".to_owned()));
+ }
Err(_) if strict => break None,
Err(_) => {
// Quiet streams are checked through the exact same raw
@@ -1332,17 +1426,18 @@ where
if cancel.is_cancelled() {
break None;
}
- // Cursor heartbeats an open stream, so a
- // gap this long on a run that has not
- // ended is a connection that stopped
- // delivering rather than an agent thinking.
- break Some((
- format!(
- "no records for {} seconds",
- STREAM_QUIET_TIMEOUT.as_secs()
- ),
- true,
- ));
+ silence += quiet_timeout;
+ if silence < STREAM_SILENCE_BEFORE_RECONNECT {
+ // The run is going and the connection is
+ // open: an agent at work, not a stream
+ // that stopped delivering.
+ continue;
+ }
+ break Some(Interruption {
+ reason: format!("no records for {} seconds", silence.as_secs()),
+ recoverable: true,
+ quiet: true,
+ });
}
};
if let Some(id) = &record.id {
@@ -1451,7 +1546,12 @@ where
interruption
}
};
- let Some((reason, recoverable)) = interruption else {
+ let Some(Interruption {
+ reason,
+ recoverable,
+ quiet,
+ }) = interruption
+ else {
break;
};
fell_back_to_poll = true;
@@ -1488,7 +1588,11 @@ where
.await?;
// Hydration verifies the whole captured prefix against a stream it
// reads from the beginning, which a resumed stream cannot offer.
- let resumable = recoverable && !strict && attempt <= STREAM_RECONNECT_ATTEMPTS as u32;
+ // A connection replaced for silence alone spends nothing: the
+ // budget rations a transport that is failing, and this one is
+ // still the only thing that can deliver the run live.
+ let resumable =
+ recoverable && !strict && (quiet || attempt <= STREAM_RECONNECT_ATTEMPTS as u32);
if !resumable {
tracing::warn!(
cursor.run.id = %run,
@@ -1511,7 +1615,9 @@ where
if sleep_unless_cancelled(cancel, delay).await {
break;
}
- reconnects = attempt;
+ if !quiet {
+ reconnects = attempt;
+ }
resume_from = last_event_id.clone();
fell_back_to_poll = false;
}
@@ -1558,7 +1664,7 @@ where
return Err(error);
}
}
- sleep_unless_cancelled(cancel, POLL_INTERVAL).await;
+ sleep_unless_cancelled(cancel, poll_delay(attempt)).await;
}
}
let Some(status) = terminal else {
@@ -1572,8 +1678,10 @@ where
"gave up waiting; Cursor still reports a non-terminal status"
);
return Err(SessionError::Rejected(
- "Cursor has not reported a result for this run, and has stopped saying \
- anything about it. Prompting again starts fresh and abandons this run."
+ "Cursor has been working on this for over two hours and Macro stopped \
+ waiting. Send another message to continue: if Cursor has finished by \
+ then, that message picks up what it did, and if not, the run is \
+ cancelled and the conversation starts fresh from there."
.into(),
));
};
@@ -1617,7 +1725,7 @@ where
/// heartbeat a Cursor turn has, and a turn that stops polling is the
/// first evidence that something took it down.
///
- /// `debug` because the loop runs every [`POLL_INTERVAL`]; the turn span
+ /// `debug` because the loop runs as often as [`POLL_DELAYS`] says; the turn span
/// above carries the outcome, this carries the liveness.
#[tracing::instrument(
name = "cursor.run.poll",
diff --git a/crates/cursor_cloud_agents/src/domain/service/test.rs b/crates/cursor_cloud_agents/src/domain/service/test.rs
index 7d5ced20f9..8ee0bdbc12 100644
--- a/crates/cursor_cloud_agents/src/domain/service/test.rs
+++ b/crates/cursor_cloud_agents/src/domain/service/test.rs
@@ -2992,9 +2992,13 @@ async fn a_run_that_never_ends_is_reported_in_words_the_prompter_can_act_on() {
"leaked source location: {message}"
);
assert!(
- message.contains("has not reported a result"),
+ message.contains("stopped waiting"),
"must say what actually happened: {message}"
);
+ assert!(
+ message.contains("Send another message"),
+ "must say what to do about it: {message}"
+ );
}
/// The turn gave up, but the journal still has to record that it did - the
@@ -3461,13 +3465,14 @@ async fn a_rejected_resume_position_reconnects_once_without_one() {
);
}
-/// Cursor heartbeats an open stream, so a long gap on a run that has not
-/// ended is a connection that stopped delivering. The run record still gets
-/// its check — that is what closes a turn whose stream hangs after the answer
-/// — but a still-running run gets a fresh connection rather than a stream that
-/// has gone silent.
+/// Cursor does not heartbeat an open stream, and a run at work says nothing
+/// for minutes at a time - a tool call waiting on CI, a long build. Seen
+/// live: a run that opened its pull request a minute after its turn had
+/// given up, having spent its whole reconnect budget in the first minute of
+/// a silence that Cursor's own record said was fine. A quiet connection on a
+/// run still going is kept, and the record confirms the run is alive.
#[tokio::test(start_paused = true)]
-async fn a_quiet_stream_reconnects_when_the_run_is_still_going() {
+async fn a_quiet_stream_is_kept_while_the_run_is_still_going() {
let (service, cursor, notifier) = service(None);
let session = service.new_session(Path::new(""), Vec::new());
@@ -3480,31 +3485,118 @@ async fn a_quiet_stream_reconnects_when_the_run_is_still_going() {
"evt-1",
)
.expect("stream open");
- // The sender stays alive: the connection is open and says nothing.
+ // The record is asked once at the first quiet check, and says: working.
cursor.script_run_result(RunOutcome {
status: RunStatus::Running,
text: None,
});
- let resumed = cursor.script_stream();
- resumed
+
+ let turn = {
+ let service = Arc::clone(&service);
+ let session = session.clone();
+ tokio::spawn(async move { service.prompt(&session, "hi").await })
+ };
+ // Past the first quiet check, well short of the silence that replaces a
+ // connection: the same connection then speaks again.
+ tokio::time::sleep(STREAM_QUIET_TIMEOUT + std::time::Duration::from_secs(5)).await;
+ quiet
.send(CursorEvent::Assistant {
text: " done".to_owned(),
})
.expect("stream open");
- resumed.send(finished("run-fake-1")).expect("stream open");
- resumed.send(CursorEvent::Done).expect("stream open");
- drop(resumed);
+ quiet.send(finished("run-fake-1")).expect("stream open");
+ quiet.send(CursorEvent::Done).expect("stream open");
+ drop(quiet);
+
+ let stop = turn
+ .await
+ .expect("the turn task completes")
+ .expect("the same stream finishes the turn");
+ assert_eq!(stop, StopReason::EndTurn);
+ assert_eq!(
+ cursor.resume_positions(),
+ vec![None],
+ "a connection that is merely quiet is not replaced"
+ );
+ assert_eq!(agent_texts(&notifier.updates()), vec!["thinking", " done"]);
+}
+
+/// Silence long enough does buy a fresh connection - insurance against a
+/// socket that died without saying so - but it never spends the reconnect
+/// budget, which rations a transport that is failing. A run that is quiet
+/// for far longer than the budget would allow of failures still streams.
+#[tokio::test(start_paused = true)]
+async fn a_long_silence_reconnects_without_spending_the_reconnect_budget() {
+ let (service, cursor, notifier) = service(None);
+ let session = service.new_session(Path::new(""), Vec::new());
+
+ // Record checks per silent connection before it is replaced: the first
+ // at the quiet timeout, then every recheck until the silence is long.
+ let checks_per_silence = {
+ let mut silence = STREAM_QUIET_TIMEOUT;
+ let mut checks = 1;
+ while silence < STREAM_SILENCE_BEFORE_RECONNECT {
+ silence += STREAM_QUIET_RECHECK;
+ checks += 1;
+ }
+ checks
+ };
+ // More silent connections in a row than the reconnect budget allows of
+ // failing ones. Each is held open (the sender kept) and says nothing.
+ let silent_connections = STREAM_RECONNECT_ATTEMPTS + 2;
+ let mut held = Vec::new();
+ let first = cursor.script_stream();
+ first
+ .send_with_id(
+ CursorEvent::Assistant {
+ text: "thinking".to_owned(),
+ },
+ "evt-1",
+ )
+ .expect("stream open");
+ held.push(first);
+ for _ in 0..checks_per_silence {
+ cursor.script_run_result(RunOutcome {
+ status: RunStatus::Running,
+ text: None,
+ });
+ }
+ for _ in 1..silent_connections {
+ held.push(cursor.script_stream());
+ for _ in 0..checks_per_silence {
+ cursor.script_run_result(RunOutcome {
+ status: RunStatus::Running,
+ text: None,
+ });
+ }
+ }
+ let speaking = cursor.script_stream();
+ speaking
+ .send(CursorEvent::Assistant {
+ text: " done".to_owned(),
+ })
+ .expect("stream open");
+ speaking.send(finished("run-fake-1")).expect("stream open");
+ speaking.send(CursorEvent::Done).expect("stream open");
+ drop(speaking);
let stop = service
.prompt(&session, "hi")
.await
- .expect("the reconnect finishes the turn");
+ .expect("the run is still streamed after a long silence");
assert_eq!(stop, StopReason::EndTurn);
- drop(quiet);
+ drop(held);
+ let positions = cursor.resume_positions();
assert_eq!(
- cursor.resume_positions(),
- vec![None, Some("evt-1".to_owned())],
- "the quiet connection is replaced, not merely polled around"
+ positions.len(),
+ silent_connections + 1,
+ "every silent connection was replaced, past the failure budget: {positions:?}"
+ );
+ assert!(
+ positions[1..]
+ .iter()
+ .all(|position| position.as_deref() == Some("evt-1")),
+ "each replacement resumes from the last record heard: {positions:?}"
);
assert_eq!(agent_texts(&notifier.updates()), vec!["thinking", " done"]);
}
diff --git a/services/lexical-service/src/endpoints/agent-announcement.test.ts b/services/lexical-service/src/endpoints/agent-announcement.test.ts
index c2757d2997..473a52afd6 100644
--- a/services/lexical-service/src/endpoints/agent-announcement.test.ts
+++ b/services/lexical-service/src/endpoints/agent-announcement.test.ts
@@ -1,5 +1,6 @@
import '../polyfills/prism';
import { describe, expect, it } from 'bun:test';
+import { readReplyTargetData } from '@macro-inc/lexical-core/nodes/ReplyTargetNode';
import { fromHono } from 'chanfana';
import { Hono } from 'hono';
import { AgentAnnouncementEndpoint } from './agent-announcement';
@@ -27,25 +28,49 @@ describe('agent announcements', () => {
'`@claude` Connect Claude, then mention me again. <m-connect-app>{"appSlug":"claude-cloud","name":"Claude","target":"harness"}</m-connect-app>',
});
});
- it('still accepts existing session announcements', async () => {
- const chip = {
- agentSessionId: 'session',
- promptedMessage: { turn: 0, author: 'user' },
- status: 'booting',
- };
+ const chip = {
+ agentSessionId: 'session',
+ promptedMessage: { turn: 0, author: 'user' },
+ status: 'booting',
+ };
+ const replyTarget = {
+ targetMessageId: 'message',
+ targetThreadId: 'thread',
+ displayText: 'hello',
+ senderId: 'user',
+ };
+ /** The reply target exactly as the editor's parser reads it back. */
+ const parsedReplyTarget = (markdown: string) => {
+ const match = markdown.match(/^<m-reply-target>(.*?)<\/m-reply-target>/s);
+ if (!match?.[1]) throw new Error(`no reply target in ${markdown}`);
+ return readReplyTargetData(JSON.parse(match[1]));
+ };
+ it('announces under the parent the reply lives in', async () => {
+ const parent = { type: 'document' as const, id: 'doc' };
const response = await request({
- replyTarget: {
- parent: { type: 'document', id: 'doc' },
- targetMessageId: 'message',
- targetThreadId: 'thread',
- displayText: 'hello',
- senderId: 'user',
- },
+ replyTarget: { parent, ...replyTarget },
chip,
});
expect(response.status).toBe(200);
- expect(await response.json<{ markdown: string }>()).toEqual({
- markdown: `<m-magic-chip>${JSON.stringify(chip)}</m-magic-chip>`,
+ const { markdown } = await response.json<{ markdown: string }>();
+ // Shipped broken once: the endpoint built the node from a `channelId`
+ // the node no longer had, and every announcement rendered as an
+ // unknown reply target. The parser, not the string, is the oracle.
+ expect(parsedReplyTarget(markdown)).toEqual({ parent, ...replyTarget });
+ expect(markdown).toEndWith(
+ `<m-magic-chip>${JSON.stringify(chip)}</m-magic-chip>`
+ );
+ });
+ it('still accepts a channel named the way callers used to', async () => {
+ const response = await request({
+ replyTarget: { channelId: 'chan', ...replyTarget },
+ chip,
+ });
+ expect(response.status).toBe(200);
+ const { markdown } = await response.json<{ markdown: string }>();
+ expect(parsedReplyTarget(markdown)).toEqual({
+ parent: { type: 'channel', id: 'chan' },
+ ...replyTarget,
});
});
it('rejects an unknown connection destination', async () => {
diff --git a/services/lexical-service/src/endpoints/agent-announcement.ts b/services/lexical-service/src/endpoints/agent-announcement.ts
index b4f3576949..6b1126ff41 100644
--- a/services/lexical-service/src/endpoints/agent-announcement.ts
+++ b/services/lexical-service/src/endpoints/agent-announcement.ts
@@ -3,6 +3,7 @@ import {
MAGIC_CHIP_AUTHORS,
MAGIC_CHIP_STATUSES,
} from '@macro-inc/lexical-core/nodes/MagicChipNode';
+import type { ReplyTargetParent } from '@macro-inc/lexical-core/nodes/ReplyTargetNode';
import { composeAgentSessionAnnouncement } from '@macro-inc/lexical-core/utils/agent-announcement';
import { composeAgentConnectionPrompt } from '@macro-inc/lexical-core/utils/agent-connection-prompt';
import { OpenAPIRoute } from 'chanfana';
@@ -100,13 +101,14 @@ export class AgentAnnouncementEndpoint extends OpenAPIRoute {
});
}
const { parent, channelId, ...target } = body.replyTarget;
- // The reply-target node still references channels only; a document
- // discussion announces with the chip alone until the node learns
- // message parents.
- const channel =
- channelId ?? (parent?.type === 'channel' ? parent.id : undefined);
+ // Callers that predate message parents send only `channelId`; the
+ // node itself references any parent the reply lives under.
+ const replyParent: ReplyTargetParent | undefined =
+ parent ?? (channelId ? { type: 'channel', id: channelId } : undefined);
const markdown = composeAgentSessionAnnouncement({
- replyTarget: channel ? { ...target, channelId: channel } : undefined,
+ replyTarget: replyParent
+ ? { ...target, parent: replyParent }
+ : undefined,
chip: body.chip,
});
return c.json({ markdown });
diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main.rs b/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main.rs
index 9896ca5330..9a35135020 100644
--- a/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main.rs
+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main.rs
@@ -81,6 +81,7 @@ fn typescript() -> Job {
.add_step(show_sccache_stats())
.add_step(check_types())
.add_step(check_collaboration_types())
+ .add_step(check_lexical_service_types())
.add_step(steps::teardown_nix())
}
@@ -219,6 +220,12 @@ fn check_collaboration_types() -> Step<Run> {
.working_directory(xtask_paths::repo_dir!("packages/collaboration"))
}
+fn check_lexical_service_types() -> Step<Run> {
+ Step::new("Check Lexical Service Types")
+ .run("bun run check")
+ .working_directory(xtask_paths::repo_dir!("services/lexical-service"))
+}
+
fn run_biome() -> Step<Run> {
Step::new("Run Biome")
.run("biome ci --changed --no-errors-on-unmatched --error-on-warnings")