Skip to content

Self-improving AI Employees for everyone

docs: document core.env_defaults + the no-hardcoded-ports convention

trohitg33f1c1c80584
diff --git a/CLAUDE.md b/CLAUDE.md
index b3c67e14..005781e3 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -184,6 +184,7 @@ server/core/
├── config.py # Application configuration
├── logging.py # Logging configuration
├── paths.py # SSOT for on-disk locations (generic helpers only): opencompany_root()/data_path()/workspaces_dir()/workspace_dir()/daemons_dir() + packages_dir()/package_dir(name) all under ~/.opencompany/ (= DATA_DIR); packages/ holds the single shared npm tree + stripe/ + temporal/ binary subdirs; example_workflows_dir() = <repo>/.opencompany/workflows/ (shipped seeds, NOT under DATA_DIR). Plugin-specific subpaths composed inline at the call site, never added here.
+├── env_defaults.py # Env accessor backed by .env.template/.env (the SSOT for port numbers; used by entry points that bypass the CLI env push)
├── encryption.py # Fernet encryption with PBKDF2 key derivation
├── credentials_database.py # Async SQLite for encrypted API keys and OAuth tokens
└── credential_backends.py # Multi-backend abstraction (Fernet, Keyring, AWS)
@@ -2683,4 +2684,5 @@ This function:
- **Deployment reconcile snapshot on WS connect** (de8df87): a stale FE `deploymentStatus.isRunning=true` used to survive a backend restart because the in-memory `DeploymentManager._deployments` dict was wiped (no recovery wiring — the `RecoverySweeper.set_recovery_callback` extension point exists but is intentionally unwired; see the "workflow status not properly recognized" investigation). The Start button therefore stayed showing "Stop" forever. Fix: new `WorkflowEvent.deployment_snapshot(running_workflow_ids)` typed factory (`source = opencompany://services/workflow`, `type = workflow.deployment.snapshot`) + `broadcaster._send_deployment_snapshot(websocket)` that runs at the tail of `broadcaster.connect()` (single-target, NOT fan-out — only the just-connecting client needs to reconcile). FE `case 'deployment_snapshot'` in `WebSocketContext.tsx` iterates `useAppStore.workflowUIStates` and clears `isExecuting=true` on any workflow NOT in the snapshot's running set (empty list is meaningful — this is the load-bearing reset). Also reconciles `deploymentStatus.isRunning` for the active workflow. Distinct from `workflow_lifecycle("deployment.started")` (state-transition edge event) — the snapshot is an idempotent state dump tied to client connect, not a transition.
- **Agent progress badge — defensive status invariant** (15b8d9d): `AIAgentNode`'s "N / max" iteration badge is gated on `isExecuting && typeof iteration === 'number' && typeof maxIterations === 'number'` where `isExecuting = nodeStatus?.status === 'executing'`. The `agent_progress` handler USED to only set `data.iteration` / `data.max_iterations`, relying on a prior `node_status='executing'` broadcast to have already stamped the status. If agent_progress arrived first (race, single-step agent completion, out-of-order Temporal activity delivery), `status` stayed undefined and the badge was hidden even though the iteration data was populated. Fix: the agent_progress handler now defensively sets `status='executing'` on the slot — but preserves `'success'` / `'error'` if a later terminal broadcast already flipped the slot (terminal states win over the resurrection).
- **Temporal Worker tuner exclusivity** (Wave 16.4, 190c896): `Worker.__init__` rejects `tuner` alongside ANY of `max_concurrent_workflow_tasks` / `max_concurrent_activities` / `max_concurrent_local_activities` / `max_concurrent_nexus_tasks` — the tuner OWNS every slot supplier via its `WorkerTuner.create_composite(workflow_supplier, activity_supplier, local_activity_supplier, nexus_supplier)` and cannot coexist with the individual max-count kwargs. In `TemporalWorkerPool.start`, ALL FOUR max-count kwargs must be pulled from the base `worker_kwargs` when `tuner=` is added; the ai-heavy / browser queues use the tuner and preserve their 10-workflow-slot ceiling via `_tuner_for -> FixedSizeSlotSupplier(10)` on the workflow_supplier slot. The framework worker at `worker.py:188` does NOT use a tuner, so it keeps the plain `max_concurrent_workflow_tasks=10` + `max_concurrent_activities=self.pool_size` kwargs directly. `TEMPORAL_WORKER_POOL_ENABLED` defaulted to True in the same commit (`test_task_queue_coverage.py::TestWorkerPoolDefaultOn` locks the default via source-introspection so the flip survives a hasty revert).
+- **No hardcoded port numbers in code or docs**: `.env.template` is the single place port numbers live (`.env` overrides, process env wins). Python resolves via `core.env_defaults.env_value/env_int` (raises loudly when unconfigured — never a numeric fallback literal); the Vite config and the Node executor sidecar require their env vars the same way; scripts/CI/installers parse the template. Docs reference env var names (`PYTHON_BACKEND_PORT`, `TEMPORAL_UI_PORT`, ...) instead of numerals; user-facing quickstarts may show the default app URL once. See `docs-internal/cli_services_integration.md` for the plugin-daemon recipe.
- never use emojis in prints
diff --git a/server/config/model_registry.json b/server/config/model_registry.json
index d5d59b0b..222ac06f 100644
--- a/server/config/model_registry.json
+++ b/server/config/model_registry.json
@@ -1,8 +1,68 @@
{
- "_generated": "2026-07-24T15:13:44.410324+00:00",
+ "_generated": "2026-07-25T15:25:22.803545+00:00",
"_source": "openrouter",
- "_model_count": 343,
+ "_model_count": 345,
"models": {
+ "anthropic/claude-opus-5-fast": {
+ "id": "anthropic/claude-opus-5-fast",
+ "name": "Claude Opus 5 (Fast)",
+ "provider": "anthropic",
+ "local_id": "claude-opus-5-fast",
+ "context_length": 1000000,
+ "max_output_tokens": 128000,
+ "input_price_per_mtok": 10.0,
+ "output_price_per_mtok": 50.0,
+ "supports_thinking": true,
+ "thinking_type": "budget",
+ "temperature_range": [
+ 0.0,
+ 1.0
+ ],
+ "is_reasoning_model": false,
+ "supported_parameters": [
+ "include_reasoning",
+ "max_tokens",
+ "reasoning",
+ "reasoning_effort",
+ "response_format",
+ "stop",
+ "structured_outputs",
+ "tool_choice",
+ "tools",
+ "verbosity"
+ ]
+ },
+ "anthropic/claude-opus-5": {
+ "id": "anthropic/claude-opus-5",
+ "name": "Claude Opus 5",
+ "provider": "anthropic",
+ "local_id": "claude-opus-5",
+ "context_length": 1000000,
+ "max_output_tokens": 128000,
+ "input_price_per_mtok": 5.0,
+ "output_price_per_mtok": 25.0,
+ "supports_thinking": true,
+ "thinking_type": "budget",
+ "temperature_range": [
+ 0.0,
+ 1.0
+ ],
+ "is_reasoning_model": false,
+ "supported_parameters": [
+ "include_reasoning",
+ "max_completion_tokens",
+ "max_tokens",
+ "reasoning",
+ "reasoning_effort",
+ "response_format",
+ "stop",
+ "structured_outputs",
+ "temperature",
+ "tool_choice",
+ "tools",
+ "verbosity"
+ ]
+ },
"inclusionai/ling-3.0-flash:free": {
"id": "inclusionai/ling-3.0-flash:free",
"name": "Ling-3.0-flash (free)",
@@ -980,8 +1040,8 @@
"local_id": "glm-5.2",
"context_length": 1048576,
"max_output_tokens": 131072,
- "input_price_per_mtok": 0.8036,
- "output_price_per_mtok": 2.5256,
+ "input_price_per_mtok": 0.7126,
+ "output_price_per_mtok": 2.2396,
"supports_thinking": false,
"thinking_type": "none",
"temperature_range": [
@@ -1038,8 +1098,8 @@
"local_id": "kimi-k2.7-code",
"context_length": 262144,
"max_output_tokens": 262144,
- "input_price_per_mtok": 0.82,
- "output_price_per_mtok": 3.75,
+ "input_price_per_mtok": 0.78,
+ "output_price_per_mtok": 3.5,
"supports_thinking": false,
"thinking_type": "none",
"temperature_range": [
@@ -1191,9 +1251,9 @@
"provider": "nvidia",
"local_id": "nemotron-3-ultra-550b-a55b",
"context_length": 512288,
- "max_output_tokens": 16384,
- "input_price_per_mtok": 0.5,
- "output_price_per_mtok": 2.2,
+ "max_output_tokens": 0,
+ "input_price_per_mtok": 0.6,
+ "output_price_per_mtok": 3.6,
"supports_thinking": false,
"thinking_type": "none",
"temperature_range": [
@@ -2193,8 +2253,8 @@
"provider": "qwen",
"local_id": "qwen3.6-27b",
"context_length": 262144,
- "max_output_tokens": 0,
- "input_price_per_mtok": 0.288,
+ "max_output_tokens": 131072,
+ "input_price_per_mtok": 0.289,
"output_price_per_mtok": 2.4,
"supports_thinking": false,
"thinking_type": "none",
@@ -2328,8 +2388,8 @@
"local_id": "deepseek-v4-flash",
"context_length": 1048576,
"max_output_tokens": 0,
- "input_price_per_mtok": 0.098,
- "output_price_per_mtok": 0.196,
+ "input_price_per_mtok": 0.0938,
+ "output_price_per_mtok": 0.1876,
"supports_thinking": false,
"thinking_type": "none",
"temperature_range": [
@@ -2624,8 +2684,8 @@
"local_id": "kimi-k2.6",
"context_length": 262144,
"max_output_tokens": 262144,
- "input_price_per_mtok": 0.684,
- "output_price_per_mtok": 3.42,
+ "input_price_per_mtok": 0.646,
+ "output_price_per_mtok": 2.72,
"supports_thinking": false,
"thinking_type": "none",
"temperature_range": [
@@ -2931,9 +2991,9 @@
"provider": "arcee-ai",
"local_id": "trinity-large-thinking",
"context_length": 262144,
- "max_output_tokens": 80000,
- "input_price_per_mtok": 0.25,
- "output_price_per_mtok": 0.8,
+ "max_output_tokens": 262144,
+ "input_price_per_mtok": 0.22,
+ "output_price_per_mtok": 0.85,
"supports_thinking": false,
"thinking_type": "none",
"temperature_range": [
@@ -3303,9 +3363,9 @@
"provider": "nvidia",
"local_id": "nemotron-3-super-120b-a12b",
"context_length": 1000000,
- "max_output_tokens": 0,
- "input_price_per_mtok": 0.08,
- "output_price_per_mtok": 0.45,
+ "max_output_tokens": 16384,
+ "input_price_per_mtok": 0.085,
+ "output_price_per_mtok": 0.4,
"supports_thinking": false,
"thinking_type": "none",
"temperature_range": [
@@ -6398,6 +6458,7 @@
"supported_parameters": [
"frequency_penalty",
"include_reasoning",
+ "logit_bias",
"logprobs",
"max_tokens",
"presence_penalty",
@@ -6422,8 +6483,8 @@
"local_id": "qwen3-next-80b-a3b-instruct",
"context_length": 262144,
"max_output_tokens": 262144,
- "input_price_per_mtok": 0.15,
- "output_price_per_mtok": 1.2,
+ "input_price_per_mtok": 0.1,
+ "output_price_per_mtok": 1.1,
"supports_thinking": false,
"thinking_type": "none",
"temperature_range": [
@@ -6942,9 +7003,9 @@
"provider": "openai",
"local_id": "gpt-oss-20b",
"context_length": 131072,
- "max_output_tokens": 0,
- "input_price_per_mtok": 0.029,
- "output_price_per_mtok": 0.14,
+ "max_output_tokens": 131072,
+ "input_price_per_mtok": 0.03,
+ "output_price_per_mtok": 0.13,
"supports_thinking": true,
"thinking_type": "effort",
"temperature_range": [
@@ -7114,9 +7175,9 @@
"provider": "qwen",
"local_id": "qwen3-30b-a3b-instruct-2507",
"context_length": 262144,
- "max_output_tokens": 0,
- "input_price_per_mtok": 0.1,
- "output_price_per_mtok": 0.3,
+ "max_output_tokens": 32000,
+ "input_price_per_mtok": 0.0481,
+ "output_price_per_mtok": 0.193,
"supports_thinking": false,
"thinking_type": "none",
"temperature_range": [
diff --git a/server/tests/core_config/test_dev_secret_guard.py b/server/tests/core_config/test_dev_secret_guard.py
index dbafd8ac..f6803315 100644
--- a/server/tests/core_config/test_dev_secret_guard.py
+++ b/server/tests/core_config/test_dev_secret_guard.py
@@ -130,7 +130,7 @@ class TestSettingsConstruction:
"cors_origins": ["http://localhost:3001"],
"workflow_db_filename": "workflow.db",
"temporal_enabled": False,
- "temporal_server_address": "localhost:5682",
+ "temporal_server_address": "localhost:5681",
"temporal_namespace": "default",
"temporal_task_queue": "machina-tasks",
"temporal_per_type_dispatch": True,
diff --git a/server/tests/nodes/test_code_fs_process.py b/server/tests/nodes/test_code_fs_process.py
index 0695b9eb..093ac5b8 100644
--- a/server/tests/nodes/test_code_fs_process.py
+++ b/server/tests/nodes/test_code_fs_process.py
@@ -228,7 +228,7 @@ class TestJavascriptExecutor:
async def test_http_exception_wrapped_in_envelope(self, harness):
_reset_nodejs_singleton()
fake_client = MagicMock(name="NodeJSClient")
- fake_client.execute = AsyncMock(side_effect=ConnectionRefusedError("Cannot connect to host localhost:5680"))
+ fake_client.execute = AsyncMock(side_effect=ConnectionRefusedError("Cannot connect to host localhost:5682"))
with patch(
"nodes.code._nodejs.acquire_client",
@@ -237,7 +237,7 @@ class TestJavascriptExecutor:
result = await harness.execute("javascriptExecutor", {"code": "output = 1"})
harness.assert_envelope(result, success=False)
- assert "localhost:5680" in result["error"]
+ assert "localhost:5682" in result["error"]
# ============================================================================
diff --git a/server/tests/temporal/test_client_readiness.py b/server/tests/temporal/test_client_readiness.py
index 34977d1c..2481c687 100644
--- a/server/tests/temporal/test_client_readiness.py
+++ b/server/tests/temporal/test_client_readiness.py
@@ -30,7 +30,7 @@ from services.temporal.client import (
def _make_wrapper(*, attempts: int = 5, delay: float = 0.0, timeout: float = 1.0) -> TemporalClientWrapper:
- w = TemporalClientWrapper("localhost:5682", "default")
+ w = TemporalClientWrapper("localhost:5681", "default")
# Override the MagicMock values the stubbed Settings produced.
w._health_check_attempts = attempts
w._health_check_delay_seconds = delay
diff --git a/server/tests/temporal/test_terminate_sweep.py b/server/tests/temporal/test_terminate_sweep.py
index ee0012c5..a2e41ecf 100644
--- a/server/tests/temporal/test_terminate_sweep.py
+++ b/server/tests/temporal/test_terminate_sweep.py
@@ -31,7 +31,7 @@ def _agen(items=None, raise_exc=None):
def _make_wrapper(client: MagicMock, *, attempts: int = 4) -> TemporalClientWrapper:
- w = TemporalClientWrapper("localhost:5682", "default")
+ w = TemporalClientWrapper("localhost:5681", "default")
w._client = client
w._sweep_attempts = attempts
w._sweep_backoff_seconds = 0.0