← Back to Pull requests

fix(api): cap OpenTelemetry settings at JavaScript's safe integer limit #6286

Open
unknown opened this pull request with 563 lines diff across 7 files
View on GitHub
unknown unknown commented on Dec 02, 2026 15:36 UTC
Author

Fixes #6285

What happens

The OpenTelemetry form resubmits all six integer fields when a user edits only the sampling rate. At the maximum accepted by #6239, JavaScript sends 18446744073709552000 for a value saved as 18446744073709551615. The API rejects the save.

| Operation | Before | After |
|---|---|---|
| PUT 9007199254740991 | 200 | 200 |
| PUT 9007199254740992 | 200 | Field-level 422, previous settings preserved |
| GET the maximum accepted by that version, edit only the sampling rate, then PUT | 422 after rounding | 200, all six integers preserved |

Cause

#6239 bounded the integers at orjson’s serialization limit. The #6274 review showed that the settings form also needs an integer range that survives JavaScript’s JSON round trip.

Change

The six OpenTelemetry integer settings now share the download settings’ existing maximum of 9007199254740991 (253 - 1), so the Web UI can read and save every accepted integer exactly.

Cap the six OpenTelemetry integers at 9007199254740991 (253 - 1) in request validation, direct saves and settings-store startup parsing. OpenAPI publishes the exact numeric maximum.

The #6274 P2 also applies to OpenTelemetry. Returning the whole startup section can put an empty startup API key into the form, and the next unrelated save clears the saved key. Reading a saved section or an older Host response now repairs only oversized fields, preserving the masked key, endpoints and protocol. API and Supervisor workers apply the same bound to older Host payloads. If an oversized queue has a valid batch larger than the default queue, the replacement queue grows to fit that batch.

Tests

Cover all six boundaries and OpenAPI fields, rejected PUTs, a sampling-rate-only browser round trip, nested and legacy-flat settings, and older Host GET, reset and worker startup. The hosted save checks that the original API key survives. The worker regression checks that the runtime queue and batch match the values returned by GET.

On Windows Python 3.10.20 and 3.14.6 at 2992db5d (rebased onto 82598b1b after #6274), the OpenTelemetry and system settings API and store tests, test_api_host.py and test_supervisor_host.py pass (96 each, two POSIX-only skips). Before the rebase, 19 of the new or changed cases failed on eb7411b4, and the extended API worker case failed there because the batch size dropped to 512. A Node.js check confirmed that the old maximum comes back as 18446744073709552000 and the new one round-trips unchanged. On Ubuntu 24.04 at 2992db5d, the changed test files passed on Python 3.12 with Transformers 5.25.0 and 4.57.6 and on Python 3.10 (59 each); with the production files from 82598b1b they fail. Pre-commit and mypy over the repository passed; the consumer suite had only failures that also occur on the base.

Supervisor startup with a legacy Host

With a startup queue of 8192, an older Host could save queue 2**53 and batch 4096. GET returned (8192, 4096), but a replacement Supervisor ran (4096, 4096) and stayed in restart_components.

Hosted reads and Supervisor startup now use the same field-level repair and queue/batch ordering. A new Host passes its original startup settings. A legacy Host supplies the environment captured for its first child, so recovery on that path depends on the original queue still being present. When the Supervisor repairs an oversized integer, it reports the saved snapshot’s revision for the legacy Host’s restart check. Ordinary snapshots retain the running settings’ revision.

The mixed-version regression compares GET with a real replacement Supervisor and checks that only api remains pending. It covers the legacy payload and an explicit startup baseline with an inherited queue of 16384. Both cases failed on 2992db5d at the effective queue comparison.

The follow-up commit 636b62af passed on Ubuntu 24.04: test_supervisor_host.py on Python 3.12 with Transformers 5.25.1 and 4.57.6 and on Python 3.10 (16 each); with the production files from 2992db5d the new cases fail. Pre-commit and mypy over the repository passed; the consumer suite had only failures that also occur on the base. On Windows Python 3.10.20 and 3.14.6, test_supervisor_host.py and the observability settings API and store tests passed (47 each).

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: 563 lines (+422 / -141) across 7 files Reviewer: Jackmeson1 Review duration: 623m
All Vouch review confidence checks passed
Residual risk 0.26 = Change Risk (0.50) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 563 lines diff across 7 files
0.50
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
46%
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.379
Shallow Review Depth shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #6286"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 46.7% 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: 49.7% (MEDIUM) · Higher = larger blast radius
49.7%
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: 46.7% · Lower = rushed or shallow review
46.7%
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: 26.5% · Safe to merge
26.5%