Skip to content

docs(cursor): document exec policy and catalog troubleshooting - #321

Merged
Ingwannu merged 1 commit into
devfrom
agent/refresh-pr303-docs
Jul 23, 2026
Merged

docs(cursor): document exec policy and catalog troubleshooting#321
Ingwannu merged 1 commit into
devfrom
agent/refresh-pr303-docs

Conversation

@Ingwannu

@Ingwannu Ingwannu commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

Current-dev replacement for #303, preserving Diego Cantarero as the commit author.

  • document nativeLocalExec modes and legacy precedence;
  • explain the fail-closed codex-sandbox behavior and loopback trust boundary;
  • add catalog troubleshooting for filters, Cursor discovery, caches, and competing local writers;
  • preserve the custom model display-name section added by Preserve custom model display names across catalog syncs #307 while resolving the stale-base conflict.

Validation

  • git diff --check
  • docs-site build: 121 pages
  • the same docs were included in the five-PR integration stack that passed full pre-push: 3,667 tests / 0 failures, typecheck, GUI lint, privacy scan.

Supersedes #303.

Summary by CodeRabbit

  • Documentation
    • Added troubleshooting guidance for missing models, catalog visibility, ordering, caching, and refresh behavior in the Codex integration guide.
    • Documented Cursor’s nativeLocalExec setting, including its available modes, security implications, and configuration examples.
    • Clarified that the legacy unsafeAllowNativeLocalExec option remains supported when the new setting is unset.

@Ingwannu
Ingwannu requested a review from lidge-jun as a code owner July 23, 2026 07:18
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Jul 23, 2026
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Documentation updates clarify Cursor native execution policy and add Codex catalog troubleshooting guidance covering model visibility, discovery, ordering, and cache refresh behavior.

Changes

Documentation guidance

Layer / File(s) Summary
Cursor native execution policy
docs-site/src/content/docs/reference/adapters.md, docs-site/src/content/docs/reference/configuration.md
Documents nativeLocalExec modes, legacy unsafeAllowNativeLocalExec precedence, configuration examples, dashboard placement, and security defaults.
Catalog troubleshooting guidance
docs-site/src/content/docs/guides/codex-integration.md
Adds an ordered checklist for model selection, visibility, Cursor discovery, catalog writes, and cache refresh using ocx sync.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: lidge-j

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 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 two main changes: Cursor exec policy documentation and catalog troubleshooting.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/refresh-pr303-docs

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

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

🤖 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 `@docs-site/src/content/docs/guides/codex-integration.md`:
- Around line 170-171: Reword the “Cache and ocx sync” guidance to clarify that
ocx sync rebuilds the on-disk Codex catalog and invalidates Codex’s
models_cache.json, but does not force live provider discovery. State that
gatherRoutedModels() continues using the per-provider modelCacheTtlMs cache,
with fresh discovery occurring only when that cache is stale or cleared.

In `@docs-site/src/content/docs/reference/adapters.md`:
- Around line 137-139: Update the nativeLocalExec resolver so any explicitly
provided unrecognized value disables the broader executor and never falls back
to unsafeAllowNativeLocalExec; retain legacy fallback only when nativeLocalExec
is unset. Align docs-site/src/content/docs/reference/adapters.md lines 137-139,
docs-site/src/content/docs/reference/configuration.md lines 190-191, and
docs-site/src/content/docs/reference/configuration.md lines 269-271 with this
fail-closed behavior, preserving “explicit value always wins” only for valid
explicit values.
🪄 Autofix (Beta)

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: ASSERTIVE

Plan: Pro Plus

Run ID: 8b5a4dc3-6ba7-48ac-9aec-baa9fdb22b35

📥 Commits

Reviewing files that changed from the base of the PR and between 5662c7e and a2c8b38.

📒 Files selected for processing (3)
  • docs-site/src/content/docs/guides/codex-integration.md
  • docs-site/src/content/docs/reference/adapters.md
  • docs-site/src/content/docs/reference/configuration.md

Comment on lines +170 to +171
5. **Cache and `ocx sync`** — live catalogs are cached for about five minutes (`modelCacheTtlMs`,
default `300000`). Run `ocx sync` to force a fresh fetch and rewrite the catalog immediately.

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 6 \
  'modelCacheTtlMs|ocx sync|invalidate|force.?fetch|cache' .

Repository: lidge-jun/opencodex

Length of output: 50378


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== docs snippet ==\n'
sed -n '160,180p' docs-site/src/content/docs/guides/codex-integration.md

printf '\n== sync references ==\n'
rg -n -C 3 '\bocx sync\b|/api/sync|modelCacheTtlMs|clearModelCache|invalidate.*cache|stale the Codex model cache|rewrite the catalog' \
  docs-site src tests --glob '!**/dist/**' --glob '!**/build/**'

