Skip to content

Commit e33f0d9

Browse files
authored
Merge pull request #93 from undoio/fix-copilot-env-passthrough
Explain: Fix passthrough of environment to Copilot CLI.
2 parents b413935 + 45f87c4 commit e33f0d9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

explain/copilot_cli_agent.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,13 @@ async def ask(self, question: str, port: int, tools: list[str]) -> str:
105105
prompt = question
106106

107107
allowed_tools = ["UDB_Server", "shell(grep)", "shell(find)", "shell(cat)", "shell(xargs)"]
108-
env = {
108+
env_changes = {
109109
"XDG_CONFIG_HOME": str(self._tempdir),
110110
"XDG_STATE_HOME": str(self._tempdir),
111111
}
112112
if runtime_dir := os.environ.get("XDG_RUNTIME_DIR"):
113113
# Pass through runtime state so it has auth access.
114-
env["XDG_RUNTIME_DIR"] = runtime_dir
114+
env_changes["XDG_RUNTIME_DIR"] = runtime_dir
115115

116116
try:
117117
copilot = await asyncio.create_subprocess_exec(
@@ -127,7 +127,7 @@ async def ask(self, question: str, port: int, tools: list[str]) -> str:
127127
"claude-sonnet-4.5",
128128
"-p",
129129
prompt,
130-
env=env,
130+
env=os.environ.copy().update(env_changes),
131131
stdin=asyncio.subprocess.PIPE,
132132
stdout=asyncio.subprocess.PIPE,
133133
stderr=asyncio.subprocess.PIPE,

0 commit comments

Comments
 (0)