fix: support harness codex model override
This commit is contained in:
+16
-1
@@ -25,6 +25,12 @@ from typing import Optional
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
def configure_output_encoding():
|
||||
for stream in (sys.stdout, sys.stderr):
|
||||
if hasattr(stream, "reconfigure"):
|
||||
stream.reconfigure(encoding="utf-8", errors="replace")
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def progress_indicator(label: str):
|
||||
"""터미널 진행 표시기. with 문으로 사용하며 .elapsed 로 경과 시간을 읽는다."""
|
||||
@@ -374,7 +380,7 @@ class StepExecutor:
|
||||
|
||||
prompt = preamble + step_file.read_text(encoding="utf-8")
|
||||
result = subprocess.run(
|
||||
[self._codex_command(), "exec", "--dangerously-bypass-approvals-and-sandbox", "--json", "-"],
|
||||
self._codex_exec_command(),
|
||||
cwd=self._root, capture_output=True, text=True, input=prompt,
|
||||
encoding="utf-8", errors="replace", timeout=1800,
|
||||
)
|
||||
@@ -406,6 +412,14 @@ class StepExecutor:
|
||||
or "codex"
|
||||
)
|
||||
|
||||
def _codex_exec_command(self) -> list[str]:
|
||||
cmd = [self._codex_command(), "exec"]
|
||||
model = os.environ.get("HARNESS_CODEX_MODEL", "").strip()
|
||||
if model:
|
||||
cmd.extend(["-m", model])
|
||||
cmd.extend(["--dangerously-bypass-approvals-and-sandbox", "--json", "-"])
|
||||
return cmd
|
||||
|
||||
def _print_header(self):
|
||||
print(f"\n{'='*60}")
|
||||
print(f" Harness Step Executor")
|
||||
@@ -561,6 +575,7 @@ class StepExecutor:
|
||||
|
||||
|
||||
def main():
|
||||
configure_output_encoding()
|
||||
parser = argparse.ArgumentParser(description="Harness Step Executor")
|
||||
parser.add_argument("phase_dir", help="Phase directory name (e.g. 0-mvp)")
|
||||
parser.add_argument("--push", action="store_true", help="Push branch after completion")
|
||||
|
||||
Reference in New Issue
Block a user