Skip to content

feat: configure database polling and skip unchanged MCP writes - #3038

Merged
EItanya merged 5 commits into
mainfrom
feat/configurable-postgres-polling
Oct 3, 2026
Merged

EItanya merged 5 commits into
mainfrom
feat/configurable-postgres-polling

Conversation

@EItanya

@EItanya EItanya commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Several controller workers query PostgreSQL every second even when there is no pending work, which keeps serverless databases active. This makes sandbox expiration, scheduled-run reservation and execution, and runtime revision cleanup intervals configurable through the existing environment accessors, preserving current defaults. Workers reject nonpositive intervals.

Session quiescence stays fixed at one second because longer intervals leave actors running after task completion or while waiting for input. #3040 tracks waking these workers in memory after settlement, with slower recovery scans. This PR does not eliminate all idle database polling.

Agent and sandbox-template preparation checks also stay fixed at one second. They scan cached state and do not query PostgreSQL once preparation and cleanup are settled, so slowing them would delay readiness without helping the database become idle.

Forward-ports dd889a1 to the current MCPServer and RemoteMCPServer controllers: discovery keeps its existing cadence, while unchanged catalogs skip PostgreSQL writes. Failed writes and deletion invalidate the cached observation so retries still reach the database. LastConnected records the last persisted connected observation.

Uses the PostgreSQL pool configuration from #3032. Defaults and latency tradeoffs stay in the existing environment-variable reference, including the 30-second lateness window for cron firings.

Validation: affected Go packages with the race detector, including an MCP test that closes the PostgreSQL pool before repeating unchanged discovery; Go lint; Helm controller/database tests; generated environment documentation check.

@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Oct 3, 2026
@EItanya EItanya changed the title feat: make background PostgreSQL polling configurable feat: configure database polling and skip unchanged MCP writes Oct 3, 2026
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Oct 3, 2026
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Forward-port dd889a1 to the current MCP controllers.

Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Oct 3, 2026
@EItanya
EItanya marked this pull request as ready for review October 3, 2026 12:33
@EItanya
EItanya requested a review from a team as a code owner October 3, 2026 12:33
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
@EItanya
EItanya merged commit 64f6acf into main Oct 3, 2026
30 checks passed
@EItanya
EItanya deleted the feat/configurable-postgres-polling branch October 3, 2026 12:57
alexdarbyshire pushed a commit to alexdarbyshire/kagent that referenced this pull request Oct 5, 2026
…t-dev#3038)

Several controller workers query PostgreSQL every second even when there
is no pending work, which keeps serverless databases active. This makes
sandbox expiration, scheduled-run reservation and execution, and runtime
revision cleanup intervals configurable through the existing environment
accessors, preserving current defaults. Workers reject nonpositive
intervals.

Session quiescence stays fixed at one second because longer intervals
leave actors running after task completion or while waiting for input.
kagent-dev#3040 tracks waking these workers in memory after settlement, with
slower recovery scans. This PR does not eliminate all idle database
polling.

Agent and sandbox-template preparation checks also stay fixed at one
second. They scan cached state and do not query PostgreSQL once
preparation and cleanup are settled, so slowing them would delay
readiness without helping the database become idle.

Forward-ports
[dd889a1](kagent-dev@dd889a1)
to the current MCPServer and RemoteMCPServer controllers: discovery
keeps its existing cadence, while unchanged catalogs skip PostgreSQL
writes. Failed writes and deletion invalidate the cached observation so
retries still reach the database. `LastConnected` records the last
persisted connected observation.

Uses the PostgreSQL pool configuration from kagent-dev#3032. Defaults and latency
tradeoffs stay in the existing environment-variable reference, including
the 30-second lateness window for cron firings.

Validation: affected Go packages with the race detector, including an
MCP test that closes the PostgreSQL pool before repeating unchanged
discovery; Go lint; Helm controller/database tests; generated
environment documentation check.

---------

Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant