Skip to content

fix(cli): highlight retained gateway environments - #8876

Merged
cv merged 10 commits into
mainfrom
fix/8797-highlight-retained-gateways
Aug 13, 2026
Merged

cv merged 10 commits into
mainfrom
fix/8797-highlight-retained-gateways

Conversation

@sandl99

@sandl99 sandl99 commented Aug 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Selected-port uninstall now presents retained sibling gateway environments and their cleanup commands as a yellow warning on interactive terminals. The warning uses stderr and remains plain when stderr does not support color or NO_COLOR is set, while gateway cleanup behavior is unchanged.

Related Issue

Partially addresses #8797.

Changes

  • Route the existing retained-gateway notice and cleanup commands through the uninstall warning channel.
  • Add one warning marker and apply yellow only when stderr reports color support.
  • Test the stderr warning, stdout absence, yellow output, plain-output fallback, and no-sibling case.

The downgrade-install migration diagnostic reported in #8797 is outside this first change and should be handled separately.

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with doc updates
  • Doc only (prose changes, no code sample modifications)
  • Doc only (includes code sample changes)

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Docs updated for user-facing behavior changes
  • Docs not applicable — justification: The uninstall guide and command reference already document retained sibling gateway ports and both cleanup commands. This change only changes the notice's terminal severity and color; it does not change the documented workflow.
  • Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging)
  • Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification:
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Documentation Writer Review

  • Documentation writer subagent reviewed the completed changes
  • Result: no-docs-needed
  • Evidence: docs/manage-sandboxes/uninstall-nemoclaw.mdx and docs/reference/commands.mdx already document the retained-gateway notice and cleanup commands; no documentation source changed.
  • Agent: Codex CLI

DGX Station Hardware Evidence

  • Tested on DGX Station
  • Tested commit: Not applicable; scripts/prepare-dgx-station-host.sh is unchanged.
  • Station profile/scenario: Not applicable.
  • Result: Not applicable.
  • Supporting evidence: Not applicable.

Verification

  • PR description includes a Signed-off-by: line and every commit appears as Verified in GitHub
  • Normal pre-commit, commit-msg, and pre-push hooks passed, or npm run validate:pr passed after refreshing origin/main when hooks were skipped or unavailable
  • Targeted behavior test passes for the current change set — npx vitest run src/lib/actions/uninstall/run-plan-other-gateway-report.test.ts -t "colors the retained gateway warning" (1 passed, 5 skipped)
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — Not applicable; this is a scoped uninstall presentation change covered by the targeted CLI test and normal hooks.
  • Quality Gates section completed with required justifications or waivers
  • No secrets, API keys, or credentials committed
  • npm run docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Signed-off-by: San Dang [email protected]

Summary by CodeRabbit

  • Bug Fixes
    • Improved uninstall reporting when other gateway environments are detected.
    • Gateway-preservation messages now appear as warnings instead of standard logs.
    • Warnings are highlighted in yellow when terminal color support is available.
    • Uninstall guidance remains visible after failed cleanup attempts, including retained resources and commands.
    • Output remains quiet when no other gateway environment is present.
    • Warning and standard log messages are now clearly separated.

@sandl99 sandl99 self-assigned this Aug 12, 2026
@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: c4adb575-8cd5-42e5-920a-a46ad1a7b9ca

📥 Commits

Reviewing files that changed from the base of the PR and between 59d51de and 59364c3.

📒 Files selected for processing (2)
  • src/lib/actions/uninstall/run-plan-other-gateway-report.test.ts
  • src/lib/actions/uninstall/run-plan.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/lib/actions/uninstall/run-plan-other-gateway-report.test.ts
  • src/lib/actions/uninstall/run-plan.ts

📝 Walkthrough

Walkthrough

The uninstall plan now reports retained gateway environments as warnings. Warning text uses conditional yellow coloring. Tests separately capture logs and warnings and verify gateway retention, command formatting, color behavior, silence, and failed sweep handling.

Changes

Uninstall gateway reporting

Layer / File(s) Summary
Gateway warning reporting
src/lib/actions/uninstall/run-plan.ts
The uninstall runtime now tracks stderr TTY and color support. Retained gateway guidance uses runtime.warn. Warning text receives yellow ANSI coloring when stderr is interactive, color support is available, and NO_COLOR is unset.
Warning output validation
src/lib/actions/uninstall/run-plan-other-gateway-report.test.ts
Tests capture logs and warnings separately. They verify retained gateway warnings, command formatting, color behavior, silence, and failed sweep handling.

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

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: highlighting retained gateway environments in the CLI.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/8797-highlight-retained-gateways

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

@github-code-quality

github-code-quality Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in commit 20b2ecd in the fix/8797-highlight-r... branch remains at 96%, unchanged from commit 7f624f0 in the main branch.

TypeScript / code-coverage/cli

The overall coverage in commit 20b2ecd in the fix/8797-highlight-r... branch remains at 82%, unchanged from commit 7f624f0 in the main branch.

