feat(docker-git): make controller limits configurable#263
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: ProverCoderAI#260
Add cpus, mem_limit, memswap_limit, and pids_limit defaults to the docker-git-api controller in docker-compose.yml and docker-compose.api.yml. Each value is parameterized via a DOCKER_GIT_CONTROLLER_* env var so operators can tune them. Per-project containers already resolve a default 30% CPU/RAM cap through resolveComposeResourceLimits, but the privileged controller that orchestrates them had no caps and could consume the entire host. This closes that gap so the whole system's resource footprint stays bounded. Closes ProverCoderAI#260
Working session summaryPR is ready and out of draft. SummaryThe issue (Russian: "Make a limit on the consumption of the whole system's resources") was already partially addressed for per-project containers (default 30% CPU/RAM via PR #136). The remaining gap: the privileged Changes:
Verification: 6/6 new tests pass, 275/275 app tests pass, 166/166 lib tests pass, typecheck clean, lint:tests clean. PR: #263 This summary was automatically extracted from the AI working session output. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost: $4.840903📊 Context and tokens usage:Claude Opus 4.7:
Total: (114 new + 104.1K cache writes + 7.2M cache reads) input tokens, 20.6K output tokens, $4.743435 cost Claude Haiku 4.5:
Total: (61 new + 36.0K cache writes + 386.5K cache reads) input tokens, 2.8K output tokens, $0.097468 cost 🤖 Models used:
📎 Log file uploaded as Gist (2582KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
🔄 Auto-restart triggered (iteration 1)Reason: CI failures detected Starting new session to address the issues. Auto-restart-until-mergeable mode is active. This run will stop after 5 restart iterations. |
Replace node:fs/path/url imports and the as-const cast so the test passes the Effect-TS lint profile. Reads the compose files via FileSystem/Path services with a NodeContext layer instead of readFileSync + import.meta.url.
Working session summaryAll 15 CI checks pass (Build, Dist deps prune, all E2E suites, Lint, Lint Effect-TS, Snapshot, Test, Types). SummaryThe "Lint Effect-TS" CI check on PR #263 was failing because the new test file
Fix (commit PR: #263 This summary was automatically extracted from the AI working session output. |
🔄 Auto-restart-until-mergeable Log (iteration 1)This log file contains the complete execution trace of the AI solution draft process. 💰 Cost: $1.611414📊 Context and tokens usage:
Total: (56 new + 59.3K cache writes + 2.0M cache reads) input tokens, 9.0K output tokens, $1.611414 cost 🤖 Models used:
📎 Log file uploaded as Gist (3601KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
🔄 Auto-restart triggered (iteration 2)Reason: Uncommitted changes detected Starting new session to address the issues. Auto-restart-until-mergeable mode is active. This run will stop after 5 restart iterations. |
Working session summaryEverything is in order. Final state:
No further work needed; the PR is ready for review. This summary was automatically extracted from the AI working session output. |
🔄 Auto-restart-until-mergeable Log (iteration 2)This log file contains the complete execution trace of the AI solution draft process. 💰 Cost: $0.380035📊 Context and tokens usage:
Total: (16 new + 35.0K cache writes + 209.6K cache reads) input tokens, 2.2K output tokens, $0.380036 cost 🤖 Models used:
📎 Log file uploaded as Gist (3905KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
|
Я думаю по дефолту он должен иметь возможность к 90% лимитов, но можно настраивать и больше и меньше с помощью cli параметров |
|
🤖 AI Work Session Started Starting automated work session at 2026-05-12T09:41:46.224Z The PR has been converted to draft mode while work is in progress. This comment marks the beginning of an AI work session. Please wait for the session to finish, and provide your feedback. |
# Conflicts: # packages/app/src/docker-git/cli/usage.ts
Working session summaryCompleted and pushed to PR #263: #263 Implemented the PR feedback: controller resources now default to 90% of host CPU/RAM, while remaining configurable via Verification passed:
Head commit is This summary was automatically extracted from the AI working session output. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
📊 Context and tokens usage:
Total: (610.4K + 31.7M cached) input tokens, 65.8K output tokens, $40.751227 cost 🤖 Models used:
📎 Log file uploaded as Repository (93239KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
Summary
Updates the controller resource cap implementation after PR feedback that the default should be 90% of available limits while remaining configurable above or below that value.
--controller-cpu,--controller-ram,--controller-pidsfordocker-git, plus./ctl up --cpu/--ram/--pidsaliases.Mathematical Guarantees
h, default controller CPU is0.9 * h.cpuCountand default RAM isfloor(0.9 * h.totalMemoryMiB)m.cpus,mem_limit,memswap_limit, andpids_limitvalues, never percentage RAM.0.9CPU,921mRAM/swap,4096PIDs).Test Plan
bun installbun run lintbun run checkbun run lint:effectbun x vitest run tests/docker-git/controller-resource-limits.test.ts(10 passed)./ctl --helpDOCKER_GIT_CONTROLLER_CPUS=75% DOCKER_GIT_CONTROLLER_MEMORY=8g DOCKER_GIT_CONTROLLER_PIDS=8192 bun --cwd packages/app scripts/print-controller-resource-env.ts(4.5,8g,8192on this 6-CPU host)bun run test(session-sync 16 passed, app 321 passed, lib 183 passed)Closes #260