Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
fix(temporal): a local model's LLM attempt gets 30 minutes (1b.25)
trohitg663cb651273a
diff --git a/docs-internal/TEMPORAL_ARCHITECTURE.md b/docs-internal/TEMPORAL_ARCHITECTURE.mdindex 1c11cabc..49ae8be3 100644--- a/docs-internal/TEMPORAL_ARCHITECTURE.md+++ b/docs-internal/TEMPORAL_ARCHITECTURE.md@@ -650,7 +650,7 @@ addition. Seven are the core loop activities:| Activity | Purpose ||---|---|| `agent.prepare_payload` | Resolves the DB-backed payload (provider / model / system_message / user_prompt / `AgentToolSpec`-derived tool definitions / memory_node_id / memory_content / memory_window_size / max_iterations / thinking_config / compaction_threshold / tool_result_max_chars / transcript_budget_bytes / context_pressure_version / auto_rebind_tools), and leaves credential resolution at the LLM activity boundary. Reads `UserSettings.agent_recursion_limit`, `auto_rebind_tools_after_canvas_change`, `tool_result_max_chars`, `max_concurrent_subagents` and `max_delegation_depth`. Recording the three transcript-pressure keys here is what lets a history recorded before them replay the original rules. Applies the optional `invocation` field (delegation children) after config resolution — per-invocation input always beats stored parameters. |-| `agent.execute_llm_step` | One LLM turn. The native branch decodes Message Wire V2, rebuilds `ToolDef` values, calls `run_native_llm_step(ChatUnifier, ...)` with SDK retries disabled, heartbeats while awaiting the provider, and returns the exact assistant message + tool calls + normalized usage. Guards against un-invokable payloads: post-filter system-only message lists raise `ApplicationError(type="EmptyAgentPrompt", non_retryable=True)`. |+| `agent.execute_llm_step` | One LLM turn. The native branch decodes Message Wire V2, rebuilds `ToolDef` values, calls `run_native_llm_step(ChatUnifier, ...)` with SDK retries disabled, heartbeats every 20 s while awaiting the provider (1-minute heartbeat timeout), and returns the exact assistant message + tool calls + normalized usage. Each attempt has a 10-minute `start_to_close_timeout`, or the provider's own when `agent.prepare_payload` recorded `llm_attempt_timeout_seconds` (30 minutes for local and OpenAI-compatible servers, [Native LLM SDK](./native_llm_sdk.md)). Guards against un-invokable payloads: post-filter system-only message lists raise `ApplicationError(type="EmptyAgentPrompt", non_retryable=True)`. || `agent.refresh_tools` | Translates `workflow_ops` add_node ops (`component_kind="tool"` OR `usable_as_tool=True`; never a chat model or the Skills node) into fresh `AgentToolSpec`-derived `tool_payload` entries via `_build_tool_from_node`. Workflow extends `tools` + `tool_index` from the result. || `agent.persist_turn` | Appends the latest human/assistant exchange to memory markdown, trims the window, broadcasts `node.parameters.updated`. || `agent.compact_context` | The shared client-side summarizer, run under transcript pressure (step 6 above). Not best-effort: after the activity's retries a failure ends the run with `CompactionError`, because past that point the transcript could only grow until the provider rejected it. |diff --git a/docs-internal/native_llm_sdk.md b/docs-internal/native_llm_sdk.mdindex fbfb393c..ef6623aa 100644--- a/docs-internal/native_llm_sdk.md+++ b/docs-internal/native_llm_sdk.md@@ -147,6 +147,16 @@ the stored key as stored (no provider rewrites a key any more). The OpenAI SDKthen sends to the configured local endpoint — traffic never reachesapi.openai.com.+**Attempt timeout** — a server that does not stream sends nothing until the+whole answer is done, so `ollama`, `lmstudio` and `openai_compatible` declare+`attempt_timeout_seconds: 1800` in `llm_defaults.json`+(`services/llm/config.py::attempt_timeout_seconds`). `OpenAIProvider` gives+their client that read timeout (the SDK's own is 10 minutes), and+`agent.prepare_payload` records it as `llm_attempt_timeout_seconds`, which+`AgentWorkflow` and the Pi workflow use as the LLM step's+`start_to_close_timeout`. Every other provider, and a history recorded+without the key, keeps 10 minutes.+**OpenCompany Gateway** — a `chat` call that arrives with no key (the installhas none for that provider) goes to the hosted gateway when it is connected andthe provider's `llm_defaults.json` block has a `"gateway"` entry: the gateway's@@ -365,7 +375,9 @@ Invalid, zero, or unrepresentable waits use exponential backoff. Nativeagent retries start at five seconds; Temporal retains its durable retrypolicy and cancellation behavior.-SDK HTTP transport errors use this same boundary. OpenAI Responses failures+SDK HTTP transport errors use this same boundary, and so does a raw+`TimeoutError` from an SDK's own deadline (category `timeout`, retryable),+which is never read as a programming error. OpenAI Responses failuresin a successful HTTP body or `response.failed` event are classified beforerecording any output; valid max-token incomplete responses remain supported.Failed streamed attempts are withdrawn immediately, while an owner's Stopdiff --git a/server/config/llm_defaults.json b/server/config/llm_defaults.jsonindex 9052acd0..13557b2e 100644--- a/server/config/llm_defaults.json+++ b/server/config/llm_defaults.json@@ -466,6 +466,8 @@"_description": "Local Ollama server (OpenAI-compatible /v1). No `default_model` because the dropdown should reflect the user's actually-pulled models — fetch_models hits the user's saved {provider}_proxy URL and returns whatever Ollama reports; when the server is offline we want an empty list (a 'start your server' cue), not a placeholder name the user almost certainly doesn't have.","detection_patterns": ["ollama"],"open_world_models": true,+ "attempt_timeout_seconds": 1800,+ "_attempt_timeout_note": "One LLM attempt, in seconds: OpenAIProvider's client timeout and the agent LLM step's start_to_close_timeout (recorded by agent.prepare_payload). A server that does not stream sends nothing until the whole answer is done, so a slow local model needs longer than the 10 minutes every other provider gets (RFC-0006 §11.3).","auth": {"placeholder_key": "ollama","_note": "Ollama's OpenAI-compatibility docs (docs.ollama.com/openai): api_key='ollama', 'required but ignored'. Read by services/llm/config.py::resolve_credential."@@ -484,6 +486,8 @@"_description": "Local LM Studio server (pure OpenAI-compatible). Same no-default-model rule as ollama — the dropdown reflects what the user has loaded in LM Studio, not a fake placeholder.","detection_patterns": ["lmstudio", "lm_studio", "lm-studio"],"open_world_models": true,+ "attempt_timeout_seconds": 1800,+ "_attempt_timeout_note": "One LLM attempt, in seconds: OpenAIProvider's client timeout and the agent LLM step's start_to_close_timeout (recorded by agent.prepare_payload). A server that does not stream sends nothing until the whole answer is done, so a slow local model needs longer than the 10 minutes every other provider gets (RFC-0006 §11.3).","auth": {"placeholder_key": "lm-studio","_note": "LM Studio's OpenAI-compatibility docs use api_key='lm-studio'; the server needs no key unless API tokens are enabled. Read by services/llm/config.py::resolve_credential."@@ -502,6 +506,8 @@"_description": "User-named OpenAI-compatible endpoints: llama.cpp, vLLM, a LiteLLM proxy, a second Ollama host, and so on. No base_url and no default_model: each endpoint is its own provider reference, openai_compatible:<slug>, whose resolved base URL and model list are stored on its credential rows when it is saved (RFC-0003 D13). This block supplies the fallbacks every endpoint shares.","detection_patterns": [],"open_world_models": true,+ "attempt_timeout_seconds": 1800,+ "_attempt_timeout_note": "One LLM attempt, in seconds: OpenAIProvider's client timeout and the agent LLM step's start_to_close_timeout (recorded by agent.prepare_payload). A server that does not stream sends nothing until the whole answer is done, so a slow model needs longer than the 10 minutes every other provider gets (RFC-0006 §11.3).","auth": {"placeholder_key": "sk-no-key-required","_note": "Sent when an endpoint has no key: the value llama.cpp's server README uses in its OpenAI client example. Servers without auth ignore it, and the OpenAI SDK refuses an empty key."diff --git a/server/services/llm/config.py b/server/services/llm/config.pyindex 303c0d2e..fe34a661 100644--- a/server/services/llm/config.py+++ b/server/services/llm/config.py@@ -288,6 +288,15 @@ def supports_model_listing(provider: str) -> bool:return bool(_provider_block(provider).get("supports_model_listing", True))+def attempt_timeout_seconds(provider: str) -> Optional[float]:+ """How long one LLM attempt may take for ``provider``, in seconds: its+ block's ``attempt_timeout_seconds`` (local and OpenAI-compatible+ servers, which send nothing until the whole answer is done), else+ ``None``, which keeps the SDK's and the LLM step's own defaults."""+ seconds = _provider_block(provider).get("attempt_timeout_seconds")+ return None if seconds is None else float(seconds)++# ---------------------------------------------------------------------------# Max-tokens / temperature resolution# ---------------------------------------------------------------------------diff --git a/server/services/llm/providers/openai.py b/server/services/llm/providers/openai.pyindex 25568dc5..a0a56047 100644--- a/server/services/llm/providers/openai.py+++ b/server/services/llm/providers/openai.py@@ -97,6 +97,8 @@ class OpenAIProvider:):import openai+ from services.llm.config import attempt_timeout_seconds+self.provider_name = provider_name or type(self).provider_nameself._model_prefix = model_prefixkwargs: Dict[str, Any] = {@@ -108,6 +110,11 @@ class OpenAIProvider:url = proxy_url or base_urlif url:kwargs["base_url"] = url+ # A provider whose server sends nothing until the whole answer is+ # done declares a longer attempt than the SDK's default read timeout.+ attempt = attempt_timeout_seconds(self.provider_name)+ if attempt is not None:+ kwargs["timeout"] = openai.Timeout(attempt, connect=openai.DEFAULT_TIMEOUT.connect)#: Which setting produced the URL, for failure logs (RFC-0003 D10).self.url_source = "proxy" if proxy_url else ("llm_defaults" if base_url else "sdk_default")self._client = openai.AsyncOpenAI(**kwargs)diff --git a/server/services/llm/unifier.py b/server/services/llm/unifier.pyindex a8912aa9..a9c245c9 100644--- a/server/services/llm/unifier.py+++ b/server/services/llm/unifier.py@@ -207,7 +207,9 @@ class ChatUnifier:if not translate_errors:raiseraise error.as_node_error() from error- except spec.sdk_exception_types + (httpx.TransportError, httpx.HTTPStatusError) as e:+ except spec.sdk_exception_types + (httpx.TransportError, httpx.HTTPStatusError, TimeoutError) as e:+ # A raw TimeoutError (an SDK's own deadline) is a timeout to+ # classify and retry, not a programming error.error = _provider_failure(provider, e)observe_stage("normalization", provider_request_id=error.request_id)if route is not None:diff --git a/server/services/temporal/agent_activities.py b/server/services/temporal/agent_activities.pyindex baca9ebc..8b720a7f 100644--- a/server/services/temporal/agent_activities.py+++ b/server/services/temporal/agent_activities.py@@ -384,18 +384,17 @@ async def _await_with_llm_heartbeats(detail: str,interval_seconds: float = 20.0,) -> Any:- """Await one buffered SDK request while heartbeating the activity."""+ """Await one buffered SDK request while heartbeating the activity. The+ request's own errors, a ``TimeoutError`` among them, come back as they+ are (``task.result()``), never mistaken for the heartbeat interval."""task = asyncio.ensure_future(awaitable)try:while True:- try:- return await asyncio.wait_for(- asyncio.shield(task),- timeout=interval_seconds,- )- except TimeoutError:- activity.heartbeat(detail)+ done, _pending = await asyncio.wait({task}, timeout=interval_seconds)+ if done:+ return task.result()+ activity.heartbeat(detail)finally:if not task.done():task.cancel()@@ -763,8 +762,8 @@ async def _execute_llm_step_body(payload: Dict[str, Any]) -> Dict[str, Any]:owns the messages list. This makes replay safe per Temporal'sdeterminism contract — each activity is a pure transformation.- Heartbeats every 30 s so long LLM streams don't trip- ``heartbeat_timeout``.+ Heartbeats every 20 s while it waits on the provider, so a long+ answer doesn't trip ``heartbeat_timeout``."""from core.logging import log_context@@ -1159,6 +1158,7 @@ async def prepare_agent_payload(context: Dict[str, Any]) -> Dict[str, Any]:from services.chat.choice import effort_of, model_offrom services.llm.config import (agent_model,+ attempt_timeout_seconds,resolve_max_tokens,resolve_temperature,)@@ -1835,6 +1835,9 @@ async def prepare_agent_payload(context: Dict[str, Any]) -> Dict[str, Any]:"employee_runtime_delivery": bool(employee_plan and node_id == employee_plan.get("lead_node_id")),"provider": provider,"model": model,+ # How long one LLM attempt may take for this provider (None: the+ # workflow's default). The workflow reads it here, never in config.+ "llm_attempt_timeout_seconds": attempt_timeout_seconds(provider),# The owner's chat choice (Quick / Thorough), for the agent that# answers them; the LLM step sends it (services/chat/choice.py)."effort": effort_of(chat_options) if chat_stream else None,diff --git a/server/services/temporal/agent_workflow.py b/server/services/temporal/agent_workflow.pyindex 5f073fa8..a43c58b8 100644--- a/server/services/temporal/agent_workflow.py+++ b/server/services/temporal/agent_workflow.py@@ -88,13 +88,23 @@ from .execution_control import ExecutionControl# reasoning models; tool calls vary widely (python: seconds, browser:# minutes). Tool activities use the plugin-declared# ``start_to_close_timeout`` automatically — we only set defaults here-# for the agent-specific activities.+# for the agent-specific activities. A provider that declares a longer+# attempt gets it through ``llm_attempt_timeout``.LLM_STEP_TIMEOUT = timedelta(minutes=10)PERSIST_TURN_TIMEOUT = timedelta(seconds=30)COMPACT_MEMORY_TIMEOUT = timedelta(minutes=5)LLM_STEP_HEARTBEAT_TIMEOUT = timedelta(minutes=1)+def llm_attempt_timeout(payload: Dict[str, Any]) -> timedelta:+ """One LLM-step attempt's ``start_to_close_timeout``: the provider's,+ as ``agent.prepare_payload`` recorded it (local and OpenAI-compatible+ servers), else ``LLM_STEP_TIMEOUT``, which a history recorded without+ the key also gets. Options only (RFC-0006 §5 rule 6)."""+ seconds = payload.get("llm_attempt_timeout_seconds")+ return timedelta(seconds=seconds) if seconds else LLM_STEP_TIMEOUT++def _declared_tool_options(node_type: str) -> Dict[str, Any]:"""A tool activity's timeouts and retry policy as its plugin declaresthem (BaseNode's for a type no plugin registers). Options only: on@@ -1000,6 +1010,7 @@ class AgentWorkflow:{"provider": str,"model": str,+ "llm_attempt_timeout_seconds": Optional[float], # None: LLM_STEP_TIMEOUT"max_tokens": int,"temperature": float,"system_message": str,@@ -3317,7 +3328,7 @@ class AgentWorkflow:"""Native command sequence; the Pi subclass bridges this durable leaf."""return await workflow.execute_activity("agent.execute_llm_step", args=[llm_payload],- activity_id=f"llm-step-{iteration + 1}", start_to_close_timeout=LLM_STEP_TIMEOUT,+ activity_id=f"llm-step-{iteration + 1}", start_to_close_timeout=llm_attempt_timeout(payload),heartbeat_timeout=LLM_STEP_HEARTBEAT_TIMEOUT, retry_policy=LLM_STEP_RETRY)async def _before_runtime_model_step(self, llm_payload, context, payload, iteration, tools=None):diff --git a/server/services/temporal/pi_workflow.py b/server/services/temporal/pi_workflow.pyindex cd51c6ec..f98e682d 100644--- a/server/services/temporal/pi_workflow.py+++ b/server/services/temporal/pi_workflow.py@@ -14,7 +14,7 @@ from temporalio import workflowfrom temporalio.common import RetryPolicyfrom temporalio.workflow import ActivityCancellationType-from .agent_workflow import AgentWorkflow, LLM_STEP_TIMEOUT, LLM_STEP_HEARTBEAT_TIMEOUT, LLM_STEP_RETRY+from .agent_workflow import AgentWorkflow, LLM_STEP_HEARTBEAT_TIMEOUT, LLM_STEP_RETRY, llm_attempt_timeoutfrom .pi_protocol import DRIVER_QUEUE, INLINE_LIMIT, OperationLedger, canonical_digest, canonical_json, conflict, tool_operation_idfrom .pi_control import PiDescendantExecutionControl, PiLocalExecutionControl@@ -257,7 +257,7 @@ class PiCodingAgentWorkflow(AgentWorkflow):async def _execute_model_step(self, llm_payload, context, payload, iteration):model_id = f"turn:{iteration}:model"step = await workflow.execute_activity("agent.execute_llm_step", args=[llm_payload],- activity_id=f"llm-step-{iteration + 1}", start_to_close_timeout=LLM_STEP_TIMEOUT,+ activity_id=f"llm-step-{iteration + 1}", start_to_close_timeout=llm_attempt_timeout(payload),heartbeat_timeout=LLM_STEP_HEARTBEAT_TIMEOUT, retry_policy=LLM_STEP_RETRY)self._pi_calls = list(step.get("calls") or [])for index, call in enumerate(self._pi_calls):diff --git a/server/tests/llm/test_attempt_timeout.py b/server/tests/llm/test_attempt_timeout.pynew file mode 100644index 00000000..04233160--- /dev/null+++ b/server/tests/llm/test_attempt_timeout.py@@ -0,0 +1,54 @@+"""Local and OpenAI-compatible servers get a 30-minute LLM attempt (1b.25).++A server that does not stream sends nothing until the whole answer is done,+so the OpenAI SDK's 10-minute read timeout cut slow local answers. Three+provider blocks declare ``attempt_timeout_seconds``; ``OpenAIProvider``+gives its client that timeout, and no other provider's client changes.+"""++from __future__ import annotations++from unittest.mock import patch++import openai+import pytest++import services.llm # noqa: F401 — side-effect import populates the registry+from services.llm import config+from services.llm.config import attempt_timeout_seconds+from services.llm.providers.openai import OpenAIProvider+from services.llm.providers.openrouter import OpenRouterProvider+from services.llm.registry import all_providers, get_provider+++def test_only_local_and_compatible_servers_declare_a_longer_attempt():+ declared = {p: attempt_timeout_seconds(p) for p in all_providers() if attempt_timeout_seconds(p) is not None}+ assert declared == {"ollama": 1800.0, "lmstudio": 1800.0, "openai_compatible": 1800.0}+ # A named endpoint reads the shared block.+ assert attempt_timeout_seconds("openai_compatible:home") == 1800.0+ assert attempt_timeout_seconds("not-a-provider") is None++[email protected]("name", sorted(p for p in all_providers() if get_provider(p).factory is OpenAIProvider))+def test_the_client_timeout_follows_the_providers_block(name):+ with patch("openai.AsyncOpenAI") as client_cls:+ OpenAIProvider("k", **get_provider(name).client_kwargs)+ kwargs = client_cls.call_args.kwargs+ seconds = attempt_timeout_seconds(name)+ if seconds is None:+ assert "timeout" not in kwargs+ else:+ assert kwargs["timeout"] == openai.Timeout(seconds, connect=openai.DEFAULT_TIMEOUT.connect)+++def test_the_value_is_read_from_the_block(monkeypatch):+ monkeypatch.setitem(config.LLM_DEFAULTS["providers"], "ollama", {"attempt_timeout_seconds": 7})+ with patch("openai.AsyncOpenAI") as client_cls:+ OpenAIProvider("k", provider_name="ollama")+ assert client_cls.call_args.kwargs["timeout"] == openai.Timeout(7, connect=openai.DEFAULT_TIMEOUT.connect)+++def test_openrouter_keeps_the_sdk_default():+ with patch("openai.AsyncOpenAI") as client_cls:+ OpenRouterProvider("k")+ assert "timeout" not in client_cls.call_args.kwargsdiff --git a/server/tests/llm/test_unifier_transport_errors.py b/server/tests/llm/test_unifier_transport_errors.pyindex 23972d0e..dfa660cc 100644--- a/server/tests/llm/test_unifier_transport_errors.py+++ b/server/tests/llm/test_unifier_transport_errors.py@@ -32,6 +32,8 @@ def dispatch(monkeypatch):(httpx.ReadTimeout, LLMErrorCategory.TIMEOUT),(httpx.ConnectError, LLMErrorCategory.CONNECTION),(httpx.RemoteProtocolError, LLMErrorCategory.CONNECTION),+ # An SDK's own deadline (1b.25): an OSError on Python 3.11+, never a bug.+ (TimeoutError, LLMErrorCategory.TIMEOUT),])async def test_sdk_transport_failure_is_retryable_and_releases_client(dispatch, error_type, category):unifier, client = dispatchdiff --git a/server/tests/temporal/test_agent_llm_contract.py b/server/tests/temporal/test_agent_llm_contract.pyindex db06774b..eb8ae86e 100644--- a/server/tests/temporal/test_agent_llm_contract.py+++ b/server/tests/temporal/test_agent_llm_contract.py@@ -482,6 +482,28 @@ class TestLlmStepActivity:assert result == "done"heartbeat.assert_called_with("waiting")+ @pytest.mark.asyncio+ async def test_a_request_timeout_comes_back_instead_of_a_beat(+ self,+ monkeypatch,+ ):+ # 1b.25: the old wait read the request's own TimeoutError as its+ # interval tick and looped on the finished request without end.+ import services.temporal.agent_activities as activity_module++ heartbeat = MagicMock(side_effect=AssertionError("a finished request was read as the interval"))+ monkeypatch.setattr(activity_module.activity, "heartbeat", heartbeat)++ async def timed_out():+ raise TimeoutError("the SDK's own deadline")++ with pytest.raises(TimeoutError):+ await activity_module._await_with_llm_heartbeats(+ timed_out(),+ detail="waiting",+ interval_seconds=5,+ )+@pytest.mark.asyncioasync def test_step_disables_sdk_retries_and_keeps_result_keys(self,@@ -548,3 +570,62 @@ class TestLlmStepActivity:assert kwargs["sdk_max_retries"] == 0assert kwargs["translate_errors"] is Falseassert kwargs["tools"][0].name == "write_todos"+++# 1b.25: an attempt gets the timeout agent.prepare_payload recorded for its+# provider; a cloud provider (None) and a history recorded before the key+# keep 10 minutes.+_ATTEMPT_TIMEOUTS = [+ ({}, timedelta(minutes=10)),+ ({"llm_attempt_timeout_seconds": None}, timedelta(minutes=10)),+ ({"llm_attempt_timeout_seconds": 1800.0}, timedelta(minutes=30)),+]+++class TestLLMAttemptTimeout:+ @pytest.mark.asyncio+ @pytest.mark.parametrize(("recorded", "expected"), _ATTEMPT_TIMEOUTS)+ async def test_agent_workflow_takes_the_recorded_timeout(+ self, monkeypatch, patched_workflow, recorded, expected+ ):+ from services.temporal.agent_workflow import AgentWorkflow++ options = []++ async def fake_execute_activity(name, *, args, **kwargs):+ if name == "agent.prepare_payload":+ return {**_payload(), **recorded}+ if name == "agent.execute_llm_step":+ options.append(kwargs)+ return {"kind": "final", "content": "done", "thinking": None,+ "usage": {"input_tokens": 3, "output_tokens": 1}}+ if name in {"agent.broadcast_progress", "agent.store_output", "agent.skill.clear"}:+ return {}+ raise AssertionError(f"Unexpected activity {name}")++ monkeypatch.setattr(patched_workflow, "execute_activity", fake_execute_activity)++ result = await AgentWorkflow().run({"node_id": "agent-1", "execution_id": "root-run-1"})++ assert result["success"] is True+ assert options[0]["start_to_close_timeout"] == expected++ @pytest.mark.asyncio+ @pytest.mark.parametrize(("recorded", "expected"), _ATTEMPT_TIMEOUTS)+ async def test_pi_workflow_takes_the_recorded_timeout(self, monkeypatch, recorded, expected):+ from services.temporal import pi_workflow++ options = {}++ async def fake_execute_activity(name, *, args, **kwargs):+ assert name == "agent.execute_llm_step"+ options.update(kwargs)+ return {"kind": "final", "content": "done"}++ monkeypatch.setattr(pi_workflow.workflow, "execute_activity", fake_execute_activity)+ value = pi_workflow.PiCodingAgentWorkflow({})+ value._pi.begin(0, {"turn:0:model": {"kind": "model", "payload": {}}})++ await value._execute_model_step({"messages": []}, {}, {"node_id": "coding", **recorded}, 0)++ assert options["start_to_close_timeout"] == expecteddiff --git a/server/tests/temporal/test_prepare_payload_pressure.py b/server/tests/temporal/test_prepare_payload_pressure.pyindex ea68bbcd..059415ad 100644--- a/server/tests/temporal/test_prepare_payload_pressure.py+++ b/server/tests/temporal/test_prepare_payload_pressure.py@@ -52,16 +52,15 @@ def prepare(monkeypatch):conversation=[],context_descriptor=None,compaction_service=lambda: None,+ parameters={+ "provider": "openai",+ "model": "test-model",+ "api_key": "sk-test",+ "prompt": "hello",+ },)database = SimpleNamespace(- get_node_parameters=AsyncMock(- return_value={- "provider": "openai",- "model": "test-model",- "api_key": "sk-test",- "prompt": "hello",- }- ),+ get_node_parameters=AsyncMock(side_effect=lambda *_a, **_k: state.parameters),get_user_settings=AsyncMock(side_effect=lambda *_a, **_k: state.user_settings),get_workflow_control_generation=AsyncMock(return_value=None),)@@ -115,6 +114,19 @@ class TestPressureControls:assert payload["transcript_budget_bytes"] == transcript_budget_bytes()assert payload["context_pressure_version"] == CONTEXT_PRESSURE_VERSION+ @pytest.mark.asyncio+ @pytest.mark.parametrize("provider", ["openai", "ollama"])+ async def test_the_run_records_its_providers_attempt_timeout(self, prepare, provider):+ # 1b.25: the workflow reads the attempt timeout here, never in config.+ from services.llm.config import attempt_timeout_seconds++ prepare.parameters["provider"] = provider++ payload = await prepare_agent_payload(dict(_CONTEXT))++ assert payload["llm_attempt_timeout_seconds"] == attempt_timeout_seconds(provider)+ assert (payload["llm_attempt_timeout_seconds"] is None) is (provider == "openai")+@pytest.mark.asyncioasync def test_the_users_tool_limit_beats_the_env_value(self, prepare):prepare.user_settings = {"tool_result_max_chars": 25_000}