Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
40 changes: 37 additions & 3 deletions .github/workflows/games.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
strategy:
fail-fast: false
matrix:
benchmark: [common, minigrid, crafter, textworld, babaisai, minihack]
benchmark: [common, minigrid, crafter, textworld, babaisai, minihack, vmage]
steps:
- uses: actions/checkout@v4
with: {persist-credentials: false}
Expand All @@ -41,6 +41,7 @@ jobs:
with: {python-version: '3.12'}
- run: python -m pip install -e .
- run: harbor run --game-suite minihack-balrog --standard --list
- run: harbor run --game-suite vmage-smoke --standard --list
- run: python game_first_exam/tests/test_game_harbor.py
fresh-clone-smoke:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -77,8 +78,38 @@ jobs:
name: fresh-clone-room-evidence
path: jobs/
retention-days: 7
fresh-clone-vmage-smoke:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with: {persist-credentials: false}
- uses: actions/setup-python@v5
with: {python-version: '3.12'}
# Start without cached game images or a preloaded local files image.
- uses: docker/setup-docker-action@v5
with:
version: v29.5.2
set-host: true
daemon-config: '{"features":{"containerd-snapshotter":true}}'
- run: python -m pip install -e .
- name: Run one V-MAGE oracle per game without model or registry credentials
run: |
harbor run --game-suite vmage-smoke --standard \
-c configs/harbor/oracle.json --plugin game_harbor:GameRecords \
--jobs-dir "$PWD/jobs" --job-name fresh-clone-vmage -y
- name: Check all five scores, end states, and evidence
run: python ci_checks/check-vmage-smoke-result.py jobs/fresh-clone-vmage
- name: Decode all five replays
run: |
if ! command -v ffmpeg >/dev/null; then
sudo apt-get update && sudo apt-get install -y ffmpeg
fi
for replay in jobs/fresh-clone-vmage/*/artifacts/data/replay.mp4; do
ffmpeg -v error -xerror -i "$replay" -f null -
done
invariants:
needs: [static, adapters, harbor, fresh-clone-smoke]
needs: [static, adapters, harbor, fresh-clone-smoke, fresh-clone-vmage-smoke]
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
Expand All @@ -87,4 +118,7 @@ jobs:
ADAPTERS: ${{ needs.adapters.result }}
HARBOR: ${{ needs.harbor.result }}
SMOKE: ${{ needs.fresh-clone-smoke.result }}
run: test "$STATIC" = success && test "$ADAPTERS" = success && test "$HARBOR" = success && test "$SMOKE" = success
VMAGE_SMOKE: ${{ needs.fresh-clone-vmage-smoke.result }}
run: |
test "$STATIC" = success && test "$ADAPTERS" = success && test "$HARBOR" = success &&
test "$SMOKE" = success && test "$VMAGE_SMOKE" = success
89 changes: 89 additions & 0 deletions ci_checks/check-vmage-smoke-result.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/usr/bin/env python3
"""Check the five frozen V-MAGE smoke oracle results and their evidence."""
import argparse
import json
from pathlib import Path


# Game, then expected (raw score, accepted decisions). Race reaches a goal;
# the other four traces deliberately end after demonstrating positive scoring.
EXPECTED = {
"vmage-race-l01-i01-standard": (100, 4),
"vmage-flappybird-l01-i01-standard": (1, 40),
"vmage-pong-l01-i01-standard": (1, 29),
"vmage-supermario-l01-i01-standard": (100, 11),
"vmage-tempestrun-l01-i01-standard": (10, 2),
}
RACE = "vmage-race-l01-i01-standard"


def read(path):
return json.loads(path.read_text())


def require(condition, message):
if not condition:
raise ValueError(message)


def check(job):
paths = sorted(job.glob("*/result.json"))
require(len(paths) == len(EXPECTED), "expected exactly five completed trials")
require(read(job / "game-provenance.json")["status"] == "complete", "provenance incomplete")
require(read(job / "runtime-images.json")["complete"] is True, "runtime image capture incomplete")
summary = read(job / "game-report/summary.json")
require(summary["complete"] and summary["expected_trials"] == summary["valid_trials"] == len(EXPECTED),
"derived report incomplete")

evidence = {}
for path in paths:
result = read(path)
task = result["task_name"].rsplit("/", 1)[-1]
require(task in EXPECTED and task not in evidence, f"unexpected or duplicate task: {task}")
score, steps = EXPECTED[task]
require(result.get("exception_info") is None, f"{task}: Harbor trial raised an exception")
agent = result.get("agent_info", {})
require(agent.get("name") == "oracle" and agent.get("model_info") is None,
f"{task}: smoke must run without a model")

trial = path.parent
reward = read(trial / "verifier/reward.json")
require(reward.get("result_valid") == 1, f"{task}: invalid result")
for key in ("infra_error", "sim_error", "environment_error"):
require(reward.get(key) == 0, f"{task}: {key} is not zero")
require(reward.get("primary_score") == score and reward.get("steps") == steps,
f"{task}: expected {score} raw points in {steps} actions")

data = trial / "artifacts/data"
final = read(data / "final.json")
require(final["finalized"] and final["result_valid"], f"{task}: invalid simulator evidence")
require(final["metrics"]["native_score"] == score and final["steps"] == steps,
f"{task}: simulator and verifier disagree")
require(not final["truncated"], f"{task}: unexpected truncation")
if task == RACE:
require(final["terminated"] and final["reason"] == "native_terminated"
and final["metrics"]["native_win"] and final["metrics"]["terminal_cause"] == "native_win"
and final["success"] and reward.get("success") == 1,
f"{task}: oracle did not reach the trophy")
else:
require(not final["terminated"] and final["reason"] == "agent_finished"
and final["metrics"]["terminal_cause"] == "running",
f"{task}: partial reference ended unexpectedly")

