Add BackendReplicas and SessionCacheSize to RunConfig#4239
Conversation
There was a problem hiding this comment.
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 *int32toRunConfigwith JSON/YAMLomitemptytags. - Add
SessionCacheSize inttoRunConfigwith JSON/YAMLomitemptytags. - Add JSON-focused round-trip and
omitemptyunit 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 Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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 *int32andSessionCacheSize inttopkg/runner.RunConfigwith JSON/YAMLomitemptytags and documented zero/nil semantics. - Add unit tests covering JSON/YAML round-trips and
omitemptybehavior for the new fields. - Update generated Swagger specs/docs to reflect the expanded
RunConfigschema.
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.
…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
There was a problem hiding this comment.
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.RunConfigwithBackendReplicas *int32andSessionCacheSize 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.
JAORMX
left a comment
There was a problem hiding this comment.
Thanks for the work on this! I have some concerns about the API shape and a type issue on SessionCacheSize. Details inline.
There was a problem hiding this comment.
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
ScalingConfigfield onRunConfigand define theScalingConfigstruct withbackend_replicasandsession_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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
JAORMX
left a comment
There was a problem hiding this comment.
Code changes look good — both structural feedback items were addressed correctly. Two minor nits before merging:
- PR description is stale — still says
SessionCacheSize (int, 0 = default 1000)but the implementation is now*int32with nil-means-default semantics. Please update to match. - PR title uses
feat(runner):— project convention is no conventional commit prefixes. Something like "Add BackendReplicas and SessionCacheSize to RunConfig" would be consistent.
* 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>
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
Test plan
task test)task test-e2e)task lint-fix)Changes
Does this introduce a user-facing change?
Special notes for reviewers