[Bug][Windows]: ocx stop impossible when WMI GetOwnerSid exceeds the 1 s per-call cap
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- powershell, typescript
- Área
- cli
Línea de trabajo
Start in src/service/windows-process-evidence.ts, at windowsProcessSnapshotScript, where each GetOwnerSid call uses a 1 s timeout inside a 1,500 ms owner budget, then follow foreignProcessOwner and bindWindowsStopWrappers into windows-checked-stop.ts, where the evidence-unreadable refusal is returned. Done means a stop succeeds on a host where the owner lookup takes about 1.8 s, or, if it still refuses, the message names the owner-lookup timeout instead of Task Scheduler. The issue leaves the fix direction open, so confirm the approach with maintainers first.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Client or integration
Other — OpenCodex CLI (ocx stop / ocx service stop), not a client integration.
Area
Service lifecycle
Summary
On a Windows host whose WMI Win32_Process.GetOwnerSid is slow (~1.76 s per call), every checked-stop path refuses with "same-account ownership of a service wrapper could not be proven". ocx stop, ocx service stop and the service uninstall path are therefore all unusable while the Task Scheduler wrapper is running. The refusal is surfaced as "The Windows Task Scheduler state could not be read", which misdirects the operator toward Task Scheduler ACLs. Nothing is changed and the proxy keeps running.
The wrapper is in fact owned by the same account as the caller; only the owner lookup exceeds the snapshot's per-call cap.
Expected: the stop succeeds. If it cannot, the refusal should name the real cause (owner lookup timed out) and document a bypass, instead of blaming Task Scheduler access.
Reproduction
Environment: Task Scheduler backend (service-state.json → "backend": "scheduler"), service installed and running, proxy listening on port 10100.
- Measure the owner lookup the stop snapshot uses (the wrapper is the
wscript.exerunningopencodex-service-launcher.vbs):
Observed on this host: 1782 / 1757 / 1756 ms over three calls, every call$w = Get-CimInstance Win32_Process -Filter "ProcessId=<wscript-pid>" Measure-Command { Invoke-CimMethod -InputObject $w -MethodName GetOwnerSid -OperationTimeoutSec 20 }rv=0with the correct SID. For reference, #8965 reports a normal Windows x64 desktop resolving 7 owner candidates in 1.4–1.6 s total (~30–100 ms each), so this host is roughly 20–50× slower. - With the wrapper tree running, run
ocx stop(orocx service stop). - Observe the refusal below; the proxy is left running and native Codex is not restored.
Wrapper tree for the minimal trigger:
wscript.exe /b /nologo "%USERPROFILE%\.opencodex\opencodex-service-launcher.vbs" → cmd.exe /c ""%USERPROFILE%\.opencodex\opencodex-service.cmd" " → bun.exe ... src\cli\index.ts start --port 10100.
Version
2.100.7 (latest; npm latest and the GitHub release are both 2.100.7). The same ownership gate also refused on 2.100.4.
Operating system
Windows 11 Pro 26H2, version 10.0.26300, build 26300.9711.
Provider and model
Not provider-specific — the failure happens before any request is sent.
Logs or error output
ocx stop:
❌ The Windows Task Scheduler state could not be read, so this stop cannot tell whether a wrapper would respawn the proxy.
Run 'ocx service status' to see the query error, repair Task Scheduler access, then retry.
The Windows service or process state could not be read (same-account ownership of a service wrapper could not be proven. Stop it from its owning Windows session using Task Manager, then retry); nothing that could not be verified was stopped.
The proxy was left running and the shared teardown skipped: the service could relaunch it.
ocx service stop:
❌ service stop did not take effect: the Windows service could not be proven stopped (unknown).
The Windows service or process state could not be read (same-account ownership of a service wrapper could not be proven. Stop it from its owning Windows session using Task Manager, then retry); nothing that could not be verified was stopped.
The proxy was left running and native Codex was NOT restored.
Screenshots and supporting files
No screenshots. The timings and process tree above are the supporting evidence.
Redacted configuration
No provider/routing dependence. Relevant service state only:
{ "backend": "scheduler" }
Checks
- I searched existing issues and documentation.
- I removed secrets, tokens, account details, request credentials, and personal data.
Additional analysis (root cause and suggested direction)
The checked stop enriches the process snapshot with owner SIDs in src/service/windows-process-evidence.ts (windowsProcessSnapshotScript):
- each owner read is
Invoke-CimMethod -InputObject $process -MethodName GetOwnerSid -OperationTimeoutSec 1; - the whole owner loop has a 1,500 ms budget and never starts within
SNAPSHOT_OWNER_RESERVE_MS(2,000 ms) of the enumeration cap.
On a host where a single GetOwnerSid takes ~1.76 s, every call is cancelled at 1 s, so foreignProcessOwner sees no verified owner and returns null. bindWindowsStopWrappers then puts the otherwise-eligible wrapper into ownershipUnverified, and windows-checked-stop.ts returns finish("unknown", "evidence-unreadable", WRAPPER_OWNER_REFUSAL). Because admission/binding run before any mutation, this blocks ocx stop, ocx service stop, and the uninstall stop alike.
This is a host WMI latency anomaly that the 1 s per-call cap turns into a total loss of stop capability, with a diagnostic that points at Task Scheduler instead of the owner lookup.
Workaround that works today: end the wscript.exe/cmd.exe wrapper first (Task Manager, or Stop-Process -Id <pid> -Force), then run ocx stop — with no wrapper process to bind, the ownership gate is never reached and the stop/restore completes. Disabling the task (schtasks /Change /TN opencodex-proxy /DISABLE) prevents an immediate respawn.
Suggested directions:
- Prefer native same-handle evidence (creation time plus token SID) over repeated CIM
GetOwnerSidcalls. #8933 already proposes this for the Link stop path; extending it to the service checked-stop would remove the WMI round-trip entirely. - Or make the per-call timeout adaptive/retryable, and make the refusal text name "owner lookup timed out" rather than "Task Scheduler state could not be read".
- At minimum, document a supported bypass (
--force/env) so a slow-WMI host is not locked out of stopping its own service.
Related: #8965 (merged; bounds owner reads inside the enumeration cap, but skipped owners stay unknown and binding still refuses), #8933 (open; native same-handle owner proof).
- Lenguaje dominante
- TypeScript
- Estrellas
- 16.9k
- Forks
- 1.3k
- Merge medio
- 1 d 2 h
- PR fusionados (30 d)
- 844
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de lidge-jun/opencodex
-
[Provider] antigravity-acp catalog omits gemini-4-hydrogen and gemini-4-neon that agy acp offersAbiertocatalog provider provider-compatibility
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
lidge-jun/opencodex#9037 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Polish Spanish documentation wording and product namesPosiblemente ocupada @federicorv25 la tomó hace 7 días. Abiertodocumentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
bug cli platform service
Dificultad 4/5 3-5 días Aptitud para principiantes 28/100
Los mantenedores suelen responder en 1 día
-
[Bug] Anthropic pool: one 429 leaves the active account rate limited with a fake weekly 100%, and background refresh skips it (2.100.7)Posiblemente ocupada @samirmedani la tomó hoy. Abiertoaccount-pool bug
Dificultad 4/5 3-5 días Aptitud para principiantes 32/100
lidge-jun/opencodex#9032 · 2 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
catalog enhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 30/100
Los mantenedores suelen responder en 1 día
Todos los issues de lidge-jun/opencodex
Issues similares
-
Project submission: xmcp DocsAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 62/100
slavakurilyak/awesome-ai-agents#1005 ·
-
kind/bug triage/unresolved
Dificultad 2/5 1-3 horas Aptitud para principiantes 60/100
Los mantenedores suelen responder en 1 día
-
effort:S P3 refactor
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
nightscout/nocturne#3735 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
wpilibsuite/systemcore-blocks-interface#641 ·
Los mantenedores suelen responder en 2 días
-
[Site] Active section detection should respect scroll-margin-topPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertoarea/web reproduced type/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
anomalyco/opencode#65384 · 1 comentario ·
Los mantenedores suelen responder en 1 día