Skip to content

[Repo Assist] fix(config): wire payloadSizeThreshold in JSON stdin + add keepaliveInterval to schema#3281

Merged
lpcox merged 1 commit intomainfrom
repo-assist/fix-compliance-keepalive-payload-2026-04-06-1630bf4a7fdbc553
Apr 6, 2026
Merged

[Repo Assist] fix(config): wire payloadSizeThreshold in JSON stdin + add keepaliveInterval to schema#3281
lpcox merged 1 commit intomainfrom
repo-assist/fix-compliance-keepalive-payload-2026-04-06-1630bf4a7fdbc553

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot commented Apr 6, 2026

🤖 This PR was created by Repo Assist, an automated AI assistant.

Fixes three compliance gaps identified in #3272 (Daily Compliance Review 2026-04-06).

What

1. keepaliveInterval rejected by JSON schema (spec §4.1.3.5)

The embedded schema (v0.64.4) did not include keepaliveInterval in gatewayConfig.properties, causing schema validation to reject it with additionalProperties: false. The Go struct StdinGatewayConfig.KeepaliveInterval already existed — only the schema was wrong.

Fix: Register keepaliveInterval in fixSchemaBytes alongside trustedBots, using the same dynamic-addition pattern.

2. payloadSizeThreshold silently ignored in JSON stdin (spec §4.1.3.3)

The embedded schema correctly listed payloadSizeThreshold in gatewayConfig.properties, so validation passed — but StdinGatewayConfig had no PayloadSizeThreshold field. Go's JSON unmarshaler silently dropped the value.

Fix: Add PayloadSizeThreshold *int to StdinGatewayConfig and wire it in convertStdinConfig.

3. Negative payload_size_threshold not rejected in TOML path (spec §4.1.3.3)

applyDefaults replaced 0 with the default, but a negative value like -1 passed all validation and would silently cause every payload to be stored to disk.

Fix: After applyDefaults, reject any negative PayloadSizeThreshold in ParseConfig.

A validation check for the JSON stdin path (in validateGatewayConfig) also ensures payloadSizeThreshold is positive when provided.

Changes

File Change
internal/config/validation_schema.go Register keepaliveInterval in fixSchemaBytes
internal/config/config_stdin.go Add PayloadSizeThreshold *int to StdinGatewayConfig; wire in convertStdinConfig
internal/config/validation.go Validate payloadSizeThreshold >= 1 in JSON stdin path
internal/config/config_core.go Validate PayloadSizeThreshold >= 0 in TOML path
internal/config/config_stdin_test.go Tests for wiring and validation
internal/config/config_core_test.go Test for negative TOML value rejection
internal/config/validation_schema_test.go Tests that keepaliveInterval is now accepted

Test Status

⚠️ Infrastructure limitation: Go 1.25.0 is not available in the agent environment (network download blocked). Tests cannot be executed locally.

The changes are straightforward struct field additions, wiring, and a bounds check. All logic is covered by new unit tests that will run in CI.

CI will verify all three fixes via the new tests added to config_stdin_test.go, config_core_test.go, and validation_schema_test.go.

Generated by Repo Assist · ● 7M ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@851905c06e905bf362a9f6cc54f912e3df747d55

…nterval to schema

Three compliance fixes reported in #3272:

1. keepaliveInterval missing from embedded JSON schema (spec §4.1.3.5)
   - Add keepaliveInterval to fixSchemaBytes alongside trustedBots
   - Previously, schema validation rejected the field with additionalProperties:false
     even though StdinGatewayConfig.KeepaliveInterval already existed in Go

2. payloadSizeThreshold silently ignored in JSON stdin format (spec §4.1.3.3)
   - Add PayloadSizeThreshold *int field to StdinGatewayConfig
   - Wire it in convertStdinConfig to cfg.Gateway.PayloadSizeThreshold
   - Add validation: must be positive integer when present

3. payload_size_threshold not validated as positive integer in TOML path (spec §4.1.3.3)
   - Negative values now rejected in ParseConfig after applyDefaults
   - Zero is already replaced with DefaultPayloadSizeThreshold by applyDefaults

Tests added for all three fixes.

Fixes #3272

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions bot added automation bug Something isn't working enhancement New feature or request repo-assist labels Apr 6, 2026
@lpcox lpcox marked this pull request as ready for review April 6, 2026 14:41
Copilot AI review requested due to automatic review settings April 6, 2026 14:41
@lpcox lpcox merged commit d2ff5f9 into main Apr 6, 2026
4 checks passed
@lpcox lpcox deleted the repo-assist/fix-compliance-keepalive-payload-2026-04-06-1630bf4a7fdbc553 branch April 6, 2026 14:41
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 addresses MCP Gateway spec-compliance gaps in config handling by aligning JSON stdin parsing/validation and the embedded JSON schema with supported gateway config fields, and by rejecting invalid payload threshold values in the TOML load path.

Changes:

  • Extend the embedded JSON schema fix-up to allow keepaliveInterval in gateway configs.
  • Add payloadSizeThreshold support to JSON stdin (StdinGatewayConfig) and wire it into the internal GatewayConfig.
  • Add validation to reject invalid payloadSizeThreshold (JSON stdin) and negative payload_size_threshold (TOML).
Show a summary per file
File Description
internal/config/validation.go Adds JSON-stdin validation for payloadSizeThreshold >= 1.
internal/config/validation_schema.go Dynamically injects keepaliveInterval into the embedded schema.
internal/config/validation_schema_test.go Adds schema acceptance tests for keepaliveInterval (incl. -1).
internal/config/config_stdin.go Adds PayloadSizeThreshold to stdin config and maps it into GatewayConfig.
internal/config/config_stdin_test.go Adds tests for stdin wiring and validation of payloadSizeThreshold.
internal/config/config_core.go Rejects negative payload_size_threshold values after defaults are applied.
internal/config/config_core_test.go Adds a TOML test ensuring negative payload_size_threshold is rejected.

Copilot's findings

Tip

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

  • Files reviewed: 7/7 changed files
  • Comments generated: 2

// validation to reject the field when additionalProperties is false.
props["keepaliveInterval"] = map[string]interface{}{
"type": "integer",
"description": "Keepalive ping interval in seconds for HTTP MCP backends. Use -1 to disable, 0 or unset for gateway default (1500s), or a positive integer for a custom interval.",
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

The newly added schema description says “0 or unset for gateway default (1500s)”, but in the JSON stdin path a user-provided keepaliveInterval=0 will be preserved (intPtrOrDefault returns 0) and GatewayConfig.HTTPKeepaliveInterval() converts 0 to a 0s duration (effectively disabling keepalive). This makes the schema/docs misleading and creates inconsistent behavior vs TOML (where 0 is normalized to the default). Consider either (a) treating 0 as unset/default during stdin conversion or validation, or (b) updating the schema description (and any related docs) to reflect that 0 disables keepalive and only nil uses the default.

Suggested change
"description": "Keepalive ping interval in seconds for HTTP MCP backends. Use -1 to disable, 0 or unset for gateway default (1500s), or a positive integer for a custom interval.",
"description": "Keepalive ping interval in seconds for HTTP MCP backends. Use -1 to disable, unset for the gateway default (1500s), 0 to disable HTTP keepalive, or a positive integer for a custom interval.",

Copilot uses AI. Check for mistakes.
Comment on lines +40 to +43
KeepaliveInterval *int `json:"keepaliveInterval,omitempty"`
PayloadDir string `json:"payloadDir,omitempty"`
PayloadSizeThreshold *int `json:"payloadSizeThreshold,omitempty"`
TrustedBots []string `json:"trustedBots,omitempty"`
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

This change makes payloadSizeThreshold configurable via JSON stdin, but docs/CONFIGURATION.md currently lists “Payload size threshold” under “TOML-only / CLI-only options (not available in JSON stdin)”. Please update the documentation (and any related references) so users know the field is now supported in JSON stdin and what its JSON name is (payloadSizeThreshold).

See below for a potential fix:

	Port           *int   `json:"port,omitempty"`
	APIKey         string `json:"apiKey,omitempty"`
	Domain         string `json:"domain,omitempty"`
	StartupTimeout *int   `json:"startupTimeout,omitempty"`
	ToolTimeout    *int   `json:"toolTimeout,omitempty"`

	// KeepaliveInterval configures the keepalive interval in JSON stdin as `keepaliveInterval`.
	KeepaliveInterval *int `json:"keepaliveInterval,omitempty"`

	// PayloadDir configures the payload directory in JSON stdin as `payloadDir`.
	PayloadDir string `json:"payloadDir,omitempty"`

	// PayloadSizeThreshold configures the payload size threshold in JSON stdin as
	// `payloadSizeThreshold`.
	PayloadSizeThreshold *int `json:"payloadSizeThreshold,omitempty"`

	// TrustedBots configures trusted bot identifiers in JSON stdin as `trustedBots`.
	TrustedBots []string `json:"trustedBots,omitempty"`

	OpenTelemetry *StdinOpenTelemetryConfig `json:"opentelemetry,omitempty"`

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation bug Something isn't working enhancement New feature or request repo-assist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants