cli: share one SSH connection per instance !190

merged merged by cmc on 2026-09-03 15:59 UTC · krz/gitbay:cli-ssh-multiplex into main

Discussion

cmc

Every command spawned a fresh ssh and paid a full handshake: 3.8 s from a laptop 170 ms away from gitbay.org. sshArgs now passes ControlMaster=auto, a socket under ~/.ssh/gitbay-%C, and ControlPersist=300, from all three places the CLI spawns ssh. Measured against gitbay.org with the branch's binary: 4.2 s for the first command, 0.36 s for every command after.

The profile's ssh_options still come last and win. no_multiplex = true on an instance opts out, and no ~/.ssh directory means no multiplexing. TestSSHArgsMultiplex covers all three. The CLI e2e tests pass with multiplexing on.

Stacked on the web writes MR; no code dependency between them.

Closes #94

retargeted from web-writes-registry to main: !189 merged

2026-09-03 15:59 UTC