Skip to content

feat: close keeps a link another session still holds - #25

Merged
lfnothias merged 5 commits into
mainfrom
feat/shared-link-holders
Oct 8, 2026
Merged

lfnothias merged 5 commits into
mainfrom
feat/shared-link-holders

Conversation

@lfnothias

Copy link
Copy Markdown
Contributor

Stacked on #24 (base fix/totp-read-diagnostics); one commit, f9a2b82.

One master and one tunnel serve every process on the machine that uses the
profile, and close tore both down unconditionally. Two sessions sharing the
link — an agent and a wrapper script, two agents — therefore cut each other's
connection with their own close, and under 2FA the reopen cost a code the
other side could not always produce.

open, and the implicit open under run, push, pull and local, now record a
holder file under $HS_CONTROL_DIR/holders; close removes its own and tears
down only when no live holder remains, saying who still holds the link. A
holder is the calling process by default — live while its pid is — or
HS_LEASE= for a session whose commands each run in a fresh shell; both
lapse after HS_LEASE_TTL seconds idle (default 14400), refreshed by every open.
HS_CLOSE_FORCE=1 closes regardless and clears the holders. status lists them.

Thirteen offline tests: a close with another holder keeps the link and names
it; the last close tears down; a pid holder whose process ended, and a named
holder past the TTL, do not keep it; a fresh named holder does; the forced
close closes and clears; an implicit open registers; status lists; a holder
name cannot leave the directory.

Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com

Tests: 13 new assertions, 220 in total, run offline with security shadowed. shellcheck, run as in CI, is clean. Nothing site-specific is in the diff.

Generated with Claude Code

lfnothias and others added 5 commits August 21, 2026 10:48
Nothing here was ever tagged, so anyone who cloned since 2026-07-29 holds a copy
with defects that are mostly silent — a watch that reports running jobs as
finished, a precedence rule that discards every documented override, a submit
that fails on any current OpenSSH. The changelog leads with what CHANGED rather
than what was added, because that is the part that can surprise someone
upgrading: sbatch arguments are quoted now, a remote script path is literal, and
watch has a third exit status.

The examples directory had only the hardest case, a cluster behind a full-tunnel
VPN that also enforces TOTP. Most people start with neither, and README solicits
worked profiles from contributors — so the simple shape should be there to copy.
A first tag makes version a question with an answer, and CHANGELOG.md opens with
behaviour changes — so a caller has to be able to tell which side of them it is on.
Nothing in the tool could say.

`version` is dispatched before the profile loads, like `init`: a setup that does not
load is exactly when someone needs to report which copy they are running. `doctor`
opens with the same line, since that output is what gets pasted into an issue.

A test holds the string equal to the newest heading in CHANGELOG.md, so a tag cannot
drift from what the tool reports. Verified by mutation: drifting the string fails
three assertions, dropping the doctor line fails one, and moving the dispatch after
the loader fails the two that cover a broken profile.

Also corrects two claims in the changelog itself — the repository's public date, which
was off by a timezone, and the assertion count.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The "Known limitations" section said no part of this release had been exercised
against a live SLURM controller. That is no longer true: one end-to-end run —
open, render, submit, queue, watch to completion, fetch, cancel, close — was
made against a TOTP-gated cluster behind a VPN, and behaved as documented.

Stated as one site and one SLURM version, which is what it is, rather than as a
compatibility claim.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A failed read sent the backend's stderr to /dev/null, so open, doctor and status
all said "no seed — run store-seed" while the seed sat in the keychain, refused
for one request only. The backend's own message, its exit status and, for the
keychain, the macOS session the read ran in are now appended to
HS_TOTP_ERROR_LOG, and the hint repeats the latest reason. The seed itself is
never written anywhere.

The read is tried once more after HS_TOTP_READ_RETRY_DELAY seconds, which
absorbs a refusal that clears by itself; not after a cancelled prompt, and not
for a missing seed file.

Thirteen new assertions, with `security` shadowed throughout; they fail on the
previous code. Suite: 207 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One master and one tunnel serve every process on the machine that uses the
profile, and `close` tore both down unconditionally. Two sessions sharing the
link — an agent and a wrapper script, two agents — therefore cut each other's
connection with their own close, and under 2FA the reopen cost a code the
other side could not always produce.

`open`, and the implicit open under run, push, pull and local, now record a
holder file under $HS_CONTROL_DIR/holders; `close` removes its own and tears
down only when no live holder remains, saying who still holds the link. A
holder is the calling process by default — live while its pid is — or
HS_LEASE=<name> for a session whose commands each run in a fresh shell; both
lapse after HS_LEASE_TTL seconds idle (default 14400), refreshed by every open.
HS_CLOSE_FORCE=1 closes regardless and clears the holders. `status` lists them.

Thirteen offline tests: a close with another holder keeps the link and names
it; the last close tears down; a pid holder whose process ended, and a named
holder past the TTL, do not keep it; a fresh named holder does; the forced
close closes and clears; an implicit open registers; status lists; a holder
name cannot leave the directory.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@lfnothias
lfnothias changed the base branch from fix/totp-read-diagnostics to main October 8, 2026 07:08
@lfnothias
lfnothias merged commit f9a2b82 into main Oct 8, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant