Skip to content

Official Codebase of 3DCodeVerse

Python

limits: the agent session timeout is stated once, AGENT_TIMEOUT_S

gaoypengf99ff43d83cf
diff --git a/harness/codeverse3d/config.py b/harness/codeverse3d/config.py
index e3ff7e3f..2b7d8d6f 100644
--- a/harness/codeverse3d/config.py
+++ b/harness/codeverse3d/config.py
@@ -38,6 +38,7 @@ from pydantic import (
from pydantic_core import PydanticUseDefault
from pydantic_settings import BaseSettings, SettingsConfigDict
+from codeverse3d.contracts.agent import AGENT_TIMEOUT_S
from codeverse3d.contracts.common import Backends
_LEGACY_KEYS_FILE = Path.home() / ".config" / "astra3d" / "gemini_keys.env"
@@ -106,7 +107,7 @@ class Render(BaseModel):
class Limits(BaseModel):
build_timeout_s: int = 300
render_timeout_s: int = 300
- agent_timeout_s: int = 1800
+ agent_timeout_s: int = AGENT_TIMEOUT_S
bpy_rlimit_gb: int = 12
# Both measured, not guessed (docs/COST.md Part III). These size the
# *subprocess* side (blender / node / chrome), which is bound by cores — 24
diff --git a/harness/codeverse3d/contracts/agent.py b/harness/codeverse3d/contracts/agent.py
index 0f80a56a..8ea1b39f 100644
--- a/harness/codeverse3d/contracts/agent.py
+++ b/harness/codeverse3d/contracts/agent.py
@@ -12,6 +12,9 @@ from pydantic import BaseModel, Field
from codeverse3d.contracts.common import Usage
+#: one agent session's wall clock — ``Settings.limits.agent_timeout_s`` defaults to it
+AGENT_TIMEOUT_S = 1800
+
class FileChange(BaseModel):
path: str
@@ -25,7 +28,7 @@ class AgentJob(BaseModel):
prompt: str
system_append: str = ""
label: str = ""
- timeout_s: int = 1800
+ timeout_s: int = AGENT_TIMEOUT_S
hard_deadline_s: float | None = Field(
default=None, ge=0, allow_inf_nan=False,
description="absolute time.monotonic() deadline on this host, derived from the run's "
diff --git a/harness/codeverse3d/tracks/generation.py b/harness/codeverse3d/tracks/generation.py
index 0ff33986..87fdc365 100644
--- a/harness/codeverse3d/tracks/generation.py
+++ b/harness/codeverse3d/tracks/generation.py
@@ -511,7 +511,7 @@ def run_agent_task(
charged to ``budget`` as it ends, so nothing is lost when a later attempt raises."""
events = NULL_EVENTS if events is None else events
before = ws.head()
- timeout = task.timeout_s or (settings.limits.agent_timeout_s if settings is not None else 1800)
+ timeout = task.timeout_s or (settings or get_settings()).limits.agent_timeout_s
# A task that chose its own window already clipped it the way its stage wanted
# (scene.py: soft for env/zones/assets, hard for refine/rebuild) — re-clipping THAT
# against the soft share handed every scene refine session after the 0.55 share
diff --git a/harness/tests/orchestrator_tracks/test_generation_planner_repair.py b/harness/tests/orchestrator_tracks/test_generation_planner_repair.py
index 8fdfde41..ffd71a17 100644
--- a/harness/tests/orchestrator_tracks/test_generation_planner_repair.py
+++ b/harness/tests/orchestrator_tracks/test_generation_planner_repair.py
@@ -95,7 +95,8 @@ def test_generate_single_shot_writes_files_and_charges(tmp_ws):
assert not res2.ok and "parse failed" in res2.notes
-def test_generate_agent_path_silent_bail_retry(tmp_ws):
+def test_generate_agent_path_silent_bail_retry(tmp_ws, switch):
+ switch("C3D_LIMITS__AGENT_TIMEOUT_S", "900") # N78: a settings-less call sat on a 1800 literal
calls = []
def writer(job, ws):
@@ -108,6 +109,7 @@ def test_generate_agent_path_silent_bail_retry(tmp_ws):
assert res.ok and len(calls) == 2 and calls[1].startswith("Your previous attempt ended WITHOUT")
assert res.usage.cost_usd == pytest.approx(0.02)
assert agent.jobs[0].write_roots == ["src", "public"] and agent.jobs[0].label == "baseline"
+ assert agent.jobs[0].timeout_s == 900
# ----------------------------------------------------------------------------- planner