Skip to content

Add BackendReplicas and SessionCacheSize to RunConfig#4239

Merged
yrobla merged 2 commits intomainfrom
issue-4203
Mar 20, 2026
Merged

Add BackendReplicas and SessionCacheSize to RunConfig#4239
yrobla merged 2 commits intomainfrom
issue-4203

Conversation

@yrobla
Copy link
Copy Markdown
Contributor

@yrobla yrobla commented Mar 19, 2026

Summary

Extends RunConfig with two optional, zero-value-safe fields needed by the proxyrunner horizontal scaling epic (THV-0047). BackendReplicas (*int32, nil = unmanaged) controls StatefulSet replica count; SessionCacheSize (*int32, 0 = default 1000) bounds the local LRU session cache. Both fields use omitempty so existing configs deserialize without modification.

Fixes #4203

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation
  • Other (describe):

Test plan

  • Unit tests (task test)
  • E2E tests (task test-e2e)
  • Linting (task lint-fix)
  • Manual testing (describe below)

Changes

File Change

Does this introduce a user-facing change?

Special notes for reviewers

@yrobla yrobla requested a review from Copilot March 19, 2026 14:57
@github-actions github-actions bot added the size/XS Extra small PR: < 100 lines changed label Mar 19, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends RunConfig (ToolHive’s serialized workload configuration / API contract) with two new optional fields needed for the proxyrunner horizontal scaling epic (THV-0047): one to control backend StatefulSet replica management and one to bound the local session LRU cache.

Changes:

  • Add BackendReplicas *int32 to RunConfig with JSON/YAML omitempty tags.
  • Add SessionCacheSize int to RunConfig with JSON/YAML omitempty tags.
  • Add JSON-focused round-trip and omitempty unit tests for the new fields.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pkg/runner/config.go Adds the two new RunConfig fields and their doc comments/tags.
pkg/runner/config_test.go Adds a new test covering JSON round-trip and omitempty behavior for the new fields.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 19, 2026

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.86%. Comparing base (5748d93) to head (edef372).
⚠️ Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
pkg/runner/config.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4239      +/-   ##
==========================================
- Coverage   69.32%   68.86%   -0.46%     
==========================================
  Files         470      473       +3     
  Lines       47189    47858     +669     
==========================================
+ Hits        32712    32959     +247     
- Misses      11957    12274     +317     
- Partials     2520     2625     +105     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions bot added size/S Small PR: 100-299 lines changed and removed size/XS Extra small PR: < 100 lines changed labels Mar 19, 2026
@yrobla yrobla requested a review from Copilot March 19, 2026 15:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the runner RunConfig API contract with two optional fields needed for upcoming proxyrunner horizontal-scaling work: an optional backend replica count and an optional session cache size limit, along with serialization round-trip tests and regenerated Swagger artifacts.

Changes:

  • Add BackendReplicas *int32 and SessionCacheSize int to pkg/runner.RunConfig with JSON/YAML omitempty tags and documented zero/nil semantics.
  • Add unit tests covering JSON/YAML round-trips and omitempty behavior for the new fields.
  • Update generated Swagger specs/docs to reflect the expanded RunConfig schema.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pkg/runner/config.go Adds the two new optional RunConfig fields and their doc comments.
pkg/runner/config_test.go Adds JSON/YAML serialization tests for the new fields.
docs/server/swagger.yaml Regenerated OpenAPI YAML including the new RunConfig properties.
docs/server/swagger.json Regenerated OpenAPI JSON including the new RunConfig properties.
docs/server/docs.go Regenerated swaggo output embedding the updated OpenAPI schema.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions github-actions bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Mar 19, 2026
@yrobla yrobla requested a review from Copilot March 19, 2026 15:24
…RC-1)

Extends RunConfig with two optional, zero-value-safe fields needed by
the proxyrunner horizontal scaling epic (THV-0047). BackendReplicas
(*int32, nil = unmanaged) controls StatefulSet replica count; SessionCacheSize
(int, 0 = default 1000) bounds the local LRU session cache. Both fields
use omitempty so existing configs deserialize without modification.

Closes #4203
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds two new optional fields to RunConfig to support upcoming proxyrunner horizontal scaling work (replica management and session cache sizing), along with serialization round-trip tests and regenerated API docs.

