fix(cli): shorten session storage startup guidance
This commit is contained in:
1 parent
1bc43f84e4
commit
1457904e8d
2 files changed
+13
-22
No files matched your search
@@ -147,25 +147,16 @@ def _validate_session_storage(config: Config, *, workspace_override: str | None
|
||||
return
|
||||
|
||||
source = "--workspace" if workspace_override else "agents.defaults.workspace"
|
||||
console.print(Text("Cannot start: session storage must be outside the agent workspace.", style="red"))
|
||||
console.print(Text(f"Config: {config_path}"))
|
||||
console.print(Text("Cannot start: chat history must be outside the workspace.", style="red"))
|
||||
console.print()
|
||||
console.print(Text(f"Workspace ({source}): {workspace}"))
|
||||
console.print(Text(f"Sessions: {sessions}"))
|
||||
console.print(
|
||||
"Sessions are stored beside the active config file. --workspace overrides the "
|
||||
"configured workspace; it does not move sessions."
|
||||
)
|
||||
console.print(
|
||||
"Stop this instance and back up its config directory and workspace. Move the "
|
||||
"config file and its runtime data, including sessions, to a directory outside the "
|
||||
"workspace, then restart with --config pointing to the moved config file."
|
||||
)
|
||||
console.print("Example layout: bot/config.json, bot/sessions/, bot/workspace/.")
|
||||
console.print(
|
||||
"Keep the existing workspace path and its .nanobot/workspace-id to preserve "
|
||||
"its session identity. See docs/troubleshooting.md#session-storage-overlaps-the-workspace "
|
||||
"for layout and migration options."
|
||||
)
|
||||
console.print(Text(f"Chat history: {sessions}"))
|
||||
console.print()
|
||||
console.print("To fix, keep the workspace in place:")
|
||||
console.print(" 1. Stop the instance and back up its files.")
|
||||
console.print(" 2. Move config.json and its runtime data outside the workspace.")
|
||||
console.print(" 3. Restart with --config pointing to the moved config file.")
|
||||
console.print("Migration help: docs/troubleshooting.md")
|
||||
raise typer.Exit(1)
|
||||
|
||||
|
||||
|
||||
@@ -46,8 +46,8 @@ def test_startup_rejects_nested_sessions_before_writing_files(
|
||||
output = "".join(result.stdout.splitlines())
|
||||
|
||||
assert result.exit_code == 1, result.output
|
||||
assert "session storage must be outside" in output
|
||||
assert str(config_path) in output
|
||||
assert "chat history must be outside" in output
|
||||
assert config_path.name in output
|
||||
assert str(workspace) in output
|
||||
assert str(config_path.parent / "sessions") in output
|
||||
source = "--workspace" if override else "agents.defaults.workspace"
|
||||
@@ -70,7 +70,7 @@ def test_startup_rejects_sessions_equal_to_workspace(tmp_path: Path) -> None:
|
||||
result = runner.invoke(app, ["gateway", "--config", str(config_path)])
|
||||
|
||||
assert result.exit_code == 1
|
||||
assert "session storage must be outside" in result.stdout
|
||||
assert "chat history must be outside" in result.stdout
|
||||
assert not workspace.exists()
|
||||
|
||||
|
||||
@@ -106,6 +106,6 @@ def test_webui_checks_resolved_workspace_before_saving(
|
||||
result = runner.invoke(app, ["webui", "--config", str(config_path), "--yes", "--no-open"])
|
||||
|
||||
assert result.exit_code == 1
|
||||
assert "session storage must be outside" in result.stdout
|
||||
assert "chat history must be outside" in result.stdout
|
||||
assert config_path.read_bytes() == before
|
||||
assert set(tmp_path.iterdir()) == {config_path}
|
||||
Reference in new issue
Block a user