Skip to content

fix(cli): prevent uninstall --dry-run from signalling the broker - #1989

Open
AyobamiH wants to merge 1 commit into
AgentWorkforce:mainfrom
AyobamiH:fix/uninstall-dry-run-process-safety
Open

AyobamiH wants to merge 1 commit into
AgentWorkforce:mainfrom
AyobamiH:fix/uninstall-dry-run-process-safety

Conversation

@AyobamiH

@AyobamiH AyobamiH commented Oct 25, 2026 •

Copy link
Copy Markdown

Fixes #1986.

What changed

  • Determine dry-run mode before broker cleanup. When a valid connection.json contains a PID, uninstall --dry-run now previews the broker shutdown instead of sending SIGTERM.
  • Preserve existing broker shutdown for ordinary uninstall.
  • Add regression coverage using a real temporary connection.json and mocked process-signalling: dry-run causes no signals or filesystem mutations, while ordinary uninstall still signals the recorded PID.
  • Record the user-visible fix in the unreleased changelog.

Verification

  • vitest run packages/cli/src/cli/commands/core.test.ts: 171 passed.
  • npm run typecheck: passed.
  • Targeted ESLint: no errors (one existing complexity warning on runUninstallCommand).
  • git diff --check: passed.

The tests do not kill a real broker; process signalling is dependency-injected and asserted explicitly. The original issue contains an isolated reproduction against the published CLI.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 54acd1e5-3f90-4756-bcb1-45fa3475ccf1
Commits

Reviewing files that changed from the base of the PR and between c3a92d9 and 2a34be7.

Files selected for processing: 3
  • CHANGELOG.md
  • packages/cli/src/cli/commands/core.test.ts
  • packages/cli/src/cli/lib/core-maintenance.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Walkthrough

The uninstall command now checks dry-run mode before handling a broker PID. Dry-run logs the prospective SIGTERM without signaling the process. Normal uninstall still attempts to send SIGTERM. Tests cover both modes, and the changelog records the behavior.

Changes: Uninstall dry-run behavior

Layer / File(s) Summary
Broker signal handling and validation
packages/cli/src/cli/lib/core-maintenance.ts, packages/cli/src/cli/commands/core.test.ts, CHANGELOG.md
The command logs the prospective SIGTERM during dry-run and attempts the signal during normal uninstall. Tests verify the process and project files remain unchanged during dry-run, and verify that normal uninstall sends SIGTERM once. The changelog records this behavior and updates the unreleased heading.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related PRs

Merge Risk: Minimal · up to 2a34b

The uninstall dry-run behavior is ready to merge with no identified blocking risk.

Pre-merge checks: Passed 2 · Failed 3

Failed Failed checks: 3 warnings

Check name Status Explanation Resolution
Description check Warning The description clearly explains the change, testing, and verification results. However, it omits the required RelayFlow Proof section and does not provide the required Test Plan checklist or manual-t… Add the required ## Test Plan section with checked statuses for tests and manual testing. Add the ## RelayFlow Proof section with exactly one valid change type and RelayFlow case, or use non-functional and n/a only if applicable.
Out of Scope Changes check Warning The core-maintenance.ts change and the new Fixed changelog entry are in scope for #1986.

CHANGELOG.md also changes the heading ## [Unreleased] to ## [Unreleased - Major]. The PR description does …
Restore the heading to ## [Unreleased], or remove the unrelated heading change from this PR. If the Unreleased - Major heading is intended, explain its purpose in the PR description and link it to a separate issue.
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 2 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: preventing uninstall --dry-run from signaling the broker.
Linked Issues check Passed [#1986] The issue requires that uninstall --dry-run does not send SIGTERM to the broker PID in a valid connection.json, and that ordinary uninstall keeps broker shutdown.

At head, `runUninstallComm…
Full details: Linked Issues check

Explanation

[#1986] The issue requires that uninstall --dry-run does not send SIGTERM to the broker PID in a valid connection.json, and that ordinary uninstall keeps broker shutdown.

At head, runUninstallCommand in packages/cli/src/cli/lib/core-maintenance.ts computes isDryRun = options.dryRun === true before the broker block. When conn.pid > 0 and isDryRun is true, the code logs [dry-run] Would send SIGTERM to broker (pid: ...) and does not call deps.killProcess. When not a dry run, the original deps.killProcess(conn.pid, 'SIGTERM') call runs inside the same try/catch. The existing dry-run branches for data and project cleanup are unchanged in the diff hunk shown.

The PR summary and raw summary describe regression tests in packages/cli/src/cli/commands/core.test.ts. These cover dry-run with no signal and no file mutation, and ordinary uninstall with one SIGTERM to the recorded PID. The test diff could not be read, so the test content is taken from the summaries only. The implementation result is confirmed from the source diff.

Full details: Description check

Explanation

The description clearly explains the change, testing, and verification results. However, it omits the required RelayFlow Proof section and does not provide the required Test Plan checklist or manual-testing status.

Resolution

Add the required ## Test Plan section with checked statuses for tests and manual testing. Add the ## RelayFlow Proof section with exactly one valid change type and RelayFlow case, or use non-functional and n/a only if applicable.

Full details: Out of Scope Changes check

Explanation

The core-maintenance.ts change and the new Fixed changelog entry are in scope for #1986.

CHANGELOG.md also changes the heading ## [Unreleased] to ## [Unreleased - Major]. The PR description does not mention this change. The heading rename does not implement the dry-run fix, the regression coverage, or the ordinary-uninstall restoration check. It changes release metadata that the issue does not request.

The Removed entry for Python workflows and the Python SDK is present in the base. The diff shows it only as unchanged context, so it is not a new change in this PR.

The test diff in core.test.ts could not be read. Its scope is therefore based on the summaries only.

Resolution

Restore the heading to ## [Unreleased], or remove the unrelated heading change from this PR. If the Unreleased - Major heading is intended, explain its purpose in the PR description and link it to a separate issue.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks the broker’s door,
“No signals sent” is what we’re here for.
The preview leaves the process sound,
While normal shutdown brings it down.
The changelog hops along the way.

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@greptile-apps

greptile-apps Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This PR appears safe to merge; dry-run no longer signals the broker, and ordinary uninstall keeps its shutdown behavior.

Summary

uninstall --dry-run now previews broker shutdown without sending SIGTERM.

  • Uninstall dry runs preview broker shutdown without stopping it.

Reviews (1) · Last reviewed commit: "fix(cli): keep broker running during uni..." · Reviewed by Greptile

This branch has not been deployed

No deployments
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.

fix(cli): uninstall --dry-run sends SIGTERM to the recorded broker PID

1 participant