ci: agent integration tests with mongod inside the job #586

Merged
sharang merged 2 commits from ci/agent-integration-tests into main 2026-11-02 21:27:13 +00:00
Owner

Backlog t61. The agent integration tests (compliance-agent/tests, 87 tests in 30 binaries) were never in CI, because the MongoDB they need kept dying mid-run (three tries in #584).

Root cause (from this PR's first run, which kept the mongod log): Too many open files → WiredTiger fatal assertion → mongod aborts. Every test opens its own database, and WiredTiger keeps a file open per collection and index. Job containers start with a soft limit of 1024 open files. This also explains the lost mongo:7 service containers in #584.
Reproduced locally in rust:1.94-bookworm with --ulimit nofile=1024:524288: 19 of 87 failed and the log shows the same error. With the limit raised: 87 passed.
It was not memory: MongoDB 7 sizes its cache from the cgroup, and it peaks at ~0.5 GB under the job's 3 GB cap.

The job agent-integration (PRs only):

  • mongod runs as a process in the job container: the official 7.0.45 Debian 12 build, checked against its sha256, with --wiredTigerCacheSizeGB 0.25 and --bind_ip 127.0.0.1;
  • ulimit -n 64000 (falls back to the hard limit), and the limit is printed;
  • tests are built before mongod starts;
  • on failure, the mongod log and process state are printed.

Note: this PR's Check job fails on cargo audit (RUSTSEC-2026-0433, pulldown-cmark). That is fixed in #587; merge it first, then this PR's Check goes green on a re-run.

🤖 Generated with Claude Code

Backlog t61. The agent integration tests (`compliance-agent/tests`, 87 tests in 30 binaries) were never in CI, because the MongoDB they need kept dying mid-run (three tries in #584). **Root cause** (from this PR's first run, which kept the mongod log): `Too many open files` → WiredTiger fatal assertion → mongod aborts. Every test opens its own database, and WiredTiger keeps a file open per collection and index. Job containers start with a soft limit of **1024** open files. This also explains the lost `mongo:7` service containers in #584. Reproduced locally in `rust:1.94-bookworm` with `--ulimit nofile=1024:524288`: 19 of 87 failed and the log shows the same error. With the limit raised: **87 passed**. It was not memory: MongoDB 7 sizes its cache from the cgroup, and it peaks at ~0.5 GB under the job's 3 GB cap. **The job** `agent-integration` (PRs only): - mongod runs as a **process in the job container**: the official 7.0.45 Debian 12 build, checked against its sha256, with `--wiredTigerCacheSizeGB 0.25` and `--bind_ip 127.0.0.1`; - `ulimit -n 64000` (falls back to the hard limit), and the limit is printed; - tests are built before mongod starts; - on failure, the mongod log and process state are printed. **Note:** this PR's `Check` job fails on `cargo audit` (RUSTSEC-2026-0433, pulldown-cmark). That is fixed in #587; merge it first, then this PR's Check goes green on a re-run. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
sharang added 2 commits 2026-11-02 21:08:08 +00:00
The 21 agent integration tests need MongoDB. Three tries with a mongo
service container lost the database mid-run (#584), so they were left
out of CI (backlog t61).

Memory was not the cause: against mongo:7 capped like a job (3 GB,
2 CPUs) all agent integration tests pass in parallel locally and mongo
peaks at ~0.5 GB (MongoDB 7 sizes its cache from the cgroup). The new
job runs mongod as a process in the job container instead: the official
Debian 12 build checked against its sha256, a 0.25 GB cache, started
after the tests are built, its log printed when a test fails. Locally
in rust:1.94-bookworm under the same cap: 87 passed, ~0.5 GB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ci: raise the open-file limit for mongod in the agent integration job
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Agent integration (pull_request) Successful in 4m13s
CI / Check (pull_request) Successful in 18m36s
a5e9913957
The first run of the job lost mongod mid-run again: its log says "Too
many open files" (WiredTiger fatal assertion). Every test opens its own
database, so WiredTiger keeps a file open per collection and index, and
job containers start with a soft limit of 1024. Reproduced locally with
--ulimit nofile=1024:524288 (19 of 87 failed); with 64000, all 87 pass.
That also explains the lost mongo service containers in #584.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sharang force-pushed ci/agent-integration-tests from 05e81625a9 to a5e9913957 2026-11-02 21:08:08 +00:00 Compare
sharang merged commit 3300bb1851 into main 2026-11-02 21:27:13 +00:00
sharang deleted branch ci/agent-integration-tests 2026-11-02 21:27:13 +00:00
Sign in to join this conversation.