Show a code coverage summary of the most impacted files.
File main 7f624f0 fix/8797-highlight-r... 20b2ecd +/-
src/lib/actions...all/run-plan.ts 86% 86% 0%
src/lib/credentials/store.ts 57% 57% 0%
src/lib/onboard...hell-version.ts 85% 85% 0%
src/lib/sandbox...rce-identity.ts 86% 86% 0%
src/lib/state/config-io.ts 93% 95% +2%
src/lib/onboard...tp-readiness.ts 98% 100% +2%
src/lib/messagi...annel-config.ts 95% 99% +4%

Updated August 13, 2026 06:40 UTC

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/lib/actions/uninstall/run-plan.ts`:
- Around line 526-531: Update yellowWarningText in
src/lib/actions/uninstall/run-plan.ts (lines 526-531) to disable color whenever
runtime.env.NO_COLOR is defined, including an empty string. Update
src/lib/actions/uninstall/run-plan-other-gateway-report.test.ts (lines 117-125)
to omit NO_COLOR from the colored case and add coverage confirming NO_COLOR: ""
returns plain warning text.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 9ede8e9b-970d-45a9-92bd-d62a8b0f4c26

📥 Commits

Reviewing files that changed from the base of the PR and between ba0fbfc and e8ded77.

📒 Files selected for processing (2)
  • src/lib/actions/uninstall/run-plan-other-gateway-report.test.ts
  • src/lib/actions/uninstall/run-plan.ts

Comment thread src/lib/actions/uninstall/run-plan.ts Resolved
@github-actions

github-actions Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

PR Review Advisor — No blocking findings reported

Advisor assessment: No blocking advisor findings reported
Next action: No advisor follow-up needed.
Findings: 0 blockers · 0 warnings · 0 suggestions

Model lanes

  • GPT-5.6 Terra (primary): Completed · high confidence · 0 blockers · 0 warnings · 0 suggestions
  • Nemotron 3 Ultra (second opinion): Completed · high confidence · 0 blockers · 0 warnings · 0 suggestions
  • Model comparison: normalized findings match; normalized terminology decisions differ; normalized E2E selections differ; severity counts match.
1 additional E2E selection from the second opinion

Advisory only. The primary lane did not select these E2E jobs or targets.

  • concurrent-gateway-ports: The completed second-opinion lane identified E2E coverage that the primary lane omitted.

Second-opinion terminology and E2E selections are advisory. Live E2E does not run automatically for pull requests.

2 semantic terminology decisions

Terminology decisions are advisory. They affect the assessment only when a separate finding identifies concrete semantic impact.

  • established — gateway-port environment at src/lib/actions/uninstall/run-plan.ts:2063: Keep the established term.
  • justified — retained gateway at src/lib/actions/uninstall/run-plan-other-gateway-report.test.ts:113: Keep the modifier in the behavior-oriented test title.

E2E guidance

Advisory only. A maintainer can dispatch the default E2E suite for the commit under review.

Recommended E2E: None

Workflow run details

This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge.

@wscurran wscurran added area: cli Command line interface, flags, terminal UX, or output area: install Install, setup, prerequisites, or uninstall flow bug-fix PR fixes a bug or regression labels Aug 12, 2026

@cv cv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

src/lib/actions/uninstall/run-plan.ts:531 treats an interactive stderr as sufficient evidence of color support. On a TTY, Node reports hasColors() === false and color depth 1 for FORCE_COLOR=0, NODE_DISABLE_COLORS=1, and TERM=dumb, but yellowWarningText still writes ANSI escape bytes. This violates the PR's plain-output contract and affects terminals or captures that explicitly disable color. Determine color capability from stderr's color support result while retaining NO_COLOR handling, and add regression coverage for an interactive stderr that does not support color. Reproduction on Node v25.9.0 through a pseudo-TTY produced isTTY=true, depth=1, and hasColors=false for all three cases; the current test covers only non-TTY stderr and NO_COLOR.

@cjagwani cjagwani self-assigned this Aug 12, 2026
@cjagwani

Copy link
Copy Markdown
Collaborator

Addressed the requested terminal-capability review on current head 59364c3: warning color now requires stderr.hasColors() in addition to TTY and NO_COLOR checks, with a regression for an interactive stderr that reports no color support. Focused behavior test, Biome, CLI build, typecheck, and normal commit/pre-push hooks pass.

@cjagwani
cjagwani requested a review from cv August 12, 2026 20:21

@cv cv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The retained-gateway warning now honors stderr color capability and NO_COLOR. Required checks pass on 20b2ecd, and no correctness or security finding remains.

@cv
cv merged commit 6160df1 into main Aug 13, 2026
55 of 57 checks passed
@cv
cv deleted the fix/8797-highlight-retained-gateways branch August 13, 2026 06:51
@wscurran wscurran added the area: observability Logging, metrics, tracing, diagnostics, or debug output label Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli Command line interface, flags, terminal UX, or output area: install Install, setup, prerequisites, or uninstall flow area: observability Logging, metrics, tracing, diagnostics, or debug output bug-fix PR fixes a bug or regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants