Skip to content

Lifecycle(feat): Add owned tmux resource scopes - #27

Draft
tony wants to merge 1 commit into
masterfrom
lifecycle-mvp
Draft

tony wants to merge 1 commit into
masterfrom
lifecycle-mvp

Conversation

@tony

@tony tony commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Current review

This draft still has two failed cleanup checks. On both the floor and current test configurations, the tests that owned a private tmux server could not confirm that cleanup finished. Its earlier example and test launchers also predate the Lua-only contributor tools. Floor failure · Current failure.

Current master has owned servers. The scoped PRs cover finding tmux on PATH, stopping a newly started server when the caller cannot accept it, and stopping a test worker’s private server when the worker is interrupted. Owned-server API · PATH lookup #179 · Startup cleanup #186 · Interrupted tests #200.


Ordinary Lua examples connect to tmux's normal endpoint. An external harness runs the same files with socket and child-environment defaults, then retires its accepted test daemon. The examples keep their imports and runtime:connect() calls.

Explicit owners accept cleanup responsibility for servers, sessions, windows and panes. Scope callbacks preserve body and cleanup errors, and retained owners permit retry. Created-resource receipts bind rollback and destruction to the accepted daemon generation and object IDs. Bounded discovery reports endpoints, failures and exhausted limits. Find-or-create returns {value, created, owner?} so reused objects remain borrowed.

Endpoint and cleanup behavior

Connection defaults capture LIBTMUX_SOCKET_PATH, LIBTMUX_SOCKET_NAME, TMUX and TMUX_TMPDIR. Explicit selectors take precedence. env supplies a complete child environment; client_env supplies copied host overrides. Existing per-command CommandOptions.env remains; ConnectOptions.env is additive. Environment sequences retain their first-value semantics, including an empty first TMUX_TMPDIR value.

Created-server acceptance and cleanup use the private startup endpoint. Replacing the published path cannot redirect acceptance or cleanup to the replacement daemon. Teardown leaves the public alias in place to avoid a check/unlink race. After daemon exit, a repeated call at that stale path fails until its directory owner coordinates alias retirement or selects a fresh path. Ordinary session cleanup against a running server needs no such alias management.

Validation

A fresh independent reviewer verified all 223 source entries and 649 builder artifacts. Controlled replacement cases pass normal close, startup rollback and pre-handoff success, cancellation and receipt rejection on Lua 5.1.5/tmux 3.2a and Lua 5.5.1/tmux 3.7c. Twelve previous-source controls and eight single-change mutant runs fail at their intended assertions. Twelve additional discovery-planning cases per lane verify duplicate environment values while blocking ambient-root enumeration.

Both unchanged ordinary programs run through path and named selectors. The external observer also covers body failure, timeout and killed example workers. Six complete guide programs run through both selectors, with byte comparisons and a failing displayed-source mutation. The native unit suites pass 120 tests on each of Lua 5.1.5, Lua 5.5.1 and LuaJIT in under 0.3 seconds per command. LuaLS, native export and editor completion checks take 13.43 seconds and pass. Neovim 0.12.5 runs the ownership program.

Preservation checks retain all 56 original fences, 503 original class/field identities, the original examples, declared floors, dependency blocks, version identities and released rockspec. Three original annotation changes make connection options optional; the later repair removes no further original comments. Exported guides and examples match source bytes.

Unresolved cleanup failures

Keep this PR in draft. Three independent runs ended with an accepted daemon still alive after worker exit: legacy environment cleanup, server-publication setup, and server-scope setup. The supervisor retired those exact children before deleting their roots. Fifteen diagnostic replays of each case did not reproduce the failures; their causes remain unresolved. Passing repetitions establish no fix for these observations.

Across 158 fixture attempts, the outside observer recorded 729 accepted process exits before root deletion. That includes the three rescues above, expected failures and a retained supervisor-recording error. This establishes containment for those accepted children, not successful library cleanup in every run or complete descendant accounting.

The declared Neovim 0.10 floor remains unexecuted. Installed-package checks, native Markdown/Astro Markdown/MDX/Sphinx reST/MyST/Python doctest integration, supervisor-death recovery, and the wider operational acceptance assessment remain pending. Earlier disk-exhaustion evidence and an unexplained acquisition failure remain recorded.

why: Ordinary programs need default tmux endpoints while test harnesses
redirect the same code and retain explicit cleanup responsibility.

what:
- Capture endpoint and child-environment defaults for later commands.
- Add ownership, bounded discovery and created/reused acquisitions.
- Retain generation receipts and cleanup errors for guarded retry.
- Accept spawned daemons through their private startup endpoints.
- Preserve published aliases when cleanup could race with replacement.
- Add native examples, failure controls and source-binding checks.

Independent review confirms the targeted replacement and environment
repairs. Three intermittent cleanup failures required outer rescue and
remain unresolved; this change is for draft review.
@tony

tony commented Dec 5, 2026

Copy link
Copy Markdown
Contributor Author

Current master already has owned-server startup and cleanup. In a fresh comparison, the focused owned-server and socket-selection cases passed on tmux 3.3a and 3.8. This older draft conflicts with that implementation, has failing cleanup checks in its floor and current runs, and changes an already published alpha rockspec.

The independently tested pieces are now available separately. Find tmux on PATH · Retire a newly started unsupported daemon · Clean up an interrupted fixture worker.

This branch was previously deployed

1 inactive deployment
docs-preview — 65a471fc Deployed Oct 10, 2026 by tony via publish (pr-27, pr, false, docs-preview, true) / publish #86
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