mirror of
https://gh-proxy.org/https://github.com/klinsmaya/multica.git
synced 2026-11-08 17:36:45 +08:00
* fix(agent): deliver the copilot prompt on stdin; name E2BIG start failures (MUL-8105) Copilot inlined the whole task prompt as -p <prompt>, so a thread above Linux's 131,072-byte MAX_ARG_STRLEN died at fork/exec with E2BIG (#9362). The prompt now rides stdin, mirroring the OpenCode move in #6552. startOwnedProcessTree also wraps oversized-command-line failures in ErrArgvLimitExceeded with an actionable remedy. Co-authored-by: multica-agent <[email protected]> * docs(agent): update copilotBackend comment for stdin prompt delivery (MUL-8105) Co-authored-by: multica-agent <[email protected]> --------- Co-authored-by: multica-agent <[email protected]>
33 lines
1.2 KiB
Go
33 lines
1.2 KiB
Go
//go:build windows
|
|
|
|
package agent
|
|
|
|
import (
|
|
"log/slog"
|
|
"os"
|
|
)
|
|
|
|
// platformCopilotInvocation keeps the argv built by buildCopilotArgs intact
|
|
// on Windows (the prompt itself rides stdin) by spawning the native copilot.exe
|
|
// bundled in the npm package, so neither cmd.exe's %* expansion nor
|
|
// PowerShell's $args re-serialisation can re-tokenise it (see
|
|
// resolveCopilotNativeFromShim for why neither launcher can be made safe).
|
|
//
|
|
// When the native binary can't be located — a partial install, or a Copilot
|
|
// build old enough to predate the platform packages — fall back to
|
|
// `powershell -File copilot.ps1`, which still avoids the strictly worse
|
|
// cmd.exe layer. powerShellLookup and rewriteCmdToPS1 are defined in
|
|
// cursor_invocation_windows.go.
|
|
func platformCopilotInvocation(lookedUp string, args []string, logger *slog.Logger) (string, []string, bool) {
|
|
if native := resolveCopilotNativeFromShim(lookedUp, os.Stat); native != "" {
|
|
if logger != nil {
|
|
logger.Info("copilot: spawning the bundled native binary to keep argv intact",
|
|
"shim", lookedUp,
|
|
"native", native,
|
|
)
|
|
}
|
|
return native, args, true
|
|
}
|
|
return rewriteCmdToPS1("copilot", lookedUp, args, logger)
|
|
}
|