Skip to content

Commit a9c3ceb

Browse files
authored
fix: pass GIT_ASKPASS and GIT_TERMINAL_PROMPT=0 in the MCP server env (#740)
* pass GIT_ASKPASS and GIT_TERMINAL_PROMPT=0 in the MCP server env * linter
1 parent 7583a60 commit a9c3ceb

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

pkg/agentrun-harness/tool/codex/codex.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
const (
2222
consoleTokenEnv = "PLRL_CONSOLE_TOKEN"
2323
gitAccessTokenEnv = "GIT_ACCESS_TOKEN"
24+
gitAskpassPath = "/plural/.git-askpass"
2425
gitSigningKeyPath = common.GitSigningKeyMountPath
2526
)
2627

@@ -102,6 +103,15 @@ func (in *Codex) Configure(consoleURL, consoleToken, deployToken string) error {
102103
}}
103104
}
104105

106+
mcpBaseEnv := map[string]string{
107+
consoleTokenEnv: consoleToken,
108+
"PLRL_CONSOLE_URL": consoleURL,
109+
"PLRL_AGENT_RUN_ID": in.Config.Run.ID,
110+
gitAccessTokenEnv: os.Getenv(gitAccessTokenEnv),
111+
"GIT_ASKPASS": gitAskpassPath,
112+
"GIT_TERMINAL_PROMPT": "0",
113+
}
114+
105115
switch in.Config.Run.Mode {
106116
case console.AgentRunModeAnalyze:
107117
agents = []AgentInput{{
@@ -119,11 +129,7 @@ func (in *Codex) Configure(consoleURL, consoleToken, deployToken string) error {
119129
Command: "/usr/local/bin/mcpserver",
120130
TrustPolicy: "always",
121131
EnabledTools: []string{"updateAgentRunAnalysis"},
122-
Env: map[string]string{
123-
consoleTokenEnv: consoleToken,
124-
"PLRL_CONSOLE_URL": consoleURL,
125-
"PLRL_AGENT_RUN_ID": in.Config.Run.ID,
126-
},
132+
Env: mcpBaseEnv,
127133
}}
128134
case console.AgentRunModeWrite:
129135
agents = []AgentInput{{
@@ -141,11 +147,7 @@ func (in *Codex) Configure(consoleURL, consoleToken, deployToken string) error {
141147
Command: "/usr/local/bin/mcpserver",
142148
TrustPolicy: "always",
143149
EnabledTools: []string{"agentPullRequest", "createBranch", "fetchAgentRunTodos", "updateAgentRunTodos"},
144-
Env: map[string]string{
145-
consoleTokenEnv: consoleToken,
146-
"PLRL_CONSOLE_URL": consoleURL,
147-
"PLRL_AGENT_RUN_ID": in.Config.Run.ID,
148-
},
150+
Env: mcpBaseEnv,
149151
}}
150152
default:
151153
return fmt.Errorf("unsupported agent run mode %q for codex", in.Config.Run.Mode)

0 commit comments

Comments
 (0)