Skip message-board notification previews when there are no recipients (#48072)

## What changed

Return post metadata from the in-memory message board after updating board state when no notification recipients remain. This avoids constructing an unused notification preview, including when the author is the only requested recipient.

## Testing

Run the existing post-and-search model-context scenario against both disk and in-memory message boards, checking that post metadata and search results reach the model without self-notifications.

GitOrigin-RevId: dcf07a5fd55738fbcd6edd3dce3f6fb8fc910eaf
This commit is contained in:
jif
2026-09-25 11:42:44 +00:00
committed by copyberry
parent 69fa3881cb
commit ca60d6fa72
2 changed files with 10 additions and 2 deletions
@@ -131,8 +131,12 @@ async fn board_requires_persistent_v2_runtime(
Ok(())
}
#[test_case::test_case(false; "disk")]
#[test_case::test_case(true; "in_memory")]
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn board_post_and_reads_reach_model_context_without_self_notices() -> anyhow::Result<()> {
async fn board_post_and_reads_reach_model_context_without_self_notices(
in_memory: bool,
) -> anyhow::Result<()> {
let server = responses::start_mock_server().await;
let mock = responses::mount_sse_sequence(&server, vec![
tool("post-decision", "post", json!({"new_channel_name":"design", "text":"A shared decision.", "agents_to_notify":["/root"]})),
@@ -140,8 +144,9 @@ async fn board_post_and_reads_reach_model_context_without_self_notices() -> anyh
done(),
]).await;
let test = test_codex()
.with_config(|config| {
.with_config(move |config| {
configure(config);
config.multi_agent_v2.message_board_in_memory = in_memory;
config.current_time_reminder = Some(codex_core::config::CurrentTimeReminderConfig {
clock_source: codex_features::CurrentTimeSource::External,
..Default::default()
@@ -326,6 +326,9 @@ impl InMemoryAgentMessageBoard {
}
}
state.subscribe(SubscriptionTarget::Thread(root), caller);
if recipients.is_empty() {
return Ok(metadata);
}
(metadata, state.posts[index].preview(/*max_chars*/ 150))
};
futures::stream::iter(recipients).for_each_concurrent(/*limit*/ 16, |recipient| {