recording = read(data / "recording.json")
require(recording.get("video_source") == "live" and recording.get("render_error") is None,
f"{task}: live recording failed")
for name in ("episode.jsonl", "replay.mp4"):
artifact = data / name
require(artifact.is_file() and artifact.stat().st_size > 0, f"{task}: {name} missing")
# A short run can finish before resource sampling. Preserve those flags.
evidence[task] = dict(score=score, steps=steps, end=final["reason"],
resource_monitor_missing=reward.get("resource_monitor_missing"),
resource_enforced=reward.get("resource_enforced"))
print(json.dumps(evidence, indent=2, sort_keys=True))


if __name__ == "__main__":
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("job", type=Path)
check(parser.parse_args().job)
30 changes: 30 additions & 0 deletions configs/game_benchmarks.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,33 @@ schema = "game_first_exam/benchmarks/babaisai/instance_schema.py"

[benchmarks.minihack]
schema = "game_first_exam/benchmarks/minihack/instance_schema.py"

[benchmarks.vmage_race]
schema = "game_first_exam/benchmarks/vmage/race/instance_schema.py"
adapter = "game_first_exam/benchmarks/vmage/race/adapter.py"
metric_rules = "game_first_exam/benchmarks/vmage/common/metric_rules.py"
runtime_files = { "/srv/vmage_bridge.py" = "game_first_exam/benchmarks/vmage/common/vmage_bridge.py", "/srv/source_loader.py" = "game_first_exam/benchmarks/vmage/common/source_loader.py", "/srv/SOURCE.json" = "game_first_exam/benchmarks/vmage/common/SOURCE.json" }

[benchmarks.vmage_flappybird]
schema = "game_first_exam/benchmarks/vmage/flappybird/instance_schema.py"
adapter = "game_first_exam/benchmarks/vmage/flappybird/adapter.py"
metric_rules = "game_first_exam/benchmarks/vmage/common/metric_rules.py"
runtime_files = { "/srv/vmage_bridge.py" = "game_first_exam/benchmarks/vmage/common/vmage_bridge.py", "/srv/source_loader.py" = "game_first_exam/benchmarks/vmage/common/source_loader.py", "/srv/SOURCE.json" = "game_first_exam/benchmarks/vmage/common/SOURCE.json" }

[benchmarks.vmage_pong]
schema = "game_first_exam/benchmarks/vmage/pong/instance_schema.py"
adapter = "game_first_exam/benchmarks/vmage/pong/adapter.py"
metric_rules = "game_first_exam/benchmarks/vmage/common/metric_rules.py"
runtime_files = { "/srv/vmage_bridge.py" = "game_first_exam/benchmarks/vmage/common/vmage_bridge.py", "/srv/source_loader.py" = "game_first_exam/benchmarks/vmage/common/source_loader.py", "/srv/SOURCE.json" = "game_first_exam/benchmarks/vmage/common/SOURCE.json" }

[benchmarks.vmage_supermario]
schema = "game_first_exam/benchmarks/vmage/supermario/instance_schema.py"
adapter = "game_first_exam/benchmarks/vmage/supermario/adapter.py"
metric_rules = "game_first_exam/benchmarks/vmage/common/metric_rules.py"
runtime_files = { "/srv/vmage_bridge.py" = "game_first_exam/benchmarks/vmage/common/vmage_bridge.py", "/srv/source_loader.py" = "game_first_exam/benchmarks/vmage/common/source_loader.py", "/srv/SOURCE.json" = "game_first_exam/benchmarks/vmage/common/SOURCE.json" }

[benchmarks.vmage_tempestrun]
schema = "game_first_exam/benchmarks/vmage/tempestrun/instance_schema.py"
adapter = "game_first_exam/benchmarks/vmage/tempestrun/adapter.py"
metric_rules = "game_first_exam/benchmarks/vmage/common/metric_rules.py"
runtime_files = { "/srv/vmage_bridge.py" = "game_first_exam/benchmarks/vmage/common/vmage_bridge.py", "/srv/source_loader.py" = "game_first_exam/benchmarks/vmage/common/source_loader.py", "/srv/SOURCE.json" = "game_first_exam/benchmarks/vmage/common/SOURCE.json" }
10 changes: 10 additions & 0 deletions configs/game_suites/vmage-extra.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
schema_version = "game-suite/2.1"
version = "0.2.4"
tier = "development"
name = "games-vmage-extra-v0.2.4"
files_images = ["connection-files", "game-files", "vmage-files"]

[[tasks]]
name = "vmage-tempestrun-l05-i01-standard"
benchmark = "vmage_tempestrun"
family = "l05"
30 changes: 30 additions & 0 deletions configs/game_suites/vmage-smoke.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
schema_version = "game-suite/2.1"
version = "0.2.4"
tier = "smoke"
name = "games-vmage-smoke-v0.2.4"
files_images = ["connection-files", "game-files", "vmage-files"]

[[tasks]]
name = "vmage-race-l01-i01-standard"
benchmark = "vmage_race"
family = "l01"

[[tasks]]
name = "vmage-flappybird-l01-i01-standard"
benchmark = "vmage_flappybird"
family = "l01"

[[tasks]]
name = "vmage-pong-l01-i01-standard"
benchmark = "vmage_pong"
family = "l01"

[[tasks]]
name = "vmage-supermario-l01-i01-standard"
benchmark = "vmage_supermario"
family = "l01"

[[tasks]]
name = "vmage-tempestrun-l01-i01-standard"
benchmark = "vmage_tempestrun"
family = "l01"
Loading