Skip to content

fix(settings): report external Codex ownership - #600

Closed
luvs01 wants to merge 7 commits into
devfrom
codex/propose-fix-for-reported-configuration-bug
Closed

luvs01 wants to merge 7 commits into
devfrom
codex/propose-fix-for-reported-configuration-bug

Conversation

@luvs01

@luvs01 luvs01 commented Sep 21, 2026 •

Copy link
Copy Markdown
Owner

Motivation

  • The injector previously returned success: true when an external model_provider owned config.toml, which caused apply to be reported as applied and led the CLI to claim the file was rewritten and to show an incorrect auth-source consequence.
  • The goal is to distinguish a deliberate preserve/no-op (externally owned config) from an actual write so the operator is not misled about which provider controls sign-in and routing.

Description

  • Return an explicit marker from the injector by adding configApplied?: false to CodexInjectResult when injection preserves an externally owned config.toml rather than writing it (src/codex/inject.ts).
  • Map that preservation outcome to a non-retryable external_provider apply reason in applyCodexDesktopSwitches, and report applied: false with the injector message as detail (src/codex/desktop-switches.ts).
  • Represent externally-controlled effective state by allowing effective to be null and by reporting authSource.presentsCodexAccount as null with a descriptive summary, so the UI/CLI shows the external ownership rather than claiming a rewrite (src/codex/desktop-switches.ts).
  • Update CLI formatting so it states when the effective state is controlled by an external provider, avoids claiming ~/.codex/config.toml was rewritten, and does not suggest ocx sync for the non-retryable external-ownership case (src/cli/system-command.ts).
  • Add regression tests and an integration assertion to cover the externally-owned path and the reporting surface (tests/config/settings-desktop-switch-apply.test.ts, tests/cli/cli-headless-parity.test.ts, and tests/codex-integration/codex-inject-integration.test.ts).
  • Document the behavior in structure/config.md to state that external model_provider ownership is preserved and reported as externally controlled rather than claiming a rewrite.

Testing

  • Ran focused tests: ./node_modules/.bin/bun test tests/config/settings-desktop-switch-apply.test.ts and ./node_modules/.bin/bun test tests/cli/cli-headless-parity.test.ts, and both passed (new external-provider cases included).
  • Ran bun run typecheck and bun run structure:check, both succeeded.
  • Ran the full test suite (bun run test) for observation: the modified subsystem tests pass; the full suite completed but included unrelated environment-sensitive failures in some integration lanes (existing JSON parse and process-group assertions) that are not caused by these changes.

Codex Task


Devin Review

devin-ai-integration Bot and others added 2 commits September 20, 2026 13:22
…forwarded role (lidge-jun#5334 follow-up)

lidge-jun#5334 made the developer wire role tri-state: an undeclared destination folds
it to system. Two suites asserting role:"developer" on the Chat wire were
missed because they are about tool-result repair ordering and document parts,
not role selection — declare the destination, per the convention the change
established.

Verified: both files fail on dev@600075d2 with system-for-developer wire roles
and pass with the declaration.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Repository: luvs01/opencodex/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 93609e76-cc4c-4043-9e96-d3670fa97752


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

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 21, 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-09-21T02:30:36.680536Z 0fe44e4 PR opened
ℹ️ 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.

@github-actions

Copy link
Copy Markdown

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Sep 21, 2026
devin-ai-integration[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

GET /api/settings and switch-free PUTs passed reason "not_requested", so describeCodexDesktopSwitches reported boolean effective state and an OpenCodex-derived sign-in requirement even while an external model_provider owned config.toml. observedCodexDesktopSwitchApply now consults the same currentExternalCodexModelProvider predicate the injector uses, so read reports describe observed ownership (effective: null, external_provider, external auth source) instead of re-deriving it only from a completed apply. Documents the reporting contract in structure/config.md and the public guide.

Co-Authored-By: Epinephrine <luvs01@hanmail.net>
@devin-ai-integration

Copy link
Copy Markdown

Fixed in 6321d1e — the read path now consults currentExternalCodexModelProvider via a new observedCodexDesktopSwitchApply() helper, so GET /api/settings (and switch-free PUTs) report effective: null and apply.reason: "external_provider" while config.toml is externally owned. A GET regression test covers an externally owned config.toml.

@devin-ai-integration

Copy link
Copy Markdown

Fixed in 6321d1e — docs-site/src/content/docs/guides/codex-integration.md now documents that GET /api/settings / ocx system settings report externally owned switches as externally controlled (effective: null) while config.toml selects another model_provider.

@devin-ai-integration

Copy link
Copy Markdown

Fixed in 6321d1e — read reports now derive external ownership from currentExternalCodexModelProvider through observedCodexDesktopSwitchApply(), independently of the one-request apply outcome, so a refreshed GET /api/settings stays accurate while config.toml remains externally owned.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration Bot and others added 3 commits September 24, 2026 16:21
…d failures

currentExternalCodexModelProvider throws when config.toml exists but cannot be
read (permissions, or deletion racing existsSync), which broke every settings
GET and unrelated PUT. observedCodexDesktopSwitchApply now reports
not_requested/retryable instead, matching how it treats undetermined ownership.

Co-Authored-By: Epinephrine <luvs01@hanmail.net>
dev renamed applyCodexDesktopSwitches to applyCodexConfigInjection and moved
desktopSwitchApplyReason into runtime-api; the merge keeps the read-path
ownership predicate (observedCodexDesktopSwitchApply) and carries the
external_provider reason into the moved helper.

Co-Authored-By: Epinephrine <luvs01@hanmail.net>
…tructure budget

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration[bot]

This comment was marked as resolved.

…ync advice

applyCodexConfigInjection's integration and runtime gates returned before the injector could classify external config.toml ownership, so a switch PUT disagreed with the settings GET. The gates now consult the same ownership predicate and report external_provider. The sidecar CLI also stops advising 'ocx sync' on that outcome — a sync re-runs the injection the external provider owns.

Co-Authored-By: Epinephrine <luvs01@hanmail.net>
@devin-ai-integration

Copy link
Copy Markdown

Addressed in c04dce2.

1 similar comment
@devin-ai-integration

Copy link
Copy Markdown

Addressed in c04dce2.

@devin-ai-integration

Copy link
Copy Markdown

Scope clarified in reply above — dashboard consumption is follow-up work, not claimed by this PR.

@luvs01

luvs01 commented Sep 24, 2026

Copy link
Copy Markdown
Owner Author

Closing: submitted upstream as lidge-jun#5776, rebased onto current dev and verified — bun test tests/config/settings-desktop-switch-apply.test.ts 4 pass; cli-headless-parity 82 pass with one pre-existing environmental timeout also present on the dev baseline. Nothing left to merge here.

@luvs01 luvs01 closed this Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aardvark bug Something isn't working codex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant