Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/deltawire-runtime.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Verify DeltaWire runtime integration

on:
pull_request:
paths:
- "labs/20-deltawire/**"
- ".github/workflows/deltawire-runtime.yml"
push:
branches: [main]
paths:
- "labs/20-deltawire/**"
- ".github/workflows/deltawire-runtime.yml"

permissions:
contents: read

jobs:
validate-runtime:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- uses: astral-sh/setup-uv@v7
- run: python3 labs/20-deltawire/eval/scripts/v6/verify_terminal_evidence_lock.py
- run: python3 labs/20-deltawire/eval/scripts/v6/test_terminal_evidence_lock.py
- run: python3 labs/20-deltawire/eval/scripts/v6/test_release.py
- run: python3 labs/20-deltawire/eval/scripts/v6/test_environment_receipt.py
- run: python3 labs/20-deltawire/eval/scripts/v6/test_artifact_manifest.py
- run: python3 labs/20-deltawire/eval/scripts/v6/test_setup_receipt.py
- run: python3 labs/20-deltawire/eval/scripts/v6/test_trial_status.py
- run: python3 labs/20-deltawire/eval/scripts/v6/test_shell_observation.py
- run: python3 labs/20-deltawire/eval/scripts/v6/negative_controls.py --self-test
- run: PYTHONPATH=labs/20-deltawire/eval uv run --with harbor==0.20.0 python labs/20-deltawire/eval/agents/test_preinstalled_gemini_cli.py
1 change: 1 addition & 0 deletions labs/20-deltawire/eval/agents/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Versioned Harbor custom agents for DeltaWire evaluation."""
73 changes: 73 additions & 0 deletions labs/20-deltawire/eval/agents/preinstalled_gemini_cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
"""Harbor Gemini CLI agent with a verification-only install boundary."""
import json
import shlex

from harbor.agents.installed.gemini_cli import GeminiCli

AGENT_NAME = "preinstalled-gemini-cli-v1"
EXPECTED_NODE_PATH = "/usr/local/bin/node"
EXPECTED_NODE_VERSION = "v22.23.1"
EXPECTED_NPM_VERSION = "10.9.8"
EXPECTED_GEMINI_PATH = "/usr/local/bin/gemini"
EXPECTED_GEMINI_VERSION = "0.51.0"
EXPECTED_PACKAGE_VERSION = "0.51.0"
EXPECTED_IMAGE_ID = "sha256:589fce58d7ddf09910876afe0198bcee0086a840af6de7c08515bbce3e8367a7"
RECEIPT_PATH = "/logs/artifacts/preinstalled-gemini/setup-receipt.json"


class PreinstalledGeminiCli(GeminiCli):
@staticmethod
def name() -> str:
return AGENT_NAME

async def install(self, environment) -> None:
async def checked(command: str) -> str:
result = await self.exec_as_agent(environment, command=command)
if result.return_code != 0:
raise RuntimeError(f"preinstalled runtime verification failed: {command}")
return (result.stdout or "").strip()

node_path = await checked("command -v node")
node_version = await checked("node --version")
npm_version = await checked("npm --version")
gemini_path = await checked("command -v gemini")
gemini_version = await checked("gemini --version")
package_version = await checked(
"node -p \"require('/usr/local/lib/node_modules/@google/gemini-cli/package.json').version\""
)
checks = {
"agent_identity": self.name() == AGENT_NAME,
"gemini_executable": gemini_path == EXPECTED_GEMINI_PATH,
"gemini_version": gemini_version == EXPECTED_GEMINI_VERSION,
"image_id": EXPECTED_IMAGE_ID.startswith("sha256:") and len(EXPECTED_IMAGE_ID) == 71,
"node_executable": node_path == EXPECTED_NODE_PATH,
"node_version": node_version == EXPECTED_NODE_VERSION,
"npm_version": npm_version == EXPECTED_NPM_VERSION,
"package_identity": package_version == EXPECTED_PACKAGE_VERSION,
}
receipt = {
"agent": AGENT_NAME,
"checks": checks,
"gemini_path": gemini_path,
"gemini_version": gemini_version,
"image_id": EXPECTED_IMAGE_ID,
"node_path": node_path,
"node_version": node_version,
"npm_version": npm_version,
"package_version": package_version,
"schema_version": "preinstalled-gemini-setup-receipt.v1",
"status": "pass" if all(checks.values()) else "fail",
}
payload = json.dumps(receipt, sort_keys=True, separators=(",", ":")) + "\n"
parent = RECEIPT_PATH.rsplit("/", 1)[0]
command = (
f"mkdir -p {shlex.quote(parent)} && "
f"temporary={shlex.quote(RECEIPT_PATH + '.tmp')} && "
f"printf %s {shlex.quote(payload)} > \"$temporary\" && "
f"mv \"$temporary\" {shlex.quote(RECEIPT_PATH)}"
)
result = await self.exec_as_agent(environment, command=command)
if result.return_code != 0:
raise RuntimeError("preinstalled setup receipt write failed")
if receipt["status"] != "pass":
raise RuntimeError("preinstalled runtime identity mismatch")
60 changes: 60 additions & 0 deletions labs/20-deltawire/eval/agents/test_preinstalled_gemini_cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/usr/bin/env python3
import ast
import asyncio
import importlib
import inspect
from pathlib import Path
from types import SimpleNamespace

MODULE = importlib.import_module("agents.preinstalled_gemini_cli")
CLASS = MODULE.PreinstalledGeminiCli


def structural_test() -> None:
source = Path(inspect.getsourcefile(CLASS)).read_text()
tree = ast.parse(source)
node = next(item for item in tree.body if isinstance(item, ast.ClassDef) and item.name == CLASS.__name__)
methods = {item.name for item in node.body if isinstance(item, (ast.FunctionDef, ast.AsyncFunctionDef))}
inherited = {name for name in methods if hasattr(CLASS.__mro__[1], name)}
assert inherited == {"name", "install"}
lowered = inspect.getsource(CLASS.install).lower()
for forbidden in ("apt-get", "apt ", "curl", "wget", "nvm", "npm install", "npm update"):
assert forbidden not in lowered
assert CLASS.run is CLASS.__mro__[1].run


def functional_test() -> None:
outputs = iter(
[
"/usr/local/bin/node\n",
"v22.23.1\n",
"10.9.8\n",
"/usr/local/bin/gemini\n",
"0.51.0\n",
"0.51.0\n",
"",
]
)
commands = []

async def fake_exec(_environment, command):
commands.append(command)
return SimpleNamespace(return_code=0, stdout=next(outputs), stderr="")

instance = object.__new__(CLASS)
instance.exec_as_agent = fake_exec
original = MODULE.EXPECTED_IMAGE_ID
MODULE.EXPECTED_IMAGE_ID = "sha256:" + "1" * 64
try:
asyncio.run(instance.install(object()))
finally:
MODULE.EXPECTED_IMAGE_ID = original
assert len(commands) == 7
assert "setup-receipt.json.tmp" in commands[-1]
assert '"status":"pass"' in commands[-1]


if __name__ == "__main__":
structural_test()
functional_test()
print("Preinstalled Gemini agent inheritance and install tests passed.")
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Harbor task discovery requires the environment directory even when task.toml
# selects a prebuilt docker_image and no Dockerfile is used.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Verify the preinstalled Gemini CLI agent runtime. Do not execute an agent or model.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
schema_version = "1.3"
artifacts = []

[task]
name = "operatorstack/preinstalled-gemini-setup-v1"
description = "Credential-free install-only conformance for the v6 agent runtime"
authors = []
keywords = []

[metadata]
benchmark_result = false
conformance_version = "v1"

[verifier]
timeout_sec = 60.0

[[verifier.collect]]
service = "main"
command = "python3 /usr/local/bin/environment_receipt.py --expectations /deltawire-environment-expectations.json --receipt /logs/artifacts/deltawire/environment-receipt.json"
timeout_sec = 30.0

[agent]
timeout_sec = 60.0

[environment]
docker_image = "deltawire-preflight-v6:runtime-v1"
network_mode = "no-network"
build_timeout_sec = 60.0
os = "linux"
mcp_servers = []
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
set -euo pipefail
exit 0
29 changes: 29 additions & 0 deletions labs/20-deltawire/eval/docs/10-preinstalled-gemini-boundary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Preinstalled Gemini CLI boundary

DeltaWire preflight v6 separates agent bootstrap from paid treatment behavior. The task image contains the runtime; Harbor's custom agent performs local identity checks only.

## Harbor 0.20.0 grounding

- Custom agents use the `module.path:ClassName` import form. V6 uses `agents.preinstalled_gemini_cli:PreinstalledGeminiCli` with the eval directory on `PYTHONPATH`.
- `harbor run --install-only` performs environment and agent setup without agent execution or model verification. `--model` is optional on that path.
- Harbor's official `GeminiCli.install` begins at line 109 of `harbor/agents/installed/gemini_cli.py` and performs dynamic `apt-get`, NVM, and npm installation. Its SHA-256 in Harbor 0.20.0 is `dc8ce81e8f41b78f00abb54cd91fd7840d147f442960ca32e68c7a760e060a2a`.
- The inherited official `GeminiCli.run` begins at line 775 in that same frozen source. The custom class overrides only `name` and `install`; execution, authentication, settings, skills, prompt, trajectory, ATIF, token, cost, and resume behavior remain Harbor's implementation.

Grounding commands:

```text
uvx --from harbor==0.20.0 harbor run --help
uv run --with harbor==0.20.0 python <inspect-source-script>
```

## Deterministic setup proof

The image pins the Linux/amd64 base manifest, Node, npm, Gemini CLI package and DeltaWire binary. The custom install boundary runs only local path/version/package checks and writes a canonical setup receipt under `/logs/artifacts`. In Harbor 0.20.0, `--install-only` implies disabled verification, so verifier collect hooks do not run and `artifacts/manifest.json` is not emitted; Harbor still performs its automatic `/logs/artifacts` collection after agent setup. The paid path retains the main-service collect hook and artifact manifest as separate environment gates. Three credential-free install-only Harbor trials must agree on setup-receipt hash and image identity, finish setup within 60 seconds, and show no model, credential, skill, agent execution, verifier execution, provider use, or dynamic installation.

Harbor process exit and trial exception are normalized independently. A zero Harbor process exit cannot turn a trial exception into a pass.

## Authorization boundary

The v6 runner exposes only `probe-v6` and `pair`. The paid probe is unavailable until the exact phrase `approve the paid v6 probe` is separately recorded after manifest-head review. The pair requires the later exact phrase `approve the frozen range-large/r1 pair`. Neither authorization is implied by building or validating v6.

All terminal states keep `READY_FOR_72=false`, `pair_launched=false`, `six_run_canary_started=false`, and `full_run_started=false` until evidence says otherwise; v6 never exposes a full-run mode.
Loading
Loading