race the subconscious peek against cancel
mid_turn_peek was a bare await while the model call three hundred lines up was already guarded, so a subconscious that never answered parked the turn somewhere /cancel could not reach it — twenty minutes, measured 2026-08-15, on a provider whose key was spent.
This commit is contained in:
parent
e485b91c14
commit
4662fa1c58
1 changed files with 15 additions and 6 deletions
|
|
@ -783,17 +783,26 @@ pub(crate) async fn run_turn(
|
|||
}
|
||||
};
|
||||
|
||||
match server
|
||||
.consciousness
|
||||
.mid_turn_peek(
|
||||
// Race the peek against cancellation, same as the model call above.
|
||||
// Without this a subconscious that never answers parks the whole
|
||||
// turn past the reach of /cancel — measured 2026-08-15, twenty
|
||||
// minutes on a provider whose key was spent.
|
||||
let peek = tokio::select! {
|
||||
biased;
|
||||
_ = cancel.cancelled() => {
|
||||
interrupted = true;
|
||||
break;
|
||||
}
|
||||
res = server.consciousness.mid_turn_peek(
|
||||
&agent_id,
|
||||
&user_message,
|
||||
tool_round,
|
||||
in_flight_summary,
|
||||
Some(tx),
|
||||
)
|
||||
.await
|
||||
{
|
||||
) => res,
|
||||
};
|
||||
|
||||
match peek {
|
||||
Ok(outcome) => {
|
||||
// Critical-urgency intrusive thoughts surface this turn
|
||||
// — the primary feels them as surfacings in her own
|
||||
|
|
|
|||
Loading…
Reference in a new issue