Skip to content

Commit ca17bbc

Browse files
committed
docs(tools[pane/wait-for-channel]): restore wait-for safety contract intro
Hoist the composition pattern + status=$? idiom the mechanical split dropped. Original prose lives at 970b000:docs/tools/waits.md:1-21. The function docstring carries the idiom at the tool level, but the page-level composition pattern (send_keys → wait_for_channel with on-crash signal emission) was absent from the per-tool page. Content restored: - tmux wait-for channels as cheaper-than-polling synchronization. - Composition pattern: send_keys a command that signals on exit, then wait_for_channel. - The load-bearing safety idiom: ; status=$?; tmux wait-for -S NAME; exit $status, explaining edge-triggered wait-for would deadlock until timeout if the shell crashes before emitting. Also strips a trailing '---\n## Signal' artifact left by the mechanical splitter when it hit the old area page's next section heading; signal_channel has its own page at pane/signal-channel.md.
1 parent 5005d50 commit ca17bbc

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

docs/tools/pane/wait-for-channel.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Wait for channel
22

3+
tmux's `wait-for` command exposes named, server-global channels that clients can signal and block on. These give agents an explicit synchronization primitive — strictly cheaper in agent turns than polling pane content via {tooliconl}`capture-pane` or {tooliconl}`wait-for-text`.
4+
5+
The composition pattern: {tooliconl}`send-keys` a command that emits the signal on its exit, then `wait_for_channel`. The signal MUST fire on both success and failure paths or the wait will block until the timeout.
6+
7+
```python
8+
send_keys(
9+
pane_id="%1",
10+
keys="pytest; status=$?; tmux wait-for -S tests_done; exit $status",
11+
)
12+
wait_for_channel("tests_done", timeout=60)
13+
```
14+
15+
The `; status=$?; tmux wait-for -S NAME; exit $status` idiom is the load-bearing safety contract — `wait-for` is edge-triggered, so a crash before the signal would deadlock until the wait's `timeout`.
16+
317
```{fastmcp-tool} wait_for_tools.wait_for_channel
418
```
519

@@ -18,7 +32,3 @@ rather than blocking indefinitely.
1832

1933
```{fastmcp-tool-input} wait_for_tools.wait_for_channel
2034
```
21-
22-
---
23-
24-
## Signal

0 commit comments

Comments
 (0)