fix(#2469): supersede stale config-PR approval on PR update instead of skipping
This commit is contained in:
parent
d8567fc546
commit
152d54dcdc
3 changed files with 54 additions and 39 deletions
|
|
@ -93,32 +93,12 @@ pub async fn poll_open_config_prs(core_token: &str, coord: &Arc<Coordinator>) ->
|
|||
};
|
||||
open_prs.insert((agent.to_owned(), pr_number));
|
||||
|
||||
// Skip if a pending approval already exists for this PR.
|
||||
match coord
|
||||
.approvals
|
||||
.has_pending_merge_config_pr(agent, pr_number)
|
||||
{
|
||||
Ok(true) => {
|
||||
tracing::debug!(
|
||||
%agent, %pr_number,
|
||||
"config-pr poll: approval already pending, skipping"
|
||||
);
|
||||
continue;
|
||||
}
|
||||
Ok(false) => {}
|
||||
Err(e) => {
|
||||
tracing::warn!(
|
||||
%agent, %pr_number, error = ?e,
|
||||
"config-pr poll: DB check failed, skipping"
|
||||
);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
tracing::info!(
|
||||
%agent, %pr_number,
|
||||
"config-pr poll: queuing missed MergeConfigPr approval"
|
||||
);
|
||||
// `submit_merge_config_pr` is idempotent + PR-drift aware: it
|
||||
// no-ops when an approval pinned to this PR's *current* head is
|
||||
// already pending, and cancels+re-queues when the head has drifted.
|
||||
// So the poll can call it unconditionally — it backstops both a
|
||||
// missed `opened` webhook (no approval yet) and a missed
|
||||
// `synchronize` (stale approval whose head moved).
|
||||
let description = format!("PR #{pr_number} on {CONFIG_ORG}/{agent} (poll fallback)");
|
||||
if let Err(e) = crate::socket_server::submit_merge_config_pr(
|
||||
coord,
|
||||
|
|
@ -131,7 +111,7 @@ pub async fn poll_open_config_prs(core_token: &str, coord: &Arc<Coordinator>) ->
|
|||
{
|
||||
tracing::warn!(
|
||||
%agent, %pr_number, error = ?e,
|
||||
"config-pr poll: failed to queue MergeConfigPr approval"
|
||||
"config-pr poll: failed to reconcile MergeConfigPr approval"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue