rmux-server 0.10.0

Tokio daemon and request dispatcher for the RMUX terminal multiplexer.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
//! A client that declares no size still owns outer terminal geometry.
//!
//! Every consumer of `ActiveAttach::client_size` — the window-size policies,
//! refresh rendering, `switch-client`, destroy-time rehoming — reads it as
//! outer terminal geometry and subtracts the status rows itself. Anchoring a
//! sizeless client to the session's *content* geometry made those consumers
//! subtract the status rows a second time.
//!
//! tmux 3.7b measured 2026-07-31 on macOS 26.5.2 (arm64) with an 80x24 PTY
//! client attached to a session created `-x 80 -y 24`, toggling
//! `status` `2 -> off -> 2 -> off -> 2`:
//!
//! ```text
//! attached 80x24 status=2      window=80x22    client_height=24
//! after status=off             window=80x24    client_height=24
//! after status=2               window=80x22    client_height=24
//! after status=off             window=80x24    client_height=24
//! after status=2               window=80x22    client_height=24
//! tty resized to 80x22         window=80x20    client_height=22
//! ```
//!
//! The client height stays the outer tty height, and the status rows come off
//! it exactly once per reconciliation.

use super::*;

const TERMINAL_SIZE: TerminalSize = TerminalSize { cols: 80, rows: 24 };
const TWO_LINE_CONTENT_SIZE: TerminalSize = TerminalSize { cols: 80, rows: 22 };
const DOUBLE_SUBTRACTED_SIZE: TerminalSize = TerminalSize { cols: 80, rows: 20 };

#[tokio::test]
async fn sizeless_attach_anchors_to_outer_terminal_geometry() {
    let handler = RequestHandler::new();
    let session = session_name("sizeless-anchor");
    let sizeless_pid = 92_101;
    let _declared_rx = seed_two_line_status_geometry(&handler, &session, 92_100).await;

    let _sizeless_rx = register_sizeless_attach(&handler, sizeless_pid, &session).await;

    assert_eq!(
        attached_client_size(&handler, sizeless_pid).await,
        TERMINAL_SIZE,
        "a sizeless client must anchor to the session's outer terminal rows, \
         not to its already status-subtracted content rows"
    );
}

#[tokio::test]
async fn list_clients_reports_the_outer_terminal_height_of_a_sizeless_client() {
    let handler = RequestHandler::new();
    let session = session_name("sizeless-list-clients");
    let sizeless_pid = 92_201;
    let _declared_rx = seed_two_line_status_geometry(&handler, &session, 92_200).await;
    let _sizeless_rx = register_sizeless_attach(&handler, sizeless_pid, &session).await;

    let response = handler
        .handle(Request::ListClients(Box::new(
            rmux_proto::ListClientsRequest {
                format: Some("#{client_pid}|#{client_width}x#{client_height}".to_owned()),
                target_session: Some(session.clone()),
                filter: None,
                sort_order: None,
                reversed: false,
            },
        )))
        .await;
    let Response::ListClients(response) = response else {
        panic!("expected list-clients response");
    };
    let listed = String::from_utf8(response.output.stdout().to_vec()).expect("utf-8");
    // tmux 3.7b reports `client_height` as the outer tty height (24 above),
    // never the status-subtracted content height.
    assert!(
        listed.contains(&format!("{sizeless_pid}|80x24\n")),
        "list-clients must report outer terminal geometry, got {listed:?}"
    );
}

#[tokio::test]
async fn sizeless_attach_status_changes_subtract_status_rows_exactly_once() {
    let handler = RequestHandler::new();
    let session = session_name("sizeless-status-cycle");
    let _declared_rx = seed_two_line_status_geometry(&handler, &session, 92_110).await;

    let _sizeless_rx = register_sizeless_attach(&handler, 92_111, &session).await;

    // Matches the tmux 3.7b measurement in this module's header: the content
    // height tracks the outer terminal height minus the current status rows,
    // and repeated toggles never accumulate.
    for (value, expected) in [
        ("off", TERMINAL_SIZE),
        ("2", TWO_LINE_CONTENT_SIZE),
        ("off", TERMINAL_SIZE),
        ("2", TWO_LINE_CONTENT_SIZE),
    ] {
        set_session_status(&handler, &session, value).await;
        assert_eq!(
            session_content_size(&handler, &session).await,
            expected,
            "status={value} must subtract the status rows from the outer \
             terminal anchor exactly once"
        );
        assert_eq!(
            session_terminal_size(&handler, &session).await,
            TERMINAL_SIZE,
            "status={value} must not move the outer terminal anchor"
        );
    }
    assert_ne!(
        session_content_size(&handler, &session).await,
        DOUBLE_SUBTRACTED_SIZE
    );
}

#[tokio::test]
async fn sizeless_attach_refresh_renders_status_at_the_outer_terminal_rows() {
    let handler = RequestHandler::new();
    let session = session_name("sizeless-refresh");
    let sizeless_pid = 92_121;
    let _declared_rx = seed_two_line_status_geometry(&handler, &session, 92_120).await;

    let mut sizeless_rx = register_sizeless_attach(&handler, sizeless_pid, &session).await;
    while sizeless_rx.try_recv().is_ok() {}
    handler.refresh_attached_session(&session).await;

    let frame = recv_render_frame(&mut sizeless_rx, "sizeless refresh").await;
    assert_eq!(
        cursor_row_before(&frame, "[sizeless-"),
        23,
        "a two-line status on an 80x24 anchor starts at row 23; rendering the \
         content rows as the terminal height moves it up to row 21, got {frame:?}"
    );
    assert!(
        frame.contains("\x1b[22;1H\x1b[0m\x1b[K"),
        "the content region must still reach row 22, got {frame:?}"
    );
}

#[tokio::test]
async fn sizeless_attach_switch_carries_the_outer_terminal_anchor() {
    let handler = RequestHandler::new();
    let alpha = session_name("sizeless-switch-alpha");
    let beta = session_name("sizeless-switch-beta");
    let sizeless_pid = 92_131;
    create_session_with_status_two(&handler, &beta).await;
    let _declared_rx = seed_two_line_status_geometry(&handler, &alpha, 92_130).await;

    let _sizeless_rx = register_sizeless_attach(&handler, sizeless_pid, &alpha).await;
    let response = handler
        .dispatch(
            sizeless_pid,
            Request::SwitchClient(SwitchClientRequest {
                target: beta.clone(),
            }),
        )
        .await
        .response;
    assert!(
        matches!(response, Response::SwitchClient(_)),
        "{response:?}"
    );

    assert_eq!(
        session_terminal_size(&handler, &beta).await,
        TERMINAL_SIZE,
        "the switch destination must inherit the client's outer terminal anchor"
    );
    assert_eq!(
        session_content_size(&handler, &beta).await,
        TWO_LINE_CONTENT_SIZE
    );
}

#[tokio::test]
async fn sizeless_attach_destroy_rehoming_carries_the_outer_terminal_anchor() {
    let handler = RequestHandler::new();
    let alpha = session_name("sizeless-destroy-alpha");
    let beta = session_name("sizeless-destroy-beta");
    create_session_with_status_two(&handler, &beta).await;
    let _declared_rx = seed_two_line_status_geometry(&handler, &alpha, 92_140).await;
    set_session_option(&handler, &alpha, OptionName::DetachOnDestroy, "off").await;

    let mut sizeless_rx = register_sizeless_attach(&handler, 92_141, &alpha).await;
    while sizeless_rx.try_recv().is_ok() {}

    let response = handler
        .handle(Request::KillSession(KillSessionRequest {
            target: alpha.clone(),
            kill_all_except_target: false,
            clear_alerts: false,
            kill_group: false,
        }))
        .await;
    assert!(matches!(response, Response::KillSession(_)), "{response:?}");

    assert_eq!(
        session_terminal_size(&handler, &beta).await,
        TERMINAL_SIZE,
        "destroy-time rehoming must carry the outer terminal anchor"
    );
    assert_eq!(
        session_content_size(&handler, &beta).await,
        TWO_LINE_CONTENT_SIZE
    );
}

#[tokio::test]
async fn same_numeric_live_resize_promotes_a_sizeless_client_to_declared_geometry() {
    let handler = RequestHandler::new();
    let session = session_name("sizeless-promotion");
    let declared_pid = 92_150;
    let sizeless_pid = 92_151;
    let _declared_rx = seed_two_line_status_geometry(&handler, &session, declared_pid).await;
    let _sizeless_rx = register_sizeless_attach(&handler, sizeless_pid, &session).await;

    // The declared client moves last, so `window-size latest` owns the session.
    let declared_size = TerminalSize {
        cols: 100,
        rows: 40,
    };
    handler
        .handle_attached_resize(declared_pid, declared_size)
        .await
        .expect("declared client resize succeeds");
    assert_eq!(
        session_terminal_size(&handler, &session).await,
        declared_size
    );

    // The sizeless client now reports the real geometry of its terminal, which
    // happens to equal the anchor it was registered with. That is still a new
    // declaration and must take over `latest`.
    handler
        .handle_attached_resize(sizeless_pid, TERMINAL_SIZE)
        .await
        .expect("promoting resize succeeds");

    assert_eq!(
        session_terminal_size(&handler, &session).await,
        TERMINAL_SIZE,
        "a real resize must promote the inferred anchor into the latest declaration"
    );
    assert_eq!(
        session_content_size(&handler, &session).await,
        TWO_LINE_CONTENT_SIZE
    );
    assert!(
        !attached_client_size_is_inferred(&handler, sizeless_pid).await,
        "a real resize leaves no inferred provenance behind"
    );
}

