Answer a live intervention only after it has run

The kickoff thread moved the posted task out before running it, so the
waiting command could read the outcome too early and refuse a substitution
or tactic change (without a reason) that was then applied anyway. The task
stays posted until it has finished.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Fable 5.2 committed 2026-11-14 08:21:18 +01:00
1 parent dcc572082a
commit fee03624be
1 file changed
+3 -1
+3 -1
View File
@@ -9884,7 +9884,9 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
for (;;) {
r->changed.wait(lock, [r] { return r->finish || r->remaining > 0 || bool(r->task); });
if (!r->task) break;
auto task = std::move(r->task);
// the task stays posted until it has run: the waiting command reads its outcome
// only after `task` is cleared below (a moved-from function would look done at once)
const auto task = r->task;
lock.unlock();
task();
lock.lock();