Skip to content

Rebuild the object in a reference image as a code-only, procedural, quality-gated, animation-ready Three.js model. Token-efficient image-to-3D.

fix: fail loud on gate participation; widen the run bound

kokorolxd6f30a0df43d
diff --git a/forge/stage3_build/run_gates.py b/forge/stage3_build/run_gates.py
index 5a54281..9edae6f 100644
--- a/forge/stage3_build/run_gates.py
+++ b/forge/stage3_build/run_gates.py
@@ -215,9 +215,18 @@ def run_plugin_gates(
# drift-guard test asserts the two match exactly.
if gate_timeout is not None:
argv += ["--gate-timeout", str(gate_timeout)]
+ # The runner applies its timeout PER GATE, so the outer bound must cover every declared gate --
+ # a flat bound killed a legitimately-configured multi-gate run mid-flight, and could never
+ # honour a forwarded --gate-timeout larger than itself. The margin is runner overhead.
+ per_gate = gate_timeout if gate_timeout is not None else GATE_TIMEOUT_SECONDS
+ try:
+ gate_count = len(json.loads((plugin_dir / "gates.json").read_text(encoding="utf-8")))
+ except (OSError, json.JSONDecodeError, TypeError):
+ gate_count = 1
+ outer_timeout = per_gate * max(gate_count, 1) + 30
try:
proc = run_bounded(
- argv, cwd=workspace, timeout=GATE_TIMEOUT_SECONDS, declared_env=[],
+ argv, cwd=workspace, timeout=outer_timeout, declared_env=[],
target_kind=f"gates:{plugin_id}",
)
except EmitTargetError as exc:
@@ -245,10 +254,13 @@ def run_gates_for_workspace(
for plugin_id, plugin_dir in _installed_plugins_with_gates(home):
try:
involved = plugin_contributed_a_step(state, plugin_id, home)
- except DomainRegistryError:
- # The profile lookup failing here is not this plugin's fault and not this function's
- # question to answer -- treat as uninvolved rather than crash the whole gate run.
- involved = False
+ except DomainRegistryError as exc:
+ # Fail loud, not open: gates are the enforcement layer, so "cannot determine
+ # participation" must stop the run -- treating it as uninvolved silently skipped a
+ # blocking gate whose domain steps had actually run in this workspace.
+ raise GateExecutionError(
+ f"cannot determine gate participation for plugin {plugin_id!r}: {exc}"
+ ) from exc
if not involved:
continue
doc = run_plugin_gates(plugin_id, plugin_dir, workspace=workspace, home=home, gate_timeout=gate_timeout)
diff --git a/forge/tests/test_run_gates.py b/forge/tests/test_run_gates.py
index 6bf4c32..1efad6d 100644
--- a/forge/tests/test_run_gates.py
+++ b/forge/tests/test_run_gates.py
@@ -212,6 +212,31 @@ class UninvolvedPluginRunsNone(RunGatesTestBase):
self.assertEqual(results, {})
+class ParticipationLookupFailureFailsLoudNotOpen(RunGatesTestBase):
+ """A DomainRegistryError during the participation check used to be swallowed as "uninvolved",
+ which silently skipped a blocking gate whose domain steps had actually run -- fail-open in the
+ enforcement layer. It must stop the run naming the plugin instead."""
+
+ def test_a_registry_error_stops_the_run_instead_of_skipping_gates(self):
+ from unittest import mock
+
+ from domains import DomainRegistryError
+
+ _write_gated_plugin(
+ self.home, "gated",
+ gate_body=PASS_GATE.format(gate_id="gated-gate", plugin_id="gated"),
+ )
+ _action_ready_state(self.workspace, self.spec_path)
+ with mock.patch.object(
+ run_gates, "plugin_contributed_a_step",
+ side_effect=DomainRegistryError("domain id 'x' is declared twice"),
+ ):
+ with self.assertRaises(run_gates.GateExecutionError) as ctx:
+ run_gates.run_gates_for_workspace(self.workspace, home=self.home)
+ self.assertIn("participation", str(ctx.exception))
+ self.assertIn("gated", str(ctx.exception))
+
+
class BlockingStopNamesGateAndPlugin(RunGatesTestBase):
def test_a_blocking_failure_stops_the_run_naming_gate_and_plugin(self):
state = _action_ready_state(self.workspace, self.spec_path)