@atolis-hq/wake 0.3.98 → 0.3.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/activities/agent/agent-activity.js +4 -2
- package/dist/src/bootstrap/initialise.js +6 -6
- package/dist/src/bootstrap/runner-registry.js +1 -1
- package/dist/src/bootstrap/version.js +1 -1
- package/dist/src/execution/application/execution-activity.js +11 -0
- package/dist/src/execution/contracts/config.js +8 -1
- package/dist/src/execution/contracts/vocabulary.js +1 -0
- package/dist/src/execution/infrastructure/process-execution.js +113 -30
- package/dist/src/execution/infrastructure/runners/claude.js +20 -4
- package/dist/src/execution/infrastructure/runners/codex.js +1 -1
- package/dist/src/execution/infrastructure/runners/command.js +2 -2
- package/dist/src/execution/infrastructure/runners/cursor.js +1 -1
- package/dist/src/execution/infrastructure/workspace/prepare-workspace.js +1 -1
- package/dist/src/integrations/github/application/inbound-comment-syntax.js +13 -5
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ export function createAgentActivity(templates, contextReader) {
|
|
|
12
12
|
resumeStartedAt: context.resumeStartedAt,
|
|
13
13
|
usageBaseline: context.usageBaseline,
|
|
14
14
|
workspace: context.workspace,
|
|
15
|
+
reportRunnerTimeout: context.reportRunnerTimeout,
|
|
15
16
|
});
|
|
16
17
|
await capturePrompt(context, invocation.workItemId, request);
|
|
17
18
|
const result = await runnerResult(context, invocation.workItemId, request);
|
|
@@ -76,7 +77,7 @@ async function recordTranscript(context, write) {
|
|
|
76
77
|
async function agentRequest(invocation, templates, contextReader, context) {
|
|
77
78
|
const input = invocation.input;
|
|
78
79
|
const template = await resolveTemplate(input.template, invocation.workItemId, templates, contextReader, context.resumeSessionId !== undefined, context.resumeStartedAt);
|
|
79
|
-
return requestFrom(input, context.runId ?? invocation.activationId, template, context.runnerContext, context.resumeSessionId, context.usageBaseline, context.workspace);
|
|
80
|
+
return requestFrom(input, context.runId ?? invocation.activationId, template, context.runnerContext, context.resumeSessionId, context.usageBaseline, context.workspace, context.reportRunnerTimeout);
|
|
80
81
|
}
|
|
81
82
|
async function resolveTemplate(name, workItemId, templates, contextReader, isResume, observedSince) {
|
|
82
83
|
if (name === undefined)
|
|
@@ -132,7 +133,7 @@ function escapeUntrustedJson(json) {
|
|
|
132
133
|
}
|
|
133
134
|
// The runner request maps each independently optional execution concern.
|
|
134
135
|
// eslint-disable-next-line max-params, complexity
|
|
135
|
-
function requestFrom(input, runId, template, runnerContext, resumeSessionId, usageBaseline, workspace) {
|
|
136
|
+
function requestFrom(input, runId, template, runnerContext, resumeSessionId, usageBaseline, workspace, reportRunnerTimeout) {
|
|
136
137
|
return {
|
|
137
138
|
runId,
|
|
138
139
|
prompt: input.prompt ?? template.prompt,
|
|
@@ -144,6 +145,7 @@ function requestFrom(input, runId, template, runnerContext, resumeSessionId, usa
|
|
|
144
145
|
...(resumeSessionId === undefined ? {} : { resumeSessionId }),
|
|
145
146
|
...(usageBaseline === undefined ? {} : { usageBaseline }),
|
|
146
147
|
...workspaceFields(workspace),
|
|
148
|
+
...(reportRunnerTimeout === undefined ? {} : { onTimeout: reportRunnerTimeout }),
|
|
147
149
|
};
|
|
148
150
|
}
|
|
149
151
|
function workspaceFields(workspace) {
|
|
@@ -22,12 +22,12 @@ function configYaml(containerName) {
|
|
|
22
22
|
execution:
|
|
23
23
|
agentRunners:
|
|
24
24
|
fake: { kind: fake }
|
|
25
|
-
claude-haiku: { kind: claude-cli, command: claude, model: haiku
|
|
26
|
-
claude-opus: { kind: claude-cli, command: claude, model: claude-opus-4-8
|
|
27
|
-
codex-luna: { kind: codex-cli, command: codex, model: gpt-5.6-luna
|
|
28
|
-
codex-terra: { kind: codex-cli, command: codex, model: gpt-5.6-terra
|
|
29
|
-
codex-sol: { kind: codex-cli, command: codex, model: gpt-5.6-sol
|
|
30
|
-
cursor-composer: { kind: cursor-cli, command: cursor, model: composer-2.5
|
|
25
|
+
claude-haiku: { kind: claude-cli, command: claude, model: haiku }
|
|
26
|
+
claude-opus: { kind: claude-cli, command: claude, model: claude-opus-4-8 }
|
|
27
|
+
codex-luna: { kind: codex-cli, command: codex, model: gpt-5.6-luna }
|
|
28
|
+
codex-terra: { kind: codex-cli, command: codex, model: gpt-5.6-terra }
|
|
29
|
+
codex-sol: { kind: codex-cli, command: codex, model: gpt-5.6-sol }
|
|
30
|
+
cursor-composer: { kind: cursor-cli, command: cursor, model: composer-2.5 }
|
|
31
31
|
runnerPools:
|
|
32
32
|
light: [fake]
|
|
33
33
|
standard: [fake]
|
|
@@ -24,7 +24,7 @@ function createConfiguredRunner(name, runner, scenarios) {
|
|
|
24
24
|
case 'command': {
|
|
25
25
|
if (runner.command === undefined)
|
|
26
26
|
throw new Error('Command runner requires a command');
|
|
27
|
-
return createCommandRunner(runner.command, runner.args, runner.
|
|
27
|
+
return createCommandRunner(runner.command, runner.args, runner.runnerTimeouts);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { ExecutionEventType } from '../contracts/events.js';
|
|
2
2
|
import { ProviderQuotaExceededFailureKind } from '../contracts/runner.js';
|
|
3
|
+
import { ExecutionCancellationReason } from '../contracts/vocabulary.js';
|
|
3
4
|
import { parseAgentRunnerResponse } from '../infrastructure/agent-runner-adapter.js';
|
|
4
5
|
import { createRunEvent } from './run-lifecycle.js';
|
|
6
|
+
import { confirmCancellation, requestCancellation } from './run-liveness-service.js';
|
|
5
7
|
export async function executeActivity(runtime, currentRunId, request) {
|
|
6
8
|
const { activation, context, occurredAt, runner } = request;
|
|
7
9
|
const controller = new AbortController();
|
|
@@ -37,6 +39,7 @@ export async function executeActivity(runtime, currentRunId, request) {
|
|
|
37
39
|
}),
|
|
38
40
|
reportExternalExecution: externalExecutionReporter(runtime, currentRunId, context, activation),
|
|
39
41
|
reportRunnerResult: runnerResultReporter(runtime, currentRunId, context, activation, request),
|
|
42
|
+
reportRunnerTimeout: runnerTimeoutReporter(runtime, currentRunId),
|
|
40
43
|
};
|
|
41
44
|
return runtime.activities.execute({
|
|
42
45
|
activationId: activation.activationId,
|
|
@@ -49,6 +52,14 @@ export async function executeActivity(runtime, currentRunId, request) {
|
|
|
49
52
|
resources: context.resources,
|
|
50
53
|
}, executionContext);
|
|
51
54
|
}
|
|
55
|
+
function runnerTimeoutReporter(runtime, currentRunId) {
|
|
56
|
+
return async (kind) => {
|
|
57
|
+
await requestCancellation(runtime.repository, runtime.dependencies.clock, currentRunId, kind === 'idle'
|
|
58
|
+
? ExecutionCancellationReason.IdleTimeout
|
|
59
|
+
: ExecutionCancellationReason.Timeout, runtime.active);
|
|
60
|
+
await confirmCancellation(runtime.repository, runtime.dependencies.clock, currentRunId);
|
|
61
|
+
};
|
|
62
|
+
}
|
|
52
63
|
function externalExecutionReporter(runtime, currentRunId, context, activation) {
|
|
53
64
|
return async (reference) => {
|
|
54
65
|
const loaded = await runtime.repository.load(currentRunId);
|
|
@@ -3,7 +3,14 @@ const isReservedFlag = (arg) => arg === '--output-format' || arg === '--resume';
|
|
|
3
3
|
const agentRunnerBase = {
|
|
4
4
|
model: z.string().trim().min(1).optional(),
|
|
5
5
|
effort: z.string().trim().min(1).optional(),
|
|
6
|
-
|
|
6
|
+
runnerTimeouts: z
|
|
7
|
+
.object({
|
|
8
|
+
idleMs: z.number().int().positive().default(600_000),
|
|
9
|
+
hardMs: z.number().int().positive().default(7_200_000),
|
|
10
|
+
cancellationGraceMs: z.number().int().positive().default(30_000),
|
|
11
|
+
})
|
|
12
|
+
.strict()
|
|
13
|
+
.prefault({}),
|
|
7
14
|
args: z.array(z.string()).default([]),
|
|
8
15
|
};
|
|
9
16
|
const commandRunner = (kind) => z
|
|
@@ -14,6 +14,7 @@ export const ExecutionCancellationReason = defineClosedVocabulary({
|
|
|
14
14
|
WorkCancelled: 'work-cancelled',
|
|
15
15
|
WorkClosed: 'work-closed',
|
|
16
16
|
WorkflowSuperseded: 'workflow-superseded',
|
|
17
|
+
IdleTimeout: 'idle-timeout',
|
|
17
18
|
Timeout: 'timeout',
|
|
18
19
|
Shutdown: 'shutdown',
|
|
19
20
|
Maintenance: 'maintenance',
|
|
@@ -2,46 +2,81 @@ import { spawn } from 'node:child_process';
|
|
|
2
2
|
// Agent CLIs can emit arbitrarily large machine-readable transcripts. Capture
|
|
3
3
|
// raw bytes ourselves so overflow never enters a third-party string buffer.
|
|
4
4
|
const maximumCapturedProcessOutputBytes = 1024 * 1024;
|
|
5
|
-
export function runProcess(command, args, cwd, signal,
|
|
5
|
+
export function runProcess(command, args, cwd, signal, options, shell = false) {
|
|
6
6
|
const child = spawn(command, args, {
|
|
7
7
|
...(cwd === undefined ? {} : { cwd }),
|
|
8
8
|
shell,
|
|
9
9
|
...(shell && process.platform !== 'win32' ? { detached: true } : {}),
|
|
10
10
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
11
11
|
});
|
|
12
|
-
|
|
13
|
-
return {
|
|
14
|
-
result,
|
|
15
|
-
cancel: async () => {
|
|
16
|
-
terminate(child, shell);
|
|
17
|
-
},
|
|
18
|
-
};
|
|
12
|
+
return captureProcessOutput(child, signal, options, shell);
|
|
19
13
|
}
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
// Lifecycle coordination must share these closures so first-event-wins is atomic.
|
|
15
|
+
// eslint-disable-next-line max-lines-per-function
|
|
16
|
+
function captureProcessOutput(child, signal, options, shell) {
|
|
17
|
+
let terminatePromise;
|
|
18
|
+
const terminate = () => (terminatePromise ??= terminateGracefully(child, shell, options?.cancellationGraceMs));
|
|
19
|
+
let cancel = terminate;
|
|
20
|
+
// eslint-disable-next-line max-lines-per-function
|
|
21
|
+
const result = new Promise((resolve) => {
|
|
22
22
|
const stdout = [];
|
|
23
23
|
const stderr = [];
|
|
24
24
|
const combinedOutput = [];
|
|
25
25
|
let capturedBytes = 0;
|
|
26
26
|
let timedOut = false;
|
|
27
|
+
let timeoutKind;
|
|
27
28
|
let overflowed = false;
|
|
28
29
|
let error;
|
|
30
|
+
let settled = false;
|
|
31
|
+
let idleTimeout;
|
|
32
|
+
let hardTimeout;
|
|
33
|
+
const clearTimeouts = () => {
|
|
34
|
+
if (idleTimeout !== undefined)
|
|
35
|
+
clearTimeout(idleTimeout);
|
|
36
|
+
if (hardTimeout !== undefined)
|
|
37
|
+
clearTimeout(hardTimeout);
|
|
38
|
+
};
|
|
39
|
+
const terminateForTimeout = async (kind) => {
|
|
40
|
+
if (settled)
|
|
41
|
+
return;
|
|
42
|
+
settled = true;
|
|
43
|
+
timedOut = true;
|
|
44
|
+
timeoutKind = kind;
|
|
45
|
+
clearTimeouts();
|
|
46
|
+
try {
|
|
47
|
+
await options?.onTimeout?.(kind);
|
|
48
|
+
}
|
|
49
|
+
finally {
|
|
50
|
+
void terminate();
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const resetIdleTimeout = () => {
|
|
54
|
+
if (settled || options?.idleMs === undefined)
|
|
55
|
+
return;
|
|
56
|
+
if (idleTimeout !== undefined)
|
|
57
|
+
clearTimeout(idleTimeout);
|
|
58
|
+
idleTimeout = setTimeout(() => void terminateForTimeout('idle'), options.idleMs);
|
|
59
|
+
};
|
|
29
60
|
const terminateForOverflow = () => {
|
|
61
|
+
if (settled)
|
|
62
|
+
return;
|
|
63
|
+
settled = true;
|
|
30
64
|
overflowed = true;
|
|
65
|
+
clearTimeouts();
|
|
31
66
|
child.stdout?.destroy();
|
|
32
67
|
child.stderr?.destroy();
|
|
33
|
-
terminate(
|
|
68
|
+
void terminate();
|
|
34
69
|
};
|
|
35
70
|
const capture = (destination) => (chunk) => {
|
|
36
|
-
if (
|
|
71
|
+
if (settled)
|
|
37
72
|
return;
|
|
73
|
+
resetIdleTimeout();
|
|
38
74
|
const remaining = maximumCapturedProcessOutputBytes - capturedBytes;
|
|
39
75
|
if (remaining <= 0 || chunk.length > remaining) {
|
|
40
|
-
if (remaining > 0)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
combinedOutput.push(
|
|
44
|
-
}
|
|
76
|
+
if (remaining > 0)
|
|
77
|
+
destination.push(chunk.subarray(0, remaining));
|
|
78
|
+
if (remaining > 0)
|
|
79
|
+
combinedOutput.push(chunk.subarray(0, remaining));
|
|
45
80
|
capturedBytes = maximumCapturedProcessOutputBytes;
|
|
46
81
|
terminateForOverflow();
|
|
47
82
|
return;
|
|
@@ -52,20 +87,33 @@ function captureProcessOutput(child, signal, timeoutMs, shell) {
|
|
|
52
87
|
};
|
|
53
88
|
child.stdout?.on('data', capture(stdout));
|
|
54
89
|
child.stderr?.on('data', capture(stderr));
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
90
|
+
resetIdleTimeout();
|
|
91
|
+
if (options?.hardMs !== undefined)
|
|
92
|
+
hardTimeout = setTimeout(() => void terminateForTimeout('hard'), options.hardMs);
|
|
93
|
+
const onAbort = () => {
|
|
94
|
+
if (settled)
|
|
95
|
+
return;
|
|
96
|
+
settled = true;
|
|
97
|
+
clearTimeouts();
|
|
98
|
+
void terminate();
|
|
99
|
+
};
|
|
100
|
+
cancel = () => {
|
|
101
|
+
if (!settled) {
|
|
102
|
+
settled = true;
|
|
103
|
+
clearTimeouts();
|
|
104
|
+
}
|
|
105
|
+
return terminate();
|
|
106
|
+
};
|
|
62
107
|
signal.addEventListener('abort', onAbort, { once: true });
|
|
108
|
+
if (signal.aborted)
|
|
109
|
+
onAbort();
|
|
63
110
|
child.once('error', (caught) => {
|
|
64
111
|
error = caught;
|
|
65
112
|
});
|
|
66
113
|
child.once('close', (exitCode) => {
|
|
67
|
-
if (
|
|
68
|
-
|
|
114
|
+
if (!settled)
|
|
115
|
+
settled = true;
|
|
116
|
+
clearTimeouts();
|
|
69
117
|
signal.removeEventListener('abort', onAbort);
|
|
70
118
|
resolve({
|
|
71
119
|
stdout: Buffer.concat(stdout).toString('utf8'),
|
|
@@ -73,6 +121,7 @@ function captureProcessOutput(child, signal, timeoutMs, shell) {
|
|
|
73
121
|
combinedOutput: Buffer.concat(combinedOutput),
|
|
74
122
|
exitCode: exitCode ?? undefined,
|
|
75
123
|
timedOut,
|
|
124
|
+
...(timeoutKind === undefined ? {} : { timeoutKind }),
|
|
76
125
|
...(overflowed
|
|
77
126
|
? {
|
|
78
127
|
failureKind: 'output-limit',
|
|
@@ -82,17 +131,51 @@ function captureProcessOutput(child, signal, timeoutMs, shell) {
|
|
|
82
131
|
});
|
|
83
132
|
});
|
|
84
133
|
});
|
|
134
|
+
return { result, cancel };
|
|
85
135
|
}
|
|
86
|
-
function
|
|
136
|
+
async function terminateGracefully(child, shell, cancellationGraceMs) {
|
|
137
|
+
if (child.exitCode !== null || child.signalCode !== null)
|
|
138
|
+
return;
|
|
139
|
+
terminate(child, shell, 'SIGTERM');
|
|
140
|
+
// Windows does not distinguish these signals, so its SIGTERM already has
|
|
141
|
+
// immediate-kill semantics and waiting would not make cancellation gentler.
|
|
142
|
+
if (process.platform === 'win32')
|
|
143
|
+
return;
|
|
144
|
+
await waitForExit(child, cancellationGraceMs ?? 0);
|
|
145
|
+
if (child.exitCode === null && child.signalCode === null)
|
|
146
|
+
terminate(child, shell, 'SIGKILL');
|
|
147
|
+
}
|
|
148
|
+
function terminate(child, shell, signal) {
|
|
149
|
+
if (shell && process.platform === 'win32' && child.pid !== undefined) {
|
|
150
|
+
const taskkill = spawn('taskkill', ['/pid', String(child.pid), '/T', '/F'], {
|
|
151
|
+
stdio: 'ignore',
|
|
152
|
+
windowsHide: true,
|
|
153
|
+
});
|
|
154
|
+
taskkill.unref();
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
87
157
|
if (shell && process.platform !== 'win32' && child.pid !== undefined) {
|
|
88
158
|
try {
|
|
89
|
-
process.kill(-child.pid);
|
|
159
|
+
process.kill(-child.pid, signal);
|
|
90
160
|
return;
|
|
91
161
|
}
|
|
92
162
|
catch {
|
|
93
163
|
// The process may have already exited; fall through to the direct signal.
|
|
94
164
|
}
|
|
95
165
|
}
|
|
96
|
-
if (
|
|
97
|
-
child.kill();
|
|
166
|
+
if (child.exitCode === null && child.signalCode === null)
|
|
167
|
+
child.kill(signal);
|
|
168
|
+
}
|
|
169
|
+
function waitForExit(child, timeoutMs) {
|
|
170
|
+
if (child.exitCode !== null || child.signalCode !== null)
|
|
171
|
+
return Promise.resolve();
|
|
172
|
+
return new Promise((resolve) => {
|
|
173
|
+
const timeout = setTimeout(done, timeoutMs);
|
|
174
|
+
child.once('exit', done);
|
|
175
|
+
function done() {
|
|
176
|
+
clearTimeout(timeout);
|
|
177
|
+
child.removeListener('exit', done);
|
|
178
|
+
resolve();
|
|
179
|
+
}
|
|
180
|
+
});
|
|
98
181
|
}
|
|
@@ -4,7 +4,7 @@ import { ExecutionCancellationReason, RunStatus } from '../../contracts/vocabula
|
|
|
4
4
|
import { runProcess } from '../process-execution.js';
|
|
5
5
|
export function createClaudeRunner(options = {}) {
|
|
6
6
|
return cliRunner('claude', options.command ?? 'claude', (request) => claudeCommandArgs(request, options.args, options), {
|
|
7
|
-
...(options.
|
|
7
|
+
...(options.runnerTimeouts === undefined ? {} : { runnerTimeouts: options.runnerTimeouts }),
|
|
8
8
|
...(options.model === undefined ? {} : { defaultModel: options.model }),
|
|
9
9
|
parseSuccessfulOutput: parseClaudeOutput,
|
|
10
10
|
classifyFailure: classifyClaudeFailure,
|
|
@@ -93,7 +93,10 @@ export function cliRunner(name, command, args, options = {}) {
|
|
|
93
93
|
return {
|
|
94
94
|
supportsSessionResume: options.supportsSessionResume === true,
|
|
95
95
|
async start(request, signal) {
|
|
96
|
-
const process = runProcess(command, args(request), request.workspacePath, signal,
|
|
96
|
+
const process = runProcess(command, args(request), request.workspacePath, signal, {
|
|
97
|
+
...options.runnerTimeouts,
|
|
98
|
+
...(request.onTimeout === undefined ? {} : { onTimeout: request.onTimeout }),
|
|
99
|
+
});
|
|
97
100
|
return {
|
|
98
101
|
identity: {
|
|
99
102
|
kind: ExternalExecutionKind.Process,
|
|
@@ -124,8 +127,12 @@ export function cliRunner(name, command, args, options = {}) {
|
|
|
124
127
|
function failureFor(value, options) {
|
|
125
128
|
if (value.timedOut)
|
|
126
129
|
return {
|
|
127
|
-
kind:
|
|
128
|
-
|
|
130
|
+
kind: value.timeoutKind === 'idle'
|
|
131
|
+
? ExecutionCancellationReason.IdleTimeout
|
|
132
|
+
: ExecutionCancellationReason.Timeout,
|
|
133
|
+
message: value.timeoutKind === 'idle'
|
|
134
|
+
? timeoutMessage('idle', options.runnerTimeouts?.idleMs)
|
|
135
|
+
: timeoutMessage('hard', options.runnerTimeouts?.hardMs),
|
|
129
136
|
};
|
|
130
137
|
if (value.failureKind !== undefined)
|
|
131
138
|
return {
|
|
@@ -137,6 +144,15 @@ function failureFor(value, options) {
|
|
|
137
144
|
return classified;
|
|
138
145
|
return { kind: 'process-exit', message: value.stderr || `exit ${value.exitCode}` };
|
|
139
146
|
}
|
|
147
|
+
function timeoutMessage(kind, timeoutMs) {
|
|
148
|
+
if (timeoutMs === undefined)
|
|
149
|
+
return kind === 'idle'
|
|
150
|
+
? 'Runner exceeded its idle timeout'
|
|
151
|
+
: 'Runner exceeded its hard timeout';
|
|
152
|
+
return kind === 'idle'
|
|
153
|
+
? `Runner was idle for ${timeoutMs}ms`
|
|
154
|
+
: `Runner exceeded the hard timeout of ${timeoutMs}ms`;
|
|
155
|
+
}
|
|
140
156
|
function parseSuccessfulOutput(stdout, request, parser) {
|
|
141
157
|
if (parser === undefined)
|
|
142
158
|
return {};
|
|
@@ -38,7 +38,7 @@ function extractCodexErrorMessage(stdout) {
|
|
|
38
38
|
}
|
|
39
39
|
export function createCodexRunner(options = {}) {
|
|
40
40
|
return cliRunner('codex', options.command ?? 'codex', (request) => codexCommandArgs(request, options.args, options), {
|
|
41
|
-
...(options.
|
|
41
|
+
...(options.runnerTimeouts === undefined ? {} : { runnerTimeouts: options.runnerTimeouts }),
|
|
42
42
|
...(options.model === undefined ? {} : { defaultModel: options.model }),
|
|
43
43
|
parseSuccessfulOutput: parseCodexOutput,
|
|
44
44
|
classifyFailure: classifyCodexFailure,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { cliRunner } from './claude.js';
|
|
2
|
-
export function createCommandRunner(command, args,
|
|
3
|
-
return cliRunner('command', command, () => [...args], {
|
|
2
|
+
export function createCommandRunner(command, args, runnerTimeouts) {
|
|
3
|
+
return cliRunner('command', command, () => [...args], { runnerTimeouts });
|
|
4
4
|
}
|
|
@@ -18,7 +18,7 @@ export function classifyCursorFailure(input) {
|
|
|
18
18
|
}
|
|
19
19
|
export function createCursorRunner(options = {}) {
|
|
20
20
|
return cliRunner('cursor', options.command ?? 'cursor', (request) => cursorCommandArgs(request, options.args, options), {
|
|
21
|
-
...(options.
|
|
21
|
+
...(options.runnerTimeouts === undefined ? {} : { runnerTimeouts: options.runnerTimeouts }),
|
|
22
22
|
...(options.model === undefined ? {} : { defaultModel: options.model }),
|
|
23
23
|
parseSuccessfulOutput: parseCursorOutput,
|
|
24
24
|
classifyFailure: classifyCursorFailure,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { runProcess } from '../process-execution.js';
|
|
2
2
|
const prepareOutputTailBytes = 4096;
|
|
3
3
|
export async function prepareWorkspace(path, hook) {
|
|
4
|
-
const process = runProcess(hook.command, [], path, new AbortController().signal, hook.timeoutMs, true);
|
|
4
|
+
const process = runProcess(hook.command, [], path, new AbortController().signal, { hardMs: hook.timeoutMs }, true);
|
|
5
5
|
const result = await process.result;
|
|
6
6
|
if (result.exitCode === 0 && !result.timedOut && result.failureKind === undefined)
|
|
7
7
|
return;
|
|
@@ -3,14 +3,22 @@ import { GitHubBuiltInCommand } from '../contracts/vocabulary.js';
|
|
|
3
3
|
export function isHumanNonWakeReply(actorKind, body) {
|
|
4
4
|
return actorKind === ReviewActorKind.Human && !body.includes('<!-- wake:');
|
|
5
5
|
}
|
|
6
|
+
function commandLine(body) {
|
|
7
|
+
const trimmed = body.trim();
|
|
8
|
+
const newlineIndex = trimmed.indexOf('\n');
|
|
9
|
+
const line = newlineIndex === -1 ? trimmed : trimmed.slice(0, newlineIndex);
|
|
10
|
+
return line.trim().toLowerCase();
|
|
11
|
+
}
|
|
12
|
+
function matchesCommand(line, command) {
|
|
13
|
+
return line === command || (line.startsWith(command) && /\s/.test(line.charAt(command.length)));
|
|
14
|
+
}
|
|
6
15
|
export function recognizedCommand(body) {
|
|
7
|
-
const
|
|
8
|
-
if (
|
|
16
|
+
const line = commandLine(body);
|
|
17
|
+
if (matchesCommand(line, GitHubBuiltInCommand.Approved))
|
|
9
18
|
return GitHubBuiltInCommand.Approved;
|
|
10
|
-
if (
|
|
11
|
-
normalized.startsWith(`${GitHubBuiltInCommand.Changes} `))
|
|
19
|
+
if (matchesCommand(line, GitHubBuiltInCommand.Changes))
|
|
12
20
|
return GitHubBuiltInCommand.Changes;
|
|
13
|
-
if (
|
|
21
|
+
if (matchesCommand(line, GitHubBuiltInCommand.Retry))
|
|
14
22
|
return GitHubBuiltInCommand.Retry;
|
|
15
23
|
return null;
|
|
16
24
|
}
|