You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Closes the parity gap with libtmux's ``Pane.respawn(environment=)``
on the ``tmux-parity`` branch. The new ``environment: dict[str, str]``
parameter on ``respawn_pane`` maps to one ``-e KEY=VALUE`` flag per
entry (single-arg ``-e<KEY>=<VAL>`` form, mirroring upstream's
emitter — tmux's ``cmd-respawn-pane.c`` accepts both joined and split
forms but upstream uses joined). The stopgap comment is updated to
include ``-e`` so the eventual swap to ``pane.respawn(environment=)``
is a single internal change.
Audit-log redaction is extended to recognise dict-shaped sensitive
args. Each ``environment`` *value* is replaced by a ``{len,
sha256_prefix}`` digest while keys remain visible (env var names
like ``DATABASE_URL`` are operator-debug-useful; values are the
secret). The same OS-process-table caveat as ``shell`` applies and
is documented in ``docs/topics/safety.md`` under the ``respawn_pane``
subsection — the audit log redacts, but ``ps`` may still observe the
flag string briefly before the spawned process inherits the env.
Tests cover the new redaction shape (`tests/test_middleware.py`) and
the runtime propagation path (`tests/test_pane_tools.py` —
``printenv`` under ``remain-on-exit`` so the assertion runs against
captured pane content, with ``capture-pane -S -50`` to read enough
scrollback even on a small pane).
Copy file name to clipboardExpand all lines: docs/tools/pane/respawn-pane.md
+20-1Lines changed: 20 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,8 @@ process, bad terminal mode) and you need a clean restart *without*
8
8
destroying the `pane_id` references other tools or callers may still
9
9
be holding. With `kill=True` (the default) tmux kills the current
10
10
process first; optional `shell` relaunches with a different command;
11
-
optional `start_directory` sets its cwd.
11
+
optional `start_directory` sets its cwd; optional `environment` adds
12
+
per-process env vars (one `-e KEY=VALUE` flag per entry).
12
13
13
14
**Avoid when** the pane genuinely needs to go away — use
14
15
{tooliconl}`kill-pane` instead. Also avoid when you want to change
@@ -48,6 +49,24 @@ time).
48
49
}
49
50
```
50
51
52
+
**Example — relaunch with extra environment variables:**
53
+
54
+
```json
55
+
{
56
+
"tool": "respawn_pane",
57
+
"arguments": {
58
+
"pane_id": "%5",
59
+
"shell": "pytest -x",
60
+
"environment": {
61
+
"PYTHONPATH": "/home/user/project/src",
62
+
"DATABASE_URL": "postgres://localhost/test"
63
+
}
64
+
}
65
+
}
66
+
```
67
+
68
+
The audit log redacts each `environment`*value* via `{len, sha256_prefix}` digests but keeps the keys visible (env var names like `DATABASE_URL` are operator-debug-useful, while their values are the secret). Note that values may still appear briefly in the OS process table while tmux spawns the new process — see {ref}`safety` for details.
Copy file name to clipboardExpand all lines: docs/topics/safety.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,6 +104,7 @@ Mitigations:
104
104
105
105
-`pane_id` is required (no fallback to "first pane in session/window"). Agents that pass only `session_name` get a `ToolError` instead of an unintended kill — resolve via {tool}`list-panes` first.
106
106
- Any `shell` argument is briefly visible in the OS process table and tmux's `pane_current_command` metadata before the spawned shell takes over; the audit log redacts `shell` payloads (see below), but do not pass credentials directly even with redaction.
107
+
- The optional `environment` argument (`dict[str, str]`) maps to one tmux `-e KEY=VALUE` flag per item. The audit log redacts each *value* via a `{len, sha256_prefix}` digest while keeping the *keys* visible — env var names like `DATABASE_URL` are usually operator-debug-useful, but their values are the secret. The same OS-process-table caveat as `shell` applies: `respawn-pane -e DB_PASSWORD=...` may briefly appear in `ps` output before the spawned process inherits the env.
107
108
- The same self-pane guard that protects the destructive kill commands also refuses to respawn the pane running the MCP server.
108
109
109
110
### `send_keys` / `paste_text`
@@ -118,7 +119,7 @@ Every tool call emits one `INFO` record on the `libtmux_mcp.audit` logger carryi
118
119
-`outcome` — `ok` or `error`, with `error_type` on failure
119
120
-`duration_ms`
120
121
-`client_id` / `request_id` — from the fastmcp context when available
121
-
-`args` — a summary of arguments. Sensitive keys (`keys`, `text`, `value`, `content`, `shell`) are replaced by `{len, sha256_prefix}`; non-sensitive strings over 200 characters are truncated.
122
+
-`args` — a summary of arguments. Sensitive scalar keys (`keys`, `text`, `value`, `content`, `shell`) are replaced by `{len, sha256_prefix}`; the dict-shaped sensitive key `environment` keeps its keys but digests each value individually. Non-sensitive strings over 200 characters are truncated.
122
123
123
124
Route this logger to a dedicated sink if you want a durable audit trail; it is deliberately namespaced separately from the main `libtmux_mcp` logger.
0 commit comments