Repository navigation
fix(health): opt-in deep check sampling completions surface - #14236
Merged
diegosouzapw merged 1 commit intoSep 22, 2026
Merged
Conversation
maxmad64bis
force-pushed
the
fix/health-deep-check
branch
from
September 20, 2026 00:58
8c8b477 to
76aaa2b
Compare
maxmad64bis
marked this pull request as ready for review
September 20, 2026 07:46
maxmad64bis
force-pushed
the
fix/health-deep-check
branch
from
September 20, 2026 10:03
76aaa2b to
bcc8606
Compare
diegosouzapw
merged commit Sep 22, 2026
7d5292f
into
diegosouzapw:release/v3.8.51
7 of 16 checks passed
diegosouzapw
added a commit
that referenced
this pull request
Sep 22, 2026
`check:env-doc-sync` (part of `check:docs-all`, blocking) has been red on the release tip since #14236: ✗ In code but missing from .env.example: 1 - DEEP_HEALTH_CHECK_ENABLED #14236 added the opt-in deep health probe behind that flag (`src/app/api/monitoring/health/route.ts`) but did not document it. Added to .env.example and docs/reference/ENVIRONMENT.md, stating both halves of the gate: the flag must be exactly "1", and an anonymous caller never triggers a probe with or without it. Validated: check:env-doc-sync in sync, check:docs-all exit 0.
5 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The system health endpoint gains an opt-in deep check (
?deep=1, gated onDEEP_HEALTH_CHECK_ENABLED=1plus management authentication) that samples the completions surface with a minimal one-token non-streaming request and serves the verdict from a 30-second cache. Only502/503answers raise the failover signal while all other failures keep the existing payload unchanged; off by default and inert without configuration, anonymous callers never trigger a probe.Related Issues
Validation
npm run lint— touched files clean locally; the full run is red on the base (inherited, non-blocking, see Reviewer Notes)Tests Added Or Updated
tests/unit/monitoring-deep-health.test.ts(new, 10 tests: 502/503 set failover, 4xx/timeout/network stay fail-open, one-token request shape, TTL, anonymous never probed, flag-off inert, status intact, cached verdict identical).Coverage Notes
src/lib/monitoring/observability.ts(newprobeDeepHealthplus two timing constants) is covered by the probe unit tests across all status classes.src/app/api/monitoring/health/route.ts(additivedeepHealthkey on the full view only, own cache) is covered by the route gating tests including TTL double-serve.Reviewer Notes
failoveris informative only with no readers, the verdict never altersstatus, and the probe never throws and never logs bodies.DEEP_HEALTH_CHECK_ENABLEDstays undocumented (nofeatureFlagDefinitions.ts,FEATURE_FLAGS.md,.env.example, orENVIRONMENT.mdentry) until the settings phase activates?deep=1. Fail-open edge cases: flag off or parameter absent keeps the current path, anonymous plus?deep=1skips the probe, and refresh runs off the request path with an in-flight guard and 3-second timeout; touched files are clean (tsc0, ESLint 0) while API Route Typecheck stays red only onrerankProviderNodes.tsandantigravity.ts(TS2677 each, merge-base unchanged, lists identical to fix(proxies): classify refusal cause and hang, add bounded opt-in recovery pass #14233).release/v3.8.51fails the same 9 jobs (API Route Typecheck, Docs Gates, Fast Quality Gates, Merge integrity, ESLint, Unit fast-path 1-4/4); every file cited by the failing gates is outside this diff. Non-blocking for this PR.