Skip to content

Claude Code. Any Model. The most powerful AI coding agent now speaks every language.

fix(pane): read a binding missing its id or path as unbound

Jack Rudenko5e664f22a2b4
diff --git a/packages/cli/src/pane/gate-binding.ts b/packages/cli/src/pane/gate-binding.ts
index e27b0c44..5dea5120 100644
--- a/packages/cli/src/pane/gate-binding.ts
+++ b/packages/cli/src/pane/gate-binding.ts
@@ -62,11 +62,14 @@ export function checkGateBinding(
const ours = normaliseTranscriptPath(expected.transcriptPath);
const theirs = b?.transcriptPath ? normaliseTranscriptPath(b.transcriptPath) : null;
const differs: string[] = [];
- if (b?.bound !== "named") differs.push(`bound ${b?.boundRaw ?? "none"}`);
+ // A `named` claim missing its session id or path parses `unbound`; the missing field is
+ // named below, so `bound named` is not listed as a difference of its own.
+ if (b?.bound !== "named" && b?.boundRaw !== "named")
+ differs.push(`bound ${b?.boundRaw ?? "none"}`);
if (b?.sessionId !== expected.sessionUuid)
differs.push(`sessionId ${b?.sessionId ?? "none"}, not ${expected.sessionUuid}`);
if (theirs !== ours) differs.push(`transcriptPath ${theirs ?? "none"}, not ${ours}`);
- if (differs.length === 0) return { ok: true };
+ if (b?.bound === "named" && differs.length === 0) return { ok: true };
return {
ok: false,
detail: `input_gate_unbound: magmux ${v} bound pane 0 to ${theirs ?? "none"} (${b?.boundRaw ?? "none"}), not ${ours}: ${differs.join("; ")}`,
diff --git a/packages/cli/src/pane/input-gate.ts b/packages/cli/src/pane/input-gate.ts
index 528909c7..34cfe303 100644
--- a/packages/cli/src/pane/input-gate.ts
+++ b/packages/cli/src/pane/input-gate.ts
@@ -79,7 +79,7 @@ export interface GateInput {
receivedAt: number;
}
-/** How magmux bound pane 0 to a transcript. `unbound`: the field is absent or unknown. */
+/** How magmux bound pane 0 to a transcript. `unbound`: a field is absent, or `bound` is unknown. */
export type GateBindingKind = "named" | "prompt" | "mtime" | "unbound";
/**
@@ -136,19 +136,22 @@ export function gateBasisOf(listResult: unknown): "direct" | "declared" | null {
return basis === "direct" || basis === "declared" ? basis : null;
}
-/** null: no pane 0. Otherwise the binding, `unbound` when magmux published no binding. */
+/**
+ * null: no pane 0. Otherwise the binding: `unbound` when `bound`, `sessionId` or
+ * `transcriptPath` is missing, or `bound` is unknown (R1.8, U4). A row claiming
+ * `bound: "named"` without a session id or path binds nothing; `boundRaw` keeps the claim.
+ */
export function parseGateBinding(listResult: unknown): GateBinding | null {
const row = paneZero(listResult);
if (!row) return null;
const boundRaw = str(row.bound);
- const bound: GateBindingKind =
- boundRaw === "named" || boundRaw === "prompt" || boundRaw === "mtime" ? boundRaw : "unbound";
- return {
- bound,
- boundRaw,
- sessionId: str(row.sessionId),
- transcriptPath: str(row.transcriptPath),
- };
+ const sessionId = str(row.sessionId);
+ const transcriptPath = str(row.transcriptPath);
+ let bound: GateBindingKind = "unbound";
+ if (sessionId && transcriptPath) {
+ if (boundRaw === "named" || boundRaw === "prompt" || boundRaw === "mtime") bound = boundRaw;
+ }
+ return { bound, boundRaw, sessionId, transcriptPath };
}
// ── the send reply ───────────────────────────────────────────────────────────