Per-provider login session naming: lab-login-<id> with prefix-keyed exclusions #77

Closed
opened 2026-07-09 21:45:44 +02:00 by dominik.polakovics · 1 comment

Context

tmuxx.LoginSession is the single fixed session name "lab-login" (internal/tmuxx/tmuxx.go:44). The session-exclusion sites — cap counting, branch ownership, stop-all (design §4d) — key on equality with that one symbol, so every provider's login flow must reuse the same tmux session name. With a second provider (#2 Codex), concurrent logins collide in one session, and the constraint is invisible until an operator setting up a fresh host trips it.

Decided in provider-seam grill (2026-07-09): per-provider names, prefix-keyed exclusions. Safer to change now, while ONE login flow exists, than after two are live.

Design

  • Login sessions are named lab-login-<providerID> (e.g. lab-login-claude-code).
  • Replace equality checks against tmuxx.LoginSession with one predicate, e.g. tmuxx.IsLoginSession(name string) bool (prefix match on lab-login), used by every exclusion site. Keep the prefix a single const so the predicate and the name derivation cannot drift.
  • The claude-code login flow derives its session name from its provider id; no other behavior change.
  • Bare lab-login (the legacy name) should still satisfy the predicate so a login session left over from an older binary is not orphaned from the exclusions.

Acceptance

  • No remaining equality comparisons against a login-session constant (grep-clean); all exclusion sites go through the predicate.
  • Tests: two fake providers' login sessions coexist; both are excluded from cap counting/stop-all; legacy lab-login still recognized.
  • Claude login flow works unchanged end to end (existing tests keep passing with the derived name).
## Context `tmuxx.LoginSession` is the single fixed session name `"lab-login"` (`internal/tmuxx/tmuxx.go:44`). The session-exclusion sites — cap counting, branch ownership, stop-all (design §4d) — key on equality with that one symbol, so every provider's login flow must reuse the same tmux session name. With a second provider (#2 Codex), concurrent logins collide in one session, and the constraint is invisible until an operator setting up a fresh host trips it. Decided in provider-seam grill (2026-07-09): per-provider names, prefix-keyed exclusions. Safer to change now, while ONE login flow exists, than after two are live. ## Design - Login sessions are named `lab-login-<providerID>` (e.g. `lab-login-claude-code`). - Replace equality checks against `tmuxx.LoginSession` with one predicate, e.g. `tmuxx.IsLoginSession(name string) bool` (prefix match on `lab-login`), used by every exclusion site. Keep the prefix a single const so the predicate and the name derivation cannot drift. - The claude-code login flow derives its session name from its provider id; no other behavior change. - Bare `lab-login` (the legacy name) should still satisfy the predicate so a login session left over from an older binary is not orphaned from the exclusions. ## Acceptance - No remaining equality comparisons against a login-session constant (grep-clean); all exclusion sites go through the predicate. - Tests: two fake providers' login sessions coexist; both are excluded from cap counting/stop-all; legacy `lab-login` still recognized. - Claude login flow works unchanged end to end (existing tests keep passing with the derived name).
Author
Owner

This was generated by AI while landing a PR.

Landed PR #82feat(tmuxx): per-provider login sessions lab-login-<id> — merged to main.

Verdict: PASS. Verification signal relied on: the required ci / native check (run #82) → success (4m55s); not re-run locally. ci-nix correctly skipped (no .nix/flake.lock/go.mod in the diff). No merge conflict with main.

Acceptance criteria (#77) all met:

  • Grep-clean: the old tmuxx.LoginSession symbol is removed; every exclusion site (instance cap-count/StopAll, reconcile ownedBranches/killSessionOnBranch, afk drainZombies, claudecode login) now goes through tmuxx.IsLoginSession.
  • Derivation (LoginSessionName) and predicate (IsLoginSession) share the one LoginSessionPrefix const — cannot drift.
  • Legacy bare lab-login still recognized/excluded; lab-loginx/xlab-login correctly rejected (dash-separator guard, tested).
  • Two providers' login sessions coexist and are excluded across cap counting, StopAll, ownedBranches, Discard, and the zombie drain (tests added).
  • Claude login flow unchanged; existing login tests pass with the derived name.
  • ADR-0034 records the decision (extends ADR-0026).

Issue auto-closed via Closes #77.

> *This was generated by AI while landing a PR.* **Landed PR #82** — `feat(tmuxx): per-provider login sessions lab-login-<id>` — merged to `main`. **Verdict: PASS.** Verification signal relied on: the required `ci / native` check (run #82) → **success (4m55s)**; not re-run locally. `ci-nix` correctly skipped (no `.nix`/`flake.lock`/`go.mod` in the diff). No merge conflict with `main`. Acceptance criteria (#77) all met: - Grep-clean: the old `tmuxx.LoginSession` symbol is removed; every exclusion site (instance cap-count/StopAll, reconcile ownedBranches/killSessionOnBranch, afk drainZombies, claudecode login) now goes through `tmuxx.IsLoginSession`. - Derivation (`LoginSessionName`) and predicate (`IsLoginSession`) share the one `LoginSessionPrefix` const — cannot drift. - Legacy bare `lab-login` still recognized/excluded; `lab-loginx`/`xlab-login` correctly rejected (dash-separator guard, tested). - Two providers' login sessions coexist and are excluded across cap counting, StopAll, ownedBranches, Discard, and the zombie drain (tests added). - Claude login flow unchanged; existing login tests pass with the derived name. - ADR-0034 records the decision (extends ADR-0026). Issue auto-closed via `Closes #77`.
Sign in to join this conversation.
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
Cloonar/coding-lab#77
No description provided.