Skip to content

Add rate limiter to helm agent fetches - #3893

Merged
michaeljguarino merged 4 commits into
masterfrom
helm-agent-scalability
Jul 23, 2026
Merged

Add rate limiter to helm agent fetches#3893
michaeljguarino merged 4 commits into
masterfrom
helm-agent-scalability

Conversation

@michaeljguarino

@michaeljguarino michaeljguarino commented Jul 22, 2026

Copy link
Copy Markdown
Member

Pretty sure these can get overwhelmed at large scale, and a simple rate limit should improve the load shedding here.

Test Plan

Test environment: https://console.plrldemo.onplural.sh/cd/clusters/a1748282-ce8b-48ab-ae7e-326e74fce04e/services/f3f89a54-d1a7-4bc8-9152-daa07ede918d/components

Checklist

  • I have added a meaningful title and summary to convey the impact of this PR to a user.
  • If required, I have updated the Plural documentation accordingly.
  • I have added tests to cover my changes.
  • I have deployed the agent to a test environment and verified that it works as expected (required only when changing agent code).

Plural Flow: console

@michaeljguarino
michaeljguarino requested a review from a team July 22, 2026 02:52
@michaeljguarino michaeljguarino added the enhancement New feature or request label Jul 22, 2026
@soffi-ai

soffi-ai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Soffi AI Summary

This PR addresses scalability and reliability concerns in the Helm agent and deployment operator at large fleet scale, while also cleaning up a feature flag that is now ready for general availability.

Rate limiting for Helm agent fetches (lib/console/deployments/git/agent.ex): The primary motivation is to prevent Helm agent fetch loops from overwhelming the system at scale. A rate limiter is added to cap the frequency of fetch operations, improving load shedding behavior under high concurrency.

Deployment operator service reconciliation tuning (go/deployment-operator/): Several interrelated improvements tighten reconciliation behavior:

  • A minServicePollInterval constant (10s) enforces a floor on the service poll interval, extracted into a shared EffectivePollInterval helper used by both service and stack reconcilers.
  • The jitter window for re-queuing services after a poll is now driven by a configurable pollJitterWindow() rather than a hardcoded 15s, making it easier to tune at scale.
  • A new cache.Store interface (go/polly/cache/) abstracts the cache layer, and a new DynamicCache implementation (go/polly/cache/dynamic_cache.go) supports runtime-configurable TTL and interval, replacing the static cache.Cache in the service reconciler. This accounts for the change in interval and jitter behavior.
  • Transient fetch errors during manifest retrieval now cause the reconciliation to short-circuit gracefully (IsTransientFetchError) rather than propagating unnecessarily.
  • New interval tests (interval_test.go) cover the effective poll interval logic for both service and stack reconcilers.

Chatbot feature flag removal (assets/): The WorkbenchChatbots feature flag and its associated FeatureFlagContext dependency are removed from WorkbenchSidePanel, making the Chatbots section unconditionally visible. The FeatureFlagContext itself is deleted. The command palette entry guarded by this flag is also removed.

Slack chat utility improvements (lib/console/chat/): Refactoring in slack.ex and utils.ex improves how chat messages are handled and formatted.

Helm chart additions (charts/console/): New values, secrets, migration, and deployment template entries support the configuration changes introduced in this PR (likely exposing rate limiter and interval settings as chart values).

Commits

Commit Summary
c87c2e6 Adds a rate limiter to Helm agent fetch operations to prevent fetch storms that can overwhelm the system at large fleet scale, improving load shedding.
0858747 Tunes deployment operator service reconciliation: enforces a minimum 10s poll interval floor via a shared helper, makes jitter windows configurable rather than hardcoded, and gracefully short-circuits on transient fetch errors during manifest retrieval.
9b888f8 Removes the WorkbenchChatbots feature flag, making the Chatbots section in the Workbench side panel unconditionally visible and deleting the now-unused FeatureFlagContext.
afa918a Refactors the deployment operator cache layer to use a new cache.Store interface and DynamicCache implementation (in go/polly) that supports runtime-configurable TTL and poll intervals, correctly accounting for the tunable interval and jitter changes.

