GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(codex): warn or restart stale app-server after sync by Wibias · Pull Request #518 · lidge-jun/opencodex

Conversation

@Wibias

@Wibias Wibias commented Jul 26, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Summary

  • Addresses Model catalog changes are not reflected in running Codex app-server until it is restarted #476: after ocx sync / ocx sync-cache rewrite on-disk catalogs, long-lived Codex app-server processes can keep serving a stale in-memory model list.
  • Detect matching codex … app-server and codex-code-mode-host processes (UID-scoped on Unix; narrow cmdline match — no broad *codex* kills).
  • Warn by default; ocx sync --restart-codex / ocx sync-cache --restart-codex send SIGTERM only (no SIGKILL escalation).
  • Docs + GUI stale hint updated; /api/sync returns shared hint and optional staleAppServerPids.

Test plan

  • bun test tests/codex-app-server-processes.test.ts
  • bun run typecheck
  • Cross-platform CI green
  • Manual: with Codex app-server running, ocx sync prints warning; ocx sync --restart-codex stops matching PIDs and refreshed list appears

Summary by CodeRabbit

  • New Features
    • Added optional --restart-codex to ocx sync and ocx sync-cache to refresh stale long-running Codex app-server processes.
    • Restart messaging/handling now triggers only when the catalog or cache is actually updated.
  • Documentation
    • Updated the Codex troubleshooting checklist and the CLI reference with the new flag and stale-process warnings.
  • UI/Localization
    • Improved the “stale app server” hint across languages to include the exact restart command.
  • Tests
    • Added cross-platform tests covering stale-process detection, warning text, restart outcomes, and CLI/API wiring.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Wibias
fix(codex): warn or restart stale app-server after sync
b6e4e13
Disk catalog updates do not refresh Codex's in-memory app-server list (#476). Warn on sync/sync-cache when matching processes are present, and offer --restart-codex for targeted SIGTERM.
@Wibias
Wibias requested review from Ingwannu and lidge-jun as code owners July 26, 2026 21:42
@github-actions github-actions Bot added the bug Something isn't working label Jul 26, 2026
@Wibias Wibias mentioned this pull request Jul 26, 2026
Model catalog changes are not reflected in running Codex app-server until it is restarted #476
Closed
@coderabbitai

coderabbitai Bot commented Jul 26, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds cross-platform detection and scoped restarting of stale Codex app-server processes after catalog updates, wires --restart-codex into both sync commands, gates handling on successful writes, exposes shared stale-process metadata through the API, updates localized guidance, and documents the behavior.

Changes

Codex app-server lifecycle

Layer / File(s) Summary
Catalog and cache write gates
src/codex/catalog/sync.ts, src/codex/refresh.ts, src/codex/sync.ts, tests/codex-*, tests/injection-model-api.test.ts
Propagates explicit catalog and cache write status through refresh and sync results, preventing stale-process handling when no write occurred.
Process detection and restart lifecycle
src/codex/app-server-processes.ts, tests/codex-app-server-processes.test.ts
Adds cross-platform discovery, narrow command matching, stale warnings, PID-safe SIGTERM restarting, and lifecycle coverage.
CLI restart flag integration
src/cli/index.ts, src/cli/help.ts, tests/codex-app-server-processes.test.ts
Adds --restart-codex to sync and sync-cache, invokes post-write handling, and updates usage and detailed help text.
API and dashboard stale-process guidance
src/server/management/config-routes.ts, gui/src/pages/dashboard-overview-sections.tsx, gui/src/i18n/*.ts
Returns the shared stale-process hint through /api/sync and renders localized guidance containing the restart command.
CLI and troubleshooting documentation
docs-site/src/content/docs/reference/cli.md, docs-site/src/content/docs/guides/codex-integration.md
Documents stale in-memory model catalogs, scoped SIGTERM behavior, the restart flag, and manual remediation steps.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CLI as ocx sync
  participant Catalog as Codex catalog sync
  participant Handler as afterCatalogWriteHandleAppServers
  participant Detector as listCodexAppServerProcesses
  participant Processes as Codex app-server processes
  CLI->>Catalog: write catalog or models_cache
  Catalog-->>CLI: return catalog/cache write status
  CLI->>Handler: pass restart option after successful write
  Handler->>Detector: detect stale processes
  Detector->>Processes: inspect platform snapshots
  Handler->>Processes: send SIGTERM when restart is enabled
  Processes-->>Handler: stopped, surviving, or failed PIDs
Loading

Possibly related issues

  • Model catalog changes are not reflected in running Codex app-server until it is restarted #476 — Directly covers stale Codex app-server detection and the ocx sync --restart-codex restart behavior.

Possibly related PRs

  • lidge-jun/opencodex#333 — Changes the same syncModelsToCodex control path and external-provider early-return result fields.

Suggested reviewers: ingwannu, lidge-jun

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: handling stale Codex app-server processes after sync by warning or restarting them.
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

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

coderabbitai[bot]

This comment was marked as resolved.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Wibias
fix(codex): address PR 518 review on app-server restart
2e5ac60
Tighten app-server argv matching, scope Windows listing to the current user, add macOS ps discovery, revalidate PIDs before SIGTERM, gate CLI handling on catalog writes, keep CLI samples out of i18n, and avoid blocking /api/sync on process enumeration.
coderabbitai[bot]

This comment was marked as resolved.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Wibias added 3 commits July 27, 2026 00:09
@Wibias
fix(codex): harden app-server identity checks from CodeRabbit
95a9bf9
Match code-mode-host only as argv0/entrypoint, require pid+cmdline identity before SIGTERM, and add CLI//api/sync wiring regressions.
@Wibias
fix(codex): use Invoke-CimMethod for Windows process owner lookup
56104a5
CIM instance GetOwner must go through Invoke-CimMethod; the direct call failed closed on every row and broke --restart-codex on Windows.
@Wibias
fix(codex): detect quoted app-server paths and gate sync-cache restarts
0631618
Match Windows Install-path CommandLines with a closing quote after codex.exe/cmd, and only warn/restart after sync-cache when models_cache was actually rewritten.
coderabbitai[bot]

This comment was marked as resolved.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Wibias
merge(dev): resolve refresh conflicts with comboOmissions
3bd698c
Keep upstream comboOmissions on the refresh result while preserving the boolean models_cache write gate from this branch.
@Wibias Wibias added enhancement New feature or request and removed bug Something isn't working labels Jul 26, 2026
@Wibias
fix(codex): gate app-server restart on catalogWritten
052015e
Treat catalogExists as insufficient proof of a write so ocx sync --restart-codex does not warn or restart when the catalog path exists but is malformed or unreadable.
@github-actions github-actions Bot added bug Something isn't working and removed enhancement New feature or request labels Jul 26, 2026
Wibias added 4 commits July 27, 2026 02:16
@Wibias
fix(codex): omit stale app-server hint on no-write sync
b9decf8
Only attach staleAppServerHint from POST /api/sync when a catalog or models_cache write succeeded, so the dashboard does not imply a restart after a no-op sync.
@Wibias
fix(codex): honor value-taking globals before app-server match
8d2292b
Skip supported Codex global options (enable/config/profile and related forms) when locating the app-server subcommand, while still rejecting later-argument and non-app-server invocations.
@Wibias
fix(codex): cover remaining value-taking app-server globals
5cc15bc
Recognize --ask-for-approval/-a, --local-provider, and --add-dir when locating the app-server subcommand so common Codex root option forms still match.
@Wibias
fix(codex): match official target-triple Codex basenames
d93b469
Recognize platform-baked binaries like codex-x86_64-unknown-linux-musl in argv0 and the Windows candidate prefilter without accepting arbitrary codex-* tools.
@Wibias Wibias mentioned this pull request Jul 27, 2026
fix(ci): stop PR labeler from reverting human type labels #525
Merged
1 of 4 tasks
Wibias
Wibias commented Jul 27, 2026
View reviewed changes

@Wibias Wibias left a comment

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Security review: PASS

Reviewed tip d93b469 — src/codex/app-server-processes.ts, CLI --restart-codex, and POST /api/sync hint wiring. Excluded unrelated issue-translation/issue-quality workflow changes from this pass.

Summary

No medium+ findings. Process termination stays local, owner/UID-scoped, and narrowly matched; SIGTERM is preceded by PID+cmdline identity revalidation; PowerShell enumeration uses fixed script + Invoke-CimMethod GetOwner with fail-closed owner checks; logs/API expose PIDs and a static hint only (no cmdlines).

Checked

  • Cross-user kill: Unix UID filter + macOS ps -u + Windows GetOwner vs current identity
  • Injection: execFile argv array; regex literals only in PS -match operands
  • argv0 / subcommand matching + target-triple basenames; negatives for opencodex/hermes
  • /api/sync: hint only, no enumerate/kill
  • Privacy: no command-line logging on warn/restart paths

Verdict: Security review: PASS

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
This was referenced Jul 27, 2026
fix(codex): report whether a sync actually wrote the catalog or cache #526
Merged
fix(codex): warn about stale Codex app-servers after a catalog write #527
Closed
@lidge-jun

lidge-jun commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Split this into two stacked PRs so the process-termination half can be reviewed on its own:

  • fix(codex): report whether a sync actually wrote the catalog or cache #526 — catalogWritten / cacheSynced signal only. 6 files, no behaviour change.
  • fix(codex): warn about stale Codex app-servers after a catalog write #527 — stale app-server detection, warning, and --restart-codex. Stacked on fix(codex): report whether a sync actually wrote the catalog or cache #526.

Both are derived from this PR at d93b469, and the union of their diffs matches this PR's 21 files exactly (verified against a frozen manifest at that SHA).

The reasoning: the second half sends SIGTERM to matching processes, and process matching is where a mistake is expensive — it drew four rounds of review feedback here. Separating the signal from the action gives that half a small diff to review against.

@Wibias this is your PR, so the call is yours: close this in favour of the two, or keep it and treat the split as a review aid. Nothing here was force-pushed or changed on your branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Wibias

Wibias commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

Looks good — thanks for splitting this out.

I'll close this PR in favor of the two stacked ones (#526 + #527). Review can continue there.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Wibias

Wibias commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favor of the stacked split: #526 (catalogWritten/cacheSynced signal) + #527 (stale app-server detection / --restart-codex).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Wibias Wibias closed this Jul 27, 2026
@Wibias
Wibias deleted the fix/476-codex-app-server-sync branch July 27, 2026 03:54
lidge-jun added a commit that referenced this pull request Jul 27, 2026
@lidge-jun
fix(codex): report whether a sync actually wrote the catalog or cache
da79601
syncCatalogModels() and invalidateCodexModelsCache() both succeeded
silently whether or not they wrote anything, so a caller could not tell a
real catalog update from a no-op on a missing or unreadable catalog.

Return that fact: syncCatalogModels() gains catalogWritten, and
invalidateCodexModelsCache() returns whether it rewrote models_cache.
refreshCodexModelCatalog() carries both outward.

This is the signal half of #518, split out so it can be reviewed on its
own. Nothing acts on it yet — the consumer (warning about, and optionally
restarting, stale app-server processes) is the other half, and it touches
process termination, which deserves its own review.
lidge-jun added a commit that referenced this pull request Jul 27, 2026
@lidge-jun
fix(codex): report whether a sync actually wrote the catalog or cache
28e66d3
syncCatalogModels() and invalidateCodexModelsCache() both succeeded
silently whether or not they wrote anything, so a caller could not tell a
real catalog update from a no-op on a missing or unreadable catalog.

Return that fact: syncCatalogModels() gains catalogWritten, and
invalidateCodexModelsCache() returns whether it rewrote models_cache.
refreshCodexModelCatalog() carries both outward.

This is the signal half of #518, split out so it can be reviewed on its
own. Nothing acts on it yet — the consumer (warning about, and optionally
restarting, stale app-server processes) is the other half, and it touches
process termination, which deserves its own review.
lidge-jun added a commit that referenced this pull request Jul 27, 2026
@lidge-jun
fix(codex): report whether a sync actually wrote the catalog or cache
edc3775
syncCatalogModels() and invalidateCodexModelsCache() both succeeded
silently whether or not they wrote anything, so a caller could not tell a
real catalog update from a no-op on a missing or unreadable catalog.

Return that fact: syncCatalogModels() gains catalogWritten, and
invalidateCodexModelsCache() returns whether it rewrote models_cache.
refreshCodexModelCatalog() carries both outward.

This is the signal half of #518, split out so it can be reviewed on its
own. Nothing acts on it yet — the consumer (warning about, and optionally
restarting, stale app-server processes) is the other half, and it touches
process termination, which deserves its own review.
lidge-jun added a commit that referenced this pull request Jul 27, 2026
@lidge-jun
fix(codex): report catalog and cache write signals
9dd3c42
* fix(codex): report whether a sync actually wrote the catalog or cache

syncCatalogModels() and invalidateCodexModelsCache() both succeeded
silently whether or not they wrote anything, so a caller could not tell a
real catalog update from a no-op on a missing or unreadable catalog.

Return that fact: syncCatalogModels() gains catalogWritten, and
invalidateCodexModelsCache() returns whether it rewrote models_cache.
refreshCodexModelCatalog() carries both outward.

This is the signal half of #518, split out so it can be reviewed on its
own. Nothing acts on it yet — the consumer (warning about, and optionally
restarting, stale app-server processes) is the other half, and it touches
process termination, which deserves its own review.

* test(codex): cover real catalog sync write signals
This was referenced Jul 27, 2026
fix(codex): warn about stale Codex app-servers after a catalog write #576
Merged
Codex/app server restart #802
Closed
This was referenced Aug 4, 2026
feat(codex): a write substrate that survives being interrupted #998
Merged
fix(codex): warn when a startup write leaves an app-server stale (#1046) #1072
Merged
fix(deepseek): advertise the ladder each V4 model actually honors (#1057) #1069
Merged
fix(catalog): skip byte-identical catalog writes so a resync cannot mark Codex stale #1460
Closed
refactor(cli): registry-driven command dispatch module #1451
Merged
This was referenced Aug 15, 2026
feat(storage): protect Codex diagnostic logs - Part 2 #1729
Merged
[Bug] ocx sync overwrites hand-edited config.json from stale server memory (GLM-5.3 tune lost); 2.21.0 save path fixed it but sync path question remains #1802
Closed
fix(codex): remove injected routing and restore the routed catalog after a Codex app rewrite #1862
Merged
fix(codex): restart only stale app-servers #1874
Closed
fix(windows): keep catalog discovery off request event loop #1876
Merged
fix(sync): refresh catalog for side profiles when Codex injection is OFF #1931
Merged
@yansigit yansigit mentioned this pull request Aug 25, 2026
feat: hardened Google Jules and Cursor automation control plane yansigit/opencodex#27
Merged
3 tasks done
@lidge-jun lidge-jun mentioned this pull request Sep 8, 2026
fix(codex): invalidate app-server observations at catalog boundaries #3981
Closed
3 of 12 tasks
agentHits pushed a commit to agentHits/opencodex that referenced this pull request Sep 17, 2026
@lidge-jun
fix(codex): report catalog and cache write signals
c96064e
* fix(codex): report whether a sync actually wrote the catalog or cache

syncCatalogModels() and invalidateCodexModelsCache() both succeeded
silently whether or not they wrote anything, so a caller could not tell a
real catalog update from a no-op on a missing or unreadable catalog.

Return that fact: syncCatalogModels() gains catalogWritten, and
invalidateCodexModelsCache() returns whether it rewrote models_cache.
refreshCodexModelCatalog() carries both outward.

This is the signal half of lidge-jun#518, split out so it can be reviewed on its
own. Nothing acts on it yet — the consumer (warning about, and optionally
restarting, stale app-server processes) is the other half, and it touches
process termination, which deserves its own review.

* test(codex): cover real catalog sync write signals
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@coderabbitai coderabbitai[bot] coderabbitai[bot] left review comments
@chatgpt-codex-connector chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] left review comments
@lidge-jun lidge-jun Awaiting requested review from lidge-jun lidge-jun is a code owner
@Ingwannu Ingwannu Awaiting requested review from Ingwannu Ingwannu is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

bug Something isn't working

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@Wibias @lidge-jun
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.