fix(#1940): carry pr_number on the live approval_added event

This commit is contained in:
damocles 2026-06-23 15:11:28 +02:00 committed by mara
commit 4c53898382
4 changed files with 74 additions and 31 deletions

View file

@ -1438,14 +1438,15 @@ fn handle_request_update_meta_inputs(
}
};
tracing::info!(%id, %label, "update_meta_inputs approval queued");
coord.emit_approval_added(
coord.emit_approval_added(crate::coordinator::ApprovalAdded {
id,
requester,
"update_meta_inputs",
None,
None,
description.map(str::to_owned),
);
agent: requester,
approval_kind: "update_meta_inputs",
sha_short: None,
diff: None,
description: description.map(str::to_owned),
pr_number: None,
});
AgentResponse::Ok
}
@ -1542,14 +1543,15 @@ fn handle_request_schedule_prompt(
interval = ?payload.interval_seconds,
"schedule_prompt approval queued"
);
coord.emit_approval_added(
coord.emit_approval_added(crate::coordinator::ApprovalAdded {
id,
requester,
"schedule_prompt",
None,
None,
payload.description.clone(),
);
agent: requester,
approval_kind: "schedule_prompt",
sha_short: None,
diff: None,
description: payload.description.clone(),
pr_number: None,
});
AgentResponse::Ok
}
@ -1802,7 +1804,15 @@ pub(crate) fn submit_init_config(
)
.map_err(|e| anyhow::anyhow!("queue approval row: {e:#}"))?;
tracing::info!(%id, %name, "init_config approval queued");
coord.emit_approval_added(id, name, "init_config", None, None, description);
coord.emit_approval_added(crate::coordinator::ApprovalAdded {
id,
agent: name,
approval_kind: "init_config",
sha_short: None,
diff: None,
description,
pr_number: None,
});
Ok(id)
}
@ -1928,14 +1938,15 @@ pub(crate) async fn submit_apply_commit(
// get a fully-formed row without a snapshot refetch. `sha_short`
// is reused from the dedup gate above.
let diff = crate::dashboard::approval_diff(agent, id).await;
coord.emit_approval_added(
coord.emit_approval_added(crate::coordinator::ApprovalAdded {
id,
agent,
"apply_commit",
Some(sha_short),
Some(diff),
description.map(str::to_owned),
);
approval_kind: "apply_commit",
sha_short: Some(sha_short),
diff: Some(diff),
description: description.map(str::to_owned),
pr_number: None,
});
Ok((id, sha))
}