#[tokio::test]
async fn sizeless_attach_preserves_both_dimensions_under_every_policy() {
    for (policy, expected_terminal, expected_content) in [
        ("latest", TERMINAL_SIZE, TerminalSize { cols: 80, rows: 22 }),
        (
            "largest",
            TerminalSize {
                cols: 100,
                rows: 30,
            },
            TerminalSize {
                cols: 100,
                rows: 28,
            },
        ),
        (
            "smallest",
            TERMINAL_SIZE,
            TerminalSize { cols: 80, rows: 22 },
        ),
    ] {
        let handler = RequestHandler::new();
        let session = session_name("sizeless-policy");
        let declared_pid = 92_160;
        let _declared_rx = seed_two_line_status_geometry(&handler, &session, declared_pid).await;
        handler
            .handle_attached_resize(
                declared_pid,
                TerminalSize {
                    cols: 100,
                    rows: 30,
                },
            )
            .await
            .expect("declared client resize succeeds");
        set_window_size_policy(&handler, &session, policy).await;

        let _sizeless_rx = register_sizeless_attach(&handler, 92_161, &session).await;
        // The sizeless client anchors to the 100x30 the declared client owns,
        // so force a distinguishable anchor by resizing it to the fixture size.
        handler
            .handle_attached_resize(92_161, TERMINAL_SIZE)
            .await
            .expect("sizeless client reports its real terminal");

        assert_eq!(
            session_terminal_size(&handler, &session).await,
            expected_terminal,
            "window-size {policy} must preserve the selected terminal geometry"
        );
        assert_eq!(
            session_content_size(&handler, &session).await,
            expected_content,
            "window-size {policy} must preserve the selected content geometry"
        );
    }
}

/// The same policy contract for a client that is *still* inferred: it keeps the
/// anchor it registered against while a declared peer moves away from it, so
/// `largest` and `smallest` weigh a real outer terminal against a real outer
/// terminal instead of against status-subtracted content rows.
#[tokio::test]
async fn a_still_inferred_client_competes_on_outer_terminal_rows_under_every_policy() {
    const DECLARED_TERMINAL_SIZE: TerminalSize = TerminalSize {
        cols: 100,
        rows: 30,
    };
    const DECLARED_CONTENT_SIZE: TerminalSize = TerminalSize {
        cols: 100,
        rows: 28,
    };

    for (policy, expected_terminal, expected_content) in [
        ("latest", DECLARED_TERMINAL_SIZE, DECLARED_CONTENT_SIZE),
        ("largest", DECLARED_TERMINAL_SIZE, DECLARED_CONTENT_SIZE),
        ("smallest", TERMINAL_SIZE, TWO_LINE_CONTENT_SIZE),
    ] {
        let handler = RequestHandler::new();
        let session = session_name("sizeless-inferred-policy");
        let declared_pid = 92_260;
        let sizeless_pid = 92_261;
        let _declared_rx = seed_two_line_status_geometry(&handler, &session, declared_pid).await;

        // Registered while the session still measures 80x24, and never resized.
        let _sizeless_rx = register_sizeless_attach(&handler, sizeless_pid, &session).await;
        assert!(attached_client_size_is_inferred(&handler, sizeless_pid).await);
        handler
            .handle_attached_resize(declared_pid, DECLARED_TERMINAL_SIZE)
            .await
            .expect("declared client resize succeeds");

        set_window_size_policy(&handler, &session, policy).await;

        assert_eq!(
            session_terminal_size(&handler, &session).await,
            expected_terminal,
            "window-size {policy} must rank the inferred anchor by its outer \
             terminal rows"
        );
        assert_eq!(
            session_content_size(&handler, &session).await,
            expected_content,
            "window-size {policy} must subtract the status rows once from the \
             selected anchor"
        );
        assert!(
            attached_client_size_is_inferred(&handler, sizeless_pid).await,
            "policy selection must not silently promote an inferred client"
        );
    }
}

