@commonlyai/cli 0.1.357 → 0.1.358
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 +1 -1
- package/src/lib/adapters/codex.js +29 -0
package/package.json
CHANGED
|
@@ -398,6 +398,33 @@ const publicCodexHomesRoot = (ctx) => {
|
|
|
398
398
|
return root;
|
|
399
399
|
};
|
|
400
400
|
|
|
401
|
+
// F186: Codex on Linux refuses to create its sandbox helper under the temp
|
|
402
|
+
// folder it sees ("Refusing to create helper binaries under temporary dir"),
|
|
403
|
+
// so a seat whose home lands there (HOME or XDG_STATE_HOME under /tmp, as on
|
|
404
|
+
// a CI box or a throwaway container) failed every turn before the model, and
|
|
405
|
+
// three of those opened the circuit. Codex's temp folder is its own TMPDIR,
|
|
406
|
+
// else /tmp, compared as written; the real paths are compared as well, so a
|
|
407
|
+
// link either way is refused too. `_codexTempRoot` replaces it in tests.
|
|
408
|
+
// Linux only: Codex on macOS ran from a home under $TMPDIR (codex-cli 0.162.1,
|
|
409
|
+
// measured 2026-11-12), and walk recipes there often put HOME in the temp folder.
|
|
410
|
+
const codexTempRoot = (ctx, childEnv) => {
|
|
411
|
+
if (ctx._codexTempRoot !== undefined) return ctx._codexTempRoot;
|
|
412
|
+
const fromEnv = childEnv?.TMPDIR;
|
|
413
|
+
return fromEnv && isAbsolute(fromEnv) ? fromEnv : '/tmp';
|
|
414
|
+
};
|
|
415
|
+
|
|
416
|
+
const refuseCodexHomeUnderTemp = async (ctx, childEnv, home, seat) => {
|
|
417
|
+
if ((ctx._platform || process.platform) !== 'linux') return;
|
|
418
|
+
const root = codexTempRoot(ctx, childEnv);
|
|
419
|
+
const [realRoot, realHome] = await Promise.all([realpathOfNearest(root), realpathOfNearest(home)]);
|
|
420
|
+
if (!contains(pathResolve(root), pathResolve(home)) && !contains(realRoot, realHome)) return;
|
|
421
|
+
throw Object.assign(new Error(
|
|
422
|
+
`the ${seat} Codex home (${home}) is inside the temporary folder ${root}, where Codex refuses to set up `
|
|
423
|
+
+ 'its sandbox helper, so every turn would stop before the model. Set XDG_STATE_HOME (or HOME) to a folder '
|
|
424
|
+
+ `outside ${root} and start the agent again.`,
|
|
425
|
+
), { code: 'codex_home_under_temp' });
|
|
426
|
+
};
|
|
427
|
+
|
|
401
428
|
// An XDG_STATE_HOME under ~/.commonly throws above, and that tree is denied anyway.
|
|
402
429
|
const privatePublicHomesDeny = (ctx) => {
|
|
403
430
|
if ((ctx._platform || process.platform) !== 'linux') return [];
|
|
@@ -503,6 +530,7 @@ const preparePrivateCodexHome = async (ctx, childEnv) => {
|
|
|
503
530
|
+ `${contains(realSource, realHome) ? `the shared Codex home (${source})` : join(userHome, '.commonly')}, `
|
|
504
531
|
+ 'which its sandbox denies on Linux. Point XDG_STATE_HOME elsewhere or unset it.');
|
|
505
532
|
}
|
|
533
|
+
if (!ctx._privateCodexHome) await refuseCodexHomeUnderTemp(ctx, childEnv, home, 'private');
|
|
506
534
|
await mkdir(home, { recursive: true, mode: 0o700 });
|
|
507
535
|
await chmod(home, 0o700);
|
|
508
536
|
for (const name of PRIVATE_HOME_LINKS) {
|
|
@@ -558,6 +586,7 @@ const preparePublicCodexHome = async (ctx, childEnv, { login = true } = {}) => {
|
|
|
558
586
|
const home = ctx._homeDir || homedir();
|
|
559
587
|
const [realRoot, realCommonly] = await Promise.all([realpathOfNearest(homesRoot), realpathOfNearest(join(home, '.commonly'))]);
|
|
560
588
|
if (contains(realCommonly, realRoot)) throw stateHomeUnderCommonly(ctx, home);
|
|
589
|
+
await refuseCodexHomeUnderTemp(ctx, childEnv, publicHome, 'public');
|
|
561
590
|
const workspacePath = pathResolve(ctx.cwd || process.cwd());
|
|
562
591
|
const [workspace, realHome] = await Promise.all([
|
|
563
592
|
// As in realpathOfNearest: only a missing workspace falls back to its own path.
|