diff --git a/hive-ag3nt/src/forge_notify.rs b/hive-ag3nt/src/forge_notify.rs index 4c04cc0..165164d 100644 --- a/hive-ag3nt/src/forge_notify.rs +++ b/hive-ag3nt/src/forge_notify.rs @@ -155,11 +155,11 @@ fn truncate(s: &str, max: usize) -> String { /// Fetches the subject and (if present) the latest comment to include /// author and body. Falls back gracefully when API calls fail. /// -/// Format: `[kind #N] title\nurl: \n\nauthor: body` (comments) -/// `[kind #N] title\nurl: \nassignee: ` (new items) +/// Format: `[kind #N repo/name] title\nurl: \n\nauthor: body` (comments) +/// `[kind #N repo/name] title\nurl: \nassignee: ` (new items) /// /// Number is extracted from `html_url` (last path segment before any `#`). -/// `repo:` line is omitted — single-repo deployments don't benefit from the noise. +/// Repo slug (`owner/name`) is always included — agents may watch multiple repos. async fn format_notification( client: &reqwest::Client, token: &str, @@ -181,6 +181,12 @@ async fn format_notification( .map(|n| format!(" #{n}")) .unwrap_or_default(); + // Repo slug for multi-repo disambiguation. Falls back gracefully when absent. + let repo = notif["repository"]["full_name"] + .as_str() + .map(|r| format!(" {r}")) + .unwrap_or_default(); + // API URLs for fetching content let subject_api_url = notif["subject"]["url"].as_str().unwrap_or(""); let comment_api_url = notif["subject"]["latest_comment_url"].as_str().unwrap_or(""); @@ -205,7 +211,7 @@ async fn format_notification( .unwrap_or("") .trim(); - let kind = format!("comment on {}{num}", notif_type_label(notif_type)); + let kind = format!("comment on {}{num}{repo}", notif_type_label(notif_type)); let url = if comment_html_url.is_empty() { html_url } else { comment_html_url }; let mut out = format!("[{kind}] {title}\nurl: {url}\n\n{author}: {}", truncate(body, BODY_TRUNCATE)); if out.ends_with('\n') { @@ -225,10 +231,10 @@ async fn format_notification( let label = notif_type_label(notif_type); let kind = match notif_state { - "merged" => format!("{label} merged{num}"), - "closed" => format!("{label} closed{num}"), - "open" | "" => format!("new {label}{num}"), - other => format!("{label}{num}: {other}"), + "merged" => format!("{label} merged{num}{repo}"), + "closed" => format!("{label} closed{num}{repo}"), + "open" | "" => format!("new {label}{num}{repo}"), + other => format!("{label}{num}{repo}: {other}"), }; let mut out = format!("[{kind}] {title}\nurl: {html_url}");