#[tokio::test]
async fn manual_window_size_never_resizes_for_a_sizeless_client() {
    let handler = RequestHandler::new();
    let session = session_name("sizeless-manual");
    let _declared_rx = seed_two_line_status_geometry(&handler, &session, 92_170).await;
    set_window_size_policy(&handler, &session, "manual").await;

    let _sizeless_rx = register_sizeless_attach(&handler, 92_171, &session).await;
    for value in ["off", "2"] {
        set_session_status(&handler, &session, value).await;
    }

    assert_eq!(
        session_terminal_size(&handler, &session).await,
        TERMINAL_SIZE
    );
    assert_eq!(
        session_content_size(&handler, &session).await,
        TWO_LINE_CONTENT_SIZE,
        "window-size manual must not resize for any client"
    );
}

#[tokio::test]
async fn read_only_sizeless_attach_acquires_no_sizing_authority() {
    let handler = RequestHandler::new();
    let session = session_name("sizeless-read-only");
    let _declared_rx = seed_two_line_status_geometry(&handler, &session, 92_180).await;
    let declared_size = TerminalSize {
        cols: 100,
        rows: 30,
    };
    handler
        .handle_attached_resize(92_180, declared_size)
        .await
        .expect("declared client resize succeeds");

    let _read_only_rx = register_sizeless_attach_with_flags(
        &handler,
        92_181,
        &session,
        super::super::attach_support::ClientFlags::default().with_read_only(),
    )
    .await;
    handler
        .handle_attached_resize(92_181, TerminalSize { cols: 40, rows: 10 })
        .await
        .expect("read-only resize is accepted but owns nothing");

    assert_eq!(
        session_terminal_size(&handler, &session).await,
        declared_size,
        "a read-only client never acquires sizing authority"
    );
    assert_eq!(
        session_content_size(&handler, &session).await,
        TerminalSize {
            cols: 100,
            rows: 28
        }
    );
}

#[tokio::test]
async fn ignore_size_sizeless_attach_acquires_no_sizing_authority() {
    let handler = RequestHandler::new();
    let session = session_name("sizeless-ignore-size");
    let _declared_rx = seed_two_line_status_geometry(&handler, &session, 92_190).await;

    let _ignored_rx = register_sizeless_attach_with_flags(
        &handler,
        92_191,
        &session,
        super::super::attach_support::ClientFlags::IGNORESIZE,
    )
    .await;
    for value in ["off", "2"] {
        set_session_status(&handler, &session, value).await;
    }

    assert_eq!(
        session_terminal_size(&handler, &session).await,
        TERMINAL_SIZE
    );
    assert_eq!(
        session_content_size(&handler, &session).await,
        TWO_LINE_CONTENT_SIZE,
        "an ignore-size client must not drive session geometry"
    );
}

/// Leaves `session` with a two-line status, an 80x24 outer terminal and an
/// 80x22 content window, driven by a declared client that stays attached.
async fn seed_two_line_status_geometry(
    handler: &RequestHandler,
    session: &SessionName,
    declared_pid: u32,
) -> mpsc::UnboundedReceiver<AttachControl> {
    create_session_with_status_two(handler, session).await;
    let (_attach_id, mut control_rx) = register_declared_attach(
        handler,
        declared_pid,
        session,
        TERMINAL_SIZE,
        super::super::attach_support::ClientFlags::default(),
    )
    .await;
    while control_rx.try_recv().is_ok() {}
    assert_eq!(session_terminal_size(handler, session).await, TERMINAL_SIZE);
    assert_eq!(
        session_content_size(handler, session).await,
        TWO_LINE_CONTENT_SIZE
    );
    control_rx
}

/// The row a `CSI row;1H` placed the cursor on immediately before `needle`.
fn cursor_row_before(frame: &str, needle: &str) -> u16 {
    let (prefix, _) = frame
        .split_once(needle)
        .unwrap_or_else(|| panic!("frame must contain {needle:?}, got {frame:?}"));
    prefix
        .match_indices("\x1b[")
        .filter_map(|(index, _)| {
            let (parameters, _) = prefix[index + 2..].split_once('H')?;
            parameters.strip_suffix(";1")?.parse::<u16>().ok()
        })
        .last()
        .unwrap_or_else(|| panic!("no cursor positioning before {needle:?}, got {frame:?}"))
}

async fn create_session_with_status_two(handler: &RequestHandler, session: &SessionName) {
    let created = handler
        .handle(Request::NewSession(NewSessionRequest {
            session_name: session.clone(),
            detached: true,
            size: Some(TERMINAL_SIZE),
            environment: None,
        }))
        .await;
    assert!(matches!(created, Response::NewSession(_)), "{created:?}");
    set_session_status(handler, session, "2").await;
}

