@commonlyai/cli 0.1.365 → 0.1.367
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/package.json
CHANGED
package/src/commands/agent.js
CHANGED
|
@@ -3838,6 +3838,13 @@ export const performRun = ({
|
|
|
3838
3838
|
// The arguments of the turn that just threw, for noticeCutOff.
|
|
3839
3839
|
let failedTurn = null;
|
|
3840
3840
|
let heldRenewTimer = null;
|
|
3841
|
+
// Renews the rows a tick claimed for its later pods while an earlier pod's
|
|
3842
|
+
// turn runs (F237). Cleared when the tick's groups are done.
|
|
3843
|
+
let laterGroupsRenewTimer = null;
|
|
3844
|
+
const clearLaterGroupsRenewal = () => {
|
|
3845
|
+
if (laterGroupsRenewTimer !== null) clearIntervalImpl(laterGroupsRenewTimer);
|
|
3846
|
+
laterGroupsRenewTimer = null;
|
|
3847
|
+
};
|
|
3841
3848
|
const clearHeldRenewal = () => {
|
|
3842
3849
|
if (heldRenewTimer !== null) clearIntervalImpl(heldRenewTimer);
|
|
3843
3850
|
heldRenewTimer = null;
|
|
@@ -4662,8 +4669,70 @@ export const performRun = ({
|
|
|
4662
4669
|
// alongside a wake on the same page, and a private wake groups apart
|
|
4663
4670
|
// from it, so a digest-only group here can be `delivered` to this run.
|
|
4664
4671
|
const claimedAfter = (groupIndex) => groups.slice(groupIndex + 1).flat();
|
|
4672
|
+
// F237 item 1: the page's groups run one turn at a time, and a later
|
|
4673
|
+
// group's rows were claimed when the page was read. A turn may run 15
|
|
4674
|
+
// minutes and the server requeues a delivered row after 10, so they are
|
|
4675
|
+
// renewed while an earlier group runs. A row the server says is no
|
|
4676
|
+
// longer this runner's is taken out before its group starts: its ack
|
|
4677
|
+
// would be a stale delivery, which stops the run, and the requeue
|
|
4678
|
+
// redelivers it.
|
|
4679
|
+
// Bounded by the running turn's deadline, as processEventBatch bounds
|
|
4680
|
+
// its own renewal: a turn whose child ignores SIGTERM can hang, and the
|
|
4681
|
+
// rows behind it must lapse to the requeue rather than stay with it.
|
|
4682
|
+
let firstWaitingGroup = 1;
|
|
4683
|
+
let runningGroupSince = Date.now();
|
|
4684
|
+
let deadlineLogged = false;
|
|
4685
|
+
// One renewal at a time. A group's turn waits for one still out, so the
|
|
4686
|
+
// groups it names have not started when its answer is applied
|
|
4687
|
+
// (CodeRabbit on #4067).
|
|
4688
|
+
let renewingLater = null;
|
|
4689
|
+
clearLaterGroupsRenewal();
|
|
4690
|
+
if (groups.length > 1) {
|
|
4691
|
+
laterGroupsRenewTimer = setIntervalImpl(async () => {
|
|
4692
|
+
if (!running) {
|
|
4693
|
+
clearLaterGroupsRenewal();
|
|
4694
|
+
return;
|
|
4695
|
+
}
|
|
4696
|
+
if (renewingLater) return;
|
|
4697
|
+
// Skipped, not stopped: the next group restarts the clock, and its
|
|
4698
|
+
// turn needs the rows behind it renewed again.
|
|
4699
|
+
if (Date.now() - runningGroupSince >= effectiveTurnTimeoutMs) {
|
|
4700
|
+
if (!deadlineLogged) {
|
|
4701
|
+
deadlineLogged = true;
|
|
4702
|
+
log('[inbox.batch] turn deadline reached; renewal of the later pods\' rows paused while this turn overruns');
|
|
4703
|
+
}
|
|
4704
|
+
return;
|
|
4705
|
+
}
|
|
4706
|
+
const from = firstWaitingGroup;
|
|
4707
|
+
renewingLater = (async () => {
|
|
4708
|
+
const confirmed = await renewHeldDeliveries(claimedAfter(from - 1));
|
|
4709
|
+
if (confirmed === null) return;
|
|
4710
|
+
let lost = 0;
|
|
4711
|
+
for (let later = from; later < groups.length; later += 1) {
|
|
4712
|
+
const kept = groups[later].filter((event) => stillHeld(event, confirmed));
|
|
4713
|
+
lost += groups[later].length - kept.length;
|
|
4714
|
+
groups[later] = kept;
|
|
4715
|
+
}
|
|
4716
|
+
if (lost) {
|
|
4717
|
+
log(
|
|
4718
|
+
`[inbox.batch] ${countEvents(lost)} no longer held by this runner on the server while `
|
|
4719
|
+
+ 'another pod\'s turn ran — not run; the server redelivers it',
|
|
4720
|
+
);
|
|
4721
|
+
}
|
|
4722
|
+
})().finally(() => { renewingLater = null; });
|
|
4723
|
+
await renewingLater;
|
|
4724
|
+
}, DELIVERY_RENEW_INTERVAL_MS);
|
|
4725
|
+
laterGroupsRenewTimer?.unref?.();
|
|
4726
|
+
}
|
|
4665
4727
|
for (let groupIndex = 0; groupIndex < groups.length; groupIndex += 1) {
|
|
4728
|
+
// renewHeldDeliveries never throws: a failed renewal resolves null.
|
|
4729
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4730
|
+
if (renewingLater) await renewingLater;
|
|
4731
|
+
firstWaitingGroup = groupIndex + 1;
|
|
4732
|
+
runningGroupSince = Date.now();
|
|
4733
|
+
deadlineLogged = false;
|
|
4666
4734
|
const group = groups[groupIndex];
|
|
4735
|
+
if (group.length === 0) continue;
|
|
4667
4736
|
if (!running) {
|
|
4668
4737
|
// Claimed by this tick's poll (or carried into it) and never run:
|
|
4669
4738
|
// a stop that arrived mid-poll or mid-page (F182). Handed back when
|
|
@@ -5001,6 +5070,7 @@ export const performRun = ({
|
|
|
5001
5070
|
}
|
|
5002
5071
|
onError?.(err);
|
|
5003
5072
|
}
|
|
5073
|
+
clearLaterGroupsRenewal();
|
|
5004
5074
|
// Notices landing during a turn share one three-second collection window
|
|
5005
5075
|
// before the next inbox read, independent of the idle polling cadence. A
|
|
5006
5076
|
// retry scheduled in the same tick keeps its own delay: the failure report
|
|
@@ -1404,16 +1404,31 @@ const CODEX_PROVIDER_KEY_ENVS = [
|
|
|
1404
1404
|
// What the turn will launch, asked for its version. 30 s, as in goose: a first
|
|
1405
1405
|
// launch after an upgrade can be slow. A failed probe isn't cached, so the next
|
|
1406
1406
|
// turn reads it again. `_codexVersion` and `_versionProbe` are test seams only.
|
|
1407
|
+
//
|
|
1408
|
+
// A Codex that can't be launched at all throws what the turn's own launch would
|
|
1409
|
+
// (F262), so the pod hears that it won't start, not that it needs upgrading.
|
|
1410
|
+
// "Can't be launched" is the probe's own ENOENT, the error execFile and the
|
|
1411
|
+
// turn's spawn share: a codex found any way the OS finds it (a relative PATH
|
|
1412
|
+
// entry, PATH unset) but exiting non-zero is a version refusal.
|
|
1407
1413
|
const readCodexVersion = async (ctx, env) => {
|
|
1408
1414
|
if (ctx._codexVersion !== undefined) return ctx._codexVersion;
|
|
1415
|
+
const { command, args } = resolveLaunch('codex', [], { env, ...ctx._commandResolution });
|
|
1416
|
+
let notFound = false;
|
|
1417
|
+
let version = null;
|
|
1409
1418
|
try {
|
|
1410
|
-
|
|
1411
|
-
return await probeVersion(command, {
|
|
1419
|
+
version = await probeVersion(command, {
|
|
1412
1420
|
args, env, timeoutMs: 30000, parse: parseCodexVersion, ...ctx._versionProbe,
|
|
1421
|
+
onError: (error) => { if (error?.code === 'ENOENT') notFound = true; },
|
|
1413
1422
|
});
|
|
1414
1423
|
} catch {
|
|
1415
|
-
|
|
1424
|
+
version = null;
|
|
1425
|
+
}
|
|
1426
|
+
if (version === null && notFound) {
|
|
1427
|
+
const missing = new Error(`spawn ${command} ENOENT`);
|
|
1428
|
+
missing.code = 'ENOENT';
|
|
1429
|
+
throw missing;
|
|
1416
1430
|
}
|
|
1431
|
+
return version;
|
|
1417
1432
|
};
|
|
1418
1433
|
|
|
1419
1434
|
// `ownGroup`: see runClaude in claude.js.
|
|
@@ -94,9 +94,11 @@ const resolveBinary = (binary, env) => {
|
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
+
// `onError` sees the launch's own error when the probe fails, so a caller can
|
|
98
|
+
// tell a binary that isn't there (ENOENT) from one that ran and refused.
|
|
97
99
|
export const probeVersion = async (binary, {
|
|
98
100
|
args = [], env, timeoutMs = 30000, parse, execFileImpl = childProcess.execFile, cache = versionCache,
|
|
99
|
-
now = Date.now,
|
|
101
|
+
now = Date.now, onError,
|
|
100
102
|
} = {}) => {
|
|
101
103
|
const resolved = args.length ? null : resolveBinary(binary, env);
|
|
102
104
|
const key = resolved?.key || null;
|
|
@@ -104,6 +106,7 @@ export const probeVersion = async (binary, {
|
|
|
104
106
|
if (hit && hit.mtimeMs === resolved.mtimeMs && now() - hit.at < VERSION_CACHE_MAX_AGE_MS) return hit.version;
|
|
105
107
|
const stdout = await new Promise((resolve) => {
|
|
106
108
|
execFileImpl(key || binary, [...args, '--version'], { encoding: 'utf8', env, timeout: timeoutMs }, (error, out) => {
|
|
109
|
+
if (error && onError) onError(error);
|
|
107
110
|
resolve(error ? null : out);
|
|
108
111
|
});
|
|
109
112
|
});
|
|
@@ -48,6 +48,9 @@ const CLAUDE_SIGNED_OUT_WORDINGS = [
|
|
|
48
48
|
];
|
|
49
49
|
const WONT_START_WORDINGS = [
|
|
50
50
|
/^spawn \S+ ENOENT/,
|
|
51
|
+
// windows-command.js resolveLaunch: not on PATH, or a .cmd/.ps1 that only a
|
|
52
|
+
// shell can run. The harness never started, as with ENOENT (F262).
|
|
53
|
+
/^cannot launch \S+ on Windows without a shell: /,
|
|
51
54
|
/^\w+ adapter: \S+ (?:is not set|is missing)/, // the seat has no provider key
|
|
52
55
|
];
|
|
53
56
|
// The vendors' credit wordings open at the adapter's own label or the claude
|