Skip to content

fix(setup): honor active client configuration and skill roots - #1504

Merged
morluto merged 7 commits into
mainfrom
codex/fix-client-profile-resolution
Oct 10, 2026
Merged

morluto merged 7 commits into
mainfrom
codex/fix-client-profile-resolution

Conversation

@morluto

@morluto morluto commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

Summary

Setup could report ready after writing configuration or skills the selected client never reads. Doctor could overlook a higher-priority disabled or managed registration, and uninstall could expose an older registration. This corrects the confirmed client integration failures from the maintainer audit; no separate issue was opened for the grouped correction.

Problem and expected behavior

GEMINI_CLI_HOME=/profiles/work must select that home's settings and skills. OpenCode must inspect its normal global files even with OPENCODE_CONFIG_DIR set, then apply explicit/custom-file precedence. Gemini must account for trusted workspace policies and same-name system server overrides before reporting readiness.

Setup plans and changes user-owned registration files only. A conflicting immutable registration or blocking policy returns needs_human with no planned/applied actions and a source-specific remediation. Doctor reports the conflict rather than aligned. Uninstall removes owned OpenCode registrations from every applicable user file.

Change and scope

  • Honor Gemini's selected home and skill root; consolidate user/default/system/trusted-workspace MCP allow/exclude policies. Evaluate persisted folder trust, explicit trust/restricted-mode overrides and effective folder-trust settings without granting trust.
  • Treat Gemini mcpServers as a shallow merge: a winning workspace/system entry replaces the entire user entry. Block a conflicting definition; accept an identical one; retain the source path.
  • Preserve OpenCode's normal XDG global configuration with custom directories, its JSON/JSONC and explicit-file precedence, malformed-source failures, and multi-file owned cleanup.
  • Correct empty Codex/Grok home overrides, relative OMP directories, Devin XDG selection, and Antigravity's personal skill destination.
  • Match downloaded Grok's actual enablement behavior: entry-level disabled=true is ignored; enabled=false and the root denylist still disable it.
  • Integrate current main, including merged Pi/Hermes support. Adapt Pi assertions to the shared relative OMP path rather than assuming doctor has exactly one registration.

No new client adapter, model request, analysis-provider change, or dependency change. MiniMax was inspected separately below; this PR does not advertise automatic MiniMax registration.

Contract and boundary impact

  • Semantic owner and earliest changed stage: supported-client path metadata and source-aware configuration/trust loading.
  • CLI and MCP/tool-catalog contract: existing setup/doctor/uninstall commands and client identifiers; no analysis-tool/catalog changes.
  • Provider, bridge, target-format, or platform compatibility: no provider/bridge changes; existing platform selection retained.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Process execution, authorization, cleanup, or containment impact: planned approval, backups, idempotency and owned uninstall retained. Workspace/system settings and trust are read-only.
  • Generated metadata, package, or installation impact: corrected active configuration/skill roots; no version bump or generated artifacts committed.

Evidence and regression coverage

  • Public CLI regression journeys cover seven affected integrations, Gemini policy consolidation/managed definitions/persisted and explicit trust, OpenCode custom-plus-global cleanup, malformed files, backups, preservation, and repeat behavior.

  • Previous base reproductions reported ready/healthy for wrong roots or suppressed registrations. New tests assert the effective paths and reject conflicts before writes.

  • Representative blocked output: status: "needs_human", empty actions, and a named mcp.allowed, mcp.excluded, or mcpServers.rea source remediation.

  • Downloaded exact npm artifacts and inspected their shipped implementations: Gemini CLI 0.63.0, Grok Build 1.0.50, MiniMax Code 0.6.5. All runtime probes used isolated homes without authentication or model calls.

  • Unmodified public Gemini CLI connected to REA and enabled the installed shared skill. Native Grok completed a real MCP handshake and discovered 139 REA tools and its skill. Installed MiniMax's unmodified runtime also discovered 139 REA tools and cataloged the skill; its public ACP session creation requires login, so that authenticated journey was not claimed.

  • Gemini workspace/trust probes execute the shipped loader. Managed merger probes supply scopes to its unchanged settings class; they do not establish privileged managed-file loading.

  • Remaining gaps: no Windows/Linux native harness session, IDE-only trust, model turn, or analysis-provider run. Gemini 0.63.0 additionally skips managed files failing OS ownership/permission checks; REA conservatively considers configured managed paths and can request manual review for a file that release ignores. MiniMax has no REA setup adapter; external-skill disabling hides its shared skill root. Its accepted relative data-directory override later fails in native plan initialization.

  • Observed, derived, and inferred claims remain distinguishable.

  • Artifact identity, source provenance, and failed attempts remain preserved.

  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

