From 0724f5dc36c58057adb9fc61e5197569fab7c82c Mon Sep 17 00:00:00 2001 From: ImBenji Date: Mon, 3 Aug 2026 14:43:30 +0100 Subject: [PATCH] fix: run autonomy workers by default --- docker-compose.yml | 29 +++++++++++++++++------------ docs/autonomy.md | 13 +++---------- workers/autonomyWorker.js | 4 +++- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index a160084..daeed13 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,7 +34,6 @@ services: - nginx_proxy_manager_default autonomy: - profiles: [autonomy] build: context: . provenance: false @@ -47,13 +46,14 @@ services: NODE_ENV: production DURIIN_DB: /data/archive.sqlite INTELLIGENCE_DB: /data/intelligence.sqlite - AUTONOMY_POLL_MS: "1000" + AUTONOMY_POLL_MS: "${AUTONOMY_POLL_MS:-5000}" + cpus: "0.50" + mem_limit: 512m restart: unless-stopped networks: - nginx_proxy_manager_default coordinator: - profiles: [autonomy] build: context: . provenance: false @@ -66,13 +66,14 @@ services: NODE_ENV: production DURIIN_DB: /data/archive.sqlite INTELLIGENCE_DB: /data/intelligence.sqlite - AUTONOMY_POLL_MS: "1000" + AUTONOMY_POLL_MS: "${AUTONOMY_COORDINATOR_POLL_MS:-5000}" + cpus: "0.75" + mem_limit: 768m restart: unless-stopped networks: - nginx_proxy_manager_default autonomy-outcomes: - profiles: [autonomy] build: context: . provenance: false @@ -83,13 +84,14 @@ services: environment: NODE_ENV: production INTELLIGENCE_DB: /data/intelligence.sqlite - AUTONOMY_OUTCOME_POLL_MS: "60000" + AUTONOMY_OUTCOME_POLL_MS: "${AUTONOMY_OUTCOME_POLL_MS:-60000}" + cpus: "0.25" + mem_limit: 384m restart: unless-stopped networks: - nginx_proxy_manager_default calibration: - profiles: [autonomy] build: context: . provenance: false @@ -100,13 +102,14 @@ services: environment: NODE_ENV: production INTELLIGENCE_DB: /data/intelligence.sqlite - AUTONOMY_CALIBRATION_POLL_MS: "60000" + AUTONOMY_CALIBRATION_POLL_MS: "${AUTONOMY_CALIBRATION_POLL_MS:-60000}" + cpus: "0.25" + mem_limit: 384m restart: unless-stopped networks: - nginx_proxy_manager_default execution: - profiles: [autonomy] build: context: . provenance: false @@ -117,9 +120,11 @@ services: environment: NODE_ENV: production INTELLIGENCE_DB: /data/intelligence.sqlite - AUTONOMY_EXECUTION_MODE: "shadow" - AUTONOMY_DEFAULT_NOTIONAL: "100" - AUTONOMY_EXECUTION_POLL_MS: "10000" + AUTONOMY_EXECUTION_MODE: "${AUTONOMY_EXECUTION_MODE:-shadow}" + AUTONOMY_DEFAULT_NOTIONAL: "${AUTONOMY_DEFAULT_NOTIONAL:-100}" + AUTONOMY_EXECUTION_POLL_MS: "${AUTONOMY_EXECUTION_POLL_MS:-10000}" + cpus: "0.25" + mem_limit: 384m restart: unless-stopped networks: - nginx_proxy_manager_default diff --git a/docs/autonomy.md b/docs/autonomy.md index ed3a5c4..4aca9a4 100644 --- a/docs/autonomy.md +++ b/docs/autonomy.md @@ -1,8 +1,7 @@ # Duriin autonomy runtime The autonomy runtime is additive to the existing archive and intelligence -tables. It is deliberately disabled until the paper-trading cutover is -approved. +tables. Its workers are part of the default runtime and restart automatically. ## Services @@ -13,16 +12,10 @@ approved. - `calibration`: creates empirical calibration snapshots and deterministic decisions. - `intelligence`: legacy worker, available only under the `legacy` Compose profile. -Start only the API by default: +Start the API and autonomy runtime: ```bash -docker compose up -d api -``` - -The new runtime is explicitly opt-in: - -```bash -docker compose --profile autonomy up -d autonomy coordinator autonomy-outcomes calibration +docker compose up -d ``` ## Authority rules diff --git a/workers/autonomyWorker.js b/workers/autonomyWorker.js index b327695..88509a4 100644 --- a/workers/autonomyWorker.js +++ b/workers/autonomyWorker.js @@ -74,7 +74,9 @@ async function runAutonomyWorker({ archivePath, intelligencePath, workerId = `au initAutonomySchema(intelligenceDb); while (true) { - const job = leaseNextJob(intelligenceDb, workerId, 120); + // This worker owns maintenance reconciliation only. Without the type filter it + // can lease coordinator_event jobs and complete them without analysis. + const job = leaseNextJob(intelligenceDb, workerId, 120, ['reconcile_archive']); if (!job) { await sleep(pollMs); continue; } try { if (job.job_type === 'reconcile_archive') {