feat(cli): show forge binary/runtime version on the startup banner (#335)#336
Merged
Conversation
#335) The startup banner printed the AGENT's forge.yaml version but not the forge binary that's running it, making it hard to tell which runtime (v0.17.0 / a vnext or dev build / a local build) is executing a deployed agent. The build version already exists (-X main.version/.commit) and is threaded to the runner as RuntimeVersion; commit was baked only into the --version template. - root.go: store commit in appCommit (was discarded after the template). - run.go: pass RuntimeCommit alongside RuntimeVersion. - runner.go: add RunnerConfig.RuntimeCommit + a 'Forge:' banner line via forgeVersionString() — 'v0.17.0 (commit: 51df9a4)', degrading to just the version for dev builds / no baked commit. Agent: my-agent (v1.2.0) # agent's forge.yaml version Forge: v0.17.0 (commit: …) # the forge binary — new --version output is unchanged. forgeVersionString covered by a table test.
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.
Closes #335.
Problem
The startup banner printed the agent's
forge.yamlversion but never the forge binary running it, so it was hard to tell which runtime (v0.17.0, avnext/dev build, or a locally-built binary) was executing a deployed agent. The build version already existed (-X main.version/-X main.commitvia the Makefile + goreleaser) and was threaded to the runner asRuntimeVersion— it just wasn't shown;commitwas baked only into the--versiontemplate.Change
root.go— storecommitinappCommit(was discarded after building the version template).run.go— passRuntimeCommitalongside the existingRuntimeVersion: appVersion.runner.go— addRunnerConfig.RuntimeCommit+ aForge:banner line viaforgeVersionString().Degradation: a dev build / no baked commit shows just the version (
dev,v0.17.0); thenonesentinel and empty commit suppress the(commit: …)suffix.forge --versionoutput is unchanged.Verification
forgeVersionString()covered by a table test (release+commit, release no-commit, empty commit, dev defaults, empty version →dev, empty version + real commit).-ldflags "-X main.version=v0.17.0 -X main.commit=abc1234"→forge --version→forge v0.17.0 (commit: abc1234)(unchanged).Fprintfinserted right after the existingAgent:line;gofmt+golangci-lintclean,go build ./...green.