mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
* fix(git): keep the agent-terminal credential guard scalar-only so env scrubs can't break git Agents that scrub env names matching KEY/TOKEN/... (DeepSeek Harness) dropped GIT_CONFIG_KEY_n but kept GIT_CONFIG_COUNT, so every git command in those terminals failed with "missing config key GIT_CONFIG_KEY_0". GCM_INTERACTIVE already carries credential.interactive and suppresses GCM's GUI, so the guard now emits only scalar variables. Tracked in #26594. Co-authored-by: yu.xia <yuxianice@163.com> * chore(git): drop stale indexed-config comments and a dead WSL forward branch --------- Co-authored-by: yu.xia <yuxianice@163.com>
53 lines
1.8 KiB
TypeScript
53 lines
1.8 KiB
TypeScript
import { addWslEnvKeys } from '../../../shared/wsl-env'
|
|
import { gitCredentialPromptGuardEnv } from '../../../shared/git/commands/git-credential-prompt-env'
|
|
import { UNTRANSLATED_GIT_OUTPUT_ENV } from '../../../shared/git/commands/git-output-locale'
|
|
|
|
export function gitOptionalLocksDisabledEnv(
|
|
env: NodeJS.ProcessEnv = process.env
|
|
): NodeJS.ProcessEnv {
|
|
return {
|
|
...env,
|
|
GIT_OPTIONAL_LOCKS: '0'
|
|
}
|
|
}
|
|
|
|
/** Pin Git diagnostics to English so parsers work under any user locale. */
|
|
export function untranslatedGitOutputEnv(env: NodeJS.ProcessEnv = process.env): NodeJS.ProcessEnv {
|
|
return { ...env, ...UNTRANSLATED_GIT_OUTPUT_ENV }
|
|
}
|
|
|
|
export function promptGuardGitEnv(
|
|
env: NodeJS.ProcessEnv = process.env,
|
|
platform: NodeJS.Platform = process.platform
|
|
): NodeJS.ProcessEnv {
|
|
return gitCredentialPromptGuardEnv(untranslatedGitOutputEnv(env), platform)
|
|
}
|
|
|
|
/** Guard PTYs/hooks without locale pins, which would affect every shell child. */
|
|
export function promptGuardShellEnv(
|
|
env: NodeJS.ProcessEnv = process.env,
|
|
platform: NodeJS.Platform = process.platform
|
|
): NodeJS.ProcessEnv {
|
|
return gitCredentialPromptGuardEnv(env, platform)
|
|
}
|
|
|
|
/** Prevent unattended credential prompts; preserve caller askpass/SSH overrides. */
|
|
export function nonInteractiveGitEnv(
|
|
env: NodeJS.ProcessEnv = process.env,
|
|
platform: NodeJS.Platform = process.platform
|
|
): NodeJS.ProcessEnv {
|
|
const next = promptGuardGitEnv(env, platform)
|
|
if (platform === 'win32') {
|
|
// Decode wsl.exe launch errors as UTF-8 rather than its default UTF-16LE.
|
|
next.WSL_UTF8 = '1'
|
|
}
|
|
if (!next.GIT_SSH_COMMAND && !next.GIT_SSH) {
|
|
next.GIT_SSH_COMMAND = 'ssh -o BatchMode=yes'
|
|
if (platform === 'win32') {
|
|
// Forward only our SSH override; caller values may be Windows-specific.
|
|
addWslEnvKeys(next, ['GIT_SSH_COMMAND'])
|
|
}
|
|
}
|
|
return next
|
|
}
|