fix: filter DOM Observer Run-only pendings when step_probe already has pending

This commit is contained in:
2026-03-10 13:08:50 +09:00
parent 14d2acf6c4
commit bec38f9a6a
3 changed files with 19 additions and 13 deletions

View File

@@ -474,13 +474,16 @@ function startObserverHttpBridge() {
res.end(JSON.stringify({ ok: false, filtered: true }));
return;
}
// "Run" button → only accept if session is actually stalled (waiting for approval)
if (/^Run/i.test(cmd) && !sessionStalled) {
logToFile(`[HTTP] filtered "Run" — session not stalled`);
// "Run" button → step_probe handles these with full command detail
// Only let through if session is stalled AND step_probe hasn't created a pending yet
if (/^Run$/i.test(cmd)) {
if (!sessionStalled || lastPendingStepIndex >= 0) {
logToFile(`[HTTP] filtered "Run" — ${!sessionStalled ? 'not stalled' : 'step_probe pending exists'}`);
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ ok: false, filtered: true }));
return;
}
}
const rid = data.request_id || Date.now().toString();
// Write pending file for Discord bot
const pendingDir = path.join(bridgePath, 'pending');

File diff suppressed because one or more lines are too long

View File

@@ -453,13 +453,16 @@ function startObserverHttpBridge(): Promise<number> {
res.end(JSON.stringify({ ok: false, filtered: true }));
return;
}
// "Run" button → only accept if session is actually stalled (waiting for approval)
if (/^Run/i.test(cmd) && !sessionStalled) {
logToFile(`[HTTP] filtered "Run" — session not stalled`);
// "Run" button → step_probe handles these with full command detail
// Only let through if session is stalled AND step_probe hasn't created a pending yet
if (/^Run$/i.test(cmd)) {
if (!sessionStalled || lastPendingStepIndex >= 0) {
logToFile(`[HTTP] filtered "Run" — ${!sessionStalled ? 'not stalled' : 'step_probe pending exists'}`);
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ ok: false, filtered: true }));
return;
}
}
const rid = data.request_id || Date.now().toString();
// Write pending file for Discord bot