-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix: prevent stale agent_version in Docker gateway deployments (#6150) #6289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12378,9 +12378,19 @@ def handle_get(handler, parsed) -> bool: | |
| # Inject the running version so the UI badge stays in sync with git tags | ||
| # without any manual release step. | ||
| try: | ||
| from api.updates import AGENT_VERSION, WEBUI_VERSION | ||
| from api.updates import ( | ||
| AGENT_VERSION, | ||
| WEBUI_VERSION, | ||
| _detect_agent_version_from_gateway_health, | ||
| ) | ||
| settings["webui_version"] = WEBUI_VERSION | ||
| settings["agent_version"] = AGENT_VERSION | ||
| # Prefer live gateway health detection so Docker gateway | ||
| # deployments always show the actual running Agent version | ||
| # even when the import-time AGENT_VERSION is stale (#6150). | ||
| settings["agent_version"] = ( | ||
| _detect_agent_version_from_gateway_health(timeout=2.0) | ||
| or AGENT_VERSION | ||
| ) | ||
|
Comment on lines
+12390
to
+12393
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| except Exception: | ||
| pass | ||
| # Channel-scoped display badge — SEPARATE from webui_version (which is | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_detect_agent_version_from_gateway_healthis a module-private helper (leading underscore convention). Importing it directly intoroutes.pycouples the route handler to an internal implementation detail ofupdates.py. If the function is later renamed, inlined, or replaced with a cached variant,routes.pywill silently break at runtime (the surroundingexcept Exception: passwill swallow theImportError). Consider promoting a thin public wrapper — e.g.get_live_agent_version()— inupdates.pythatroutes.pycan import by stable name.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!