feat: zmx session persistence for pixels console#5
Merged
Conversation
⬇️ Go test coverage decreased from 26.2% to 25.4% compared to 7dddb76
|
`pixels console` now attaches to a persistent zmx session by default, keeping shells alive across SSH disconnects. Reconnecting re-attaches to the same session with all processes still running. - Add `--session/-s` flag (default "console") to name the zmx session - Add `--no-persist` flag to skip zmx and use plain SSH - Graceful fallback to plain SSH when zmx is not installed - New `pixels sessions <name>` command to list zmx sessions - Refactor ssh package: introduce ConnConfig parameter object replacing the repeated (host, user, keyPath) triple across all SSH functions - Add consoleArgs() helper for PTY-forced remote command execution Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Provision containers with /etc/profile.d/pixels.sh (alias detach='zmx detach') and /etc/motd showing detach hint. Add unit tests for validSessionName, zmxCmd, Runner.conn, and consoleArgs no-key edge case. Update console command help text and README with session persistence docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add Executor interface with Exec/Output methods and MockExecutor for testing. Runner methods now go through the interface instead of calling ssh.ExecQuiet/OutputQuiet directly, enabling unit tests without real SSH. Also fixes: --console now creates a zmx session (was plain SSH), MOTD trailing newline for clean formatting, and adds isZFSPathChar test. Coverage: provision 26% → 79%, total 21.5% → 32.5%. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The MOTD gets cleared when zmx attach takes over the terminal. Move the detach hint to the pixels CLI, printed to stderr right before ssh.Console when a zmx session is active. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Print the hint from /etc/profile.d/pixels.sh when ZMX_SESSION is set, so it appears after zmx clears the screen. Remove the client-side stderr print which was invisible. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
zmx starts a non-login shell by default, which skips /etc/profile.d/. Pass 'bash -l' as the command to zmx attach so the detach hint and alias from pixels-profile.sh are sourced on session creation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
a75d440 to
117a8de
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Coverage for internal/truenas goes from 68.8% to 83.8%. Tests cover the rootfs path construction, config/write errors, cron job lifecycle (create, run, delete), and ZFS path validation for unsafe characters. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pixels consolenow attaches to a persistent zmx session by default, keeping shells alive across SSH disconnects (network drops, laptop sleep, terminal close). Reconnecting re-attaches to the same session with all processes still running.--session/-sflag (default"console") to name sessions,--no-persistto skip zmx. Graceful fallback when zmx is not installed.pixels sessions <name>command to list active/exited zmx sessions in a container.ConnConfigparameter object, replacing the repeated(host, user, keyPath)triple.Test plan
go buildcompilesgo test ./...passes (including newTestConsoleArgscases)pixels console <name>attaches to zmx session "console"pixels console <name>re-attaches to same sessionpixels console <name> -s buildcreates/attaches to "build" sessionpixels sessions <name>lists active sessionspixels console <name> --no-persistopens plain SSH (no zmx)pixels console <name>falls back to plain SSH🤖 Generated with Claude Code