Skip to content

Sleep action exposed for adopted (running-external) servers shown as 'online' #3

Description

@thetimblank

Bug

The "Sleep" action (server card, server detail page, network context menu) is
shown/enabled whenever server.status === 'online'. But the frontend collapses
the backend's running-external lifecycle state — a server mserve only
observes/adopted, doesn't own — into that same 'online' status
(mapRuntimeStateToStatus in src/lib/server-telemetry.ts). Clicking Sleep on
an adopted server always fails.

Root cause

The backend sleep_server command
(src-tauri/src/app/commands/runtime.rs) requires LifecycleState::Online
specifically, plus an owned child process (runtime.child.is_some()). An
adopted server's backend state is RunningExternal, not Online, so the
guard rejects it with "Server must be online to sleep." — but the frontend has
no way to distinguish "owned online" from "adopted online" today, since
neither ServerRuntimeSnapshot nor the server-runtime-state event expose an
ownership flag to the UI.

Fix

Either:

  • Expose an isOwned/isExternal flag on the runtime snapshot and
    server-runtime-state event so the frontend can hide Sleep (and any other
    owned-only action) for adopted servers, or
  • Have sleep_server return a clearer, distinguishable error message the UI
    can surface (e.g. "This server was started outside mserve and can't be put
    to sleep"), matching the pattern already used in stop_server's
    RCON-fallback error.

Affects: src/components/server-card.tsx, src/pages/network/ServerNodeMenu.tsx,
src/pages/server/server-overview-panel.tsx.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions