Add pinned Unity runtime bridge

This commit is contained in:
Meta Vens 2026-04-30 12:43:56 +01:00
commit 559a6b97fd
11 changed files with 731 additions and 94 deletions

View file

@ -14,6 +14,8 @@ Current slice:
lanes, role findings, jobs, and artifact bundles
- writes explicit status-snapshot and coordinator-plan artifact bundles through
bounded operator buttons
- resolves project-pinned Unity editors through the runtime bridge and writes
audit artifacts instead of letting workers launch PATH/default editors
- prepares durable Epiphany checkpoint state, then launches and reads the fixed
modeling, verification, and reorient lanes from GUI buttons, with reorient
acceptance kept explicit and review-gated
@ -52,6 +54,8 @@ The bounded buttons are intentionally narrow:
`.epiphany-gui/status-snapshots`.
- **Coordinator Plan** runs `tools/epiphany_mvp_coordinator.py --mode plan` and
writes an auditable bundle under `.epiphany-dogfood`.
- **Inspect Unity** runs `tools/epiphany_unity_bridge.py inspect` and writes a
pinned-editor inspection bundle under `.epiphany-gui/runtime`.
- **Prepare Checkpoint** seeds durable Epiphany state for a GUI operator thread
and returns the persisted thread id that unlocks lane actions.
- **Launch/Read Modeling** and **Launch/Read Verification** call the fixed role

View file