printf '\n== model cache implementation ==\n'
rg -n -C 4 'modelCacheTtlMs|clearModelCache|getStaleCached|setCached|cache.*ttl|ttl.*cache|invalidate.*model cache' src tests --glob '!**/dist/**' --glob '!**/build/**'

Repository: lidge-jun/opencodex

Length of output: 50378


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== sync command files ==\n'
fd -a 'sync' src docs-site tests | sed -n '1,120p'

printf '\n== direct references to ocx sync command ==\n'
rg -n -C 4 'ocx sync|sync command|command.*sync|/api/sync|stale the Codex model cache' src docs-site tests

printf '\n== model-cache file outline ==\n'
fd -a 'model-cache' src tests

Repository: lidge-jun/opencodex

Length of output: 50377


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== candidate model-cache file ==\n'
fd -a 'model-cache.ts' src

printf '\n== candidate sync implementation files ==\n'
fd -a 'sync' src | sed -n '1,120p'

Repository: lidge-jun/opencodex

Length of output: 315


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 5 '/api/sync|stale the Codex model cache|clearModelCache\(|modelCacheTtlMs: 0|sync.*model cache|refresh.*catalog' \
  src docs-site tests

Repository: lidge-jun/opencodex

Length of output: 50377


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 4 'clearModelCache|setCached\(|getStaleCached\(|modelCacheTtlMs|sync' src/codex src/cli src | head -n 200

Repository: lidge-jun/opencodex

Length of output: 12880


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== src/codex/sync.ts ==\n'
sed -n '1,140p' src/codex/sync.ts

printf '\n== src/codex/model-cache.ts ==\n'
sed -n '1,180p' src/codex/model-cache.ts

printf '\n== refreshCodexModelCatalog references ==\n'
rg -n -C 6 'refreshCodexModelCatalog|syncModelsToCodex|clearModelCache\(' src/codex src/server src/cli

Repository: lidge-jun/opencodex

Length of output: 31145


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== src/codex/refresh.ts ==\n'
sed -n '1,220p' src/codex/refresh.ts

printf '\n== sync/catalog call sites ==\n'
rg -n -C 4 'syncCatalogModels|refreshCodexModelCatalog|gatherRoutedModels|modelCacheTtlMs' src/codex src/server src/cli

printf '\n== model-cache usage in refresh path ==\n'
rg -n -C 4 'clearModelCache\(|setCached\(|getFreshCached\(|getStaleCached\(' src/codex src/server

Repository: lidge-jun/opencodex

Length of output: 23832


Clarify ocx sync here. src/codex/sync.ts only rebuilds the on-disk Codex catalog and invalidates Codex’s models_cache.json; it still calls gatherRoutedModels() through the normal per-provider cache path, so a warm modelCacheTtlMs entry can be reused instead of forcing a live fetch. Reword this to say ocx sync refreshes the catalog and Codex cache, while live provider discovery still honors the TTL unless the provider cache is stale or cleared.

🤖 Prompt for 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.

In `@docs-site/src/content/docs/guides/codex-integration.md` around lines 170 -
171, Reword the “Cache and ocx sync” guidance to clarify that ocx sync rebuilds
the on-disk Codex catalog and invalidates Codex’s models_cache.json, but does
not force live provider discovery. State that gatherRoutedModels() continues
using the per-provider modelCacheTtlMs cache, with fresh discovery occurring
only when that cache is stale or cleared.

Source: Path instructions

Comment on lines +137 to +139
and `desktopExecutor` integrations have separate opt-ins; `nativeLocalExec: "on"` enables the
broader built-in executor and bypasses Codex approval/sandbox semantics, and legacy
`unsafeAllowNativeLocalExec: true` remains equivalent only when `nativeLocalExec` is unset.

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.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Make legacy precedence fail closed for invalid selectors.

The documentation says the legacy boolean applies only when nativeLocalExec is unset and that explicit values always win, but the resolver falls back to the legacy opt-in for any unrecognized value. A malformed selector combined with unsafeAllowNativeLocalExec: true can therefore enable the broader executor unexpectedly.

  • docs-site/src/content/docs/reference/adapters.md#L137-L139: keep the documented precedence only after the resolver treats invalid explicit values as fail-closed.
  • docs-site/src/content/docs/reference/configuration.md#L190-L191: align the field contract with the resolver’s actual invalid-value behavior.
  • docs-site/src/content/docs/reference/configuration.md#L269-L271: retain “explicit value always wins” only after invalid values no longer fall through to the legacy flag.
📍 Affects 2 files
  • docs-site/src/content/docs/reference/adapters.md#L137-L139 (this comment)
  • docs-site/src/content/docs/reference/configuration.md#L190-L191
  • docs-site/src/content/docs/reference/configuration.md#L269-L271
