Skip to content

Add Zellij runtime adapter#66

Open
proboscis wants to merge 1 commit intomainfrom
issue/ISSUE-031/run-20260308-105100
Open

Add Zellij runtime adapter#66
proboscis wants to merge 1 commit intomainfrom
issue/ISSUE-031/run-20260308-105100

Conversation

@proboscis
Copy link
Copy Markdown
Owner

Summary

  • Switch zellij adapter from session-per-run to tab-per-run model: each job now runs in a named tab inside a shared session, reducing session proliferation and aligning with zellij's tab-oriented design
  • Promote session_is_running / session_exists from bool to Result<bool> so zellij CLI errors surface instead of being silently swallowed
  • Add tab_exists() helper (via zellij action query-tab-names) for tab-level liveness checks in is_alive() and attach()
  • Expose ZellijAdapter in runbox-core's public API (lib.rs re-export)
  • Add zellij-tests feature flag in runbox-cli/Cargo.toml (mirrors existing tmux-tests pattern) to gate integration tests that require a live zellij binary
  • Update CLI --runtime help text and attach command docs to reflect zellij parity with tmux
  • Add feature-gated test_attach_zellij integration test covering the full spawn → tab-create → attach path

Acceptance Criteria

  • Tab-based spawn: spawn() creates a background session, opens a named tab, runs the command with --close-on-exit, and verifies the tab exists before returning a RuntimeHandle
    • Evidence: zellij.rs diff — three-step session_outputtab_outputrun_output sequence with tab verification
  • Tab-level liveness: is_alive() checks both session running AND tab exists
    • Evidence: is_alive() now calls session_is_running(session).unwrap_or(false) && tab_exists(session, tab).unwrap_or(false)
  • Error propagation: session_is_running / session_exists return Result<bool> with .context(...) on every zellij CLI call
    • Evidence: Both helpers use .output().context("...") and return Ok(...) / bail!(...)
  • Public API: ZellijAdapter re-exported from runbox-core
    • Evidence: lib.rs diff adds ZellijAdapter to the pub use runtime:: line
  • Feature gate: zellij-tests feature added to Cargo.toml; integration test gated with #[cfg(feature = "zellij-tests")]
    • Evidence: Cargo.toml diff + attach.rs test function annotation
  • CLI parity: --runtime arg docs updated to list zellij alongside tmux; attach hint shown for both runtimes in cmd_run_replay
    • Evidence: main.rs diff — three --runtime help strings updated + matches!(runtime, RuntimeType::Tmux | RuntimeType::Zellij) guard
  • Existing test assertions updated: test_attach_background_not_supported and test_attach_no_runtime_not_supported now expect "only supported for tmux/zellij"
    • Evidence: attach.rs diff lines 67 and 110
  • Working tree clean after commit: git status shows nothing to commit, working tree clean
  • Branch pushed: git push -u origin issue/ISSUE-031/run-20260308-105100 succeeded with new branch created on remote

Notes

⚠️ Backward-compatibility caveat: Any persisted RuntimeHandle::Zellij records created before this change store a full-UUID session name. After this deploy, is_alive / attach will fail to find those sessions (session name format changed from runbox-<full-uuid> to runbox-<8-char-short-id>). Existing in-flight runs should be stopped before upgrading.

Refs: ISSUE-031

Switch from session-per-run to tab-per-run model: each job now runs in a
named tab inside a shared session, reducing session proliferation and
enabling tab-level liveness checks. Propagate errors from zellij CLI
calls via Result<bool> instead of silently returning false. Expose
ZellijAdapter in the public API, add zellij-tests feature gate, update
CLI help text and attach hints, and add a feature-gated integration test
for the full spawn→tab→attach path.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
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