Skip to content

Safely remove registered gateways from CLI - #14

Merged
alejandro-ao merged 1 commit into
mainfrom
feat/remove-gateways
Oct 1, 2026
Merged

alejandro-ao merged 1 commit into
mainfrom
feat/remove-gateways

Conversation

@alejandro-ao

Copy link
Copy Markdown
Owner

$## Summary\n- Add pi-gateway remove <name> (or -c <config> remove) with status/path preview, confirmation, automation --yes, and non-mutating --dry-run.\n- Refuse running background bots unless --stop succeeds; serialize removal with background startup.\n- Delete only the selected config and registry entry, preserving database, logs, directories, and Pi sessions.\n- Document limitations for foreground/systemd bots and add removal safety tests.\n\n## Verification\n- Python 3.11 and 3.14: ruff, mypy, pytest (27 passed, 7 subtests), uv build.\n- compileall, CLI help, git diff --check.

Copilot AI balanced review requested due to automatic review settings October 1, 2026 09:25
@alejandro-ao
alejandro-ao merged commit 26b12a4 into main Oct 1, 2026
3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Lock scope and partial-failure handling can block unrelated gateways or delete configuration before registry persistence succeeds.

Review effort: Balanced
Findings: 2 Medium severity

Open (2)
What changed in this PR

Adds CLI support for removing registered gateway configurations while preserving runtime history and state.

Changes:

  • Adds preview, confirmation, stop, and automation options.
  • Serializes removal with background startup.
  • Adds safety tests and documentation.
File Description
pi_gateway/​cli.py Implements removal and startup locking.
tests/​test_remove.py Tests removal safety behavior.
README.md Documents removal usage.
docs/​02-startup-and-cli-flow.md Describes removal flow.
docs/​06-configuration-and-deployment.md Documents deployment implications.
AGENTS.md Adds removal guidance.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread pi_gateway/cli.py
raise SystemExit("Specify a gateway name, -c <config-file>, or -i <instance>.")
config = resolve_config(args) if not args.target else None
registry = InstanceRegistry(expand_path(REGISTRY_PATH))
with registry.locked():
Comment thread pi_gateway/cli.py
Comment on lines +172 to +173
path.unlink(missing_ok=True)
registry.save([entry for entry in entries if entry is not match])
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.

2 participants