orquesta-agent 0.2.241 → 0.2.245
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/claude-transcript.d.ts +14 -0
- package/dist/claude-transcript.d.ts.map +1 -1
- package/dist/claude-transcript.js +4 -0
- package/dist/claude-transcript.js.map +1 -1
- package/dist/executor.d.ts +45 -1
- package/dist/executor.d.ts.map +1 -1
- package/dist/executor.js +185 -17
- package/dist/executor.js.map +1 -1
- package/dist/hook.d.ts.map +1 -1
- package/dist/hook.js +5 -1
- package/dist/hook.js.map +1 -1
- package/dist/index.js +154 -44
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +65 -9
- package/dist/logger.js.map +1 -1
- package/dist/redact.d.ts +15 -0
- package/dist/redact.d.ts.map +1 -1
- package/dist/redact.js +26 -0
- package/dist/redact.js.map +1 -1
- package/dist/sandbox.d.ts +29 -0
- package/dist/sandbox.d.ts.map +1 -1
- package/dist/sandbox.js +54 -0
- package/dist/sandbox.js.map +1 -1
- package/dist/socketio-transport.d.ts +2 -0
- package/dist/socketio-transport.d.ts.map +1 -1
- package/dist/socketio-transport.js.map +1 -1
- package/dist/supabase.d.ts +17 -0
- package/dist/supabase.d.ts.map +1 -1
- package/dist/supabase.js +5 -3
- package/dist/supabase.js.map +1 -1
- package/package.json +1 -1
|
@@ -17,6 +17,20 @@ export interface StartTranscriptTailOptions {
|
|
|
17
17
|
onLog: (entry: AgentLogEntry) => void;
|
|
18
18
|
/** Optional logger for diagnostics (best-effort, never throws). */
|
|
19
19
|
log?: (msg: string) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Fired once if the transcript file never showed up within
|
|
22
|
+
* DISCOVERY_TIMEOUT_MS.
|
|
23
|
+
*
|
|
24
|
+
* This is a TELEMETRY failure, not a session failure — the tailer only feeds
|
|
25
|
+
* the dashboard's structured timeline, and the session runs fine without it.
|
|
26
|
+
* Do not hang a kill off this callback: "no transcript" has causes that have
|
|
27
|
+
* nothing to do with a broken session (claude changing where it writes
|
|
28
|
+
* between versions, or strict mode's `--tmpfs` on ~/.claude/projects hiding a
|
|
29
|
+
* transcript written under a project dir we did not pre-create). Killing on
|
|
30
|
+
* those would take healthy sessions down. Report; let the reaper judge health
|
|
31
|
+
* from PTY output, which is the signal that actually means "alive".
|
|
32
|
+
*/
|
|
33
|
+
onDiscoveryTimeout?: () => void;
|
|
20
34
|
}
|
|
21
35
|
/**
|
|
22
36
|
* Begin tailing the Claude transcript for a session. Returns a handle with
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-transcript.d.ts","sourceRoot":"","sources":["../src/claude-transcript.ts"],"names":[],"mappings":"AA8BA,OAAO,EACL,aAAa,EAKd,MAAM,uBAAuB,CAAA;AAO9B,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,IAAI,CAAA;CACjB;AAwID,MAAM,WAAW,0BAA0B;IACzC,mFAAmF;IACnF,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,gFAAgF;IAChF,WAAW,EAAE,MAAM,CAAA;IACnB;;;;OAIG;IACH,WAAW,EAAE,MAAM,MAAM,GAAG,SAAS,CAAA;IACrC,oEAAoE;IACpE,KAAK,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;IACrC,mEAAmE;IACnE,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"claude-transcript.d.ts","sourceRoot":"","sources":["../src/claude-transcript.ts"],"names":[],"mappings":"AA8BA,OAAO,EACL,aAAa,EAKd,MAAM,uBAAuB,CAAA;AAO9B,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,IAAI,CAAA;CACjB;AAwID,MAAM,WAAW,0BAA0B;IACzC,mFAAmF;IACnF,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,gFAAgF;IAChF,WAAW,EAAE,MAAM,CAAA;IACnB;;;;OAIG;IACH,WAAW,EAAE,MAAM,MAAM,GAAG,SAAS,CAAA;IACrC,oEAAoE;IACpE,KAAK,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;IACrC,mEAAmE;IACnE,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3B;;;;;;;;;;;;OAYG;IACH,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAA;CAChC;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,0BAA0B,GAAG,YAAY,CAgFlF"}
|
|
@@ -183,6 +183,10 @@ export function startTranscriptTail(opts) {
|
|
|
183
183
|
if (Date.now() > discoveryDeadline) {
|
|
184
184
|
opts.log?.('[transcript] file never appeared — giving up');
|
|
185
185
|
stopped = true;
|
|
186
|
+
try {
|
|
187
|
+
opts.onDiscoveryTimeout?.();
|
|
188
|
+
}
|
|
189
|
+
catch { /* never throws into the timer */ }
|
|
186
190
|
return;
|
|
187
191
|
}
|
|
188
192
|
return schedule();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-transcript.js","sourceRoot":"","sources":["../src/claude-transcript.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,EAEL,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,GAChB,MAAM,uBAAuB,CAAA;AAE9B,kEAAkE;AAClE,MAAM,gBAAgB,GAAG,GAAG,CAAA;AAC5B,yEAAyE;AACzE,MAAM,oBAAoB,GAAG,MAAM,CAAA;AAMnC,iEAAiE;AACjE,SAAS,kBAAkB;IACzB,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,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E,CAAC;oBACzB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;oBAC3B,IAAI,CAAC,OAAO;wBAAE,SAAQ;oBACtB,IAAI,GAA4B,CAAA;oBAChC,IAAI,CAAC;wBACH,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;oBAC3B,CAAC;oBAAC,MAAM,CAAC;wBACP,SAAQ,CAAC,8BAA8B;oBACzC,CAAC;oBACD,KAAK,MAAM,KAAK,IAAI,kBAAkB,CAAC,GAAG,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,CAAC;wBACjE,IAAI,CAAC;4BAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;wBAAC,CAAC;wBAAC,MAAM,CAAC,CAAC,mBAAmB,CAAC,CAAC;oBACzD,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,GAAG,EAAE,CAAC,4BAA4B,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;QAC5F,CAAC;QACD,QAAQ,EAAE,CAAA;IACZ,CAAC,CAAA;IAED,QAAQ,EAAE,CAAA;IACV,OAAO;QACL,IAAI,EAAE,GAAG,EAAE;YACT,OAAO,GAAG,IAAI,CAAA;YACd,IAAI,KAAK;gBAAE,YAAY,CAAC,KAAK,CAAC,CAAA;QAChC,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/dist/executor.d.ts
CHANGED
|
@@ -120,6 +120,25 @@ export declare function checkClaudeAuth(): {
|
|
|
120
120
|
method: string | null;
|
|
121
121
|
available: boolean;
|
|
122
122
|
};
|
|
123
|
+
/**
|
|
124
|
+
* The argv for `git clone`, as a list rather than a command line.
|
|
125
|
+
*
|
|
126
|
+
* Pure so the quoting rule can actually be tested. It used to be built by
|
|
127
|
+
* interpolating into a shell string, which broke on the first destination with
|
|
128
|
+
* a space in it: `D:\DUOC\Practica profesional\...` reached git as three
|
|
129
|
+
* arguments, git answered with its usage screen, and the agent retried the same
|
|
130
|
+
* failure forever. Argv has no such ambiguity — and it is also what closes the
|
|
131
|
+
* shell injection the old form carried, since `targetDir` comes from project
|
|
132
|
+
* configuration, not from a constant.
|
|
133
|
+
*
|
|
134
|
+
* NOTE ON THE TOKEN: it still goes into the URL, and therefore into
|
|
135
|
+
* `.git/config` as the origin remote. That is deliberate for now — gitPull()
|
|
136
|
+
* and gitPush() run with no credential helper of their own, so they work on
|
|
137
|
+
* private repos only because the clone left the credential there. Removing it
|
|
138
|
+
* has to be paired with giving pull/push their own credentials; doing it here
|
|
139
|
+
* alone would break every private-repo agent in the fleet.
|
|
140
|
+
*/
|
|
141
|
+
export declare function buildCloneArgs(repoUrl: string, targetDir: string, githubToken?: string): string[];
|
|
123
142
|
export declare function gitClone(repoUrl: string, targetDir: string, githubToken?: string): Promise<void>;
|
|
124
143
|
export declare function gitPull(targetDir: string): Promise<void>;
|
|
125
144
|
/**
|
|
@@ -222,8 +241,27 @@ export interface GeneratePlanItemsOptions {
|
|
|
222
241
|
* This runs Claude to analyze the request and generate actionable tasks.
|
|
223
242
|
*/
|
|
224
243
|
export declare function generatePlanItems(options: GeneratePlanItemsOptions): Promise<void>;
|
|
244
|
+
/** The assisted-run item an interactive session was claimed against. */
|
|
245
|
+
export interface AssistedSessionEnvelope {
|
|
246
|
+
runId: string;
|
|
247
|
+
itemId: string;
|
|
248
|
+
branch: string;
|
|
249
|
+
/** The prompt row the claim minted, and the subject of the exit report. */
|
|
250
|
+
promptId: string;
|
|
251
|
+
/**
|
|
252
|
+
* HEAD when the session started, captured agent-side. The exit report diffs
|
|
253
|
+
* against it, so commits the person made by hand mid-session are counted too.
|
|
254
|
+
*/
|
|
255
|
+
baseSha?: string;
|
|
256
|
+
}
|
|
257
|
+
/** What `setOnSessionEnded` receives about the session that just ended. */
|
|
258
|
+
export interface SessionEndInfo {
|
|
259
|
+
sessionId: string;
|
|
260
|
+
workingDirectory: string;
|
|
261
|
+
assisted?: AssistedSessionEnvelope;
|
|
262
|
+
}
|
|
225
263
|
/** Register a callback to be called when an interactive session ends (PTY exits). */
|
|
226
|
-
export declare function setOnSessionEnded(cb: () => void): void;
|
|
264
|
+
export declare function setOnSessionEnded(cb: (info?: SessionEndInfo) => void): void;
|
|
227
265
|
export interface StartSessionOptions {
|
|
228
266
|
sessionId: string;
|
|
229
267
|
workingDirectory?: string;
|
|
@@ -246,6 +284,12 @@ export interface StartSessionOptions {
|
|
|
246
284
|
* per-id resume, so they fall back to --continue.
|
|
247
285
|
*/
|
|
248
286
|
resumeSessionId?: string;
|
|
287
|
+
/**
|
|
288
|
+
* Set when this session is a claimed item of an assisted QA run. Suppresses
|
|
289
|
+
* every deploy instruction in the system prompt (same rule as a dispatched
|
|
290
|
+
* assisted prompt) and is handed back on exit so the diff can be reported.
|
|
291
|
+
*/
|
|
292
|
+
assisted?: AssistedSessionEnvelope;
|
|
249
293
|
}
|
|
250
294
|
export interface ResumableSession {
|
|
251
295
|
sessionId: string;
|
package/dist/executor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../src/executor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../src/executor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAmItD,OAAO,EAAmI,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA;AAoPhL,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAOhF;AAGD,wBAAgB,sBAAsB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAA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,MAAM,GAAG,IAAI,CAAC;IAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,CAAC;IAAC,QAAQ,EAAE,WAAW,EAAE,CAAA;CAAE,CAetN;AAyCD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CA+BzD"}
|
package/dist/executor.js
CHANGED
|
@@ -118,10 +118,11 @@ import { randomUUID } from 'crypto';
|
|
|
118
118
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
119
119
|
import { createRequire } from 'module';
|
|
120
120
|
import * as logger from './logger.js';
|
|
121
|
+
import { redactSecrets } from './redact.js';
|
|
121
122
|
// ESM require for resolving the bundled orquesta-cli entry on Windows (see the
|
|
122
123
|
// interactive-session spawn — node-pty can't launch the `.cmd` shim).
|
|
123
124
|
const nodeRequire = createRequire(import.meta.url);
|
|
124
|
-
import { isSandboxAvailable, buildBwrapArgs, shQuote, ensureStrictProjectDirs, encodeClaudeProjectDir } from './sandbox.js';
|
|
125
|
+
import { isSandboxAvailable, buildBwrapArgs, shQuote, ensureStrictProjectDirs, encodeClaudeProjectDir, findStaleBinds, criticalBindPaths } from './sandbox.js';
|
|
125
126
|
import { isLoggedOutMessage } from './cli-auth-detect.js';
|
|
126
127
|
import { parseCoordSpec, runCoordination } from './coordination.js';
|
|
127
128
|
import { parseSudosudoInstallSpec, runSudosudoInstall } from './sudosudo.js';
|
|
@@ -235,6 +236,10 @@ const promptCostCents = new Map();
|
|
|
235
236
|
// ever saw logs, and panels that read prompts.result (architecture extraction,
|
|
236
237
|
// auto-agent polling) found it empty.
|
|
237
238
|
const promptFinalResult = new Map();
|
|
239
|
+
// The CLI's own verdict for a run, from its `end` event. Kept per prompt because
|
|
240
|
+
// several prompts stream through the same process concurrently. See QA-76: an
|
|
241
|
+
// exit code is not evidence that the work succeeded.
|
|
242
|
+
const promptCliReportedFailure = new Map();
|
|
238
243
|
function trackFileModified(promptId, filePath) {
|
|
239
244
|
if (!executionFilesModified.has(promptId)) {
|
|
240
245
|
executionFilesModified.set(promptId, new Set());
|
|
@@ -1148,15 +1153,36 @@ export function checkClaudeAuth() {
|
|
|
1148
1153
|
// instead of hanging forever waiting for credentials it can't read.
|
|
1149
1154
|
const GIT_NET_TIMEOUT_MS = 120_000;
|
|
1150
1155
|
const GIT_NONINTERACTIVE_ENV = { ...process.env, GIT_TERMINAL_PROMPT: '0' };
|
|
1151
|
-
|
|
1152
|
-
|
|
1156
|
+
/**
|
|
1157
|
+
* The argv for `git clone`, as a list rather than a command line.
|
|
1158
|
+
*
|
|
1159
|
+
* Pure so the quoting rule can actually be tested. It used to be built by
|
|
1160
|
+
* interpolating into a shell string, which broke on the first destination with
|
|
1161
|
+
* a space in it: `D:\DUOC\Practica profesional\...` reached git as three
|
|
1162
|
+
* arguments, git answered with its usage screen, and the agent retried the same
|
|
1163
|
+
* failure forever. Argv has no such ambiguity — and it is also what closes the
|
|
1164
|
+
* shell injection the old form carried, since `targetDir` comes from project
|
|
1165
|
+
* configuration, not from a constant.
|
|
1166
|
+
*
|
|
1167
|
+
* NOTE ON THE TOKEN: it still goes into the URL, and therefore into
|
|
1168
|
+
* `.git/config` as the origin remote. That is deliberate for now — gitPull()
|
|
1169
|
+
* and gitPush() run with no credential helper of their own, so they work on
|
|
1170
|
+
* private repos only because the clone left the credential there. Removing it
|
|
1171
|
+
* has to be paired with giving pull/push their own credentials; doing it here
|
|
1172
|
+
* alone would break every private-repo agent in the fleet.
|
|
1173
|
+
*/
|
|
1174
|
+
export function buildCloneArgs(repoUrl, targetDir, githubToken) {
|
|
1153
1175
|
let cloneUrl = repoUrl;
|
|
1154
1176
|
if (githubToken && repoUrl.includes('github.com')) {
|
|
1155
1177
|
// Insert token into URL for private repos
|
|
1156
1178
|
cloneUrl = repoUrl.replace('https://github.com', `https://${githubToken}@github.com`);
|
|
1157
1179
|
}
|
|
1180
|
+
return ['clone', cloneUrl, targetDir];
|
|
1181
|
+
}
|
|
1182
|
+
export async function gitClone(repoUrl, targetDir, githubToken) {
|
|
1183
|
+
logger.info(`Cloning repository: ${repoUrl}`);
|
|
1158
1184
|
try {
|
|
1159
|
-
|
|
1185
|
+
execFileSync('git', buildCloneArgs(repoUrl, targetDir, githubToken), {
|
|
1160
1186
|
stdio: 'inherit',
|
|
1161
1187
|
timeout: GIT_NET_TIMEOUT_MS,
|
|
1162
1188
|
env: GIT_NONINTERACTIVE_ENV,
|
|
@@ -1164,7 +1190,12 @@ export async function gitClone(repoUrl, targetDir, githubToken) {
|
|
|
1164
1190
|
logger.success('Repository cloned successfully');
|
|
1165
1191
|
}
|
|
1166
1192
|
catch (error) {
|
|
1167
|
-
|
|
1193
|
+
// Node puts the whole failing command in the message, and the clone URL
|
|
1194
|
+
// carries the token — so this string is the one that put a live GitHub
|
|
1195
|
+
// credential on a QA screenshot. The logger redacts its own console and
|
|
1196
|
+
// file output now, but this error also travels to the dashboard and into
|
|
1197
|
+
// callers that format it themselves, so scrub it at the source too.
|
|
1198
|
+
throw new Error(redactSecrets(`Failed to clone repository: ${error}`));
|
|
1168
1199
|
}
|
|
1169
1200
|
}
|
|
1170
1201
|
export async function gitPull(targetDir) {
|
|
@@ -2466,9 +2497,22 @@ ${userRequestBody}`;
|
|
|
2466
2497
|
promptFinalResult.set(promptId, String(content));
|
|
2467
2498
|
}
|
|
2468
2499
|
}
|
|
2500
|
+
else if (json.event === 'error') {
|
|
2501
|
+
// orquesta-cli emits this when a run ends badly. There was no branch
|
|
2502
|
+
// for it, so the reason a run failed never reached the timeline —
|
|
2503
|
+
// only the (misleading) completion line did.
|
|
2504
|
+
const { message } = json.data;
|
|
2505
|
+
if (message) {
|
|
2506
|
+
output += `\n❌ ${message}\n`;
|
|
2507
|
+
logs.push(createErrorLog(String(message), false, 'error', promptId, json.data?.code));
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2469
2510
|
else if (json.event === 'end') {
|
|
2470
2511
|
const { success, duration_ms, usage } = json.data;
|
|
2471
2512
|
const duration = (duration_ms / 1000).toFixed(1);
|
|
2513
|
+
// Remember the CLI's answer. It knows things the exit code does not.
|
|
2514
|
+
if (success === false && promptId)
|
|
2515
|
+
promptCliReportedFailure.set(promptId, true);
|
|
2472
2516
|
output += `\n${success ? '✅' : '❌'} Completed in ${duration}s\n`;
|
|
2473
2517
|
if (usage) {
|
|
2474
2518
|
output += `📊 Tokens: ${usage.total_tokens || 0}\n`;
|
|
@@ -2891,7 +2935,18 @@ ${userRequestBody}`;
|
|
|
2891
2935
|
addLog(promptId, 'error', 'system', `Claude CLI unavailable (no fallback): ${claudeApiError}`);
|
|
2892
2936
|
sendOutput(channel, commandId, 'stderr', `\n❌ Claude CLI unavailable: ${claudeApiError}\n`);
|
|
2893
2937
|
}
|
|
2894
|
-
|
|
2938
|
+
// A CLI that swallowed a fatal error and still exited 0 is exactly how a
|
|
2939
|
+
// revoked-token run ended up wearing a green "Completed" badge (QA-76).
|
|
2940
|
+
// When the CLI told us in its `end` event that the run failed, that beats
|
|
2941
|
+
// the exit code — same shape as the claudeApiError rule above, which
|
|
2942
|
+
// exists because `claude` also exits 0 on an account-level failure.
|
|
2943
|
+
const cliReportedFailure = promptId ? promptCliReportedFailure.get(promptId) === true : false;
|
|
2944
|
+
if (promptId)
|
|
2945
|
+
promptCliReportedFailure.delete(promptId);
|
|
2946
|
+
if (cliReportedFailure && (code ?? 0) === 0) {
|
|
2947
|
+
logger.warn('CLI reported a failed run but exited 0 — recording it as failed');
|
|
2948
|
+
}
|
|
2949
|
+
const exitCode = (claudeApiError || cliReportedFailure) ? (code || 1) : (code ?? 0);
|
|
2895
2950
|
const duration = Date.now() - startTime;
|
|
2896
2951
|
const status = exitCode === 0 ? 'completed' : 'failed';
|
|
2897
2952
|
if (exitCode === 0) {
|
|
@@ -3499,6 +3554,13 @@ let onSessionEndedCallback = null;
|
|
|
3499
3554
|
// terminate sessions idle past the timeout or beyond a hard max lifetime.
|
|
3500
3555
|
const SESSION_IDLE_TIMEOUT_MS = 60 * 60 * 1000; // 1h with no PTY output
|
|
3501
3556
|
const SESSION_MAX_LIFETIME_MS = 6 * 60 * 60 * 1000; // 6h hard ceiling
|
|
3557
|
+
// A session that has produced NO output at all since spawn never came up: the
|
|
3558
|
+
// CLI hung before its first paint (a sandbox handed it a stale ~/.claude.json,
|
|
3559
|
+
// a login prompt it cannot draw, a binary that died without a word). Held to a
|
|
3560
|
+
// far shorter fuse than the idle timeout, because an hour of a dead terminal
|
|
3561
|
+
// blocking the slot is an hour the operator spends wondering. Healthy sessions
|
|
3562
|
+
// paint within seconds — `session:started` is itself gated on first output.
|
|
3563
|
+
const SESSION_NO_FIRST_OUTPUT_MS = 5 * 60 * 1000; // 5m without ever painting
|
|
3502
3564
|
let sessionReaper = null;
|
|
3503
3565
|
function ensureSessionReaper() {
|
|
3504
3566
|
if (sessionReaper)
|
|
@@ -3508,7 +3570,12 @@ function ensureSessionReaper() {
|
|
|
3508
3570
|
for (const s of [...sessions.values()]) {
|
|
3509
3571
|
const idle = now - (s.lastPtyOutputAt ?? s.startTime);
|
|
3510
3572
|
const age = now - s.startTime;
|
|
3511
|
-
if (
|
|
3573
|
+
if (!s.sawPtyOutput && age > SESSION_NO_FIRST_OUTPUT_MS) {
|
|
3574
|
+
logger.warn(`[Session] Reaping session ${s.sessionId} that never produced output (age ${Math.round(age / 60000)}m)`);
|
|
3575
|
+
void reportAgentError('warn', 'session_never_started', `Reaped an interactive session that produced no output in ${Math.round(age / 60000)}m — the CLI hung before its first paint`, { sessionId: s.sessionId, workingDirectory: s.workingDirectory });
|
|
3576
|
+
terminateSession(s.sessionId);
|
|
3577
|
+
}
|
|
3578
|
+
else if (idle > SESSION_IDLE_TIMEOUT_MS || age > SESSION_MAX_LIFETIME_MS) {
|
|
3512
3579
|
logger.warn(`[Session] Reaping stale session ${s.sessionId} (idle ${Math.round(idle / 60000)}m, age ${Math.round(age / 60000)}m)`);
|
|
3513
3580
|
void reportAgentError('info', 'session_reap', `Reaped stale interactive session (idle ${Math.round(idle / 60000)}m, age ${Math.round(age / 60000)}m)`, { sessionId: s.sessionId });
|
|
3514
3581
|
terminateSession(s.sessionId);
|
|
@@ -3518,7 +3585,10 @@ function ensureSessionReaper() {
|
|
|
3518
3585
|
clearInterval(sessionReaper);
|
|
3519
3586
|
sessionReaper = null;
|
|
3520
3587
|
}
|
|
3521
|
-
|
|
3588
|
+
// 60s, not 5m: the no-first-output fuse is 5m, and sweeping at 5m would
|
|
3589
|
+
// make it fire anywhere between 5 and 10 minutes. The sweep walks a map
|
|
3590
|
+
// that holds a handful of sessions and clears itself once empty.
|
|
3591
|
+
}, 60 * 1000);
|
|
3522
3592
|
}
|
|
3523
3593
|
// Per-file byte offset into /tmp/rr-*.log (rogerthat-handoff listener inboxes).
|
|
3524
3594
|
// Shared across interactive sessions AND one-shot execute() prompts so phone
|
|
@@ -3774,7 +3844,7 @@ export function listResumableSessions(workingDir, subAgentId, limit = 12) {
|
|
|
3774
3844
|
* The session runs with --dangerously-skip-permissions for uninterrupted interaction.
|
|
3775
3845
|
*/
|
|
3776
3846
|
export async function startSession(options) {
|
|
3777
|
-
const { sessionId, workingDirectory, channel, cols = 120, rows = 40, subAgentId, subAgentName, resume, resumeSessionId } = options;
|
|
3847
|
+
const { sessionId, workingDirectory, channel, cols = 120, rows = 40, subAgentId, subAgentName, resume, resumeSessionId, assisted } = options;
|
|
3778
3848
|
// If this exact sessionId is already live, terminate it before re-creating.
|
|
3779
3849
|
// Sessions on OTHER workstreams are left untouched — they run concurrently.
|
|
3780
3850
|
if (sessions.has(sessionId)) {
|
|
@@ -3903,7 +3973,15 @@ export async function startSession(options) {
|
|
|
3903
3973
|
catch { /* file not found — try next */ }
|
|
3904
3974
|
}
|
|
3905
3975
|
const browserBlockPart = globalBrowserEnabled ? `${BROWSER_TOOLS_PROMPT_BLOCK}\n\n` : '';
|
|
3906
|
-
|
|
3976
|
+
// An assisted session is on a QA branch whose diff a reviewer has to read, so
|
|
3977
|
+
// it gets the same deploy suppression a dispatched assisted prompt gets. It
|
|
3978
|
+
// leads the block rather than trailing it: the operator can type anything
|
|
3979
|
+
// here, and a rule buried under 14KB of capabilities is a rule the model has
|
|
3980
|
+
// already stopped weighting by the time it matters.
|
|
3981
|
+
const assistedBlockPart = assisted
|
|
3982
|
+
? `## Assisted QA run\n\nYou are on branch \`${assisted.branch}\`, working one item of an assisted QA run. Deployment is DISABLED: do NOT deploy, do NOT call the Orquesta Deploy API, and do NOT push to the main branch. A reviewer reads this diff before anything ships.\n\n`
|
|
3983
|
+
: '';
|
|
3984
|
+
const systemPromptBlock = `${assistedBlockPart}${browserBlockPart}${ORQUESTA_CAPABILITIES_PROMPT_BLOCK}${liveCoordination}${projectMdContent}`;
|
|
3907
3985
|
// On Windows the prompt (~38KB) + a big CLAUDE.md can exceed CreateProcess's
|
|
3908
3986
|
// 32767-char command-line cap and the interactive session fails to spawn. Both
|
|
3909
3987
|
// orquesta-cli and claude support --append-system-prompt-file, so we ALWAYS write
|
|
@@ -4037,13 +4115,48 @@ export async function startSession(options) {
|
|
|
4037
4115
|
logger.info(`Sandbox active for interactive session — confining writes to ${cwd}`);
|
|
4038
4116
|
}
|
|
4039
4117
|
}
|
|
4040
|
-
|
|
4118
|
+
// Captured into a const: the null guard above narrows the module-level
|
|
4119
|
+
// `ptySpawn`, but a closure over a mutable binding cannot keep that
|
|
4120
|
+
// narrowing, and this has to be a closure so the stale-bind path can spawn
|
|
4121
|
+
// twice with identical arguments.
|
|
4122
|
+
const spawnWithPty = ptySpawn;
|
|
4123
|
+
const spawnPty = () => spawnWithPty(ptyFile, ptyArgsFinal, {
|
|
4041
4124
|
name: 'xterm-256color',
|
|
4042
4125
|
cols,
|
|
4043
4126
|
rows,
|
|
4044
4127
|
cwd,
|
|
4045
4128
|
env: ptyEnv,
|
|
4046
4129
|
});
|
|
4130
|
+
ptyProcess = spawnPty();
|
|
4131
|
+
// A bind whose source was deleted and recreated between buildBwrapArgs and
|
|
4132
|
+
// the spawn leaves the sandbox reading a stale inode — see findStaleBinds.
|
|
4133
|
+
// The window is small but real: claude's own auto-updater rewrites
|
|
4134
|
+
// ~/.claude.json by delete+recreate, and it does that while sessions start.
|
|
4135
|
+
// Respawning is the whole fix, because the second buildBwrapArgs resolves
|
|
4136
|
+
// the new inode. Retry ONCE: if the updater is still churning, a loop would
|
|
4137
|
+
// fight it forever, and a session on a stale config is worse than a session
|
|
4138
|
+
// that says why it is unhappy.
|
|
4139
|
+
if (ptyFile === 'bwrap' && typeof ptyProcess.pid === 'number') {
|
|
4140
|
+
const stale = await staleBindsAfterSpawn(ptyProcess.pid);
|
|
4141
|
+
if (stale.length > 0) {
|
|
4142
|
+
logger.warn(`Sandbox spawned with stale bind(s): ${stale.join(', ')} — respawning once`);
|
|
4143
|
+
killSessionTree(ptyProcess, 'SIGKILL');
|
|
4144
|
+
ptyProcess = spawnPty();
|
|
4145
|
+
const stillStale = typeof ptyProcess.pid === 'number'
|
|
4146
|
+
? await staleBindsAfterSpawn(ptyProcess.pid)
|
|
4147
|
+
: [];
|
|
4148
|
+
if (stillStale.length > 0) {
|
|
4149
|
+
// Continue rather than refuse. The session may still be perfectly
|
|
4150
|
+
// usable (a stale ~/.claude.json costs a re-login, not a crash), and
|
|
4151
|
+
// refusing to start would turn a degraded session into no session.
|
|
4152
|
+
logger.warn(`Bind(s) still stale after respawn: ${stillStale.join(', ')} — starting anyway`);
|
|
4153
|
+
void reportAgentError('warn', 'sandbox_stale_bind', `Sandbox bind still stale after one respawn: ${stillStale.join(', ')}. A background process is rewriting it (claude's auto-updater does this to ~/.claude.json); the session may start logged out.`, { sessionId, paths: stillStale });
|
|
4154
|
+
}
|
|
4155
|
+
else {
|
|
4156
|
+
void reportAgentError('info', 'sandbox_stale_bind', `Respawned the sandbox to clear a stale bind: ${stale.join(', ')}`, { sessionId, paths: stale });
|
|
4157
|
+
}
|
|
4158
|
+
}
|
|
4159
|
+
}
|
|
4047
4160
|
// The CLI reads the temp system-prompt file at startup; remove it shortly
|
|
4048
4161
|
// after so it doesn't linger in the temp dir.
|
|
4049
4162
|
if (sysPromptFile) {
|
|
@@ -4077,6 +4190,7 @@ export async function startSession(options) {
|
|
|
4077
4190
|
lastPtyOutputAt: Date.now(),
|
|
4078
4191
|
rogerthatWatcher: null,
|
|
4079
4192
|
transcriptTail: null,
|
|
4193
|
+
assisted,
|
|
4080
4194
|
};
|
|
4081
4195
|
sessions.set(sessionId, session);
|
|
4082
4196
|
ensureSessionReaper(); // reap this session if it's later abandoned without session:end
|
|
@@ -4101,6 +4215,17 @@ export async function startSession(options) {
|
|
|
4101
4215
|
void sendSessionLog(channel, sessionId, entry);
|
|
4102
4216
|
},
|
|
4103
4217
|
log: (msg) => logger.debug(`[Session ${sessionId}] ${msg}`),
|
|
4218
|
+
// Report, do not kill. The tailer is telemetry: losing it costs the
|
|
4219
|
+
// dashboard its structured timeline and nothing else, and its timeout
|
|
4220
|
+
// fires for causes that say nothing about session health. What DOES mean
|
|
4221
|
+
// "this session is dead" is the absence of PTY output, which the reaper
|
|
4222
|
+
// already watches — so a missing transcript on a session that is happily
|
|
4223
|
+
// painting is a reporting bug to chase, not a terminal to kill.
|
|
4224
|
+
onDiscoveryTimeout: () => {
|
|
4225
|
+
const live = sessions.get(sessionId);
|
|
4226
|
+
logger.warn(`[Session ${sessionId}] transcript never appeared — structured logs unavailable for this session`);
|
|
4227
|
+
void reportAgentError('warn', 'transcript_missing', 'Claude transcript never appeared within 60s; the session keeps running but its structured timeline will be empty.', { sessionId, sawPtyOutput: Boolean(live?.sawPtyOutput), workingDirectory: cwd });
|
|
4228
|
+
},
|
|
4104
4229
|
});
|
|
4105
4230
|
}
|
|
4106
4231
|
// Send session:started only after Claude produces its first output.
|
|
@@ -4138,6 +4263,9 @@ export async function startSession(options) {
|
|
|
4138
4263
|
const liveSession = sessions.get(sessionId);
|
|
4139
4264
|
if (liveSession) {
|
|
4140
4265
|
liveSession.lastPtyOutputAt = Date.now();
|
|
4266
|
+
// First byte ever = the CLI came up. The reaper reads this to tell a
|
|
4267
|
+
// session that went quiet from one that never spoke at all.
|
|
4268
|
+
liveSession.sawPtyOutput = true;
|
|
4141
4269
|
}
|
|
4142
4270
|
// Confirm session is ready on first output from Claude
|
|
4143
4271
|
if (!sessionStartedSent) {
|
|
@@ -4200,9 +4328,14 @@ export async function startSession(options) {
|
|
|
4200
4328
|
sessions.delete(sessionId);
|
|
4201
4329
|
// Note: do NOT clear rogerthatLogOffsets here — the map is shared with
|
|
4202
4330
|
// one-shot execute() prompts and persists for the agent process lifetime.
|
|
4203
|
-
// Notify index.ts to drain any queued prompts
|
|
4331
|
+
// Notify index.ts to drain any queued prompts — and, when this terminal
|
|
4332
|
+
// was a claimed assisted item, to commit and report its diff.
|
|
4204
4333
|
if (onSessionEndedCallback)
|
|
4205
|
-
onSessionEndedCallback(
|
|
4334
|
+
onSessionEndedCallback({
|
|
4335
|
+
sessionId,
|
|
4336
|
+
workingDirectory: exitingSession.workingDirectory,
|
|
4337
|
+
assisted: exitingSession.assisted,
|
|
4338
|
+
});
|
|
4206
4339
|
}
|
|
4207
4340
|
});
|
|
4208
4341
|
return true;
|
|
@@ -4374,7 +4507,11 @@ export function endSession(sessionId) {
|
|
|
4374
4507
|
// Manually send session:ended — onExit won't do it since we removed the session
|
|
4375
4508
|
sendSessionEnded(ch, sessionId, -1, duration).catch(() => { });
|
|
4376
4509
|
if (onSessionEndedCallback)
|
|
4377
|
-
onSessionEndedCallback(
|
|
4510
|
+
onSessionEndedCallback({
|
|
4511
|
+
sessionId,
|
|
4512
|
+
workingDirectory: sessionRef.workingDirectory,
|
|
4513
|
+
assisted: sessionRef.assisted,
|
|
4514
|
+
});
|
|
4378
4515
|
}
|
|
4379
4516
|
}, 2000);
|
|
4380
4517
|
}
|
|
@@ -4485,6 +4622,26 @@ export function getSessionStatus() {
|
|
|
4485
4622
|
* session/group leader, so signalling the NEGATIVE pid reaches every process in
|
|
4486
4623
|
* its group (bwrap + the CLI). We hit the group first, then the pty leader.
|
|
4487
4624
|
*/
|
|
4625
|
+
/**
|
|
4626
|
+
* Give bwrap a moment to build its namespace, then report stale binds.
|
|
4627
|
+
*
|
|
4628
|
+
* Polls because the mounts do not exist at the instant node-pty returns the
|
|
4629
|
+
* pid — bwrap is still setting them up. Bounded and fail-open: if the process
|
|
4630
|
+
* dies, is not Linux, or simply never shows the mounts, we report nothing and
|
|
4631
|
+
* the session proceeds exactly as it did before this check existed.
|
|
4632
|
+
*/
|
|
4633
|
+
async function staleBindsAfterSpawn(pid) {
|
|
4634
|
+
const paths = criticalBindPaths();
|
|
4635
|
+
if (paths.length === 0)
|
|
4636
|
+
return [];
|
|
4637
|
+
for (let attempt = 0; attempt < 8; attempt++) {
|
|
4638
|
+
await new Promise(r => setTimeout(r, 75));
|
|
4639
|
+
const stale = findStaleBinds(pid, paths);
|
|
4640
|
+
if (stale.length > 0)
|
|
4641
|
+
return stale;
|
|
4642
|
+
}
|
|
4643
|
+
return [];
|
|
4644
|
+
}
|
|
4488
4645
|
function killSessionTree(ptyProcess, signal) {
|
|
4489
4646
|
const pid = ptyProcess.pid;
|
|
4490
4647
|
if (typeof pid === 'number' && pid > 1) {
|
|
@@ -4506,6 +4663,14 @@ export function terminateSession(sessionId) {
|
|
|
4506
4663
|
const targets = sessionId
|
|
4507
4664
|
? (sessions.has(sessionId) ? [sessions.get(sessionId)] : [])
|
|
4508
4665
|
: [...sessions.values()];
|
|
4666
|
+
// Captured before the loop kills them: a reaped or force-ended assisted
|
|
4667
|
+
// session still has to report, or its item stays `in_progress` forever and
|
|
4668
|
+
// the whole run is wedged behind a terminal nobody is sitting at.
|
|
4669
|
+
const ended = targets.map(t => ({
|
|
4670
|
+
sessionId: t.sessionId,
|
|
4671
|
+
workingDirectory: t.workingDirectory,
|
|
4672
|
+
assisted: t.assisted,
|
|
4673
|
+
}));
|
|
4509
4674
|
for (const s of targets) {
|
|
4510
4675
|
const { sessionId: sid, channel, startTime, ptyProcess } = s;
|
|
4511
4676
|
const duration = Date.now() - startTime;
|
|
@@ -4529,8 +4694,11 @@ export function terminateSession(sessionId) {
|
|
|
4529
4694
|
// because we already removed the session above
|
|
4530
4695
|
sendSessionEnded(channel, sid, -1, duration).catch(() => { });
|
|
4531
4696
|
}
|
|
4532
|
-
// Drain any queued prompts once
|
|
4533
|
-
|
|
4534
|
-
|
|
4697
|
+
// Drain any queued prompts after terminating, once per session so an
|
|
4698
|
+
// assisted envelope is never dropped when several are killed together.
|
|
4699
|
+
if (onSessionEndedCallback) {
|
|
4700
|
+
for (const info of ended)
|
|
4701
|
+
onSessionEndedCallback(info);
|
|
4702
|
+
}
|
|
4535
4703
|
}
|
|
4536
4704
|
//# sourceMappingURL=executor.js.map
|