On macOS, Node 24.18.0 / npm 11.16.0:

  • npm run test:focused -- with 16 client/setup/registration test files — 228 passed.
  • npm run check — passed: types, lint/module boundaries, formatting, Knip, metadata and architecture guards.
  • npm run docs:check — passed.
  • npm run verify:package — passed, including installed CLI/MCP, setup/uninstall/backups, bundled skill and Skills 1.7.2 discovery; 139 tools.
  • npm pack --dry-run — passed.
  • Actual downloaded harness workflows and controlled loader probes described above — passed within their stated scope.

Compatibility, safety, and release

  • Breaking changes or migration: no command/identifier removal; rerun setup under the intended client environment to repair old installations.
  • Real Hopper/Ghidra, browser, or OS coverage: macOS CLI/package/harness workflows; provider behavior unchanged.
  • Package/release metadata impact: no version bump; ignored build/evidence outputs excluded.
  • Security/privacy/process review: no credentials/model calls, ambient environment persistence, administrator/workspace writes, trust grants, or unrelated software installation. Malformed sources stop setup before writes; unrelated registrations/settings remain intact.

Review checklist

  • Concrete problem and focused Conventional Commit title.
  • Grouped audit explains why no separate issue was linked.
  • Observable behavior, meaningful failures and owning docs covered.
  • Representative CLI output and native proof limits included.
  • Final diff checked for secrets, unrelated cleanup and unsupported claims.

@morluto
morluto marked this pull request as ready for review October 10, 2026 08:03
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 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-10T08:33:13.783735Z b7f5440 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: 1a5a0ee946

ℹ️ 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/SupportedClients.ts Resolved

@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: b7f5440052

ℹ️ 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/SupportedClients.ts Resolved
An empty OPENCODE_CONFIG_DIR now stays on the XDG directory, and doctor
and setup inspect global OpenCode files when a custom directory is absent.
Uninstall reports one status per client so a missing earlier layer does
not hide a removed registration.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@CassieFox23

CassieFox23 commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

TL;DR: All seven fixes work on Linux at head b7f544005, and main 983b070d4 still shows every bug. Config and skills now land where each client reads them. Gemini CLI (Apache-2.0) rules that block REA now stop setup.

Case Main 983b070d4 This PR b7f544005
GEMINI_CLI_HOME set Writes the default ~/.gemini. Doctor says aligned. Writes the profile. Skill goes to the profile.
opencode.json plus opencode.jsonc with REA off Leaves REA off in the JSONC. Doctor says aligned. Fixes the JSONC. Doctor checks the JSONC. Uninstall cleans both files.
Empty CODEX_HOME Writes config.toml in the scratch folder. Writes ~/.codex/config.toml.
Empty GROK_HOME Writes config.toml in the scratch folder. Writes ~/.grok/config.toml.
omp with a relative PI_CODING_AGENT_DIR Ignores it. Writes ~/.omp/agent. Writes under the scratch folder.
devin with a custom XDG_CONFIG_HOME Writes ~/.config/devin. Writes under the custom folder.
antigravity skill Goes to ~/.agents/skills. Goes to ~/.gemini/config/skills.
Gemini CLI rule Main This PR
User file excludes rea Ready Needs human. No file changed.
System file allows only other Ready Needs human
Workspace excludes rea, folder not trusted Ready Ready, as your docs say.
Workspace excludes rea, folder in trustedFolders.json Ready Needs human
Workspace excludes rea, GEMINI_CLI_TRUST_WORKSPACE=true Ready Needs human
Trusted workspace with its own rea entry Ready Needs human
Rule added after setup, then doctor Aligned Stale