async fn register_sizeless_attach(
    handler: &RequestHandler,
    requester_pid: u32,
    session: &SessionName,
) -> mpsc::UnboundedReceiver<AttachControl> {
    register_sizeless_attach_with_flags(
        handler,
        requester_pid,
        session,
        super::super::attach_support::ClientFlags::default(),
    )
    .await
}

async fn register_sizeless_attach_with_flags(
    handler: &RequestHandler,
    requester_pid: u32,
    session: &SessionName,
    flags: super::super::attach_support::ClientFlags,
) -> mpsc::UnboundedReceiver<AttachControl> {
    let (control_tx, control_rx) = mpsc::unbounded_channel();
    handler
        .register_attach_with_access(
            requester_pid,
            session.clone(),
            None,
            attach_registration(control_tx, flags, None),
        )
        .await
        .expect("sizeless attach registration succeeds");
    control_rx
}

async fn register_declared_attach(
    handler: &RequestHandler,
    requester_pid: u32,
    session: &SessionName,
    size: TerminalSize,
    flags: super::super::attach_support::ClientFlags,
) -> (u64, mpsc::UnboundedReceiver<AttachControl>) {
    let (control_tx, control_rx) = mpsc::unbounded_channel();
    let attach_id = handler
        .register_attach_with_access(
            requester_pid,
            session.clone(),
            None,
            attach_registration(control_tx, flags, Some(size)),
        )
        .await
        .expect("declared attach registration succeeds");
    handler
        .handle_attached_resize(requester_pid, size)
        .await
        .expect("initial declared client size is accepted");
    (attach_id, control_rx)
}

fn attach_registration(
    control_tx: mpsc::UnboundedSender<AttachControl>,
    flags: super::super::attach_support::ClientFlags,
    client_size: Option<TerminalSize>,
) -> AttachRegistration {
    let uid = current_owner_uid();
    AttachRegistration {
        control_tx,
        control_backlog: Arc::new(AtomicUsize::new(0)),
        closing: Arc::new(AtomicBool::new(false)),
        persistent_overlay_epoch: Arc::new(AtomicU64::new(0)),
        terminal_context: OuterTerminalContext::default(),
        client_title: None,
        flags,
        render_stream: false,
        uid,
        user: rmux_os::identity::UserIdentity::Uid(uid),
        can_write: true,
        client_size,
    }
}

async fn attached_client_size(handler: &RequestHandler, attach_pid: u32) -> TerminalSize {
    handler
        .active_attach
        .lock()
        .await
        .by_pid
        .get(&attach_pid)
        .expect("attached client is tracked")
        .client_size
}

async fn attached_client_size_is_inferred(handler: &RequestHandler, attach_pid: u32) -> bool {
    handler
        .active_attach
        .lock()
        .await
        .by_pid
        .get(&attach_pid)
        .expect("attached client is tracked")
        .client_size_is_inferred()
}

async fn session_terminal_size(handler: &RequestHandler, session: &SessionName) -> TerminalSize {
    handler
        .state
        .lock()
        .await
        .sessions
        .session(session)
        .expect("session exists")
        .terminal_size()
}

async fn session_content_size(handler: &RequestHandler, session: &SessionName) -> TerminalSize {
    handler
        .state
        .lock()
        .await
        .sessions
        .session(session)
        .expect("session exists")
        .window()
        .size()
}

async fn set_session_status(handler: &RequestHandler, session: &SessionName, value: &str) {
    set_session_option(handler, session, OptionName::Status, value).await;
}

async fn set_session_option(
    handler: &RequestHandler,
    session: &SessionName,
    option: OptionName,
    value: &str,
) {
    let response = handler
        .handle(Request::SetOption(SetOptionRequest {
            scope: ScopeSelector::Session(session.clone()),
            option,
            value: value.to_owned(),
            mode: SetOptionMode::Replace,
        }))
        .await;
    assert!(matches!(response, Response::SetOption(_)), "{response:?}");
}

async fn set_window_size_policy(handler: &RequestHandler, session: &SessionName, value: &str) {
    let response = handler
        .handle(Request::SetOption(SetOptionRequest {
            scope: ScopeSelector::Window(WindowTarget::with_window(session.clone(), 0)),
            option: OptionName::WindowSize,
            value: value.to_owned(),
            mode: SetOptionMode::Replace,
        }))
        .await;
    assert!(matches!(response, Response::SetOption(_)), "{response:?}");
}