Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions dimos/robot/cli/dimos.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,48 @@ def _stop_entry(entry: "RunEntry", force: bool = False) -> None:
typer.echo(f" {msg}")


@main.command()
def restart(
force: bool = typer.Option(False, "--force", "-f", help="Force kill before restarting"),
daemon: bool = typer.Option(False, "--daemon", "-d", help="Restart in background"),
) -> None:
"""Restart the running DimOS instance with the same arguments."""
from dimos.core.run_registry import get_most_recent

entry = get_most_recent(alive_only=True)
if not entry:
typer.echo("No running DimOS instance to restart", err=True)
raise typer.Exit(1)

# Save args before stopping (stop removes the entry)
blueprint_args = entry.cli_args
config_overrides = entry.config_overrides

typer.echo(f"Restarting {entry.run_id} ({entry.blueprint})...")
_stop_entry(entry, force=force)

# Re-invoke run with saved arguments

cmd = [sys.executable, "-m", "dimos.robot.cli.dimos"]
# Restore config overrides as CLI flags
for key, value in config_overrides.items():
flag = f"--{key.replace('_', '-')}"
if isinstance(value, bool):
if value:
cmd.append(flag)
Comment on lines +289 to +291
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

False boolean overrides are silently lost during restart.

When a boolean config override is False (e.g., user originally ran dimos --no-some-flag run blueprint), the reconstruction loop at lines 289–291 only emits a flag for True values. Since the CLI uses a --flag/--no-flag pattern (line 70), False values need to emit --no-<flag> to be restored correctly.

Suggested change
if isinstance(value, bool):
if value:
cmd.append(flag)
if isinstance(value, bool):
if value:
cmd.append(flag)
else:
cmd.append(f"--no-{key.replace('_', '-')}")

else:
cmd.extend([flag, str(value)])
cmd.append("run")
if daemon:
cmd.append("--daemon")
cmd.extend(blueprint_args)

typer.echo(f" Running: {' '.join(cmd)}")
import os

os.execvp(cmd[0], cmd)


@main.command()
def show_config(ctx: typer.Context) -> None:
"""Show current config settings and their values."""
Expand Down
Loading