Log plugin version at startup (server.start)#29
Open
swarup-padhi-glean wants to merge 1 commit into
Open
Conversation
The glean-server.log had no way to tell which plugin build served a
session — only `tools-list.served` lines, no version. When debugging a
reported session you couldn't tell whether it ran current code or an
older bundle (the paste-back vs loopback auth flows, for instance).
Inject the manifest version into the bundle at build time (esbuild
`define`, read from the Claude manifest — all three manifests are kept
aligned by check-version-bump.sh) and emit one `server.start
{version, node, pid}` line as the first log line per process. Under
`tsx` dev runs the constant is absent and falls back to "dev".
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.
Why
glean-server.loghad no way to tell which plugin build served a session. The active log is just repeatedtools-list.servedlines with no version, so when debugging a reported session you can't tell whether it ran current code or an older bundle — e.g. the paste-back vs. loopback OAuth flows behave very differently, and there was no way to confirm which one a user actually hit.What
scripts/build.mjs): read the version from the Claude manifest (all three host manifests are kept aligned bycheck-version-bump.sh) and pass it to esbuild as adefineconstant__GLEAN_PLUGIN_VERSION__.server.startlog line (src/index.ts): emit one structured line as the first thing inmain()—server.start {version, node, pid}— so every session's log is traceable to the exact build, Node version, and process that served it.tsxdev runs the constant is absent; atypeofguard falls back to"dev"(noReferenceError).Verification
npm run build→__GLEAN_PLUGIN_VERSION__resolves to"0.2.36"indist/index.js; no leftover token.typeofguard yields"dev", no throw.npm run typecheckclean;npm test160/160 pass.Notes
Per-line session-id tagging and auth-flow logging are intentionally not in this PR — they come in a separate auth-logging PR. This change is deliberately minimal: one startup line, one build constant.