Archive sessions, allow spaces in names, stop tripping the SSH rate limit #2

Merged
reudy merged 1 commit from session/archive-and-bugfix into main 2026-10-06 11:47:06 +02:00
Member

Three things from one request:

1. "ssh: Connection refused" after a few quick clicks
Cause: UFW on the dev box has LIMIT on 14922, which rejects the 6th new connection from one IP within 30 s. A page view = 2 SSH calls, each button = 1 more. Kernel log at 09:30:23 shows UFW LIMIT BLOCK SRC=<prod> right after list, repos, stop, list, stop.
Fix: the web app multiplexes every call over one SSH connection (ControlMaster=auto, ControlPersist=120, socket in its private tmp dir). compose.yaml gets init: true so the backgrounded master is reaped. The app logs a warning if it runs as PID 1.

2. Spaces in names
create takes a title (Fix login bug: letters, digits, -, single spaces, ≤48). The dev box derives the slug (fix-login-bug) for dir/branch/unit/tmux. The title is displayed and passed to claude as --name. Old slugs still work unchanged. AGENTS.md invariant 1 is updated to name this one exception.

3. Archive
New remote verbs archive (stop + flag; nothing deleted) and unarchive (back to list, stopped). Archived sessions can't be started. The page has a collapsible "Archived (n)" section (<details>, still no JS).

Also: validation used re.match with $, which accepts a trailing newline → now fullmatch. And list re-reads state under the lock before saving the RC URL, so it can't undo a concurrent archive.

Tests: both unittest suites pass (28 + 10). End to end with a throwaway 127.0.0.1 key and the real container image: archive → start refused → unarchive → create with spaces; 24 remote calls used 1 TCP connection; no zombie after the master exits. Not tested: the UFW limit itself (loopback is exempt) and the panel honouring init: true.

After merge: re-run ./dev/install.sh on the dev box (new verbs), redeploy the panel app.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Rog8S9b5qKaw6nUicxXLkM

Three things from one request: **1. "ssh: Connection refused" after a few quick clicks** Cause: UFW on the dev box has `LIMIT` on 14922, which rejects the 6th new connection from one IP within 30 s. A page view = 2 SSH calls, each button = 1 more. Kernel log at 09:30:23 shows `UFW LIMIT BLOCK SRC=<prod>` right after list, repos, stop, list, stop. Fix: the web app multiplexes every call over one SSH connection (`ControlMaster=auto`, `ControlPersist=120`, socket in its private tmp dir). `compose.yaml` gets `init: true` so the backgrounded master is reaped. The app logs a warning if it runs as PID 1. **2. Spaces in names** `create` takes a title (`Fix login bug`: letters, digits, `-`, single spaces, ≤48). The dev box derives the slug (`fix-login-bug`) for dir/branch/unit/tmux. The title is displayed and passed to claude as `--name`. Old slugs still work unchanged. AGENTS.md invariant 1 is updated to name this one exception. **3. Archive** New remote verbs `archive` (stop + flag; nothing deleted) and `unarchive` (back to list, stopped). Archived sessions can't be started. The page has a collapsible "Archived (n)" section (`<details>`, still no JS). Also: validation used `re.match` with `$`, which accepts a trailing newline → now `fullmatch`. And `list` re-reads state under the lock before saving the RC URL, so it can't undo a concurrent archive. **Tests:** both unittest suites pass (28 + 10). End to end with a throwaway 127.0.0.1 key and the real container image: archive → start refused → unarchive → create with spaces; 24 remote calls used 1 TCP connection; no zombie after the master exits. Not tested: the UFW limit itself (loopback is exempt) and the panel honouring `init: true`. **After merge:** re-run `./dev/install.sh` on the dev box (new verbs), redeploy the panel app. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Rog8S9b5qKaw6nUicxXLkM
agent added 1 commit 2026-10-06 11:43:08 +02:00
Connection refused: the dev box's UFW `limit` rule refuses the 6th new
SSH connection from one address within 30 s. Every page view made two
calls (list, repos) and every button one more, so stopping two sessions
and refreshing hit it (kernel log: "UFW LIMIT BLOCK" from prod's IP).
The web app now multiplexes all calls over one connection
(ControlMaster=auto, ControlPersist=120), with the socket in its private
temp dir. compose.yaml gets `init: true` so the backgrounded master is
reaped; the app warns if it runs as PID 1.

Spaces in names: `create` now takes a title (letters, digits, '-',
single spaces, <= 48 chars). The slug used for the directory, branch,
unit and tmux socket is derived from it; the title is shown on the page
and passed to claude as --name. A plain slug still maps to itself.

Archive: new remote verbs `archive` (stop + flag, keeps checkout and
conversation) and `unarchive` (back to the list, still stopped). An
archived session refuses `start`. The page lists archived sessions in a
collapsible section. `list` re-reads state under the lock before saving
a Remote Control URL so it can't undo a concurrent archive.

Also: name/branch validation used re.match with `$`, which accepts a
trailing newline; it now uses fullmatch.

Tested end to end with a throwaway 127.0.0.1 key and the real container:
24 remote calls went over 1 TCP connection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rog8S9b5qKaw6nUicxXLkM
reudy merged commit 39997de1e8 into main 2026-10-06 11:47:06 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: reudy-net/sessions#2
No description provided.