Skip to content

fix(uninstall): remove the REA-owned ZCode fallback registration - #2783

Merged
kaoru0822-kitauji merged 11 commits into
mainfrom
fix/issue-2664
Oct 14, 2026
Merged

kaoru0822-kitauji merged 11 commits into
mainfrom
fix/issue-2664

Conversation

@kaoru0822-kitauji

Copy link
Copy Markdown
Collaborator

Fixes #2664.

Problem

ZCode reads the user-scope ~/.agents/mcp.json mcpServers fallback whenever its native ~/.zcode/cli/config.json mcp.servers table is empty (docs/client-configuration.md). Setup already accounts for this: it copies fallback servers into the native table when writing the first native server.

Uninstall only edited the native table. With a REA-owned rea entry in both places, rea uninstall reported status: complete and ZCode removed. But the native table ended up empty and the fallback still held REA's registration, which ZCode would load again. Doctor then reported ZCode missing.

Fix

systemUninstallHost().clients() now also yields the ZCode fallback as a standard mcpServers JSON configuration (format: "json", configPath: zcodeFallbackPath). It reuses the existing uninstall path unchanged:

  • ownership check (isOwnedRegistration), so a foreign command stored under rea is retained;
  • .rea.backup before editing, readback verification, and restore on failure;
  • other fallback servers and settings are preserved;
  • a missing fallback is "skipped". Its result merges into the single ZCode item through collapseUninstallItems, like multi-path clients.

docs/client-configuration.md now states that uninstall removes REA's own entry from both locations.

Validation

  • New zcodeClientConfiguration.test.ts > ZCode fallback uninstall tests run the real runUninstall(false, systemUninstallHost(home)) on a disposable home:

    • With an owned entry in both locations, both are removed. ui and the other server are kept, the fallback .rea.backup equals the original, and ZCode reports removed.
    • A fallback-only owned entry is removed, and a foreign rea entry is kept.

    Both fail on main and pass here.

  • All uninstall/setup suites pass: 23 files, 360 tests, including tests/acceptance/setup. npm run check:fast, docs:check and format:check pass.

  • Not run: actual ZCode startup.

Behavior note: a malformed or unreadable fallback file now stops uninstall with a repair message, the same way a malformed native config already does. Uninstall can't tell whether such a file still holds REA's registration.

🤖 Generated with Claude Code

ZCode loads the user-scope `~/.agents/mcp.json` `mcpServers` fallback
whenever its native `mcp.servers` table is empty. Uninstall removed REA
only from the native table, so a REA-owned fallback entry became eligible
to load again once the last native server was gone, while uninstall
reported ZCode as removed and complete.

Also visit the ZCode fallback as a standard `mcpServers` JSON
configuration in the uninstall host. It goes through the same
ownership check, `.rea.backup`, readback and restore path as every other
client configuration, so other fallback servers and settings, and a
foreign `rea` entry, are preserved. Its result merges into the ZCode item.

Fixes #2664

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T00:26:12.229720Z 6305f83 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a3320f24e7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/application/Uninstall.ts Resolved
@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable defects were found.

Summary

Uninstall now removes REA-owned registrations from both ZCode configuration files.

  • ZCode uninstall removes REA-owned entries from both config files.

Reviews (8) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile

Address review findings at their producing boundaries and preserve directly affected consumers. Source inspection and git diff --check completed. Tests and automated checks were not run at the user’s explicit request.
@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Review findings addressed at their producing boundaries and consumers. Latest changes were reviewed from source; tests and provider runs were skipped at the maintainer's request. Findings requiring separate decisions or verification remain open.

  1. thread 1

The synthetic fallback entry selected the generic JSONC dialect. It now uses an explicit zcode_fallback dialect routed to the existing strict JSON.parse owner, including readback. Configuration editing and backup ownership are unchanged. Added comment/trailing-comma/BOM cases proving malformed fallback text remains unchanged without a backup/write.

Source inspection and git diff --check completed. Tests and automated checks were not run at the user’s explicit request. Commit: 6ae4887

@morluto morluto added bug Something isn't working area: setup Setup, packaging, upgrade, install, Doctor, and client registration area: cli CLI adapter and one-shot commands area: domain Domain logic, errors, and pure functions P2: medium Medium priority issue labels Oct 13, 2026
dakjdakd and others added 8 commits October 14, 2026 00:59
* fix(comparison): preserve incomplete function call evidence

Keep missing, unknown, partial and unresolved call relationships unknown in function comparisons and reconstruction claims. Aggregate IDA caller and callee coverage without overwriting uncertainty.

Validate with 144 focused tests, typecheck/lint, docs checks and test discovery. Real providers were not verified; the full headless IDA session suite requires unavailable Windows native controls.

* fix(comparison): recheck historical calls-only changes

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
* fix: repair the static-check failures on the default branch

The default branch fails its own required `Static checks` job three ways, so
every pull request reports that job as failed regardless of its own change.

- `npm run format:check` reports `src/domain/functionComparison.test.ts` and
  `src/ida/IdaOperationRunner.ts`.
- `npm run lint` reports a duplicate `import { join } from "node:path"` in
  `tests/boundary/mcp/ghidraInventoryMcp.test.ts` (lines 4 and 17).
- `npm run typecheck` reports `format: "devin"` missing from the client format
  union in `src/application/SupportedClients.ts`, and an unchecked index in
  `tests/boundary/cli/clientProfileLifecycle.test.ts`, whose pair array is
  inferred as `string[][]`.

Apply the pinned formatter, drop the duplicate import, list the `"devin"` format
that its own definition already uses, and mark the pair array `as const`.

Validation: `npm run check:fast` and `npm run format:check` pass.

* fix(setup): keep Devin on the JSON configuration dialect

---------

Co-authored-by: 吴佳浩 <wujiahao@supremind.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6305f8309b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

clients.flatMap((client) =>
uninstallConfigPaths(client).map((configPath) => ({
clients.flatMap((client) => [
...uninstallConfigPaths(client).map((configPath) => ({

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Remove the ZCode fallback before the native config

When the fallback copy or write fails after preflight (for example, a filesystem error while creating its backup), removeAll stops without rolling back the already-removed native entry. With this ordering, a native table whose only server was REA becomes empty while the fallback still contains REA, so ZCode activates the fallback registration again despite uninstall reporting failure. Process the fallback entry before the native entry so a later native failure leaves the active native registration intact.

Useful? React with 👍 / 👎.

@kaoru0822-kitauji
kaoru0822-kitauji merged commit ff56f78 into main Oct 14, 2026
34 checks passed
@kaoru0822-kitauji
kaoru0822-kitauji deleted the fix/issue-2664 branch October 14, 2026 00:33
morluto added a commit that referenced this pull request Oct 14, 2026
Keep layered environment choices, current byte-exact recovery snapshots, and package-manager failure details. Report pinned package drift without claiming runner resolution. Retain failed Linux installer cleanup for host-owned retry while preserving the install outcome.

Reviewed fixes include #2632, #2769, #2783, #2959, #2979, #2983, #2995, #3009, and #2559.

Validation: 98 focused setup/registration tests passed; 45 Linux installer tests passed. Real Linux package installation remains unverified.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI adapter and one-shot commands area: domain Domain logic, errors, and pure functions area: setup Setup, packaging, upgrade, install, Doctor, and client registration bug Something isn't working P2: medium Medium priority issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(uninstall): ZCode fallback retains REA after native registration removal

4 participants