fix(#2635): close review nits on the questions mirror (inc2 pt2)

This commit is contained in:
damocles 2026-07-23 22:01:27 +02:00 committed by mara
commit 7b2645078a
3 changed files with 51 additions and 30 deletions

View file

@ -242,9 +242,22 @@ impl AgentServer {
answer: args.answer,
})
.await;
if resp.is_ok() {
// Best-effort — this agent is done owing a reply for `id`;
// drop its `answering` mirror row.
// Clear the local `answering` mirror row whenever this agent is
// done owing a reply for `id`: either a genuine success, or
// c0re telling us the question already resolved without us
// (the asker cancelled/answered it first, surfacing as an
// "already answered"/"not found" rejection) — in both cases
// nothing is still owed, so the row would otherwise linger
// stale. Any other rejection (e.g. wrong answerer) means the
// question is still genuinely outstanding, so leave it be.
let should_clear = match &resp {
Ok(hive_core_agent_sock::Response::Ok) => true,
Ok(hive_core_agent_sock::Response::Err { message }) => {
message.contains("not found") || message.contains("already answered")
}
_ => false,
};
if should_clear {
let _ = dial_agent_socket(&hive_agent_sock::Request::ClearQuestion { id }).await;
}
annotate_retries(