@ -33,6 +33,7 @@ struct ArtifactBundle {
final_status_path: Option<String>,
comparison_path: Option<String>,
implementation_audit: Option<ImplementationAudit>,
runtime_audit: Option<RuntimeAudit>,
modified_millis: Option<u128>,
}
@ -45,6 +46,15 @@ struct ImplementationAudit {
changed_files: Vec<String>,
}
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
struct RuntimeAudit {
result_path: String,
status: String,
project_version: Option<String>,
editor_path: Option<String>,
}
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
struct OperatorSnapshot {
@ -77,6 +87,7 @@ fn run_operator_action(
match action.as_str() {
"statusSnapshot" => run_status_snapshot(&repo_root, request),
"coordinatorPlan" => run_coordinator_plan(&repo_root, request),
"inspectUnity" => run_unity_inspection(&repo_root, request),
"launchModeling"
| "readModelingResult"
| "acceptModeling"
@ -92,6 +103,39 @@ fn run_operator_action(
}
}
fn run_unity_inspection(
repo_root: &Path,
request: StatusRequest,
) -> Result<OperatorActionResult, String> {
let python = find_python()?;
let artifact_root = repo_root.join(".epiphany-gui").join("runtime");
let workspace = request
.cwd
.map(PathBuf::from)
.unwrap_or_else(|| repo_root.to_path_buf());
let mut command = Command::new(python);
command
.current_dir(repo_root)
.arg(repo_root.join("tools").join("epiphany_unity_bridge.py"))
.arg("inspect")
.arg("--project-path")
.arg(workspace)
.arg("--artifact-root")
.arg(artifact_root);
let value = run_json_command(command, "unity inspection")?;
let status = value
.get("status")
.and_then(Value::as_str)
.unwrap_or("unknown");
Ok(OperatorActionResult {
action: "inspectUnity".to_string(),
artifact_path: json_string(&value, "artifactPath")?,
summary: format!("Unity bridge inspection: {status}."),
thread_id: None,
})
}
fn load_status(repo_root: &Path, request: StatusRequest) -> Result<Value, String> {
let python = find_python()?;
let status_script = repo_root.join("tools").join("epiphany_mvp_status.py");
@ -338,6 +382,11 @@ fn list_artifacts(repo_root: &Path) -> Result<Vec<ArtifactBundle>, String> {
&repo_root.join(".epiphany-gui").join("status-snapshots"),
"status/",
)?;
collect_artifact_root(
&mut bundles,
&repo_root.join(".epiphany-gui").join("runtime"),
"runtime/",
)?;
bundles.sort_by(|a, b| b.modified_millis.cmp(&a.modified_millis));
Ok(bundles)
@ -379,11 +428,13 @@ fn collect_artifact_root(
path: path.display().to_string(),
summary_path: existing_path(&path, "epiphany-dogfood-summary.json")
.or_else(|| existing_path(&path, "gui-action-summary.json"))
.or_else(|| existing_path(&path, "unity-bridge-summary.json"))
.or_else(|| existing_path(&path, "status.json")),
final_status_path: existing_path(&path, "epiphany-final-status.json")
.or_else(|| existing_path(&path, "after-status.json")),
comparison_path: existing_path(&path, "comparison.md"),
implementation_audit: read_implementation_audit(&path),
runtime_audit: read_runtime_audit(&path),
files,
modified_millis,
});
@ -392,6 +443,27 @@ fn collect_artifact_root(
Ok(())
}
fn read_runtime_audit(root: &Path) -> Option<RuntimeAudit> {
let result_path = root.join("unity-bridge-summary.json");
let text = fs::read_to_string(&result_path).ok()?;
let value: Value = serde_json::from_str(&text).ok()?;
let status = value.get("status").and_then(Value::as_str)?.to_string();
let project_version = value
.get("projectVersion")
.and_then(Value::as_str)
.map(ToString::to_string);
let editor_path = value
.get("editorPath")
.and_then(Value::as_str)
.map(ToString::to_string);
Some(RuntimeAudit {
result_path: result_path.display().to_string(),
status,
project_version,
editor_path,
})
}
fn existing_path(root: &Path, name: &str) -> Option<String> {
let path = root.join(name);
path.exists().then(|| path.display().to_string())

View file

@ -26,7 +26,7 @@ const actionButtons: Array<{
requiresVerificationResult?: boolean;
requiresReorientResult?: boolean;
requiresContinueImplementation?: boolean;
icon: "file" | "check" | "play" | "eye" | "accept";
icon: "file" | "check" | "play" | "eye" | "accept" | "runtime";
}> = [
{
action: "statusSnapshot",
@ -42,6 +42,13 @@ const actionButtons: Array<{
title: "Run a review-gated coordinator plan",
icon: "check",
},
{
action: "inspectUnity",
label: "Inspect Unity",
runningLabel: "Inspecting",
title: "Resolve the project-pinned Unity editor and write runtime artifacts",
icon: "runtime",
},
{
action: "prepareCheckpoint",
label: "Prepare Checkpoint",
@ -247,6 +254,11 @@ export function App() {
[snapshot?.artifacts],
);
const latestImplementationAudit = latestImplementationArtifact?.implementationAudit;
const latestRuntimeArtifact = useMemo(
() => (snapshot?.artifacts ?? []).find((artifact) => artifact.runtimeAudit),
[snapshot?.artifacts],
);
const latestRuntimeAudit = latestRuntimeArtifact?.runtimeAudit;
const implementationNoDiffPending =
Boolean(latestArtifact?.implementationAudit) && latestArtifact?.implementationAudit?.workspaceChanged === false;
const readyState = scene.stateStatus === "ready";
@ -367,6 +379,20 @@ export function App() {
</section>
)}
{latestRuntimeAudit && (
<section className={`notice ${latestRuntimeAudit.status === "ready" ? "okNotice" : "warnNotice"}`}>
{latestRuntimeAudit.status === "ready" ? (
<CheckCircle2 size={18} aria-hidden="true" />
) : (
<AlertTriangle size={18} aria-hidden="true" />
)}
<span>
<strong>Latest runtime audit:</strong> Unity {text(latestRuntimeAudit.projectVersion)} is{" "}
{text(latestRuntimeAudit.status)}. <code>{latestRuntimeArtifact?.path}</code>
</span>
</section>
)}
<section className="statusGrid" aria-label="Coordinator summary">
<Panel title="Recommendation" icon={<ClipboardCheck size={18} />}>
<div className={`actionBanner ${statusClass(coordinator.action ?? crrc.action)}`}>
@ -477,11 +503,12 @@ function SectionHeader({ title, icon }: { title: string; icon: React.ReactNode }
);
}
function ActionIcon({ icon }: { icon: "file" | "check" | "play" | "eye" | "accept" }) {
function ActionIcon({ icon }: { icon: "file" | "check" | "play" | "eye" | "accept" | "runtime" }) {
if (icon === "file") return <FileText size={16} aria-hidden="true" />;
if (icon === "check") return <ClipboardCheck size={16} aria-hidden="true" />;
if (icon === "play") return <Play size={16} aria-hidden="true" />;
if (icon === "eye") return <Eye size={16} aria-hidden="true" />;
if (icon === "runtime") return <Database size={16} aria-hidden="true" />;
return <CheckCircle2 size={16} aria-hidden="true" />;
}
@ -515,6 +542,14 @@ function Finding({ title, result, findingKey = "finding" }: { title: string; res
function ArtifactOutcome({ artifact }: { artifact: ArtifactBundle }) {
const audit = artifact.implementationAudit;
const runtime = artifact.runtimeAudit;
if (runtime) {
return (
<Pill tone={runtime.status === "ready" ? "ok" : "warn"}>
Unity {runtime.status}
</Pill>
);
}
if (!audit) return <span className="artifactOutcome muted">none</span>;
return (
<Pill tone={audit.workspaceChanged ? "ok" : "warn"}>

View file

@ -8,6 +8,7 @@ export interface StatusRequest {
export type OperatorAction =
| "statusSnapshot"
| "coordinatorPlan"
| "inspectUnity"
| "prepareCheckpoint"
| "continueImplementation"
| "launchModeling"
@ -40,6 +41,12 @@ export interface ArtifactBundle {
trackedDiffPresent: boolean;
changedFiles: string[];
};
runtimeAudit?: {
resultPath: string;
status: string;
projectVersion?: string;
editorPath?: string;
};
modifiedMillis?: number;
}

View file

@ -87,6 +87,7 @@ The landed machine now has:
- first auditable Phase 6 fixed-lane coordinator runner through `tools/epiphany_mvp_coordinator.py`, producing coordinator summary, JSONL steps, rendered snapshots, transcript, stderr, and final next-action artifacts while keeping semantic findings review-gated by default
- first auditable Phase 6 live-specialist runner through `tools/epiphany_mvp_live_specialist.py`, proving `roleLaunch -> agent_jobs worker -> report_agent_job_result -> roleResult` without manual backend completion
- first Phase 6 GUI operator shell under `apps/epiphany-gui`, a Tauri v2 + React console over the existing status bridge, dogfood artifacts, and GUI action artifacts, with durable checkpoint preparation, bounded status/coordinator artifact buttons, fixed modeling/verification/reorient launch and read-back buttons, and explicit review-gated reorient acceptance
- first Unity editor/runtime bridge through `tools/epiphany_unity_bridge.py`, `tools/epiphany_unity_bridge_smoke.py`, and the GUI Inspect Unity action, resolving exact project-pinned editors and writing runtime artifacts while refusing wrong or missing versions
- live Phase 6 reorientation app-server smoke coverage in `tools/epiphany_phase6_reorient_smoke.py`
- live Phase 6 reorient-launch app-server smoke coverage in `tools/epiphany_phase6_reorient_launch_smoke.py`
- live Phase 6 MVP status smoke coverage in `tools/epiphany_mvp_status_smoke.py`
@ -124,6 +125,7 @@ These boundaries are more important than the individual method names:
- `thread/epiphany/roleResult` is a read-only result projection, not a promotion gate, state writer, scheduler, or hidden continuation trigger.
- `thread/epiphany/roleAccept` is a narrow modeling/checkpoint acceptance write, not automatic specialist promotion, a verifier substitute, a broad state editor, or permission for workers to accept their own output.
- The GUI may render and steer typed state, but it must not manufacture canonical understanding.
- The Unity bridge may inspect and run only the project-pinned editor through explicit bridge commands; agents must not launch PATH/default/legacy Unity directly or substitute nearby Hub versions.
- The MVP GUI target is a local Tauri v2 + React operator app over the existing app-server APIs. Tauri owns windowing and local lifecycle; app-server and typed Epiphany state remain authoritative.
- The app-server remains a host seam; Epiphany-owned machinery should live in `epiphany-core` where practical.
- Qdrant is the preferred persistent semantic backend; BM25 remains the bootstrap/fallback/control path.
@ -160,7 +162,7 @@ and notify typed state. It can.
The next unknowns are:
- how to give implementation and verification lanes controlled runtime/editor access without letting workers launch random local tools
- how much controlled runtime/editor access the first Unity bridge gives implementation and verification lanes before deeper engine probes need a richer bridge
- how the landed watcher-backed invalidation telemetry should be consumed without turning freshness into a secret worker
- how far the read-only CRRC recommendation should go before explicit client/operator action takes over
- how much narrow coordination is needed so modeling, implementation, verification, and CRRC automation can hand off work without collapsing back into one context
@ -238,14 +240,16 @@ written. The runner now always writes the prompt, reference status, comparison,
and manifest honestly, and an explicit `--run-vanilla-reference` pass can spend
a real vanilla Codex turn and persist its transcript for comparison.
The latest Aetheria dogfood pass found the next bigger blocker. The fixed lanes
can now catch modeling, verification, stale job, no-diff, and reorientation
failures, but the implementation lane cannot prove engine assumptions without a
controlled editor/runtime bridge. A worker tried to launch a legacy default
Unity editor even though Aetheria pins a Unity 6000 project version. The guard
is now to refuse PATH/default/legacy Unity, but the real MVP organ is a bridge
that resolves the project-pinned editor, runs explicit batch/test/probe commands,
captures logs and artifacts, and feeds those artifacts into evidence.
The latest Aetheria dogfood pass found the next bigger blocker, and the first
slice is now landed. The fixed lanes can catch modeling, verification, stale
job, no-diff, and reorientation failures, but the implementation lane cannot
prove engine assumptions by launching random local tools. A worker tried to
launch a legacy default Unity editor even though Aetheria pins Unity
`6000.1.10f1`. `tools/epiphany_unity_bridge.py` now reads the project pin,
resolves only an exact Hub editor, refuses wrong or missing editors, owns the
batch/quit/projectPath command wrapper, and writes inspection/command/log
artifacts. On this machine Aetheria is correctly blocked: only Unity
`6000.4.2f1` is installed.
## Phase 6 Direction
@ -253,8 +257,8 @@ Phase 6 should grow observable harness state outward from the typed spine.
Useful candidates:
1. Build a first-class editor/runtime bridge for engine repos. For Unity, read the project-pinned editor version, refuse wrong or missing editors, run only explicit batch/test/probe commands, and write logs/probe output into auditable artifacts.
2. Keep dogfood execution agent-run and auditable, then put the fixed-lane coordinator and pre-compaction checkpoint loop in front of the user through the smallest local GUI/operator view over the same status/artifact surfaces.
1. Dogfood the first Unity editor/runtime bridge in the implementation lane. The bridge can inspect pins, refuse wrong/missing editors, and run exact-editor batch/probe commands; it still needs real Aetheria use before richer engine probes are justified.
2. Keep dogfood execution agent-run and auditable through the fixed-lane coordinator and GUI/operator view over the same status/artifact surfaces.
3. Keep accepted worker findings review-gated; do not convert acceptance into automatic promotion of arbitrary worker output.
4. Keep pre-compaction intervention narrow: steer once at `shouldPrepareCompaction`, latch the compact handoff only after successful steering, then let explicit checkpointing, compact/resume/reorient, and review gates do their jobs.
@ -287,6 +291,7 @@ Initial shape:
- refresh status
- run status snapshot
- run coordinator pass
- inspect project-pinned Unity runtime through the bridge
- prepare a durable checkpoint for a resumable operator thread
- launch fixed modeling/checkpoint role
- accept a completed modeling/checkpoint `statePatch` after review
@ -305,11 +310,11 @@ Implementation slices:
existing MVP status bridge, render the same data as
`tools/epiphany_mvp_status.py`, and provide artifact bundle links. This
slice is landed under `apps/epiphany-gui`.
2. **Bounded operator actions**: status snapshot, coordinator-plan, durable
checkpoint preparation, roleLaunch, roleResult, reorientLaunch,
reorientResult, and explicit reorientAccept flows are landed. Review gates
remain explicit; the GUI does not auto-promote evidence or continue
implementation after semantic findings.
2. **Bounded operator actions**: status snapshot, coordinator-plan, Unity
runtime inspection, durable checkpoint preparation, roleLaunch, roleResult,
reorientLaunch, reorientResult, and explicit reorientAccept flows are
landed. Review gates remain explicit; the GUI does not auto-promote
evidence or continue implementation after semantic findings.
3. **Dogfood launcher**: wrap `tools/epiphany_mvp_dogfood.py` and
`tools/epiphany_mvp_coordinator.py` as explicit operator actions that write
artifact bundles and stream progress/status into the GUI.
@ -320,6 +325,7 @@ Implementation slices:
Verification:
- Keep the existing CLI smokes as backend guardrails.
- Keep `tools/epiphany_unity_bridge_smoke.py` for Unity bridge regressions.
- Keep `npm run smoke:visual` for browser-layout regressions and bounded
browser-fallback action clicks.
- For native GUI changes, run `npm run build`, `cargo fmt --check`,

View file

@ -47,8 +47,8 @@ Do not trust this file for the exact live HEAD. Always check git.
- A later dogfood attempt exposed another supervision scar: manually launching modeling, reorientation, and verification from the supervisor is not clean dogfood. The coordinator now treats `regatherManually` as fallback only after fixed lanes cannot advance, stops at `reviewModelingResult` for completed unaccepted modeling findings, and the CLI runner's explicit test-only `--auto-review` mode can accept modeling `statePatch` findings before launching verification. Production semantic findings remain review-gated.
- The latest dogfood pass fixed concrete harness wounds: stale completed backend jobs now project as terminal, accepted verifier non-pass findings no longer clear implementation, verification coverage accepts modeler source evidence ids as current-model coverage, implementation audits compare pre/post diff hashes instead of treating existing dirt as fresh work, the latest implementation audit status wins, blocked no-diff turns route back through CRRC, stale accepted reorient findings relaunch bounded reorientation when the checkpoint regathers, and accepted reorientation findings now bank resume-ready checkpoints.
- The latest audited implementation artifact is `.epiphany-dogfood/aetheria-supervised/gui-actions/continueImplementation-1777548050463576300-28568`: it correctly shows `workspaceChanged: false`, `dirtyWorkspace: true`, `trackedDiffChanged: false`, wrote a no-diff audit, advanced Epiphany state to revision 57, and routed coordinator/CRRC back to `launchReorientWorker` instead of pretending old dirt was progress.
- Aetheria dogfood also exposed the next product organ: editor/runtime integration. An implementation worker launched legacy `D:\Unity\Editor\Unity.exe -version` (Unity 5.5.0f3) even though Aetheria pins Unity `6000.1.10f1`; the stray process was killed, and `tools/epiphany_gui_action.py` now tells implementation workers not to launch PATH/default/legacy Unity when the exact pinned editor is unavailable. This is a guardrail, not the real bridge.
- The next real MVP organ is a typed editor/runtime bridge for engine repos: resolve the project-pinned editor, refuse wrong or missing versions, run explicit batch/test/probe commands, capture logs/screenshots/probe outputs as artifacts, and feed those artifacts into Epiphany evidence for verification. Do not let implementation agents test assumptions by launching random editors from shell.
- Aetheria dogfood exposed and then landed the first editor/runtime bridge. An implementation worker launched legacy `D:\Unity\Editor\Unity.exe -version` (Unity 5.5.0f3) even though Aetheria pins Unity `6000.1.10f1`; the stray process was killed. `tools/epiphany_unity_bridge.py` now resolves the project-pinned Unity editor, refuses wrong/missing versions, owns `-batchmode`, `-quit`, and `-projectPath`, and writes inspection/command/log artifacts. `tools/epiphany_gui_action.py` points implementation workers at that bridge, and the GUI has an Inspect Unity action.
- The current Aetheria runtime truth is blocked but legible: the project pins Unity `6000.1.10f1`, this machine currently has Hub editor `6000.4.2f1`, and the bridge wrote `.epiphany-gui/runtime/unity-inspect-1777549218802064800-23832` proving the exact editor is missing. Treat that artifact as the evidence gap until the pinned editor exists.
- The GUI parses `implementation-result.json` into artifact metadata, surfaces the latest implementation diff/no-diff outcome, and pauses immediate `Continue Implementation` repeats when the newest artifact is a no-diff implementation audit.
- The repo is an Epiphany fork of Codex, not a Codex preset.
- `vendor/codex` is tracked directly, not a submodule.
@ -111,6 +111,7 @@ The current spine:
- token-count pre-compaction checkpoint intervention for loaded Epiphany turns at the `shouldPrepareCompaction` threshold, with a turn-scoped compact handoff consumed after a successful steer
- durable investigation checkpoint packet through typed state, prompt, scene, and context
- distilled shared and config-backed specialist prompt doctrine through the base prompt, rendered Epiphany state, modeling/body, verification/soul, reorientation/life, and coordinator/Self surfaces
- first Unity runtime bridge through `tools/epiphany_unity_bridge.py`, `tools/epiphany_unity_bridge_smoke.py`, GUI Inspect Unity, runtime artifact listing, and implementation prompt guardrails
- live scene app-server smoke through `tools/epiphany_phase6_scene_smoke.py`
- live jobs app-server smoke through `tools/epiphany_phase6_jobs_smoke.py`
- live freshness app-server smoke through `tools/epiphany_phase6_freshness_smoke.py`
@ -359,19 +360,21 @@ bounded browser-fallback controls. A live bridge probe also proved
`prepareCheckpoint` creates a resumable thread and a later process can
`readModelingResult` from it.
The next real move is not more direct Aetheria implementation. The supervised
run proved the fixed lanes can catch failures, but engine verification needs a
first-class editor/runtime bridge before the agent can test its assumptions.
Build that bridge next: pinned Unity resolution, wrong-version refusal, explicit
batch/test/probe commands, artifact capture, and evidence ingestion. Read only
operator-safe projections; do not open raw worker transcripts, direct worker
messages, or `rawResult` payloads unless the user explicitly asks for forensic
debugging. Use generated function/API telemetry for call-shape visibility
without sungazing. CRRC is not a specialist-agent persona; the reorient-worker
it may launch is the specialist. Do not turn the coordinator into a broad hidden
dispatcher, arbitrary marketplace, alternate job backend, automatic semantic
acceptance path, target-repo implementation worker, direct-thought feed, random
editor launcher, or GUI-as-source-of-truth.
The next real move is not more direct Aetheria implementation by the supervisor.
The first Unity bridge is landed, and it correctly blocks Aetheria runtime
execution until Unity `6000.1.10f1` is installed. Resume dogfood through
Epiphany's GUI/coordinator/fixed lanes with the bridge in the loop: the
implementation lane may inspect the source and may use bridge artifacts as
evidence, but it must not launch Unity directly or use the installed
`6000.4.2f1` editor as a substitute. Read only operator-safe projections; do
not open raw worker transcripts, direct worker messages, or `rawResult`
payloads unless the user explicitly asks for forensic debugging. Use generated
function/API telemetry for call-shape visibility without sungazing. CRRC is not
a specialist-agent persona; the reorient-worker it may launch is the
specialist. Do not turn the coordinator into a broad hidden dispatcher,
arbitrary marketplace, alternate job backend, automatic semantic acceptance
path, target-repo implementation worker, direct-thought feed, random editor
launcher, or GUI-as-source-of-truth.
Live `thread/epiphany/scene`, `thread/epiphany/jobs`, `thread/epiphany/roles`,
`thread/epiphany/freshness`, `thread/epiphany/context`,
@ -389,7 +392,7 @@ next organs.
- GUI-as-source-of-truth
- broad runtime CRRC execution beyond the landed safe-boundary compact, fixed reorient-worker launch, and pre-compaction checkpoint steering actions
- Epiphany-owned long-running job execution beyond the current runtime `agent_jobs` seam
- first-class editor/runtime bridge for pinned Unity or other engine/tool runtimes
- broader editor/runtime bridges beyond the first pinned Unity bridge
- broad event stream beyond the landed state update notification
The machine is good enough to move outward. Do not sand the same edge until the

View file

@ -49,3 +49,4 @@
{"ts": "2026-04-30T10:05:10+01:00", "type": "implementation", "status": "ok", "note": "Coordinator regather policy now keeps fixed lanes in charge: regatherManually no longer preempts modeling/verification review, completed unaccepted modeling findings produce reviewModelingResult before verification, modeling acceptance can be driven only by explicit test auto-review or operator review, and the current Aetheria coordinator replay now stops at reviewModelingResult instead of supervisor improvisation. Focused Rust coordinator tests and MVP coordinator smoke passed."}
{"ts": "2026-04-30T11:35:00+01:00", "type": "implementation", "status": "ok", "note": "Aetheria supervised dogfood hardened the fixed-lane coordinator and GUI audit loop: stale active backend jobs now project terminal when progress is complete; accepted non-pass verifier findings no longer clear implementation; verifier coverage accepts modeler source evidence ids; no-diff implementation audits compare pre/post diff hashes and latest audit status; blocked implementation regather routes through CRRC; stale accepted reorient findings relaunch bounded reorientation; accepted reorientation banks a resume-ready checkpoint."}
{"ts": "2026-04-30T11:36:00+01:00", "type": "verification", "status": "blocked", "note": "Aetheria dogfood exposed the next MVP product blocker: engine assumptions require editor/runtime integration. A worker launched legacy D:\\Unity\\Editor\\Unity.exe (Unity 5.5.0f3) despite Aetheria pinning Unity 6000.1.10f1. The GUI action prompt now refuses PATH/default/legacy Unity when the exact pinned editor is unavailable, but the real next organ is a typed editor/runtime bridge that resolves pinned editors, runs explicit batch/probe commands, and captures artifacts as evidence."}
{"ts": "2026-04-30T11:43:33+00:00", "type": "implementation", "status": "ok", "note": "First Unity editor/runtime bridge landed: tools/epiphany_unity_bridge.py resolves ProjectSettings-pinned Unity editors, refuses wrong or missing versions, owns batch/quit/projectPath execution, writes inspection/command/log artifacts, and is exposed through GUI Inspect Unity plus implementation prompt guidance. Smoke verified wrong-only roots are rejected, exact fake roots plan dry-run commands, and missing editors block runs; real Aetheria inspection shows pin 6000.1.10f1 while only 6000.4.2f1 is installed."}

View file

@ -65,7 +65,7 @@ active_subgoals:
- Keep the supervisor out of Epiphany worker thought streams: dogfood artifacts should be operator-safe by default, with direct transcripts and raw result payloads sealed.
- Use `tools/epiphany_agent_telemetry.py` and generated `agent-function-telemetry.json` files to inspect behavior shape without opening sealed transcripts.
- Treat repeated no-diff implementation turns as an MVP blocker, not success. A bounded implementation pass must leave a reviewable workspace diff or an explicit reviewable failure artifact before dogfood can be called healthy.
- Build a first-class editor/runtime bridge before expecting Epiphany to verify engine assumptions end to end; the Aetheria Unity dogfood needs pinned-editor execution, logs, probe artifacts, and wrong-version refusal instead of ad hoc shell launches.
- Dogfood the first Unity editor/runtime bridge before resuming engine implementation: inspect the project-pinned editor, refuse wrong or missing versions, and route any Unity batch/probe execution through auditable bridge artifacts.
accepted_design:
- Epiphany is a fork-level modeling architecture, not merely a Codex collaboration mode.
@ -123,7 +123,7 @@ accepted_design:
- Dogfood supervision is a separate operator role. If the supervising Codex session edits the target repo directly, that work can be useful seed material, but it is not clean Epiphany evidence and must be labeled as supervisor intervention or contamination.
- Dogfood supervision is also a projection boundary: the operator may inspect summaries, verdicts, missing coverage, state patches, job state, and artifact receipts, but not the specialist's raw stream of thought or full transcript unless a forensic debugging request explicitly breaks the seal.
- `tools/epiphany_agent_telemetry.py` derives operator-safe function/API telemetry from sealed app-server transcripts so the supervisor can see calls, statuses, paths, and counts without reading direct thoughts.
- Editor/runtime verification is now part of the MVP product boundary for engine repos: implementation workers need a controlled bridge that resolves the project-pinned editor, runs explicit batch/test/probe commands, captures logs and artifacts, and refuses stale or missing runtimes.
- Editor/runtime verification is now part of the MVP product boundary for engine repos: `tools/epiphany_unity_bridge.py` is the first controlled bridge, resolving the project-pinned Unity editor, refusing wrong or missing versions, running explicit batch/probe commands only through the exact editor, and writing inspection/command/log artifacts for evidence.
- If the agent's persistent instructions, memory, workflow, or state shape are making it less coherent, slower to rehydrate, less honest, or more likely to build Jenga, the agent should ask the user to change it.
- Epiphany should make compaction less like death and more like sleep: bank the fire before the dark, so the next waking thing finds coals instead of ash and can meaningfully resume the pattern instead of merely continuing the task.
@ -147,6 +147,7 @@ landed_baseline:
- Phase 6 safe-boundary CRRC automation: turn-complete automation limited to coordinator-approved compact, successful pre-compaction handoff compact, and fixed reorient-worker launch actions.
- Phase 6 pre-compaction checkpoint intervention: token-count pressure hook that steers active turns once when `shouldPrepareCompaction` is reached so working context is banked before compaction, then latches a pending compact handoff for clean turn completion.
- Phase 6 GUI operator shell: Tauri v2 + React console under `apps/epiphany-gui` over the existing status bridge and artifact bundles, with visual smoke, durable checkpoint preparation, fixed lane launch/read-back controls, and explicit review-gated reorient acceptance.
- Phase 6 Unity runtime bridge: `tools/epiphany_unity_bridge.py` plus GUI Inspect Unity action resolve pinned Unity editors, reject wrong/missing versions, and write runtime artifacts before engine assumptions are treated as testable.
guardrails:
- Use `tools/epiphany_phase5_smoke.py` before modifying update, distill, propose, promote, read-projection, or notification behavior.
- Use `tools/epiphany_phase6_scene_smoke.py` before modifying scene projection behavior.
@ -164,6 +165,7 @@ landed_baseline:
- Use `tools/epiphany_mvp_status_smoke.py` before modifying the MVP operator status view.
- Use `tools/epiphany_mvp_coordinator_smoke.py` before modifying the fixed-lane MVP coordinator endpoint or runner.
- Use `tools/epiphany_phase6_role_smoke.py` before modifying explicit role launch/read-back behavior.
- Use `tools/epiphany_unity_bridge_smoke.py` before modifying the Unity editor/runtime bridge.
- Use `tools/epiphany_mvp_live_specialist.py` before claiming live specialist execution still works end to end.
- Use `npm run build`, `npm run smoke:visual`, `cargo fmt --check`, `cargo check`, and `npm run tauri -- build --debug --no-bundle` under `apps/epiphany-gui` before claiming GUI operator changes are usable.
- Use focused scene/jobs/context/pressure/reorient/protocol/schema checks for reflection-only changes.
@ -184,5 +186,5 @@ rejected_paths:
reason: persistent state that accumulates every local truth becomes memory cruft and weakens rehydration
current_status:
summary: Phase 1 durable state through Phase 6 GUI/coordinator/specialist/CRRC MVP surfaces are landed and actively dogfooded. The Aetheria supervised run found and fixed several real harness wounds: stale completed backend jobs projected as active, accepted verifier non-pass findings incorrectly cleared implementation, current verifier coverage ignored modeler source evidence ids, dirty pre-existing worktrees were misread as fresh implementation diffs, blocked no-diff audits were overridden by older ok audits, stale accepted reorient findings could loop CRRC, and accepted reorientation updates kept checkpoints regather_required instead of banking the new resume-ready checkpoint. The latest implementation worker also launched an ancient Unity 5.5 default editor against a project pinned to Unity 6000.1.10f1, proving editor/runtime testing needs a first-class pinned bridge before engine dogfood can verify assumptions.
next_action: Commit the current harness hardening, then build the next MVP organ: a controlled editor/runtime bridge for engine repos. For Aetheria, that means resolving the project-pinned Unity editor, refusing wrong/missing versions, running explicit batch/test/probe commands only through the bridge, capturing logs/probe output as auditable artifacts, and feeding those artifacts back into Epiphany evidence for verification. Do not inspect raw worker transcripts or `rawResult` payloads unless the user explicitly requests forensic debugging.
summary: Phase 1 durable state through Phase 6 GUI/coordinator/specialist/CRRC MVP surfaces are landed and actively dogfooded. The Aetheria supervised run found and fixed real harness wounds in coordinator policy, no-diff audits, stale job/result projection, and reorient acceptance. The Unity incident has now produced the first runtime bridge: `tools/epiphany_unity_bridge.py` resolves the project-pinned editor, refuses wrong/missing versions, plans/runs exact-editor batch probes, writes artifacts, and the GUI exposes Inspect Unity. Aetheria currently pins Unity 6000.1.10f1 while only Hub 6000.4.2f1 is installed, so runtime verification is correctly blocked with an audit artifact.
next_action: Commit the Unity bridge slice, then resume dogfood through Epiphany lanes with the bridge in the loop. Do not let implementation workers invoke Unity directly; use bridge artifacts as evidence of either a pinned-editor run or a missing-runtime blocker. Do not inspect raw worker transcripts or `rawResult` payloads unless the user explicitly requests forensic debugging.

View file

@ -20,6 +20,7 @@ from epiphany_mvp_status import sanitize_for_operator
from epiphany_phase5_smoke import AppServerClient
from epiphany_phase5_smoke import ROOT
from epiphany_phase6_reorient_launch_smoke import BINDING_ID as REORIENT_BINDING_ID
from epiphany_unity_bridge import bridge_guidance as unity_bridge_guidance
DEFAULT_CODEX_HOME = ROOT / ".epiphany-gui" / "codex-home"
@ -309,63 +310,8 @@ def active_review_files_from_status(status: dict[str, Any]) -> list[str]:
return sorted(set(files))
def read_unity_project_version(cwd: Path) -> str | None:
version_path = cwd / "ProjectSettings" / "ProjectVersion.txt"
if not version_path.exists():
return None
for line in version_path.read_text(encoding="utf-8", errors="replace").splitlines():
if line.startswith("m_EditorVersion:"):
version = line.split(":", 1)[1].strip()
return version or None
return None
def installed_unity_hub_versions() -> list[str]:
roots = [
Path(os.environ.get("ProgramFiles", r"C:\Program Files"))
/ "Unity"
/ "Hub"
/ "Editor",
Path(os.environ.get("ProgramFiles(x86)", r"C:\Program Files (x86)"))
/ "Unity"
/ "Hub"
/ "Editor",
]
versions: set[str] = set()
for root in roots:
if not root.exists():
continue
versions.update(path.name for path in root.iterdir() if path.is_dir())
return sorted(versions)
def unity_guidance(cwd: Path) -> str:
project_version = read_unity_project_version(cwd)
if project_version is None:
return "- Unity: no ProjectSettings/ProjectVersion.txt was found; do not launch Unity from PATH."
exact_editor = (
Path(os.environ.get("ProgramFiles", r"C:\Program Files"))
/ "Unity"
/ "Hub"
/ "Editor"
/ project_version
/ "Editor"
/ "Unity.exe"
)
installed_versions = installed_unity_hub_versions()
installed_text = ", ".join(installed_versions) if installed_versions else "none detected"
if exact_editor.exists():
return (
f"- Unity: project pins {project_version}. If an editor run is unavoidable, "
f"use only `{exact_editor}` with explicit batch/quit/projectPath arguments; "
"do not invoke `Unity`, `Unity.exe`, default installs, or PATH-resolved editors."
)
return (
f"- Unity: project pins {project_version}, but no exact Hub editor was found "
f"(Hub versions detected: {installed_text}). Do not launch `Unity`, `Unity.exe`, "
"default installs, or legacy editors; if runtime parity requires Unity, stop with "
"a reviewable inability/evidence-gap artifact instead of probing with the wrong editor."
)
return unity_bridge_guidance(cwd, ROOT)
def first_present(value: dict[str, Any], *paths: tuple[str, ...]) -> Any:

View file

@ -0,0 +1,388 @@
from __future__ import annotations
import argparse
from datetime import datetime
from datetime import timezone
import json
import os
import subprocess
import time
from pathlib import Path
from typing import Any
ROOT = Path(__file__).resolve().parents[1]
DEFAULT_ARTIFACT_ROOT = ROOT / ".epiphany-gui" / "runtime"
PROJECT_VERSION_RELATIVE = Path("ProjectSettings") / "ProjectVersion.txt"
UNITY_EDITOR_RELATIVE = Path("Editor") / "Unity.exe"
FORBIDDEN_EXTRA_ARGS = {"-batchmode", "-quit", "-projectpath"}
def now_iso() -> str:
return datetime.now(timezone.utc).isoformat()
def write_json(path: Path, value: Any) -> None:
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(json.dumps(value, indent=2, ensure_ascii=False) + "\n", encoding="utf-8")
def write_text(path: Path, value: str) -> None:
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(value, encoding="utf-8")
def read_unity_project_version(project_path: Path) -> dict[str, Any]:
version_path = project_path / PROJECT_VERSION_RELATIVE
result: dict[str, Any] = {
"path": str(version_path),
"exists": version_path.exists(),
"editorVersion": None,
"editorVersionWithRevision": None,
}
if not version_path.exists():
result["status"] = "missingProjectVersion"
result["note"] = "ProjectSettings/ProjectVersion.txt was not found."
return result
for line in version_path.read_text(encoding="utf-8", errors="replace").splitlines():
if line.startswith("m_EditorVersion:"):
result["editorVersion"] = line.split(":", 1)[1].strip() or None
elif line.startswith("m_EditorVersionWithRevision:"):
result["editorVersionWithRevision"] = line.split(":", 1)[1].strip() or None
if result["editorVersion"]:
result["status"] = "ready"
else:
result["status"] = "missingProjectVersion"
result["note"] = "ProjectVersion.txt did not contain m_EditorVersion."
return result
def default_unity_editor_roots() -> list[Path]:
roots: list[Path] = []
env_roots = os.environ.get("EPIPHANY_UNITY_EDITOR_ROOTS")
if env_roots:
roots.extend(Path(item) for item in env_roots.split(os.pathsep) if item)
roots.extend(
[
Path(os.environ.get("ProgramFiles", r"C:\Program Files"))
/ "Unity"
/ "Hub"
/ "Editor",
Path(os.environ.get("ProgramFiles(x86)", r"C:\Program Files (x86)"))
/ "Unity"
/ "Hub"
/ "Editor",
]
)
seen: set[str] = set()
deduped: list[Path] = []
for root in roots:
key = str(root.resolve()) if root.exists() else str(root)
if key in seen:
continue
seen.add(key)
deduped.append(root)
return deduped
def editor_path_for_version(root: Path, version: str) -> Path:
if root.name == version:
return root / UNITY_EDITOR_RELATIVE
return root / version / UNITY_EDITOR_RELATIVE
def installed_unity_editors(roots: list[Path] | None = None) -> list[dict[str, Any]]:
editors: list[dict[str, Any]] = []
for root in roots or default_unity_editor_roots():
if not root.exists():
continue
if (root / UNITY_EDITOR_RELATIVE).exists():
editors.append(
{
"version": root.name,
"root": str(root),
"editorPath": str(root / UNITY_EDITOR_RELATIVE),
}
)
continue
for child in sorted(root.iterdir(), key=lambda path: path.name.lower()):
if not child.is_dir():
continue
editor_path = child / UNITY_EDITOR_RELATIVE
if editor_path.exists():
editors.append(
{
"version": child.name,
"root": str(child),
"editorPath": str(editor_path),
}
)
return editors
def resolve_unity_editor(project_path: Path) -> dict[str, Any]:
project_path = project_path.resolve()
version = read_unity_project_version(project_path)
roots = default_unity_editor_roots()
editors = installed_unity_editors(roots)
result: dict[str, Any] = {
"kind": "unity",
"projectPath": str(project_path),
"generatedAt": now_iso(),
"versionFile": version,
"searchRoots": [str(root) for root in roots],
"installedEditors": editors,
"projectVersion": version.get("editorVersion"),
"projectVersionWithRevision": version.get("editorVersionWithRevision"),
"editorPath": None,
"status": "missingProjectVersion",
"note": "ProjectSettings/ProjectVersion.txt was not found or did not pin a Unity editor.",
}
project_version = version.get("editorVersion")
if not isinstance(project_version, str) or not project_version:
return result
exact_candidates = [editor_path_for_version(root, project_version) for root in roots]
exact = next((candidate for candidate in exact_candidates if candidate.exists()), None)
if exact is None:
installed_versions = ", ".join(editor["version"] for editor in editors) or "none detected"
result["status"] = "missingEditor"
result["candidatePaths"] = [str(candidate) for candidate in exact_candidates]
result["note"] = (
f"Project pins Unity {project_version}, but no exact editor was found. "
f"Installed Hub versions: {installed_versions}."
)
return result
result["status"] = "ready"
result["editorPath"] = str(exact)
result["candidatePaths"] = [str(candidate) for candidate in exact_candidates]
result["note"] = (
f"Project pins Unity {project_version}; exact editor resolved at {exact}."
)
return result
def render_inspection(summary: dict[str, Any]) -> str:
installed = summary.get("installedEditors")
if not isinstance(installed, list) or not installed:
installed_lines = ["- none detected"]
else:
installed_lines = [
f"- {item.get('version')}: {item.get('editorPath')}"
for item in installed
if isinstance(item, dict)
]
candidates = summary.get("candidatePaths")
if not isinstance(candidates, list) or not candidates:
candidate_lines = ["- none"]
else:
candidate_lines = [f"- {item}" for item in candidates]
return "\n".join(
[
"# Unity Runtime Bridge",
"",
f"Status: {summary.get('status')}",
f"Project: {summary.get('projectPath')}",
f"Project version: {summary.get('projectVersion') or 'none'}",
f"Editor path: {summary.get('editorPath') or 'none'}",
"",
"Installed Hub editors:",
*installed_lines,
"",
"Exact candidate paths:",
*candidate_lines,
"",
f"Note: {summary.get('note')}",
"",
]
)
def artifact_dir(root: Path, action: str) -> Path:
return root.resolve() / f"unity-{action}-{time.time_ns()}-{os.getpid()}"
def write_inspection_artifacts(directory: Path, summary: dict[str, Any]) -> None:
write_json(directory / "unity-bridge-summary.json", summary)
write_text(directory / "unity-bridge-inspection.md", render_inspection(summary))
def normalize_unity_args(values: list[str]) -> list[str]:
if values and values[0] == "--":
values = values[1:]
return values
def validate_unity_args(values: list[str]) -> None:
lowered = {value.lower() for value in values}
forbidden = sorted(lowered & FORBIDDEN_EXTRA_ARGS)
if forbidden:
raise ValueError(
"Unity bridge owns batchmode, quit, and projectPath; remove extra args: "
+ ", ".join(forbidden)
)
def build_unity_command(summary: dict[str, Any], extra_args: list[str]) -> list[str]:
editor_path = summary.get("editorPath")
if not isinstance(editor_path, str) or not editor_path:
raise ValueError("Unity editor path is unavailable.")
project_path = summary.get("projectPath")
if not isinstance(project_path, str) or not project_path:
raise ValueError("Unity project path is unavailable.")
validate_unity_args(extra_args)
return [
editor_path,
"-batchmode",
"-quit",
"-projectPath",
project_path,
*extra_args,
]
def run_unity(args: argparse.Namespace) -> dict[str, Any]:
directory = args.artifact_dir.resolve() if args.artifact_dir else artifact_dir(args.artifact_root, "run")
project_path = args.project_path.resolve()
summary = resolve_unity_editor(project_path)
summary["artifactPath"] = str(directory)
summary["operation"] = "run"
summary["label"] = args.label
extra_args = normalize_unity_args(list(args.unity_args or []))
summary["unityArgs"] = extra_args
if summary.get("status") != "ready":
summary["runStatus"] = "blocked"
summary["note"] = (
f"{summary.get('note')} Runtime execution refused; install the exact pinned editor "
"or use inspect artifacts as evidence of the missing runtime."
)
write_inspection_artifacts(directory, summary)
return summary
command = build_unity_command(summary, extra_args)
summary["command"] = command
if args.dry_run:
summary["runStatus"] = "planned"
summary["returncode"] = None
write_inspection_artifacts(directory, summary)
write_json(directory / "unity-command.json", {"command": command, "dryRun": True})
return summary
stdout_path = directory / "unity-stdout.log"
stderr_path = directory / "unity-stderr.log"
started = time.time()
try:
completed = subprocess.run(
command,
cwd=project_path,
capture_output=True,
check=False,
timeout=args.timeout_seconds,
)
duration_seconds = time.time() - started
stdout_path.parent.mkdir(parents=True, exist_ok=True)
stdout_path.write_bytes(completed.stdout)
stderr_path.write_bytes(completed.stderr)
summary.update(
{
"runStatus": "passed" if completed.returncode == 0 else "failed",
"returncode": completed.returncode,
"durationSeconds": round(duration_seconds, 3),
"stdoutPath": str(stdout_path),
"stderrPath": str(stderr_path),
}
)
except subprocess.TimeoutExpired as error:
duration_seconds = time.time() - started
stdout_path.parent.mkdir(parents=True, exist_ok=True)
if error.stdout:
stdout_path.write_bytes(error.stdout)
summary["stdoutPath"] = str(stdout_path)
if error.stderr:
stderr_path.write_bytes(error.stderr)
summary["stderrPath"] = str(stderr_path)
summary.update(
{
"runStatus": "timedOut",
"returncode": None,
"durationSeconds": round(duration_seconds, 3),
"note": f"Unity command timed out after {args.timeout_seconds} seconds.",
}
)
write_inspection_artifacts(directory, summary)
write_json(directory / "unity-command.json", {"command": command, "dryRun": False})
return summary
def inspect_unity(args: argparse.Namespace) -> dict[str, Any]:
directory = (
args.artifact_dir.resolve() if args.artifact_dir else artifact_dir(args.artifact_root, "inspect")
)
summary = resolve_unity_editor(args.project_path.resolve())
summary["artifactPath"] = str(directory)
summary["operation"] = "inspect"
write_inspection_artifacts(directory, summary)
return summary
def bridge_guidance(project_path: Path, repo_root: Path | None = None) -> str:
repo_root = repo_root or ROOT
summary = resolve_unity_editor(project_path)
script_path = repo_root / "tools" / "epiphany_unity_bridge.py"
inspect_command = (
f"`python {script_path} inspect --project-path {project_path}`"
)
if summary.get("status") == "ready":
return (
f"- Unity bridge: project pins {summary.get('projectVersion')} and the exact editor "
f"resolved to `{summary.get('editorPath')}`. If Unity execution is needed, use "
f"`python {script_path} run --project-path {project_path} -- -executeMethod <method>`; "
"the bridge owns -batchmode, -quit, -projectPath, logs, and artifacts. Do not invoke "
"`Unity`, `Unity.exe`, default installs, or PATH-resolved editors directly."
)
return (
f"- Unity bridge: {summary.get('note')} Run {inspect_command} to write an auditable "
"runtime evidence artifact. Do not invoke `Unity`, `Unity.exe`, default installs, or "
"PATH-resolved editors directly; if runtime parity is needed, stop with the bridge "
"artifact as the evidence gap."
)
def main() -> int:
parser = argparse.ArgumentParser(description="Auditable pinned Unity editor bridge.")
subparsers = parser.add_subparsers(dest="command", required=True)
inspect_parser = subparsers.add_parser("inspect", help="Resolve the project-pinned editor.")
inspect_parser.add_argument("--project-path", type=Path, default=Path.cwd())
inspect_parser.add_argument("--artifact-root", type=Path, default=DEFAULT_ARTIFACT_ROOT)
inspect_parser.add_argument("--artifact-dir", type=Path)
run_parser = subparsers.add_parser("run", help="Run an explicit pinned-editor batch command.")
run_parser.add_argument("--project-path", type=Path, default=Path.cwd())
run_parser.add_argument("--artifact-root", type=Path, default=DEFAULT_ARTIFACT_ROOT)
run_parser.add_argument("--artifact-dir", type=Path)
run_parser.add_argument("--label", default="unity-bridge-run")
run_parser.add_argument("--timeout-seconds", type=int, default=600)
run_parser.add_argument("--dry-run", action="store_true")
run_parser.add_argument("unity_args", nargs=argparse.REMAINDER)
args = parser.parse_args()
try:
if args.command == "inspect":
result = inspect_unity(args)
else:
result = run_unity(args)
except Exception as error:
print(json.dumps({"status": "error", "error": str(error)}, indent=2), flush=True)
return 1
print(json.dumps(result, indent=2, ensure_ascii=False))
return 0 if result.get("runStatus") != "blocked" else 2
if __name__ == "__main__":
raise SystemExit(main())

View file

@ -0,0 +1,173 @@
from __future__ import annotations
import json
import os
from pathlib import Path
import shutil
import subprocess
import sys
from typing import Any
from epiphany_phase5_smoke import ROOT
from epiphany_phase5_smoke import require
DEFAULT_WORKSPACE = ROOT / ".epiphany-smoke" / "unity-bridge-workspace"
DEFAULT_ARTIFACT_ROOT = ROOT / ".epiphany-smoke" / "unity-bridge-artifacts"
DEFAULT_RESULT = ROOT / ".epiphany-smoke" / "unity-bridge-smoke-result.json"
PROJECT_VERSION = "6000.1.10f1"
WRONG_VERSION = "6000.4.2f1"
def reset_path(path: Path) -> None:
if path.exists():
shutil.rmtree(path)
path.mkdir(parents=True, exist_ok=True)
def prepare_project(workspace: Path) -> None:
reset_path(workspace)
settings = workspace / "ProjectSettings"
settings.mkdir(parents=True, exist_ok=True)
(settings / "ProjectVersion.txt").write_text(
"\n".join(
[
f"m_EditorVersion: {PROJECT_VERSION}",
f"m_EditorVersionWithRevision: {PROJECT_VERSION} (3c681a6c22ff)",
"",
]
),
encoding="utf-8",
)
def create_fake_editor(root: Path, version: str) -> Path:
editor = root / version / "Editor" / "Unity.exe"
editor.parent.mkdir(parents=True, exist_ok=True)
editor.write_text("fake unity binary for dry-run smoke only\n", encoding="utf-8")
return editor
def run_bridge(
workspace: Path,
artifact_root: Path,
*,
roots: Path,
args: list[str],
expect_success: bool = True,
) -> dict[str, Any]:
env = os.environ.copy()
env["EPIPHANY_UNITY_EDITOR_ROOTS"] = str(roots)
completed = subprocess.run(
[
sys.executable,
str(ROOT / "tools" / "epiphany_unity_bridge.py"),
args[0],
"--project-path",
str(workspace),
"--artifact-root",
str(artifact_root),
*args[1:],
],
cwd=ROOT,
env=env,
capture_output=True,
encoding="utf-8",
errors="replace",
check=False,
)
if expect_success:
require(
completed.returncode == 0,
f"bridge should succeed, got {completed.returncode}: {completed.stderr}",
)
else:
require(completed.returncode != 0, "bridge should fail for blocked runtime execution")
try:
return json.loads(completed.stdout)
except json.JSONDecodeError as error:
raise AssertionError(f"bridge did not return JSON: {error}\n{completed.stdout}") from error
def require_artifact(summary: dict[str, Any], name: str) -> None:
artifact_path = Path(str(summary["artifactPath"]))
require((artifact_path / name).exists(), f"missing bridge artifact: {name}")
def main() -> int:
workspace = DEFAULT_WORKSPACE.resolve()
artifact_root = DEFAULT_ARTIFACT_ROOT.resolve()
fake_roots = ROOT / ".epiphany-smoke" / "unity-bridge-editors"
result_path = DEFAULT_RESULT.resolve()
prepare_project(workspace)
reset_path(artifact_root)
reset_path(fake_roots)
wrong_editor = create_fake_editor(fake_roots, WRONG_VERSION)
missing = run_bridge(
workspace,
artifact_root,
roots=fake_roots,
args=["inspect"],
)
require(missing["status"] == "missingEditor", "wrong-only Hub root should not satisfy pin")
require(
missing["projectVersion"] == PROJECT_VERSION,
"inspection should report the project-pinned version",
)
require_artifact(missing, "unity-bridge-summary.json")
require_artifact(missing, "unity-bridge-inspection.md")
exact_editor = create_fake_editor(fake_roots, PROJECT_VERSION)
ready = run_bridge(
workspace,
artifact_root,
roots=fake_roots,
args=["inspect"],
)
require(ready["status"] == "ready", "exact editor should satisfy pin")
require(ready["editorPath"] == str(exact_editor), "inspection should resolve exact editor")
planned = run_bridge(
workspace,
artifact_root,
roots=fake_roots,
args=["run", "--dry-run", "--", "-executeMethod", "Epiphany.SmokeProbe"],
)
require(planned["status"] == "ready", "dry run should still require exact editor")
require(planned["runStatus"] == "planned", "dry run should plan instead of executing")
command = planned["command"]
require(command[0] == str(exact_editor), "command should use exact editor path")
require("-batchmode" in command, "bridge should own -batchmode")
require("-quit" in command, "bridge should own -quit")
require("-projectPath" in command, "bridge should own -projectPath")
require(str(workspace) in command, "command should target the requested project")
require(str(wrong_editor) not in command, "command must not use wrong editor")
require_artifact(planned, "unity-command.json")
blocked = run_bridge(
workspace,
artifact_root,
roots=fake_roots / "missing",
args=["run", "--dry-run", "--", "-executeMethod", "Epiphany.SmokeProbe"],
expect_success=False,
)
require(blocked["runStatus"] == "blocked", "missing editor run should be blocked")
result = {
"workspace": str(workspace),
"artifactRoot": str(artifact_root),
"missingStatus": missing["status"],
"readyStatus": ready["status"],
"plannedStatus": planned["runStatus"],
"blockedStatus": blocked["runStatus"],
"resolvedEditor": ready["editorPath"],
}
result_path.parent.mkdir(parents=True, exist_ok=True)
result_path.write_text(json.dumps(result, indent=2, ensure_ascii=False) + "\n", encoding="utf-8")
print(json.dumps(result, indent=2, ensure_ascii=False))
return 0
if __name__ == "__main__":
raise SystemExit(main())