Repository navigation
feat(config): persist provider settings in a user config file - #3023
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
[Medium impact] The PR appears safe to merge; no new blocking issue was found. SummaryAdds saved provider settings with environment values taking precedence. Setup keeps saved defaults out of client registrations, while doctor reports their source.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[CLI invocation] --> B{Command}
B -->|config| C[Command reads or edits saved settings]
B -->|uninstall| D[Use explicit environment]
B -->|other runtime commands| E[Load saved settings]
E --> F[Environment overrides saved values]
F --> G[Run command]
D --> H[Check registration ownership]
H --> I[Remove owned registrations and optional caches]
Reviews (16) · Last reviewed commit: "fix(uninstall): bypass saved provider de..." · Reviewed by Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f227d55010
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
f227d55 to
6d5e78e
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6d5e78ee7a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
6d5e78e to
4ab933a
Compare
|
Rebased onto Two conflicts came out of the rebase, both in the startup path that
Verification on this branch:
No new behaviour beyond the original proposal: a JSON config file at the documented path, environment variables still win, and every user-config key maps to the env var it already had. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4ab933a5ce
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Providers currently rediscover install paths from scratch in every process, so a path set once (for example GHIDRA_INSTALL_DIR) silently reverts on the next run. Introduce ~/.config/rea/rea.json as the user-owned persistence layer and merge it into the environment snapshot before configuration parsing, keeping env > config file > auto-detect precedence on both the CLI and MCP entry points. Add a rea config command (list/get/set/unset) as the write surface, reporting the effective value and where it came from.
…rface - stage config writes beside the file and rename into place so an interrupted write cannot leave partial JSON (greptile morluto#4, codex morluto#11) - convert unreadable config files into configuration errors on the CLI seam instead of escaping raw filesystem errors (greptile morluto#5, codex morluto#15) - keep injected runtimes without a config root isolated from the host account's rea.json (codex morluto#18) - surface the config file error on stderr when doctor falls back to the raw environment (greptile morluto#3, codex morluto#16) - route the config command through logCliCommand and return documents so --json stays parseable and failures exit non-zero (greptile morluto#2, codex morluto#10) - reject empty --set values, unknown --set/--unset/--get names, and --get combined with mutations (greptile #1/morluto#7, codex morluto#9/morluto#12/morluto#13/morluto#17) - cover the new behavior in the boundary tests and stop leaking one temporary home per run (greptile morluto#8)
4ab933a to
a5db808
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a5db808bb0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
TL;DR: At head a5db808 the new test file passes, 21 of 21, on Node 22.23.4, 24.22.1 and 26.12.1; the PR body says 18. The CLI saves, lists, reads and removes settings, and an environment variable wins over the file. One problem: with a malformed rea.json, every command I tried exits 1, even I ran the head as it stands, in a VM, not merged onto main (015a02d). This head is 1,224 commits behind main. On this head CI ran only Greptile, PR readiness and the author declaration, so no test ran in CI. Results
Findings
Not run
Test setup
CommandsInstall and tests, Node 24.22.1 unless noted. All exit 0. The same CLI and MCP probes, each as
🤖 Written and tested with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊 |
|
Pushed the startup conflict resolution at
|
|
I verified the remaining input-validation and production-home threads on a44c1ee. The current config registrar validates values and setting names before any file operation and rejects a read combined with mutations. Fresh CLI invocations refused empty values, get/set and get/unset combinations, and misspelled get/unset keys. Every invocation left the saved file byte-for-byte identical. The production MCP entrypoint loads the account configuration independently of the injected runtime. In an isolated Linux arm64 container, launching MCP with no home or config-root variables reported a malformed The source of live auto-discovered values remains open. The current |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a44c1ee1e9
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 42f26477c2
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 20f870fcae
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 175794f256
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a2c7166f3f
ℹ️ 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".
Problem and expected behavior
Problem: Provider settings set once (
GHIDRA_INSTALL_DIRetc.) revert on the next run, because every process rediscovers install paths from scratch. Reported in #3016.Expected: Settings stick across runs for both CLI and MCP entry points, with
env > config file > auto-detectprecedence, and existing env-based workflows untouched.Change and scope
src/config/userConfig.ts: reads~/.config/rea/rea.json(XDGXDG_CONFIG_HOMErespected, platform-aware home resolution), validates keys against the known provider-setting allowlist, and merges values into the environment snapshot beforeparseConfigruns.scripts/rea.mjsoverlays the user config via the exportedenvironmentWithUserConfighelper beforecreateClireceives the environment.src/main.tsmerges the config into the environment snapshot before configuration parsing.rea configcommand as the write surface:list(default, prints effective value + source),--get NAME,--set NAME=VALUE(repeatable),--unset NAME(repeatable).Follow the contribution scope: configuration persistence within existing boundaries — no target execution, injection, mutation, or protection recovery, so no maintainer scope decision is required (not applicable).
Contract and boundary impact
src/config/userConfig.ts); CLI + MCP wiring downstreamrea configsubcommand (list/--get/--set/--unset); no existing command changeddocs/public/product-catalog.json), package, or installation impact: canonical product catalog re-verified (11/11) after regenerating the build artifactExpected effects (check known effects; use documentation-only on its own).
Compatibility, safety, and release
~/.config/rea/rea.json), keys validated against a known allowlist, unknown keys rejected; no secrets stored by this PRAuthor readiness
Human owner: @Jackzigen
Before merge
type(scope): outcome.tests/boundary/userConfig.test.ts(18 tests).rea configlist/get/set/unset output with(env)/(config)source markers.Local validation:
npm run test:fast427 files / 5560 passed / 0 failed;tsc --noEmitclean;oxfmtclean; end-to-end smoke on the bundled CLI confirms env-over-file precedence.What
Provider settings set once (for example
GHIDRA_INSTALL_DIR) currently revert on the next run because every process rediscovers install paths from scratch. This PR adds a user-owned config file so such settings stick, on both the CLI and MCP entry points.Implementation
src/config/userConfig.ts: reads~/.config/rea/rea.json(XDGXDG_CONFIG_HOMErespected, platform-aware home resolution), validates keys against the known provider-setting allowlist, and merges values into the environment snapshot beforeparseConfigruns.scripts/rea.mjsnow overlays the user config via the exportedenvironmentWithUserConfighelper beforecreateClireceives the environment.src/main.tsmerges the config into the environment snapshot before configuration parsing.rea configcommand as the write surface:list(default, prints effective value + source),--get NAME,--set NAME=VALUE(repeatable),--unset NAME(repeatable). Output marks whether each value comes fromenvorconfig.Testing
tests/boundary/userConfig.test.ts: 18 tests covering path resolution (XDG override, non-absolute fallback, Windows), JSON validation (unknown keys rejected), merge precedence (env wins, file fills gaps, invalid JSON surfaces a ConfigurationError), and write/unset round-trips on real temp directories (sorted keys, trailing newline, merge preserves other keys, unset on missing file is a no-op).npm run test:fast: 427 files / 5560 passed / 0 failed.tsc --noEmitclean;oxfmtclean; canonical product catalog re-verified (11/11) after regenerating the build artifact.config --set, then list shows(config); with the env var set the same list shows(env)and the file value is shadowed — precedence confirmed on the real binary.Closes #3016