Changes:

  • Extend pkg/runner.RunConfig with BackendReplicas *int32 and SessionCacheSize int (both optional / zero-value-safe).
  • Add JSON + YAML round-trip unit tests covering presence/omission and pointer-to-zero behavior.
  • Update generated OpenAPI artifacts to include the new fields.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pkg/runner/config.go Adds BackendReplicas and SessionCacheSize fields to the public RunConfig schema.
pkg/runner/config_test.go Adds unit tests for JSON/YAML round-tripping and omitempty behavior of new fields.
docs/server/swagger.yaml Documents the new RunConfig fields in the OpenAPI YAML spec.
docs/server/swagger.json Documents the new RunConfig fields in the OpenAPI JSON spec.
docs/server/docs.go Updates the embedded OpenAPI template to include the new fields.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions github-actions bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Mar 19, 2026
JAORMX
JAORMX previously requested changes Mar 20, 2026
Copy link
Copy Markdown
Collaborator

@JAORMX JAORMX left a comment

Choose a reason for hiding this comment

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

Thanks for the work on this! I have some concerns about the API shape and a type issue on SessionCacheSize. Details inline.

@github-actions github-actions bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Mar 20, 2026
@yrobla yrobla requested review from JAORMX and Copilot March 20, 2026 10:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the runner configuration schema to support upcoming proxyrunner horizontal scaling work by introducing scaling-related configuration and updating unit tests and API documentation artifacts.

Changes:

  • Add a new ScalingConfig field on RunConfig and define the ScalingConfig struct with backend_replicas and session_cache_size.
  • Add JSON and YAML round-trip tests covering the new scaling configuration fields.
  • Update generated OpenAPI (swagger) artifacts to document the new fields.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
pkg/runner/config.go Adds ScalingConfig to RunConfig and introduces ScalingConfig struct with scaling knobs.
pkg/runner/config_test.go Adds round-trip JSON/YAML tests for scaling config serialization/deserialization.
docs/server/swagger.yaml Updates OpenAPI YAML schema to include replica/cache-size fields.
docs/server/swagger.json Updates OpenAPI JSON schema to include replica/cache-size fields.
docs/server/docs.go Updates generated swaggo template to include replica/cache-size fields.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions github-actions bot removed the size/S Small PR: 100-299 lines changed label Mar 20, 2026
@github-actions github-actions bot added the size/S Small PR: 100-299 lines changed label Mar 20, 2026
@yrobla yrobla requested a review from Copilot March 20, 2026 10:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions github-actions bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Mar 20, 2026
Copy link
Copy Markdown
Collaborator

@JAORMX JAORMX left a comment

Choose a reason for hiding this comment

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

Code changes look good — both structural feedback items were addressed correctly. Two minor nits before merging:

  1. PR description is stale — still says SessionCacheSize (int, 0 = default 1000) but the implementation is now *int32 with nil-means-default semantics. Please update to match.
  2. PR title uses feat(runner): — project convention is no conventional commit prefixes. Something like "Add BackendReplicas and SessionCacheSize to RunConfig" would be consistent.

@yrobla yrobla changed the title feat(runner): add BackendReplicas and SessionCacheSize to RunConfig Add BackendReplicas and SessionCacheSize to RunConfig Mar 20, 2026
@yrobla yrobla merged commit a685e89 into main Mar 20, 2026
42 checks passed
@yrobla yrobla deleted the issue-4203 branch March 20, 2026 13:21
Sanskarzz pushed a commit to Sanskarzz/toolhive that referenced this pull request Mar 23, 2026
* feat(runner): add BackendReplicas and SessionCacheSize to RunConfig (RC-1)

Extends RunConfig with two optional, zero-value-safe fields needed by
the proxyrunner horizontal scaling epic (THV-0047). BackendReplicas
(*int32, nil = unmanaged) controls StatefulSet replica count; SessionCacheSize
(int, 0 = default 1000) bounds the local LRU session cache. Both fields
use omitempty so existing configs deserialize without modification.

Closes stacklok#4203

* fixes from review

---------

Co-authored-by: taskbot <taskbot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Small PR: 100-299 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extend RunConfig with replica and cache-size fields

4 participants