after moving all to cipher
This commit is contained in:
@@ -27,6 +27,7 @@ import uuid
|
||||
from pathlib import Path
|
||||
|
||||
import atif_session
|
||||
import browser_note
|
||||
|
||||
from harbor.agents.installed.codex import Codex
|
||||
from harbor.models.trial.paths import EnvironmentPaths
|
||||
@@ -77,8 +78,12 @@ _INSTALL_CMD = (
|
||||
|
||||
|
||||
class SystemNodeCodex(Codex):
|
||||
# Set by install()'s probe, read by build_cli_flags(). Mirrors the claude adapter.
|
||||
_has_browser = False
|
||||
|
||||
async def install(self, environment) -> None: # type: ignore[override]
|
||||
await self.exec_as_root(environment, command=_INSTALL_CMD)
|
||||
self._has_browser = await browser_note.probe_browser(environment)
|
||||
|
||||
def build_cli_flags(self) -> str: # type: ignore[override]
|
||||
"""Harbor's flags plus the registry's `agent_config`, so a trial's toolset
|
||||
@@ -86,7 +91,24 @@ class SystemNodeCodex(Codex):
|
||||
$RACCOON_AGENT_FLAGS. Both run paths go through here."""
|
||||
flags = super().build_cli_flags()
|
||||
reductions = load_harness_registry().require("codex").agent_config_flags()
|
||||
return f"{flags} {reductions}".strip() if reductions else flags
|
||||
if reductions:
|
||||
flags = f"{flags} {reductions}".strip()
|
||||
return f"{flags} {self._browser_flag()}".strip() if self._browser_flag() else flags
|
||||
|
||||
def _browser_flag(self) -> str:
|
||||
"""Disclose the browser to codex the way codex takes extra instructions.
|
||||
|
||||
`developer_instructions` PREPENDS a developer message and leaves codex's own base
|
||||
instructions in place — verified with `codex debug prompt-input`. That makes it the
|
||||
equivalent of claude's --append-system-prompt. `model_instructions_file`, the other
|
||||
instruction-shaped key, REPLACES the base instructions; do not use it here.
|
||||
"""
|
||||
if not self._has_browser:
|
||||
return ""
|
||||
note = browser_note.browser_note()
|
||||
if not note:
|
||||
return ""
|
||||
return f"-c developer_instructions={shlex.quote(note)}"
|
||||
|
||||
|
||||
# Where harbor's run-prep stages the prior Claude Code session for snapshot tasks
|
||||
|
||||
Reference in New Issue
Block a user