remove vm session feature

Cuts the daemon-managed guest-session machinery (start/list/show/
logs/stop/kill/attach/send). The feature shipped aimed at agent-
orchestration workflows (programmatic stdin piping into a long-lived
guest process) that aren't driving any concrete user today, and the
~2.3K LOC of daemon surface area — attach bridge, FIFO keepalive,
controller registry, sessionstream framing, SQLite persistence — was
locking in an API we'd have to keep through v0.1.0.

Anything session-flavoured that people actually need today can be
done with `vm ssh + tmux` or `vm run -- cmd`.

Deleted:
- internal/cli/commands_vm_session.go
- internal/daemon/{guest_sessions,session_lifecycle,session_attach,session_stream,session_controller}.go
- internal/daemon/session/ (guest-session helpers package)
- internal/sessionstream/ (framing package)
- internal/daemon/guest_sessions_test.go
- internal/store/guest_session_test.go
- GuestSession* types from internal/{api,model}
- Store UpsertGuestSession/GetGuestSession/ListGuestSessionsByVM/DeleteGuestSession + scanner helpers
- guest.session.* RPC dispatch entries
- 5 CLI session tests, 2 completion tests, 2 printer tests

Extracted:
- ShellQuote + FormatStepError lifted to internal/daemon/workspace/util.go
  (only non-session consumer); workspace package now self-contained
- internal/daemon/guest_ssh.go keeps guestSSHClient + dialGuest +
  waitForGuestSSH — still used by workspace prepare/export
- internal/daemon/fake_firecracker_test.go preserves the test helper
  that used to live in guest_sessions_test.go

Store schema: CREATE TABLE guest_sessions and its column migrations
removed. Existing dev DBs keep an orphan table (harmless, pre-v0.1.0).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Thales Maciel 2026-04-20 12:47:58 -03:00
parent c42fcbe012
commit 2b6437d1b4
No known key found for this signature in database
GPG key ID: 33112E6833C34679
34 changed files with 194 additions and 4031 deletions

View file

@ -34,23 +34,6 @@ const (
VMStateError VMState = "error"
)
type GuestSessionStatus string
const (
GuestSessionStatusStarting GuestSessionStatus = "starting"
GuestSessionStatusRunning GuestSessionStatus = "running"
GuestSessionStatusExited GuestSessionStatus = "exited"
GuestSessionStatusFailed GuestSessionStatus = "failed"
GuestSessionStatusStopping GuestSessionStatus = "stopping"
)
type GuestSessionStdinMode string
const (
GuestSessionStdinClosed GuestSessionStdinMode = "closed"
GuestSessionStdinPipe GuestSessionStdinMode = "pipe"
)
type DaemonConfig struct {
LogLevel string
FirecrackerBin string
@ -176,37 +159,6 @@ type VMSetRequest struct {
NATEnabled *bool
}
type GuestSession struct {
ID string `json:"id"`
VMID string `json:"vm_id"`
Name string `json:"name"`
Backend string `json:"backend"`
AttachBackend string `json:"attach_backend,omitempty"`
AttachMode string `json:"attach_mode,omitempty"`
Command string `json:"command"`
Args []string `json:"args,omitempty"`
CWD string `json:"cwd,omitempty"`
Env map[string]string `json:"env,omitempty"`
StdinMode GuestSessionStdinMode `json:"stdin_mode,omitempty"`
Status GuestSessionStatus `json:"status"`
ExitCode *int `json:"exit_code,omitempty"`
GuestPID int `json:"guest_pid,omitempty"`
GuestStateDir string `json:"guest_state_dir,omitempty"`
StdoutLogPath string `json:"stdout_log_path,omitempty"`
StderrLogPath string `json:"stderr_log_path,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
LastError string `json:"last_error,omitempty"`
Attachable bool `json:"attachable"`
Reattachable bool `json:"reattachable"`
LaunchStage string `json:"launch_stage,omitempty"`
LaunchMessage string `json:"launch_message,omitempty"`
LaunchRawLog string `json:"launch_raw_log,omitempty"`
CreatedAt time.Time `json:"created_at"`
StartedAt time.Time `json:"started_at,omitempty"`
UpdatedAt time.Time `json:"updated_at"`
EndedAt time.Time `json:"ended_at,omitempty"`
}
type WorkspacePrepareMode string
const (