Skip to content

Windows: ocx service install rolls back with a non-ASCII profile path #3064

Description

@chowyuan1314

Client or integration

Codex CLI

Area

Service lifecycle

Summary

On Windows, a fresh ocx service install can create the opencodex-proxy Scheduled Task, then reject it as unhealthy and roll it back when the Windows user-profile path contains non-ASCII characters.

Expected: the valid task passes post-create verification and remains registered.

Actual: the install command rolls back the new task.

Reproduction

  1. Use a Windows account whose profile directory name contains non-ASCII characters.
  2. Install OpenCodex globally with npm install -g @bitkyc08/opencodex.
  3. Run ocx service install.
  4. Observe that opencodex-proxy is created and then rolled back.

Diagnostic result: querying the task with schtasks /query /tn opencodex-proxy /xml returns the expected launcher path when its native output bytes are decoded directly. In contrast, the runFile() path used by src/service.ts supplies text that has already undergone code-page conversion, corrupting the non-ASCII part of <Arguments>. The subsequent task-registration health comparison fails.

A narrowly scoped code change that resolves the issue is to use Bun.spawnSync({ cmd: [windowsSchtasks(), ...args] }) only for /xml task queries, then pass Buffer.from(result.stdout) to decodeSchtasksOutput(); retain the existing runFile() fallback for all other queries.

Version

2.37.0

Operating system

Windows 11 24H2 (x64)

Provider and model

Not applicable; this occurs before any provider request.

Logs or error output

ocx service install

Service install cleanup failed: Task Scheduler registration was created but failed the OpenCodex action/trigger or attempt-ownership verification. The invalid registration was rolled back.

The exact local profile path has been intentionally redacted.

Screenshots and supporting files

None.

Redacted configuration

No provider or routing configuration is required to reproduce. This is a default global npm installation followed by ocx service install.

Checks

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcliCLI, config inject, packaging flagsinstallInstallation or packagingplatformOS/service/tray/ACL (Windows-heavy, not Windows-only)serviceService lifecycle (WinSW/launchd/scheduler)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions