Skip to content

An error occurred, is it in conflict with ccswitch? #591

Description

@qq666666qq

Client or integration

Codex CLI

Area

CLI

Summary

安装失败: 336 | function sh(cmd: string): string { 337 | return execSync(cmd, { encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] }).trim(); 338 | } 339 | 340 | function runFile(file: string, args: string[]): string { 341 | return execFileSync(file, args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"], windowsHide: true }).trim(); ^ error: Command failed: C:\Windows\System32\schtasks.exe /create /tn opencodex-proxy /xml C:\Users\25115.opencodex\opencodex-service-task.xml /f ����: �ܾ����ʡ� signal: null, status: 1, output: [ null, "", "����: �ܾ����ʡ�\r\r\n" ], pid: 20772, stdout: "", stderr: "����: �ܾ����ʡ�\r\r\n", at genericNodeError (node:child_process:1010:13) at checkExecSyncError (node:child_process:470:27) at execFileSync (node:child_process:269:31) at runFile (C:\Users\25115\AppData\Roaming\npm\node_modules@bitkyc08\opencodex\src\service.ts:341:10) at installWindows (C:\Users\25115\AppData\Roaming\npm\node_modules@bitkyc08\opencodex\src\service.ts:666:3) at serviceCommand (C:\Users\25115\AppData\Roaming\npm\node_modules@bitkyc08\opencodex\src\service.ts:1169:17) at C:\Users\25115\AppData\Roaming\npm\node_modules@bitkyc08\opencodex\src\cli\index.ts:791:11 Bun v1.3.14 (Windows x64 baseline)

我管理员运行这个指令成功了,但是后面的使用还是有问题

Image ocx restore运行这个还是不行

Reproduction

1

Version

2.7.42

Operating system

win 11

Provider and model

No response

Logs or error output

Screenshots and supporting files

空日志

Image

Redacted configuration

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.
Translated Message

Original language: Chinese

Client or integration

Codex CLI

Area

CLI

Summary

Installation failed: 336 | function sh(cmd: string): string { 337 | return execSync(cmd, { encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] }).trim(); 338 | } 339 | 340 | function runFile(file: string, args: string[]): string { 341 | return execFileSync(file, args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"], windowsHide: true }).trim(); ^ error: Command failed: C:\Windows\System32\schtasks.exe /create /tn opencodex-proxy /xml C:\Users\25115.opencodex\opencodex-service-task.xml /f ����: �ܾ����ʡ� signal: null, status: 1, output: [ null, "", "����: �ܾ����ʡ�\r\r\n" ], pid: 20772, stdout: "", stderr: "����: �ܾ����ʡ�\r\r\n", at genericNodeError (node:child_process:1010:13) at checkExecSyncError (node:child_process:470:27) at execFileSync (node:child_process:269:31) at runFile (C:\Users\25115\AppData\Roaming\npm\node_modules@bitkyc08\opencodex\src\service.ts:341:10) at installWindows (C:\Users\25115\AppData\Roaming\npm\node_modules@bitkyc08\opencodex\src\service.ts:666:3) at serviceCommand (C:\Users\25115\AppData\Roaming\npm\node_modules@bitkyc08\opencodex\src\service.ts:1169:17) at C:\Users\25115\AppData\Roaming\npm\node_modules@bitkyc08\opencodex\src\cli\index.ts:791:11 Bun v1.3.14 (Windows x64 baseline)

I ran this command successfully as an administrator, but there are still issues with its use later on.

Image ocx restore still does not work.

Reproduction

1

Version

2.7.42

Operating system

win 11

Provider and model

No response

Logs or error output

Screenshots and supporting files

Empty logs.

Image

Redacted configuration

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

changed the title [-]出现错误,是不是和ccswich冲突啊[/-] [+]An error occurred, is it in conflict with ccswitch?[/+] on Jul 28, 2026

github-actions commented on Jul 28, 2026

@github-actions
Contributor

Automated translation bookkeeping — detected language: English.

Ingwannu commented on Jul 28, 2026

@Ingwannu
Owner

The attached evidence does not currently show a CCswitch conflict.

The first failure is Windows Task Scheduler returning Access is denied while creating the OpenCodex task without elevation. The later screenshots show the service/tray as not installed and an empty request log, but do not include the exact error produced after the administrator attempt. Also, ocx restore intentionally restores native Codex behavior; it is not a service repair command.

Please rerun from the same non-administrator account that normally uses Codex and paste the exact text output of:

whoami
where.exe ocx
ocx service status
schtasks /query /tn opencodex-proxy /fo LIST /v
ocx doctor --json

Please redact usernames, home paths, and account data from the doctor output. Also include the exact command run as administrator and its complete output. With that, we can distinguish a missing per-user task, an elevated-user/task ownership mismatch, and a real third-party shim conflict.

added
needs-infoWaiting on reporter for a concrete spec or reproduction
on Jul 28, 2026

Wibias commented on Jul 29, 2026

@Wibias
Contributor

Closed until Info.

qq666666qq commented on Jul 29, 2026

@qq666666qq
Author

Image我先运行了修复指令

Image还是显示这个

日志
PowerShell 7.6.4
PS C:\Users\25115> ocx restore
✅ External Codex provider "custom" preserved; no native restore was needed.
✅ Removed the opencodex managed block from Grok config.
Plain codex now runs natively (no proxy). Switch back with: ocx restore back
PS C:\Users\25115> whoami
q666666\25115
PS C:\Users\25115> where.exe ocx
C:\Users\25115\AppData\Roaming\npm\ocx
C:\Users\25115\AppData\Roaming\npm\ocx.cmd
PS C:\Users\25115> ocx service status
✅ running:
���:
������ �´�����ʱ�� ģʽ
======================================== ====================== ===============
opencodex-proxy N/A ��������
Diagnostics: logs: C:\Users\25115.opencodex\service.log
PS C:\Users\25115> schtasks /query /tn opencodex-proxy /fo LIST /v

文件夹:
主机名: Q666666
任务名: \opencodex-proxy
下次运行时间: N/A
模式: 正在运行
登录状态: 只使用交互方式
上次运行时间: 2026/7/29 14:21:55
上次结果: 267009
创建者: N/A
要运行的任务: C:\Windows\System32\wscript.exe /b /nologo "C:\Users\25115.opencodex\opencodex-service-launcher.vbs"
起始于: N/A
注释: OpenCodex proxy service wrapper
计划任务状态: 已启用
空闲时间: 已禁用
电源管理:
作为用户运行: 25115
删除没有计划的任务: 已禁用
如果运行了 X 小时 X 分钟,停止任务: 已禁用
计划: 计划数据在此格式中不可用。
计划类型: 登陆时
开始时间: N/A
开始日期: N/A
结束日期: N/A
天: N/A
月: N/A
重复: 每: N/A
重复: 截止: 时间: N/A
重复: 截止: 持续时间: N/A
重复: 如果还在运行,停止: N/A
PS C:\Users\25115> ocx doctor --json
opencodex doctor

Paths
ok CODEX_HOME: C:\Users\25115.codex
ok CODEX_HOME/auth.json: C:\Users\25115.codex\auth.json
ok OPENCODEX_HOME: C:\Users\25115.opencodex
ok OPENCODEX_HOME/config.json: C:\Users\25115.opencodex\config.json

Codex app home targeting
ok Effective Codex home: C:\Users[USER].codex
No Orca-owned CODEX_HOME mismatch detected.

Codex restart safety
!! AT RISK after restart (Codex routing could not be verified; run 'ocx restore')
routing=unknown, service=installed-but-unhealthy, shim=healthy

Codex runtime selection
ok Selected runtime: C:\Users[USER]\AppData\Roaming\npm\codex.cmd (0.144.6, source=configured)

Current doctor process proxy env (presence only)
unset HTTP_PROXY
unset HTTPS_PROXY
unset ALL_PROXY
unset NO_PROXY

Configured proxy (value hidden)
unset config.proxy (file; not configured)

Running proxy process proxy env (presence only)
-- pid 23880: process env inspection is only supported on Linux

Memory / runtime
-- doctor process Bun 1.3.14 (this is NOT the service process)
ok service pid 23880: Bun 1.3.14 on win32
rss=78MB, external=11MB, arrayBuffers=2MB, heapUsed=25MB, jscHeap=25MB
observed=78MB (rss)
streamMode=auto (eager relay: off, auto-known-bad)
watchdog threshold=4096MB, no warnings
memory usage looks normal
service is running Bun 1.3.14 on Windows — a version affected by the upstream Bun memory issue.
Options: wait for a bundled runtime update, or set OPENCODEX_BUN_PATH to a runtime you trust (unvalidated — own risk),
or opt into streamMode "eager-relay" via PUT /api/settings (crash risk on this runtime; see docs).

WHAM reachability
ok https://chatgpt.com/backend-api/wham/usage
status=200, 2800ms, authenticated

Codex history migration
ok no legacy opencodex-tagged threads pending

Project Codex configs
ok no project-local provider bypass detected

OAuth reliability
[OK] OAuth credential storage directory is writable for atomic auth.json updates.
[OK] Token refresh single-flight is active.
[OK] Codex forward path uses pass-through client metadata (build-time invariant; not a runtime scan).

Hints

  • Codex is pinned to the local proxy without persistent startup protection. After restart, requests can reconnect indefinitely. Run 'ocx restore'.
    PS C:\Users\25115>
Translated Message

Original language: Chinese

I first ran the repair command

Image It still shows this.

Log
PowerShell 7.6.4
PS C:\Users\25115> ocx restore
✅ External Codex provider "custom" preserved; no native restore was needed.
✅ Removed the opencodex managed block from Grok config.
Plain codex now runs natively (no proxy). Switch back with: ocx restore back
PS C:\Users\25115> whoami
q666666\25115
PS C:\Users\25115> where.exe ocx
C:\Users\25115\AppData\Roaming\npm\ocx
C:\Users\25115\AppData\Roaming\npm\ocx.cmd
PS C:\Users\25115> ocx service status
✅ running:
文件夹:
主机名: Q666666
任务名: \opencodex-proxy
下次运行时间: N/A
模式: 正在运行
登录状态: 只使用交互方式
上次运行时间: 2026/7/29 14:21:55
上次结果: 267009
创建者: N/A
要运行的任务: C:\Windows\System32\wscript.exe /b /nologo "C:\Users\25115.opencodex\opencodex-service-launcher.vbs"
起始于: N/A
注释: OpenCodex proxy service wrapper
计划任务状态: 已启用
空闲时间: 已禁用
电源管理:
作为用户运行: 25115
删除没有计划的任务: 已禁用
如果运行了 X 小时 X 分钟,停止任务: 已禁用
计划: 计划数据在此格式中不可用。
计划类型: 登陆时
开始时间: N/A
开始日期: N/A
结束日期: N/A
天: N/A
月: N/A
重复: 每: N/A
重复: 截止: 时间: N/A
重复: 截止: 持续时间: N/A
重复: 如果还在运行,停止: N/A
PS C:\Users\25115> ocx doctor --json
opencodex doctor

Paths
ok CODEX_HOME: C:\Users\25115.codex
ok CODEX_HOME/auth.json: C:\Users\25115.codex\auth.json
ok OPENCODEX_HOME: C:\Users\25115.opencodex
ok OPENCODEX_HOME/config.json: C:\Users\25115.opencodex\config.json

Codex app home targeting
ok Effective Codex home: C:\Users[USER].codex
No Orca-owned CODEX_HOME mismatch detected.

Codex restart safety
!! AT RISK after restart (Codex routing could not be verified; run 'ocx restore')
routing=unknown, service=installed-but-unhealthy, shim=healthy

Codex runtime selection
ok Selected runtime: C:\Users[USER]\AppData\Roaming\npm\codex.cmd (0.144.6, source=configured)

Current doctor process proxy env (presence only)
unset HTTP_PROXY
unset HTTPS_PROXY
unset ALL_PROXY
unset NO_PROXY

Configured proxy (value hidden)
unset config.proxy (file; not configured)

Running proxy process proxy env (presence only)
-- pid 23880: process env inspection is only supported on Linux

Memory / runtime
-- doctor process Bun 1.3.14 (this is NOT the service process)
ok service pid 23880: Bun 1.3.14 on win32
rss=78MB, external=11MB, arrayBuffers=2MB, heapUsed=25MB, jscHeap=25MB
observed=78MB (rss)
streamMode=auto (eager relay: off, auto-known-bad)
watchdog threshold=4096MB, no warnings
memory usage looks normal
service is running Bun 1.3.14 on Windows — a version affected by the upstream Bun memory issue.
Options: wait for a bundled runtime update, or set OPENCODEX_BUN_PATH to a runtime you trust (unvalidated — own risk),
or opt into streamMode "eager-relay" via PUT /api/settings (crash risk on this runtime; see docs).

WHAM reachability
ok https://chatgpt.com/backend-api/wham/usage
status=200, 2800ms, authenticated

Codex history migration
ok no legacy opencodex-tagged threads pending

Project Codex configs
ok no project-local provider bypass detected

OAuth reliability
[OK] OAuth credential storage directory is writable for atomic auth.json updates.
[OK] Token refresh single-flight is active.
[OK] Codex forward path uses pass-through client metadata (build-time invariant; not a runtime scan).

Hints

  • Codex is pinned to the local proxy without persistent startup protection. After restart, requests can reconnect indefinitely. Run 'ocx restore'.
    PS C:\Users\25115>

qq666666qq commented on Jul 29, 2026

@qq666666qq
Author
Image

qq666666qq commented on Jul 29, 2026

@qq666666qq
Author

Image管理员权限运行之后还是不行

Image跟这个一模一样

Translated Message

Original language: Chinese

Running with administrator privileges still doesn't work.

It's exactly the same as this.

removed
needs-infoWaiting on reporter for a concrete spec or reproduction
on Jul 29, 2026

Ingwannu commented on Jul 29, 2026

@Ingwannu
Owner

Thanks — these diagnostics are sufficient, so I’m reopening this and removing needs-info.

The screenshots show two separate conditions:

  1. The elevated service installation succeeded. The scheduled task is running (0x41301), the service PID is alive, the memory endpoint works, and WHAM returns HTTP 200. After that, ocx restore intentionally switched plain Codex away from the OpenCodex proxy. To route Codex through OpenCodex again, run:

    ocx restore back

    Then refresh Startup Safety. Do not run ocx restore again unless you intentionally want to return to the native/external-provider configuration.

  2. The initial non-elevated install exposed a real Windows locale bug. The localized Chinese schtasks access-denied output is decoded as mojibake, so OpenCodex classifies it as reason: "other" instead of access-denied. That prevents the existing actionable/UAC recovery path from being selected.

I’m going to make the access-denied classification locale-independent while keeping elevation scoped to the fixed scheduler-create transaction, add regression coverage, and update the Windows service documentation. The evidence here does not currently point to a ccswitch conflict or to a broken running service.

Ingwannu commented on Jul 29, 2026

@Ingwannu
Owner

The fix is now up for review in #698.

It adds a locale-independent effective-token check, but only for OpenCodex's exact owned Task Scheduler create command. Unknown token state and every unrelated scheduler/service/file failure remain non-elevating. Regression tests, the full 5,902-test suite, privacy scan, and the multilingual docs build are clean.

Because this touches the UAC decision boundary, I have requested another maintainer's explicit review rather than self-merging it. In the meantime, your currently installed service is already running; use ocx restore back to reconnect Codex to OpenCodex, and refresh Startup Safety afterward.

Ingwannu commented on Jul 29, 2026

@Ingwannu
Owner

Status update: #698 is fully green again after the final review-driven documentation clarification. The latest Windows run passed the complete runtime suite plus GUI tests, privacy scan, lint, build, and smoke checks. There are no unresolved review threads.

The native Go runtime uses a different in-process service-install path, so I also opened #703 with the needs-go-port label and the exact fixed-command/fail-closed/UAC rollback requirements for dev2-go.

#591 remains open only because #698 still needs the repository-required non-author security review before merge. The current workaround remains ocx restore back after the already-successful elevated service installation.

lidge-jun commented on Jul 29, 2026

@lidge-jun
Owner

Resolved and released.

The blocker noted in my last update was that #698 still needed the repository-required non-author security review before merge. That review is done: #698 merged on 2026-07-29 (97dfbb20b) and shipped in v2.7.43, tagged 2026-07-30.

To restate the outcome, since this issue started as a suspected CCswitch conflict: the failure was not a CCswitch interaction. It was Windows Task Scheduler returning a localized Access is denied while creating the OpenCodex task without elevation, which the proxy did not classify as an elevation problem. The fix adds a locale-independent effective-token check, scoped to OpenCodex's own Task Scheduler create command. Unknown token state and every unrelated scheduler, service, or file failure stay non-elevating and fail closed — the UAC decision boundary did not get wider.

You reported 2.7.42, which is before the fix. Please upgrade:

npm install -g @bitkyc08/opencodex@latest
ocx restart

You should no longer need the ocx restore back workaround for a fresh install. If the scheduler error returns on 2.7.43, please comment with the OpenCodex version and whether the shell was elevated, and I will reopen.

Thanks for the persistence on this one — the elevated-run screenshots are what separated the scheduler token condition from a CCswitch conflict and made the fix targetable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions