Skip to content

Log plugin version at startup (server.start)#29

Open
swarup-padhi-glean wants to merge 1 commit into
mainfrom
swarup/plugin-version-logging
Open

Log plugin version at startup (server.start)#29
swarup-padhi-glean wants to merge 1 commit into
mainfrom
swarup/plugin-version-logging

Conversation

@swarup-padhi-glean

Copy link
Copy Markdown
Contributor

Why

glean-server.log had no way to tell which plugin build served a session. The active log is just repeated tools-list.served lines 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

  • Build-time version injection (scripts/build.mjs): read the version from the Claude manifest (all three host manifests are kept aligned by check-version-bump.sh) and pass it to esbuild as a define constant __GLEAN_PLUGIN_VERSION__.
  • server.start log line (src/index.ts): emit one structured line as the first thing in main()server.start {version, node, pid} — so every session's log is traceable to the exact build, Node version, and process that served it.
  • Under tsx dev runs the constant is absent; a typeof guard falls back to "dev" (no ReferenceError).

Verification

  • npm run build__GLEAN_PLUGIN_VERSION__ resolves to "0.2.36" in dist/index.js; no leftover token.
  • Dev fallback proven: typeof guard yields "dev", no throw.
  • npm run typecheck clean; npm test 160/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.

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".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant