Repository navigation
fix(langchain): recognise is_healthy in health tool status normalization - #5885
Open
varun-projects wants to merge 1 commit into
Open
varun-projects wants to merge 1 commit into
varun-projects wants to merge 1 commit into
Conversation
The observer system-status result serializes its top-level health flag as
is_healthy, and SyncHTTPClient.get_status() returns that result unchanged.
The viking_health tool prefers get_status() over is_healthy(), but its
normalizer only inspected the boolean keys healthy and ok before falling
back to string status/state fields, so the SDK shape matched nothing.
Before this change, {"is_healthy": true, "errors": [], "components": {}}
produced state "unknown" and healthy false, and the safe summary omitted
the flag entirely. Now the same response produces state "healthy" and
healthy true, is_healthy false produces state "unhealthy" and healthy
false, and the summary reports the flag. The key is checked after healthy
and ok, so responses carrying the already recognised healthy, ok, status
or state fields keep their existing precedence, and the summary stays
restricted to the safe field allowlist.
This branch has not been deployed
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.
Description
The LangChain
viking_healthtool reportedstate: "unknown"andhealthy: falsefor ahealthy backend. The observer system-status result serializes its top-level health flag as
is_healthy, andSyncHTTPClient.get_status()returns that result dict unchanged. The toolprefers
get_status()overis_healthy(), but_infer_health_stateonly inspected theboolean keys
healthyandokbefore falling back to stringstatus/statefields, so theSDK's shape matched nothing and fell through to
"unknown". The safe summary also omitted thecanonical flag.
This teaches the existing normalizer about
is_healthyrather than adding a parallel codepath. The key is appended after
healthyandok, so responses carrying the alreadyrecognized
healthy,ok,status, orstatefields keep their current precedence. Thesummary keeps its restricted field allowlist; raw
componentsanderrorsvalues are stillnever exposed, only the existing
component_count.This is an adapter compatibility fix for the existing response field, not a change to server
health computation or observer authorization.
The issue was reproduced before fixing, not inferred from code alone: a scripted repro using
the issue's own
InMemoryOpenVikingClientsubclass returnedstate: "unknown",healthy: false, andsummary: {"type": "dict"}for{"is_healthy": true, "errors": [], "components": {}}. Reproduction was at theadapter/SDK-response level; it does not exercise a deployed OpenViking server, model service,
or authentication configuration.
Human Involvement
Related Issue
Fixes #5876
Type of Change
Changes Made
_infer_health_statenow recognizesis_healthyas a boolean health key, checked after theexisting
healthyandokkeys so current precedence is preserved._safe_status_summaryaddsis_healthyto its safe-field allowlist so the canonical flagreaches the model-facing summary; the allowlist remains otherwise unchanged.
tests/unit/test_langchain_integration.pyforis_healthy: true,is_healthy: false, andthe
healthy: false+is_healthy: trueprecedence case, asserting the summary stillexcludes
componentsanderrors.Testing
Validated with the same commands as the repository's own
langchain-testsCI job, afteruv pip install -e sdk/pythonanduv pip install -e "examples/langchain[langgraph,test,dev]":The same suite on this branch's unmodified base gives 206 passed; the difference is the three
parametrized cases added here.
Before and after the change, verified with a temporary reproduction script: before,
is_healthy: trueyieldedunknown/falsewithsummary: {"type": "dict"}; after, ityields
healthy/truewithsummary: {"is_healthy": true},is_healthy: falseyieldsunhealthy/false, and{"healthy": false, "is_healthy": true}still resolves viahealthyto
unhealthy/false.Checklist
Additional Notes
Scope is deliberately minimal: two tuple entries in the existing health normalizer plus test
coverage. No new helper, no new configuration surface. No user-facing documentation describes
the health tool's status-key handling, so no docs change was needed.