🤖 Prompt for 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.

In `@docs-site/src/content/docs/reference/adapters.md` around lines 137 - 139,
Update the nativeLocalExec resolver so any explicitly provided unrecognized
value disables the broader executor and never falls back to
unsafeAllowNativeLocalExec; retain legacy fallback only when nativeLocalExec is
unset. Align docs-site/src/content/docs/reference/adapters.md lines 137-139,
docs-site/src/content/docs/reference/configuration.md lines 190-191, and
docs-site/src/content/docs/reference/configuration.md lines 269-271 with this
fail-closed behavior, preserving “explicit value always wins” only for valid
explicit values.

Source: Path instructions

@Ingwannu

Copy link
Copy Markdown
Owner Author

Maintainer validation complete. This preserves #303 author attribution, is rebased onto current dev, keeps the #307 custom-display-name section while adding the Cursor exec-policy and catalog troubleshooting documentation, passes git diff --check, builds all 121 documentation pages, and was included in the combined 3,667-test / 0-failure integration run. All PR checks are green. Merging.

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

ℹ️ 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 on lines +165 to +166
3. **`liveModels: false` with empty `models`** — when live discovery is off and `models` is empty or
omitted, opencodex exposes no routed models for that provider.

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 Scope the empty static-catalog guidance

This is not true for every provider: when a built-in provider such as kiro or moonshot omits models, gatherRoutedModels() calls enrichProviderFromRegistry(), which restores that provider's registry-seeded models before honoring liveModels: false; openai-apikey can also add its trusted registry rows even when models is explicitly empty. Users troubleshooting those providers will therefore be told to expect an empty catalog while routed entries remain visible. Please limit this guidance to providers without registry seeds and document the built-in/OpenAI exceptions.

Useful? React with 👍 / 👎.

Comment on lines +241 to +242
- **`"on"` (trusted-local opt-in)** — always allows Cursor-native local execution for this provider.
Use it only for a trusted local experiment on a host where every data-plane caller is trusted.

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 Document the apply_patch mutation exception

In normal Codex requests that advertise apply_patch, this mode does not always allow every listed native operation: LiveCursorTransport.run() sets rejectNativeFileMutations, and handleCursorNativeExec() then rejects Cursor-native write and delete calls even when the exec policy resolves to "on". The unconditional wording can make operators expect a fully enabled native executor while mutations continue to fail; document that write and delete remain delegated to apply_patch whenever that client tool is available.

Useful? React with 👍 / 👎.

Comment on lines +269 to +271
The legacy `unsafeAllowNativeLocalExec: true` boolean is still accepted and is equivalent to
`nativeLocalExec: "on"` when `nativeLocalExec` is unset; an explicit `nativeLocalExec` value always
wins. Prefer `nativeLocalExec` for new configs.

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 Update the legacy enablement instructions together

The newly documented precedence makes the existing provider guide incorrect for users who first copy this page's example with nativeLocalExec: "off": guides/providers.md still tells them to enable execution by adding only unsafeAllowNativeLocalExec: true, but the explicit "off" wins and execution remains disabled. The Japanese, Korean, Russian, and Chinese provider/reference pages repeat the same unconditional legacy instruction and omit the new modes, so update those pages to use nativeLocalExec: "on" or clearly explain the precedence.

AGENTS.md reference: AGENTS.md:L78-L79

Useful? React with 👍 / 👎.

Comment on lines +158 to +160
If a model is missing from Codex, or the catalog order/visibility looks wrong, check in order:

1. **`selectedModels`** on the provider — a non-empty allowlist exposes only those ids to Codex;

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 Include disabled providers in the troubleshooting checklist

A provider-level disabled: true is another direct cause of every model from that provider disappearing: gatherRoutedModels() removes disabled providers before discovery, filtering, and catalog generation. Because this new section tells users with missing models to check these items in order but never mentions the provider's disabled switch, they can exhaust the checklist without finding the actual cause. Add the provider-level switch before selectedModels in the sequence.

Useful? React with 👍 / 👎.

@Ingwannu
Ingwannu merged commit 82af651 into dev Jul 23, 2026
6 checks passed
@lidge-jun
lidge-jun deleted the agent/refresh-pr303-docs branch July 23, 2026 08:09
zamelee added a commit to zamelee/opencodex that referenced this pull request Jul 23, 2026
The previous commit (79cafcb) placed useRef(t) and tRef.current = t inside a useEffect body. React 19 throws error lidge-jun#321 (Invalid hook call) when a hook runs outside the component body, which crashed the root and left the login screen blank.

Move useRef + ref assignment to the component top level, next to where t is defined. The probe effect still reads tRef.current so it sees the latest translations while keeping an empty dep array.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants