fix: bound sentinel submit action wait

This commit is contained in:
Codex
2026-06-27 04:41:23 +00:00
parent ee784a2934
commit 76978a6160
4 changed files with 18 additions and 3 deletions
@@ -358,8 +358,9 @@ async function processCommand(command) {
alternateResponsePaths: ["/v1/agent/chat/steer"],
noActiveReason: "send-no-turn-composer",
throwOnActionMismatch: true,
expectedActionWaitMs: command.expectedActionWaitMs,
}), "sendPrompt");
case "steer": return withObserverSync(await sendPrompt(String(command.text || ""), { expectedAction: "steer", responsePath: "/v1/agent/chat/steer", noActiveReason: "steer-no-active-turn" }), "steer");
case "steer": return withObserverSync(await sendPrompt(String(command.text || ""), { expectedAction: "steer", responsePath: "/v1/agent/chat/steer", noActiveReason: "steer-no-active-turn", expectedActionWaitMs: command.expectedActionWaitMs }), "steer");
case "cancel": return withObserverSync(await cancelRunningTurn(), "cancel");
case "selectProvider": return withObserverSync(await selectProvider(String(command.provider || command.value || command.text || "")), "selectProvider");
case "clickSession": return withObserverSync(await clickSession(String(command.sessionId || command.value || "")), "clickSession");
@@ -1520,8 +1521,11 @@ async function sendPrompt(text, options = {}) {
].join(", ")).last();
await submit.waitFor({ state: "visible", timeout: 15000 });
if (options.expectedAction) {
const actionWaitMs = Number.isFinite(Number(options.expectedActionWaitMs))
? Math.max(1000, Math.trunc(Number(options.expectedActionWaitMs)))
const configuredActionWaitMs = options.expectedActionWaitMs === null || options.expectedActionWaitMs === undefined || options.expectedActionWaitMs === ""
? null
: Number(options.expectedActionWaitMs);
const actionWaitMs = Number.isFinite(configuredActionWaitMs)
? Math.max(1000, Math.trunc(configuredActionWaitMs))
: options.expectedAction === "turn" ? 180000 : 1000;
const actionDeadline = Date.now() + actionWaitMs;
let composer = null;
@@ -3798,6 +3802,7 @@ function commandInputSummary(command) {
severity: command.severity || null,
alternateSessionStrategy: command.alternateSessionStrategy || null,
expectedSentinelRange: command.expectedSentinelRange || null,
expectedActionWaitMs: command.expectedActionWaitMs === null || command.expectedActionWaitMs === undefined || command.expectedActionWaitMs === "" ? null : Number(command.expectedActionWaitMs),
requireComposerReady: command.requireComposerReady === true,
findingId: command.findingId || null,
blocking: command.blocking === true ? true : command.blocking === false ? false : null,
@@ -2317,6 +2317,7 @@ function runSentinelQuickVerify(state: SentinelCicdState, reason: string, timeou
}
if (type === "sendPrompt") {
args.push("--text", prompts.prompts[promptIndex % prompts.prompts.length] ?? "");
args.push("--expected-action-wait-ms", String(numberAtNullable(item, "expectedActionWaitMs") ?? 45000));
promptIndex += 1;
}
appendScenarioObserveCommandArgs(args, item, { skipText: type === "sendPrompt" });
+1
View File
@@ -202,6 +202,7 @@ export interface NodeWebProbeObserveOptions {
commandSeverity: string | null;
commandAlternateSessionStrategy: string | null;
commandExpectedSentinelRange: string | null;
commandExpectedActionWaitMs: number | null;
commandRequireComposerReady: boolean;
commandFindingId: string | null;
commandBlocking: boolean | null;
@@ -259,6 +259,7 @@ export function parseNodeWebProbeObserveOptions(
"--severity",
"--alternate-session-strategy",
"--expected-sentinel-range",
"--expected-action-wait-ms",
"--finding-id",
"--source-id",
"--file-ref",
@@ -349,6 +350,11 @@ export function parseNodeWebProbeObserveOptions(
const commandSeverity = optionValue(args, "--severity") ?? null;
const commandAlternateSessionStrategy = optionValue(args, "--alternate-session-strategy") ?? null;
const commandExpectedSentinelRange = optionValue(args, "--expected-sentinel-range") ?? null;
const commandExpectedActionWaitMsRaw = optionValue(args, "--expected-action-wait-ms") ?? null;
const commandExpectedActionWaitMs = commandExpectedActionWaitMsRaw === null ? null : Number(commandExpectedActionWaitMsRaw);
if (commandExpectedActionWaitMs !== null && (!Number.isInteger(commandExpectedActionWaitMs) || commandExpectedActionWaitMs < 1000 || commandExpectedActionWaitMs > 600000)) {
throw new Error("unsafe web-probe observe --expected-action-wait-ms: expected integer 1000-600000");
}
const commandFindingId = optionValue(args, "--finding-id") ?? null;
const commandBlocking = args.includes("--blocking") ? true : args.includes("--non-blocking") ? false : null;
for (const [label, value] of [
@@ -422,6 +428,7 @@ export function parseNodeWebProbeObserveOptions(
commandSeverity,
commandAlternateSessionStrategy,
commandExpectedSentinelRange,
commandExpectedActionWaitMs,
commandRequireComposerReady: args.includes("--require-composer-ready"),
commandFindingId,
commandBlocking,
@@ -1492,6 +1499,7 @@ export function runNodeWebProbeObserveCommand(options: NodeWebProbeObserveOption
severity: options.commandSeverity,
alternateSessionStrategy: options.commandAlternateSessionStrategy,
expectedSentinelRange: options.commandExpectedSentinelRange,
expectedActionWaitMs: options.commandExpectedActionWaitMs,
requireComposerReady: options.commandRequireComposerReady,
findingId: options.commandFindingId,
blocking: options.commandBlocking,