On this PR, every second setup changed nothing. Uninstall removed every REA entry and skill copy. It kept comments, other servers and other settings. The codex config came back byte for byte.

Check on b7f544005 Node 22.23.1 Node 24.18.0 Node 26.11.1
The three changed test files 26 of 26 26 of 26 26 of 26
npm run check Pass
npm run docs:check Pass

Small notes

  • Oxlint now shows 507 warnings, up from 502 on main. There are no errors. The five new ones are in ClientRegistrationStatus.ts (three), GeminiClientSettings.ts and SupportedClients.ts.
  • In the relative omp case, doctor also lists pi as aligned. Both read PI_CODING_AGENT_DIR, so it is the same file. Only pi shows the path unresolved.
  • Uninstall leaves a .rea.backup file and an empty server table. Main does the same, so this is not new.

Not run

  • The real clients. None of them is installed here, so I checked files only.
  • Windows and macOS.
  • Trust that comes from a running IDE. Your docs leave this out too.
  • OPENCODE_CONFIG_DIR, OPENCODE_CONFIG and GEMINI_CLI_SYSTEM_DEFAULTS_PATH.
  • The newest commit, dfe448fc0, which treats empty OpenCode overrides as unset. It landed after my run.

Thanks, morluto, for the careful fix and the clear examples in the PR text.

Commands

Each run used a fresh fake home and a separate scratch folder. The steps were dry run, setup, doctor, setup again, then uninstall. Each step ran like this, with HOME checked to sit inside my test folder first:

env -i PATH="$NODE24/bin:/usr/bin:/bin" HOME="$FAKE" TMPDIR="$FAKE/tmp" \
  XDG_CONFIG_HOME="$FAKE/.config" XDG_DATA_HOME="$FAKE/.local/share" \
  XDG_CACHE_HOME="$FAKE/.cache" XDG_STATE_HOME="$FAKE/.local/state" \
  npm_config_cache="$FAKE/.npm" npm_config_prefix="$FAKE/.npm-global" npm_command=exec \
  timeout 60 node scripts/rea.mjs setup --client gemini_cli --yes --format json

Tests: node scripts/run-development-tests.mjs focused tests/boundary/cli/clientProfiles.test.ts tests/boundary/cli/piClientSetup.test.ts tests/boundary/filesystem/ompClientConfiguration.test.ts, once per Node.

Test setup
  • Box: Nobara 44 (Fedora 44 base), Linux 7.2.9
  • CPU: AMD Ryzen 9 5900X, 12 cores / 24 threads
  • RAM: 32 GB
  • Node: 22.23.1, 24.18.0, 26.11.1 (npm 11.16.0 for installs)
  • Head / base: b7f544005 / 983b070d4

🤖 Generated with Claude Code (Opus 5.5) 🦊

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@morluto
morluto merged commit 7a56fe6 into main Oct 10, 2026
13 checks passed
@morluto
morluto deleted the codex/fix-client-profile-resolution branch October 10, 2026 09:03
darsrc pushed a commit to darsrc/rea that referenced this pull request Oct 10, 2026
…o#1504)

* refactor(setup): resolve skill destinations per client

* fix(setup): honor active client configuration and skill roots

* fix(setup): validate effective client scopes and Gemini trust

* fix(setup): treat empty OpenCode overrides as unset

An empty OPENCODE_CONFIG_DIR now stays on the XDG directory, and doctor
and setup inspect global OpenCode files when a custom directory is absent.
Uninstall reports one status per client so a missing earlier layer does
not hide a removed registration.

---------

Co-authored-by: Cursor Agent <[email protected]>
@morluto morluto added bug Something isn't working area: cli CLI adapter and one-shot commands labels Oct 14, 2026
@morluto morluto added the area: setup Setup, packaging, upgrade, install, Doctor, and client registration label Nov 23, 2026
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: setup Setup, packaging, upgrade, install, Doctor, and client registration bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants