fix(windows): support npm shims in agent authentication - #2970
Open
janburzinski wants to merge 2 commits into
Open
fix(windows): support npm shims in agent authentication#2970janburzinski wants to merge 2 commits into
janburzinski wants to merge 2 commits into
Conversation
Contributor
Greptile SummaryThis PR adds trusted Windows npm-shim support for static agent authentication commands.
Confidence Score: 5/5The PR appears safe to merge. The previously reported Windows status-shim issue is fixed: Claude, OpenCode, and shared authentication checks now propagate the trusted-script marker through the agent-config runtime's NodeExecutionContext, which wraps resolved .cmd and .bat shims with cmd.exe.
|
| Filename | Overview |
|---|---|
| packages/core/src/exec/windows-script-command.ts | Introduces the explicitly gated Windows command wrapper and argument serializer used for trusted authentication scripts. |
| packages/core/src/exec/node-execution-context.ts | Applies trusted Windows script resolution before buffered child-process execution. |
| packages/core/src/pty/node/node-pty-spawner.ts | Applies the same trusted wrapper to interactive authentication PTY launches without changing generic TUI execution. |
| packages/core/src/host-dependencies/runtime/probe.ts | Prefers runnable Windows executable extensions over extensionless command matches. |
| packages/plugins/src/agents/helpers/auth.ts | Propagates the trusted-script marker through shared static authentication status checks. |
| packages/plugins/src/agents/impl/claude/auth.ts | Correctly marks Claude's static authentication status invocation for Windows shim adaptation. |
| packages/plugins/src/agents/impl/opencode/auth.ts | Correctly marks OpenCode's static authentication status invocation for Windows shim adaptation. |
| packages/runtime/src/agent-config/runtime/auth.ts | Marks the plugin-owned interactive authentication command as trusted for PTY execution. |
Sequence Diagram
sequenceDiagram
participant UI as Agent configuration UI
participant Runtime as AgentConfigRuntime
participant Host as AgentPluginHost
participant Exec as NodeExecutionContext
participant Cmd as cmd.exe
participant Agent as Agent npm shim
UI->>Runtime: Refresh authentication status
Runtime->>Host: checkAuthStatus(provider)
Host->>Exec: exec(cli, static args, windowsScript: trusted)
Exec->>Exec: Resolve .cmd/.bat wrapper
Exec->>Cmd: /d /s /c escaped command
Cmd->>Agent: Run authentication status command
Agent-->>Runtime: Authentication output
Reviews (2): Last reviewed commit: "fix(auth): route Windows status shims th..." | Re-trigger Greptile
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix Codex authentication on Windows when an npm installation exposes an extensionless POSIX shim before
codex.cmd.Previously, Emdash could pass the extensionless shim directly to node-pty/ConPTY, causing: Failed to spawn PTY: Cannot create process, error code: 193
This change:
.cmd,.bat,.com, or.execandidate existscodex loginPTY and thecodex login statuscheckwindowsScript: 'trusted'boundarycmd.exeserializerThe trust boundary is intentionally limited to plugin-owned static authentication commands. Generic Windows npm-shim TUI execution remains outside the scope of this PR.
Related issues
https://discord.com/channels/1422831935553667175/1530791430929256508
Testing
tested this on my windows 10 computer
Checklist
messages and, when possible, the PR title