fix: enable Codex sandbox in Docker

This commit is contained in:
2026-07-20 16:19:59 +02:00
parent 14737db853
commit a12229a147
5 changed files with 70 additions and 6 deletions
+4 -3
View File
@@ -76,7 +76,7 @@ class CodexClient:
*self._turn_args(model, reasoning, permission, schema_name),
"-",
]
session_id, result = await self._invoke(args, prompt, result_type)
session_id, result = await self._invoke(args, prompt, result_type, workspace=workspace)
if not session_id:
raise CodexError("Codex did not emit a thread.started event")
return session_id, result
@@ -104,7 +104,7 @@ class CodexClient:
session_id,
"-",
]
_, result = await self._invoke(args, prompt, result_type)
_, result = await self._invoke(args, prompt, result_type, workspace=workspace)
return result
def _turn_args(
@@ -127,7 +127,7 @@ class CodexClient:
]
async def _invoke(
self, args: list[str], prompt: str, result_type: type[T]
self, args: list[str], prompt: str, result_type: type[T], *, workspace: Path
) -> tuple[str | None, T]:
started = monotonic()
operation = "codex.resume" if "resume" in args else "codex.start"
@@ -141,6 +141,7 @@ class CodexClient:
try:
process = await asyncio.create_subprocess_exec(
*args,
cwd=workspace,
env=self._environment(),
stdin=asyncio.subprocess.PIPE,
stdout=asyncio.subprocess.PIPE,