You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When ocx service repair re-registers the Task Scheduler task through the elevated fallback, the spawn fails with:
WindowsElevationError: ENAMETOOLONG: name too long, uv_spawn
at startPowerShellCommand (…/src/lib/windows-elevation.ts:560)
at runWindowsElevatedScheduledTaskRegistration (…/src/lib/windows-elevation.ts:704)
at registerFreshWindowsSchedulerTask (…/src/service/windows-ops.ts:313)
at reregisterWindowsSchedulerTask (…/src/service/windows-ops.ts:430)
at repairService (…/src/service/repair.ts:212)
runWindowsElevatedScheduledTaskRegistration embeds two full XML payloads — the new task XML and the expected-existing snapshot (replace precondition) — as base64(utf16le) inside an inner PowerShell script, which is then itself base64(utf16le)-encoded into the outer -EncodedCommand. With a ~2 KB task XML this pushes the outer command line past the Windows spawn limit. Observed on 2.54.0; the snapshot precondition added the second payload, and the same code is present in 2.55.0.
If the task was originally registered by an elevated process (admin-owned task file), plain schtasks /create /f is denied, so every repair funnels into this elevated path — repair can never exit 0.
Environment
OS: Windows 11, zh-CN
opencodex 2.54.0 (same code in 2.55.0)
Reproduction
Register opencodex-proxy from an elevated installer (task file owned by Administrators).
ocx service repair → non-elevated schtasks /create /f returns Access is denied → elevated fallback → ENAMETOOLONG: name too long, uv_spawn.
Suggested fix
Pass the XML through an ACL-protected staging file (readable only by the elevated process) and reference its path in the elevated command — or write the inner script to a temp .ps1 — instead of double-base64 inline payloads. The current "immutable bytes, never a caller-writable pathname" design goal can be preserved by ACL-hardening the staged file (similar to hardenSecretPath).
Workaround that unblocked us: delete the admin-owned task once from an elevated prompt (schtasks /delete /tn opencodex-proxy /f), then let repair re-create it as the current user; afterwards the non-elevated replace succeeds and the elevated path is never needed.
I searched existing issues and documentation (no prior ENAMETOOLONG report found).
I removed secrets, tokens, account details, request credentials, and personal data.
Summary
When
ocx service repairre-registers the Task Scheduler task through the elevated fallback, the spawn fails with:runWindowsElevatedScheduledTaskRegistrationembeds two full XML payloads — the new task XML and the expected-existing snapshot (replace precondition) — as base64(utf16le) inside an inner PowerShell script, which is then itself base64(utf16le)-encoded into the outer-EncodedCommand. With a ~2 KB task XML this pushes the outer command line past the Windows spawn limit. Observed on 2.54.0; the snapshot precondition added the second payload, and the same code is present in 2.55.0.Two aggravating factors on affected hosts:
identityUpgradeNeededis true on every repair, so the re-register path runs every time, not once.schtasks /create /fis denied, so every repair funnels into this elevated path — repair can never exit 0.Environment
Reproduction
opencodex-proxyfrom an elevated installer (task file owned by Administrators).identityUpgradeNeededstays true.ocx service repair→ non-elevatedschtasks /create /freturnsAccess is denied→ elevated fallback →ENAMETOOLONG: name too long, uv_spawn.Suggested fix
Pass the XML through an ACL-protected staging file (readable only by the elevated process) and reference its path in the elevated command — or write the inner script to a temp
.ps1— instead of double-base64 inline payloads. The current "immutable bytes, never a caller-writable pathname" design goal can be preserved by ACL-hardening the staged file (similar tohardenSecretPath).Workaround that unblocked us: delete the admin-owned task once from an elevated prompt (
schtasks /delete /tn opencodex-proxy /f), then let repair re-create it as the current user; afterwards the non-elevated replace succeeds and the elevated path is never needed.