Register a prompt's pending answer before announcing it
CI / UI screenshots (before/after) (push) Skipped
CI / Lint (eslint) (pull_request) Successful in 51s
CI / Security (npm audit) (pull_request) Successful in 51s
CI / Integration (api) (pull_request) Successful in 3m51s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 3m35s
CI / Test (jest) (push) Successful in 1m41s
CI / Scan (secrets, workflows, shell) (push) Successful in 2m57s
CI / Test (jest) (pull_request) Successful in 48s
CI / UI (playwright) (pull_request) Failing after 11m39s
CI / Lint (eslint) (push) Successful in 40s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / UI screenshots (before/after) (pull_request) Successful in 35s
CI / Notify (pull_request) Skipped
CI / Security (npm audit) (push) Successful in 52s
CI / Integration (api) (push) Successful in 3m6s
CI / UI (playwright) (push) Successful in 2m18s
CI / Deploy (push) Skipped
CI / Deploy worker (push) Skipped
CI / Notify (push) Skipped

An answer arriving between the 'prompt' log entry and the registration got
'No pending prompt' (404); CI hit it under load on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jaredandClaude Opus 5.5 committed 2026-11-23 00:36:22 -05:00
1 parent 986791ae20
commit b5af336338
1 file changed
+20 -15
+20 -15
View File
@@ -1180,23 +1180,13 @@ async function executePromptStep(executionId, step, stepNumber, deadline = Infin
// Include the last command output so the user can review results alongside the question
const lastOutput = (execState?.state?._lastCommandOutput) || null;
const logEntry = {
step: stepNumber, step_name: step.name, action: 'prompt',
message, options, timestamp: new Date().toISOString()
};
if (lastOutput) logEntry.output = lastOutput;
await addExecutionLog(executionId, logEntry);
broadcast({
type: 'execution_prompt',
execution_id: executionId,
prompt: { message, options, step: stepNumber, step_name: step.name, output: lastOutput || undefined }
});
return new Promise(resolve => {
// Register the pending answer before announcing the prompt: an answer that arrived
// between the log entry and the registration used to get "No pending prompt" (404).
let timer;
const answered = new Promise(resolve => {
// Never wait past the execution's own deadline (#21).
const ms = Math.max(0, Math.min(PROMPT_TIMEOUT_EFFECTIVE_MS, deadline - Date.now()));
const timer = setTimeout(() => {
timer = setTimeout(() => {
_executionPrompts.delete(executionId);
console.warn(`[Workflow] Prompt timed out for execution ${executionId}`);
resolve(PROMPT_TIMED_OUT);
@@ -1211,6 +1201,21 @@ async function executePromptStep(executionId, step, stepNumber, deadline = Infin
options
});
});
const logEntry = {
step: stepNumber, step_name: step.name, action: 'prompt',
message, options, timestamp: new Date().toISOString()
};
if (lastOutput) logEntry.output = lastOutput;
await addExecutionLog(executionId, logEntry);
broadcast({
type: 'execution_prompt',
execution_id: executionId,
prompt: { message, options, step: stepNumber, step_name: step.name, output: lastOutput || undefined }
});
return answered;
}
async function executeCommandStep(executionId, step, stepNumber, params = {}) {