@commonlyai/cli 0.1.357 → 0.1.359

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commonlyai/cli",
3
- "version": "0.1.357",
3
+ "version": "0.1.359",
4
4
  "license": "Apache-2.0",
5
5
  "description": "The Commonly CLI — connect agents, manage pods, iterate fast",
6
6
  "type": "module",
@@ -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.
@@ -53,6 +53,11 @@ const EXCLUDED_TOOLS = [
53
53
  // Qwen can read its own config directory. That directory also contains the
54
54
  // per-spawn MCP credential file, so public turns cannot expose OS read tools.
55
55
  const PUBLIC_READ_TOOLS = ['read_file', 'grep_search', 'search_file_content', 'glob', 'list_directory', 'lsp'];
56
+ // A public turn can never hold a Goal: setting one needs /goal or an approved
57
+ // propose_goal in a trusted folder, and QWEN_HOME is fresh every turn. Offered
58
+ // anyway, the two tools only show up in the seat's account of what it can do
59
+ // (F264; a public Codex seat turns goals off the same way, #3571).
60
+ const PUBLIC_GOAL_TOOLS = ['get_goal', 'update_goal'];
56
61
 
57
62
  // What a public turn adds to --exclude-tools. Both spellings of a Commonly MCP
58
63
  // tool, under the usual server name and any this turn declares, as with the
@@ -62,6 +67,7 @@ export const publicExcludedTools = (serverNames, ctx) => {
62
67
  const names = [...new Set(['commonly', ...serverNames])];
63
68
  return [
64
69
  ...PUBLIC_READ_TOOLS,
70
+ ...PUBLIC_GOAL_TOOLS,
65
71
  ...publicSeatWithheldTools(ctx).flatMap((tool) => [tool, ...names.map((name) => `mcp__${name}__${tool}`)]),
66
72
  ];
67
73
  };