Skip to content

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

fix(pane): start pane children with Claude Code's native cursor

Jack Rudenko626586617143
diff --git a/ai-docs/architecture/pane-session.md b/ai-docs/architecture/pane-session.md
index f377ebb5..ab28b435 100644
--- a/ai-docs/architecture/pane-session.md
+++ b/ai-docs/architecture/pane-session.md
@@ -626,7 +626,9 @@ run the user's profile.
- **Added:** `COLUMNS`/`LINES` at the launch size (160×50 unless a size was requested while the
pane was starting; they are not updated by a later resize — "Terminal size" below), the slot's `CLAUDISH_TOKEN_FILE` and
`CLAUDISH_UPSTREAM_ERROR_LOG`, and `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1` when the owner left
- it unset (it suppresses side calls billed on the routed model).
+ it unset (it suppresses side calls billed on the routed model), with `CLAUDE_CODE_NATIVE_CURSOR=1`
+ under the same rule (traffic off makes Claude self-draw a reverse-video cursor on the faint
+ placeholder, which the input gate reads as `box_not_empty`).
- **`MAGMUX_*` survives in the child.** magmux injects `MAGMUX_SOCK` into the pane; it is excluded
from the snapshot and kept when the snapshot is applied, so the child knows it is already inside a
multiplexer and never wraps itself in a second magmux.
diff --git a/packages/cli/src/pane/pane-launch.test.ts b/packages/cli/src/pane/pane-launch.test.ts
index 61d6ba49..ea31ea58 100644
--- a/packages/cli/src/pane/pane-launch.test.ts
+++ b/packages/cli/src/pane/pane-launch.test.ts
@@ -175,6 +175,69 @@ describe("pane environment", () => {
expect(magmuxEnv.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC).toBe("0");
});
+ // REGRESSION: pane child boot_timeout — self-drawn cursor on the placeholder read as typed text — /dev:fix session dev-fix-20261017-g10-socket
+ test("CLAUDE_CODE_NATIVE_CURSOR defaults to 1 alongside the traffic default", () => {
+ const { magmuxEnv } = buildPaneEnv({
+ parentEnv,
+ slotEnv: {},
+ cwd: "/c",
+ ctlDir: "/r/launch-AAAAAA",
+ });
+ expect(magmuxEnv.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC).toBe("1");
+ expect(magmuxEnv.CLAUDE_CODE_NATIVE_CURSOR).toBe("1");
+ expect(JSON.parse(magmuxEnv.CLAUDISH_PANE_ENV as string).CLAUDE_CODE_NATIVE_CURSOR).toBe("1");
+ });
+
+ // REGRESSION: pane child boot_timeout — self-drawn cursor on the placeholder read as typed text — /dev:fix session dev-fix-20261017-g10-socket
+ test("a caller's own CLAUDE_CODE_NATIVE_CURSOR is kept as given", () => {
+ const { magmuxEnv } = buildPaneEnv({
+ parentEnv: { ...parentEnv, CLAUDE_CODE_NATIVE_CURSOR: "yes" },
+ slotEnv: {},
+ cwd: "/c",
+ ctlDir: "/r/launch-AAAAAA",
+ });
+ expect(magmuxEnv.CLAUDE_CODE_NATIVE_CURSOR).toBe("yes");
+ });
+
+ test("the native cursor defaults to 1 when the caller turned traffic off itself", () => {
+ const { magmuxEnv } = buildPaneEnv({
+ parentEnv: { ...parentEnv, CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: "1" },
+ slotEnv: {},
+ cwd: "/c",
+ ctlDir: "/r/launch-AAAAAA",
+ });
+ expect(magmuxEnv.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC).toBe("1");
+ expect(magmuxEnv.CLAUDE_CODE_NATIVE_CURSOR).toBe("1");
+ });
+
+ // REGRESSION: pane child boot_timeout — self-drawn cursor on the placeholder read as typed text — /dev:fix session dev-fix-20261017-g10-socket
+ test("the slot env overrides both pane defaults and the parent's values", () => {
+ const slotEnv = {
+ CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: "slot-traffic",
+ CLAUDE_CODE_NATIVE_CURSOR: "slot-cursor",
+ };
+ const fromDefault = buildPaneEnv({
+ parentEnv,
+ slotEnv,
+ cwd: "/c",
+ ctlDir: "/r/launch-AAAAAA",
+ }).magmuxEnv;
+ expect(fromDefault.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC).toBe("slot-traffic");
+ expect(fromDefault.CLAUDE_CODE_NATIVE_CURSOR).toBe("slot-cursor");
+ const fromParent = buildPaneEnv({
+ parentEnv: {
+ ...parentEnv,
+ CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: "parent-traffic",
+ CLAUDE_CODE_NATIVE_CURSOR: "parent-cursor",
+ },
+ slotEnv,
+ cwd: "/c",
+ ctlDir: "/r/launch-AAAAAA",
+ }).magmuxEnv;
+ expect(fromParent.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC).toBe("slot-traffic");
+ expect(fromParent.CLAUDE_CODE_NATIVE_CURSOR).toBe("slot-cursor");
+ });
+
test("Linux refuses a snapshot over 131,000 bytes; macOS has no per-string limit", () => {
const big = { ...parentEnv, BIG: "x".repeat(LINUX_ENV_STRING_LIMIT) };
expect(() =>
diff --git a/packages/cli/src/pane/pane-launch.ts b/packages/cli/src/pane/pane-launch.ts
index 51fed3cd..e0b8b87d 100644
--- a/packages/cli/src/pane/pane-launch.ts
+++ b/packages/cli/src/pane/pane-launch.ts
@@ -196,8 +196,17 @@ export function buildPaneEnv(input: PaneEnvInput): { magmuxEnv: Record<string, s
}
env.COLUMNS = String(input.cols ?? DEFAULT_PANE_COLS);
env.LINES = String(input.rows ?? DEFAULT_PANE_ROWS);
+ // Two independent defaults; a caller's own value of either is kept. Each is checked on
+ // its own, because a caller that turns traffic off itself still needs the cursor
+ // default. Traffic off leaves Claude Code's tengu_native_cursor flag at its default
+ // false, so Claude draws
+ // its own reverse-video cursor on the first rune of the faint "Try …" placeholder,
+ // which magmux's input gate reads as text in the box (box_not_empty) and boot never
+ // becomes ready. CLAUDE_CODE_NATIVE_CURSOR restores the terminal's native cursor;
+ // Claude Code reads it as set or unset, so any non-empty value (even "0") turns it on.
if (input.parentEnv.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC === undefined)
env.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC = "1";
+ if (input.parentEnv.CLAUDE_CODE_NATIVE_CURSOR === undefined) env.CLAUDE_CODE_NATIVE_CURSOR = "1";
Object.assign(env, input.slotEnv);
env[ENV.CLAUDISH_PANE_CHILD] = "1";
env[ENV.CLAUDISH_PANE_CWD] = input.cwd;