@tranhoangnguyen0310/pi-flow-external 2.4.0-external.0 → 2.4.1-external.0

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/CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@ All notable changes to pi-flow external are documented here.
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## [2.4.1-external.0] - 2026-09-23
8
+
9
+ ### Fixed
10
+
11
+ - Muse rejects effective `thinking: off` before process launch because its `meta` provider does not support `--reasoning-effort none`. The error explains supported profile/parent levels without silently changing reasoning (#60).
12
+ - Grok runtime-socket symlink sandbox failures include actionable guidance while retaining the original error, requested permissions, and fail-closed behavior. No socket changes, retries, or sandbox downgrade (#61).
13
+ - Added an offline test of the actual Pi `openai-completions` provider payload for optional tool selectors. Client optionality is preserved; the downstream model-facing conversion remains unresolved and tracked in #62. See `docs/tool-schema-compatibility.md`.
14
+
7
15
  ## [2.4.0-external.0] - 2026-09-21
8
16
 
9
17
  Adds `muse` as a fifth external CLI backend, delegating to Muse Code alongside Claude Code, Codex CLI, Antigravity, and Grok Build CLI. Investigation notes: `docs/plans/muse-backend-prep.md`; ex-ante design issue: none filed — additive backend addition following the same shape as the Grok backend.
@@ -51,7 +51,9 @@ Defaults:
51
51
 
52
52
  Override with `--model`/`--thinking`. Use `--keep` only when evidence inspection is necessary; it preserves sensitive output and the temporary profile path printed by the runner.
53
53
 
54
- Grok's `readonly`/`edit` tiers run under its own kernel sandbox (`--sandbox read-only`/`workspace`). On a macOS host where `/var/run/docker.sock` resolves to a symlink, sandbox startup can fail closed before the child even runs the prompt — that is expected fail-closed behavior, not a bug; verify enforcement on Linux, or adjust the host's Docker socket if you need to reproduce it locally on macOS.
54
+ Grok's `readonly`/`edit` tiers run under its own kernel sandbox (`--sandbox read-only`/`workspace`). Grok 1.0.40 on macOS can refuse startup with `sandbox could not be applied: socket deny resolution failed: could not resolve runtime-socket deny path /var/run/docker.sock: endpoint is a symlink`. This is an upstream CLI/environment incompatibility, not proof that the adapter's sandbox flags are wrong. The failed receipt retains the diagnostic and requested permission metadata; the adapter never retries with sandbox off. Do **not** remove or alter the Docker socket as a runner workaround. Verify sandbox enforcement on a compatible host or check a newer Grok version with an actual sandboxed invocation, not just `--help`. An explicitly requested `danger` run has no OS isolation and does not validate readonly delegation. Track compatibility and any confirmed upstream fix in [#61](https://github.com/tranhoangnguyen03/pi-flow-external/issues/61); no fixed upstream version has been verified.
55
+
56
+ Muse Code 1.3.0 accepts `none` in help text but its `meta` provider rejects `--reasoning-effort none`. Effective `thinking: off` (including the parent session's inherited default) therefore fails before launch with remediation; it is never silently mapped to minimal. Pin the Muse profile to `minimal`, `low`, `medium`, `high`, or `xhigh`, or select a supported parent thinking level. Removing a profile pin alone does not help when the parent still inherits `off`. Compatibility probes must invoke provider validation, not merely inspect `--help`.
55
57
 
56
58
  Muse's `meta` provider performs its own internal retries (observed up to 10 attempts with growing backoff on transient 503/504 errors) entirely inside the `muse` process; this is unrelated to and invisible from this extension's own no-auto-retry contract, and shows up only as activity narration (e.g. "retrying meta model stream in 60000ms (attempt 3/10)"). A run that never reports usage/cost is expected — Muse has never been observed to report either.
57
59
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tranhoangnguyen0310/pi-flow-external",
3
- "version": "2.4.0-external.0",
3
+ "version": "2.4.1-external.0",
4
4
  "description": "External Claude Code, Codex CLI, Antigravity, Grok Build CLI, and Muse Code delegation for pi.",
5
5
  "type": "module",
6
6
  "main": "./index.ts",
package/src/core/grok.ts CHANGED
@@ -274,6 +274,29 @@ export function extractGrokError(event: Record<string, unknown>): string | undef
274
274
  return undefined;
275
275
  }
276
276
 
277
+ /**
278
+ * Produces an actionable diagnosis when Grok's kernel sandbox refuses to start
279
+ * because a runtime socket deny path is a symlink.
280
+ *
281
+ * Preserves the exact stderr and explains:
282
+ * - Upstream Grok sandbox initialization failed because a runtime socket deny path is a symlink.
283
+ * - The socket must NOT be removed or altered as a runner workaround.
284
+ * - pi-flow-external preserves requested sandbox permissions and will never automatically downgrade
285
+ * or retry with protections disabled.
286
+ * - Recommends running on a compatible host or upgrading to an upstream Grok release.
287
+ */
288
+ export function diagnoseGrokSandboxError(stderr: string): string | undefined {
289
+ if (!stderr.includes("runtime-socket deny path") || !stderr.includes("endpoint is a symlink")) {
290
+ return undefined;
291
+ }
292
+ return (
293
+ "Grok sandbox initialization failed because a runtime socket deny path is a symlink. " +
294
+ "Do not remove or alter the socket as a runner workaround. " +
295
+ "pi-flow-external preserves requested sandbox permissions and will not automatically downgrade or retry with protections disabled. " +
296
+ "Run on a compatible host or upgrade to an upstream Grok release that resolves socket symlinks."
297
+ );
298
+ }
299
+
277
300
  function getPreviewFromRecord(record: Record<string, unknown>): string {
278
301
  const candidates = [
279
302
  record.command,
@@ -560,8 +583,10 @@ export async function spawnGrokSubagent(params: {
560
583
  }
561
584
  if (closeResult.code !== 0) {
562
585
  const stderr = stderrBuffer.text().trim();
586
+ const diagnostic = diagnoseGrokSandboxError(stderr);
587
+ const diagnosticSuffix = diagnostic ? `\n\nDiagnostic: ${diagnostic}` : "";
563
588
  throw new Error(
564
- `grok exited with code ${closeResult.code}${closeResult.signal ? ` (signal ${closeResult.signal})` : ""}${stderr ? `: ${stderr}` : ""}`,
589
+ `grok exited with code ${closeResult.code}${closeResult.signal ? ` (signal ${closeResult.signal})` : ""}${stderr ? `: ${stderr}` : ""}${diagnosticSuffix}`,
565
590
  );
566
591
  }
567
592
 
package/src/core/muse.ts CHANGED
@@ -21,6 +21,7 @@ import { abortChildTree } from "./process-tree.ts";
21
21
  import { selectorHarness } from "../profiles.ts";
22
22
 
23
23
  const MUSE_COMMAND = "muse";
24
+ const MUSE_PROVIDER = "meta";
24
25
 
25
26
  export type MuseReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh";
26
27
 
@@ -49,6 +50,38 @@ export function normalizeMuseReasoningEffort(thinkingLevel: ThinkingLevel | unde
49
50
  return undefined;
50
51
  }
51
52
 
53
+ /**
54
+ * `muse exec --help` syntactically lists `none` as a valid `--reasoning-effort`
55
+ * value, but `--provider meta` rejects it at launch (verified against
56
+ * installed Muse Code 1.3.0: `--reasoning-effort none is not supported with
57
+ * --provider meta; choose minimal|low|medium|high|xhigh|max|ultra`, exit 2).
58
+ * `thinking: "off"` therefore has no representable effort for this provider —
59
+ * and it is not a rare edge case. `off` is the pinned `pi-agent-core` SDK's
60
+ * own session-level thinking default (`agent.js`/`agent-harness.js`/
61
+ * `session.js`), so any muse call whose profile leaves `thinking` unset
62
+ * inherits `"off"` from the parent session unless a user has explicitly
63
+ * raised it; `pi-subagent.ts`/`workflow/tool.ts` resolve
64
+ * `profile.thinking ?? <session thinking level>` before ever reaching
65
+ * {@link buildMuseArgs}, so a profile pinning `thinking: off` in its own
66
+ * frontmatter reaches this same check the same way. `buildMuseArgs` applies
67
+ * one more `thinkingLevel ?? profile.thinking` fallback of its own (for
68
+ * direct/test callers), so this is checked once on that fully merged,
69
+ * already-normalized value — inherited-default and profile-pinned `off`
70
+ * are indistinguishable by the time they get here, and both are rejected
71
+ * rather than one silently downgraded to `minimal` (a different, undisclosed
72
+ * reasoning level from what was actually requested or inherited).
73
+ */
74
+ function assertMuseReasoningEffortSupported(effort: MuseReasoningEffort | undefined, profileName: string): void {
75
+ if (effort !== "none") {
76
+ return;
77
+ }
78
+ throw new Error(
79
+ `Muse profile "${profileName}" resolved thinking "off", which has no --reasoning-effort equivalent under --provider ${MUSE_PROVIDER} ` +
80
+ `(muse rejects "--reasoning-effort none"). Pin this Muse profile's thinking to minimal, low, medium, high, or xhigh, ` +
81
+ `or select a supported parent thinking level. An unset profile inherits the parent's level, which may still be off.`,
82
+ );
83
+ }
84
+
52
85
  export function buildMuseArgs({
53
86
  promptFilePath,
54
87
  schemaFilePath,
@@ -66,7 +99,10 @@ export function buildMuseArgs({
66
99
  permission?: PermissionTier;
67
100
  resumeSessionId?: string;
68
101
  }): string[] {
69
- const args: string[] = ["exec", "--json", "--provider", "meta", "--workspace", workspace, "--prompt-file", promptFilePath];
102
+ const effort = normalizeMuseReasoningEffort(thinkingLevel ?? profile.thinking);
103
+ assertMuseReasoningEffortSupported(effort, profile.name);
104
+
105
+ const args: string[] = ["exec", "--json", "--provider", MUSE_PROVIDER, "--workspace", workspace, "--prompt-file", promptFilePath];
70
106
  if (schemaFilePath) {
71
107
  args.push("--output-schema", schemaFilePath);
72
108
  }
@@ -77,7 +113,6 @@ export function buildMuseArgs({
77
113
  if (profile.model) {
78
114
  args.push("--model", profile.model);
79
115
  }
80
- const effort = normalizeMuseReasoningEffort(thinkingLevel ?? profile.thinking);
81
116
  if (effort) {
82
117
  args.push("--reasoning-effort", effort);
83
118
  }