Deploy in Soffi


Updated: 2026-07-23 01:04 UTC

@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds rate limiting to Helm agent fetches. The main changes are:

  • Exposes the Git agent's rate-limit helper for reuse.
  • Applies one shared Helm bucket to chart fetch and digest cache misses.
  • Raises the existing per-agent limit from 50 to 100 requests per second.

Confidence Score: 5/5

The changed flow looks mergeable after separating the Helm and Git rate limits.

  • The Helm calls use a distinct bucket and preserve error-tuple propagation.
  • The shared constant unintentionally doubles the existing Git request allowance.

lib/console/deployments/git/agent.ex

Important Files Changed

Filename Overview
lib/console/deployments/git/agent.ex Exposes the rate-limit helper and raises its shared limit, which also weakens the existing Git-agent limit.
lib/console/deployments/helm/agent.ex Applies the shared limiter to Helm fetch and digest calls after cache misses.

Reviews (1): Last reviewed commit: "Add rate limiter to helm agent fetches" | Re-trigger Greptile

Comment thread lib/console/deployments/git/agent.ex Outdated
@poll :timer.seconds(120)
@timeout :timer.seconds(10)
@limit 50
@limit 100

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Git Load Shedding Is Weakened

Raising this shared constant also doubles the existing Git tar and changes limits from 50 to 100 requests per second. Those paths receive no benefit from the new Helm limiter and can now place twice the prior load on each Git agent; Helm should use a separate limit so its tuning does not change existing Git protection.

Context Used: CLAUDE.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

@plural-copilot plural-copilot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy PR created: https://github.com/pluralsh/plrl-up-demos/pull/2334

This updates the console deployment to sha-1c45cda for commit 1c45cda42d0d8fbb76fe89f3b086e202311d9253.

@michaeljguarino
michaeljguarino force-pushed the helm-agent-scalability branch 2 times, most recently from ec863fa to 517b4d6 Compare July 22, 2026 04:45
@michaeljguarino
michaeljguarino force-pushed the helm-agent-scalability branch 6 times, most recently from 29990fd to 361549e Compare July 22, 2026 16:35
Pretty sure these can get overwhelmed at large scale, and a simple rate limit should improve the load shedding here.
@michaeljguarino
michaeljguarino force-pushed the helm-agent-scalability branch from 361549e to c87c2e6 Compare July 22, 2026 16:40
@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

@plural-copilot plural-copilot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michaeljguarino
michaeljguarino force-pushed the helm-agent-scalability branch from 902764c to 9ac1235 Compare July 22, 2026 17:45
@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

@plural-copilot plural-copilot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy PR created: https://github.com/pluralsh/plrl-up-demos/pull/2336
Image tag: sha-9ac1235

@michaeljguarino
michaeljguarino force-pushed the helm-agent-scalability branch from 9ac1235 to 0858747 Compare July 22, 2026 18:31
@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

@plural-copilot plural-copilot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michaeljguarino
michaeljguarino force-pushed the helm-agent-scalability branch from 5c1647c to f40d592 Compare July 22, 2026 22:29
@michaeljguarino
michaeljguarino force-pushed the helm-agent-scalability branch from f40d592 to 9b888f8 Compare July 22, 2026 22:34
@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

@plural-copilot plural-copilot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created the deploy PR: https://github.com/pluralsh/plrl-up-demos/pull/2338 for image tag sha-9b888f8 from commit 9b888f890ecdb5b77336bf3159f7bec3b5bcf252.

@michaeljguarino
michaeljguarino force-pushed the helm-agent-scalability branch from f719b49 to afa918a Compare July 23, 2026 01:04
@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

@plural-copilot plural-copilot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy PR created for commit afa918a: https://github.com/pluralsh/plrl-up-demos/pull/2341

@michaeljguarino
michaeljguarino merged commit 654199b into master Jul 23, 2026
160 of 163 checks passed
@michaeljguarino
michaeljguarino deleted the helm-agent-scalability branch July 23, 2026 01:50
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.

2 participants