Skip to content

[Windows] ocx service install refuses: effective-account SID lookup times out on cold PowerShell start #7544

Closed

Description

@lidge-jun

Client or integration

Other

Area

Service lifecycle

Summary

On the main push Service lifecycle workflow (run 39812199456, attempt 1, job windows-schtasks), ocx service install failed with CodexUserIdentityRefusal: Windows effective-account lookup timed out. before it reached Task Scheduler. The attempt 2 rerun of the same commit passed.

The SID for the Windows service mutation lock path is resolved by spawning powershell.exe to evaluate [System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value. That child already has a 30s budget (widened in #2914), and the step still spent ~35s and hit it. A cold PowerShell start on a loaded runner is the whole cost: the value itself is a constant of the process token.

Expected: resolving the current process SID should not depend on PowerShell startup time on Windows x64, where the same module already reads LocalAppData in-process through bun:ffi (src/codex/windows-local-appdata.ts). A lookup that genuinely fails must still refuse (fail closed).

Reproduction

Intermittent; observed on a GitHub-hosted windows-latest runner.

  1. Fresh runner, write %USERPROFILE%\.opencodex\config.json.
  2. bun run src/cli/index.ts service install
  3. The first PowerShell child spawned by the process (the SID lookup) exceeds the 30s timeout and the install refuses.

Version

83ec4f7

Operating system

GitHub Actions windows-latest (Windows Server, x64), Bun 1.4.2

Provider and model

No response

Logs or error output

CodexUserIdentityRefusal: Windows effective-account lookup timed out.
 code: "CODEX_USER_IDENTITY_REFUSED"
      at refuse (src\codex\user-identity.ts:101:9)
      at powershellValue (src\codex\user-identity.ts:254:34)
      at resolveWindowsSid (src\codex\user-identity.ts:263:15)
      at resolveEffectiveUserIdentity (src\codex\user-identity.ts:281:38)
      at windowsServiceMutationLockPath (src\lib\windows-service-mutation-lock.ts:57:20)
      at withWindowsServiceMutationLock (src\lib\windows-service-mutation-lock.ts:82:37)
      at serviceCommand (src\service\cli.ts:526:11)
Bun v1.4.2 (Windows x64)

Screenshots and supporting files

No response

Redacted configuration

{"port":10199,"providers":{}}

Checks

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

Activity

  1. added
    cliCLI, config inject, packaging flags
    platformOS/service/tray/ACL (Windows-heavy, not Windows-only)
    serviceService lifecycle (WinSW/launchd/scheduler)
    on Oct 22, 2026
  2. lidge-jun commented on Oct 22, 2026

    @lidge-jun
    OwnerAuthor

    Fixed on dev by #7548 (merged just now): on Windows x64 the service-install SID lookup now reads the token SID in-process through advapi32 instead of starting PowerShell, so ocx service install no longer hits the 30 s lookup budget (Service lifecycle windows-schtasks: 35 s failing → 11 s passing on the exact head). Closing manually because GitHub only auto-closes from main. The remaining PowerShell use for the ACL principal is tracked in #7547.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcliCLI, config inject, packaging flagsplatformOS/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