← Back to Pull requests

fix(api): reject oversized OpenTelemetry settings integers #6239

Closed
unknown closed this pull request without merging on Dec 01, 2026 14:32 UTC
View on GitHub
unknown unknown commented on Nov 30, 2026 10:58 UTC
Author

Fixes #6238

What happens

An oversized OpenTelemetry settings update now returns a field-level JSON 422 before the store changes. GET continues to return the previous settings.

| Schedule delay | Before · PUT / following GET | After · PUT / following GET |
|---|---|---|
| 264 - 1 | 200 / 200 | 200 / 200 |
| 2
64 | 500 / 500 | 422 / 200 |

Cause

The six integer fields had a lower bound. The store could write and apply a value larger than orjson could encode in the settings response.

Change

Use the same inclusive 2**64 - 1 limit in request validation, direct store saves, and startup environment parsing. The OpenAPI field descriptions give the exact limit because FastAPI rounds a numeric bound of this size. When a previously saved OpenTelemetry section contains an oversized integer, the store starts with its environment baseline and preserves the file. An oversized environment value uses that field’s existing default. During a rolling API upgrade, the replacement worker applies the same defaults to oversized integers in the legacy Host’s startup baseline, and hosted GET returns that baseline when the Host’s saved settings contain an oversized integer. Reads preserve the settings file, and oversized PUT requests still return 422. During Supervisor replacement, apply the existing field defaults to oversized OpenTelemetry integers from a legacy Host while preserving the settings file and enforcing the size limit on new writes. The Supervisor receives only the legacy Host's effective section, so it repairs field by field instead of restoring the startup section.

Tests

The regressions cover the accepted boundary, JSON field errors, disk and runtime state after rejection, subsequent GET, saved-file startup, environment fallback, and direct store writes.

On Windows Python 3.10.20 and 3.14.6 I ran the observability API, store, restart and system-settings test files on the original version of this change: 59 passed on each, and with production code from 49e3c981 the 12 new cases failed at the expected assertions. After consolidating the tests, the two changed files pass on both versions (8 and 12 tests).

On Ubuntu 24.04 at 0d5c305f, the changed tests passed on Python 3.12 with Transformers 5.24.1 and 4.57.6 and on Python 3.10 (20 each). Pre-commit on the changed files and mypy over the repository (1,243 files) passed. The consumer suite had only failures that also occur on the base. With production code from 49e3c981, the new tests fail at the expected status assertions.

The follow-up commit 30654bfa adds a regression for each legacy-Host case, using the settings store from 49e3c981. On Windows Python 3.10.20 and 3.14.6, both failed at the expected assertions with production code from 0d5c305f and pass with the fix. On Ubuntu 24.04 at 30654bfa, the two changed test files passed on Python 3.12 with Transformers 5.24.1 and 4.57.6 and on Python 3.10 (22 each). With production code from 0d5c305f they fail. Pre-commit and mypy over the repository passed, and the consumer suite had only failures that also occur on the base.

The second follow-up commit 0c7ff696 adds a regression for each source of the Supervisor case (startup environment and saved settings), using the same legacy store; each runs a real Supervisor replacement and checks readiness and the unchanged settings file. On Windows Python 3.10.20 and 3.14.6 both failed on 30654bfa with the delay-bound ValueError before actor-pool creation and pass with the fix. On Ubuntu 24.04 at 0c7ff696, test_supervisor_host.py passed on Python 3.12 with Transformers 5.24.1 and 4.57.6 and on Python 3.10 (13 each); with production code from 30654bfa the new cases fail. The consumer tests, pre-commit and mypy over the repository passed.

AI disclosure: this was prepared with AI assistance (Claude Code with Claude Opus 5.5, and OpenAI Codex with GPT-6.2).

🤖 Generated with Claude Code

Diff: 497 lines (+372 / -125) across 6 files Reviewer: Jackmeson1 Review duration: 1654m
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.47) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.47 · 497 lines diff across 6 files
0.47
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.372
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #6239"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 47.5% (MEDIUM) · Higher = larger blast radius
47.5%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 18.8% · Safe to merge
18.8%