Skip to content

feat(server): bound database connection pool#236

Draft
abhinav-galileo wants to merge 4 commits into
mainfrom
abhi/agent-control-db-pooling
Draft

feat(server): bound database connection pool#236
abhinav-galileo wants to merge 4 commits into
mainfrom
abhi/agent-control-db-pooling

Conversation

@abhinav-galileo

@abhinav-galileo abhinav-galileo commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add explicit async SQLAlchemy pool settings for non-SQLite databases.
  • Bound pool size, overflow, checkout timeout, connect timeout, and statement timeout.
  • Track checked-out SQLAlchemy connections with a Prometheus gauge.
  • Release evaluation DB sessions before evaluator execution and dispose the engine on shutdown.

Defaults

  • AGENT_CONTROL_DB_POOL_SIZE=5
  • AGENT_CONTROL_DB_MAX_OVERFLOW=10
  • AGENT_CONTROL_DB_POOL_TIMEOUT_SECONDS=5.0
  • AGENT_CONTROL_DB_CONNECT_TIMEOUT_SECONDS=5
  • AGENT_CONTROL_DB_STATEMENT_TIMEOUT_SECONDS=50.0

Verification

  • uv run --package agent-control-server ruff check --config pyproject.toml server/src server/tests/test_config.py server/tests/test_db.py server/tests/test_evaluation_error_handling.py
  • uv run --package agent-control-server mypy --config-file pyproject.toml server/src
  • GitHub CI passing

@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.36066% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
server/src/agent_control_server/db.py 97.61% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@abhinav-galileo abhinav-galileo force-pushed the abhi/agent-control-db-pooling branch from 54d842f to ed28d63 Compare June 8, 2026 12:49
@abhinav-galileo abhinav-galileo marked this pull request as ready for review June 8, 2026 12:50
@abhinav-galileo abhinav-galileo marked this pull request as draft June 8, 2026 12:50
@abhinav-galileo abhinav-galileo marked this pull request as ready for review June 8, 2026 12:53
@abhinav-galileo abhinav-galileo changed the title Bound Agent Control database connection pool fix(server): bound database connection pool Jun 11, 2026
- bound connection establishment and per-statement runtime at the
  driver level for non-SQLite URLs (psycopg and asyncpg)
- default AGENT_CONTROL_DB_MAX_OVERFLOW to 10 so short bursts borrow
  transient connections instead of failing after the pool timeout
- initialize the checked-out-connections gauge so idle processes
  report 0 instead of an absent series
@abhinav-galileo abhinav-galileo changed the title fix(server): bound database connection pool feat(server): bound database connection pool Jun 11, 2026
@abhinav-galileo abhinav-galileo marked this pull request as draft June 12, 2026 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant