Repository navigation
Description
trinity_version is read from GIT_COMMIT_SHORT, an environment variable this repo never sets. Both call sites therefore fall through to the "unknown" default on every install, always — so the field carries no information and silently misleads anyone reading it.
Where
src/backend/services/operator_intake_service.py:219
"trinity_version": os.getenv("GIT_COMMIT_SHORT", "unknown"),
src/backend/routers/agent_data.py:302
"trinity_version": os.getenv("GIT_COMMIT_SHORT", "unknown"),
grep -rn GIT_COMMIT_SHORT . over the whole repo returns exactly those two lines. There is no ARG, no ENV, no compose build.args entry, no start.sh export that sets it. The platform's real version env var is VERSION (build-stamped and wired through docker-compose backend.build.args + start.sh, per the comment at main.py:1860), plus the VERSION file.
Why it matters
- Every operator-intake notice reports
Trinity version: unknown. A reader naturally infers something about that install — pre-release build, broken version endpoint, install that cannot phone home. All of those inferences are false: the value is the same constant for every install, healthy or not. The field looks like a signal and is not one. - ent#466 (presence heartbeat) is specified on top of this field, describing it as
// existing (GIT_COMMIT_SHORT / /api/version). Built as written, a new default-on telemetry stream inherits a constant"unknown"and the defect gets harder to see. - The export payload at
agent_data.py:302has the same hole.
The helper already exists
src/backend/utils/app_version.py::resolve_release_version() was written for exactly this (ent#437): VERSION env var with any +g<sha> build suffix stripped, then /app/VERSION, then the repo-root VERSION file, and "unknown" only as a genuine last resort.
Its module docstring also rules out the variable these two call sites are reaching for: "The telemetry aggregate must carry the RELEASE version — never the commit SHA. Version-adoption timing is a join key: a per-commit value re-links the anonymous share stream to the identified presence/intake streams." So GIT_COMMIT_SHORT is both unset and the wrong thing to want.
Suggested fix
Replace both os.getenv("GIT_COMMIT_SHORT", "unknown") calls with resolve_release_version(). Two one-line changes against an existing, tested helper.
Note the operator-intake payload is an identified stream, so the anonymity argument in that docstring is weaker here than for the share stream — but the release version is still the right value and the SHA is still the wrong one.
Acceptance criteria
- Both call sites resolve the version through
utils/app_version.resolve_release_version(). - An operator-intake notice from a tagged release build reports that release version, not
"unknown". - A test pins that
"unknown"appears only when noVERSIONenv var and noVERSIONfile can be read — so a regression to an unset variable fails CI. - Either
GIT_COMMIT_SHORTis gone from the tree, or something sets it. - ent#466 is updated so its payload spec no longer cites
GIT_COMMIT_SHORT.
Not claimed
I have not checked whether any downstream consumer already treats trinity_version as unreliable, and I have not read the enterprise submodule for other readers of the same variable.
Found while triaging why three fresh self-hosted installs all reported Trinity version: unknown — the answer is that every install does.
Activity