feat(broker): align reported version with product release line#911
feat(broker): align reported version with product release line#911willwashburn wants to merge 2 commits into
Conversation
The broker previously reported its Cargo crate version (3.0.0) in health/session/telemetry payloads even when shipped inside agent-relay 6.x, making install debugging and telemetry confusing. - Add util::version::broker_version() that reads AGENT_RELAY_VERSION at compile time and falls back to CARGO_PKG_VERSION for dev builds. - Route all listen_api, telemetry, and swarm version reporting through the helper and expose --version on the CLI. - Pass AGENT_RELAY_VERSION through publish, build-broker-binary, and package-validation workflows (plus Cross.toml for aarch64 musl), and fail validation if the binary does not report the release version. Closes #904 https://claude.ai/code/session_01Cs6t4GfxUHbnptziCekJAR
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a compile-time AGENT_RELAY_VERSION injected by CI/cross builds; introduces util::version BROKER_VERSION and broker_version(); updates CLI, /health, swarm handshake, and telemetry to use broker_version(); package-validation ensures the built binary reports the expected product version. ChangesBroker version alignment with product releases
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/package-validation.yml:
- Line 274: Remove the undefined needs.build output reference by deleting the
AGENT_RELAY_VERSION environment variable assignment that uses ${{
needs.build.outputs.new_version }} in the standalone-macos-smoke job; keep the
job's needs: changes declaration as-is and rely on the existing run-step
fallback that reads the version from package.json instead of referencing
needs.build.outputs.new_version.
In `@crates/broker/src/util/version.rs`:
- Around line 11-13: The BROKER_VERSION const currently accepts an empty
AGENT_RELAY_VERSION string; change the match so an empty string is treated like
None and falls back to env!("CARGO_PKG_VERSION"). Update the match on
option_env!("AGENT_RELAY_VERSION") (or wrap it in a small const fn) so that you
only return Some(v) when v is non-empty (e.g., treat Some(v) with v == "" as the
None branch), otherwise return env!("CARGO_PKG_VERSION"); reference
BROKER_VERSION, option_env!("AGENT_RELAY_VERSION") and env!("CARGO_PKG_VERSION")
when making the change.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 5a64de0e-ba35-4352-87a3-77ad9d0f86c7
📒 Files selected for processing (10)
.github/workflows/build-broker-binary.yml.github/workflows/package-validation.yml.github/workflows/publish.ymlCross.tomlcrates/broker/src/cli/mod.rscrates/broker/src/listen_api.rscrates/broker/src/swarm.rscrates/broker/src/telemetry.rscrates/broker/src/util/mod.rscrates/broker/src/util/version.rs
- Drop dead `needs.build.outputs.new_version` reference in package-validation.yml; standalone-macos-smoke only `needs: changes`, so the expression was always empty. Read package.json directly. - Treat an empty `AGENT_RELAY_VERSION` env var as unset so a stray unresolved CI expression cannot surface as an empty broker version string; fall back to CARGO_PKG_VERSION instead. https://claude.ai/code/session_01Cs6t4GfxUHbnptziCekJAR
Closes #904.
Summary
The Rust broker crate previously reported its Cargo package version (
3.0.0) in health, session, and telemetry payloads — even when shipped inside anagent-relay/@agent-relay/sdk6.x release. That made install/support debugging and telemetry filtering confusing.This PR embeds the product release-line version into the broker at compile time, keeping the Cargo crate version as a developer-build fallback rather than the source of truth.
Changes
crates/broker/src/util/version.rsexposing aBROKER_VERSIONconst andbroker_version()accessor, backed byoption_env!("AGENT_RELAY_VERSION")withCARGO_PKG_VERSIONas the fallback.env!("CARGO_PKG_VERSION")call inlisten_api.rs(health +/api/config),telemetry.rs, andswarm.rswith the helper.--versiononagent-relay-brokerso packagers / smoke tests can verify the shipped version.AGENT_RELAY_VERSIONthroughpublish.yml(thebuild-brokerjob nowneeds: buildso it can readneeds.build.outputs.new_version),build-broker-binary.yml(uses the dispatch tag orpackage.jsonversion), andpackage-validation.yml(now fails ifbroker --versiondoes not matchpackage.json).Cross.tomlpassthrough updated so the env var reaches the aarch64-musl cross container.Acceptance criteria from #904
agent-relay/@agent-relay/sdkrelease that shipped them (workflow setsAGENT_RELAY_VERSIONfromneeds.build.outputs.new_version).cargo build --bin agent-relay-brokerstill reports a reasonable fallback (CARGO_PKG_VERSION)./api/config, health/session, and telemetry use one helper instead of directenv!calls.package-validation.ymlverifiesbroker --versionmatches the release version.Test plan
cargo test -p agent-relay-broker --lib— 625 existing + 2 new tests pass.cargo clippy -p agent-relay-broker --bin agent-relay-broker -- -D warningsclean.AGENT_RELAY_VERSION=6.2.99 cargo build→agent-relay-broker --versionreports6.2.99; plaincargo buildreports3.0.0(the crate fallback).https://claude.ai/code/session_01Cs6t4GfxUHbnptziCekJAR
Generated by Claude Code