Skip to content

fix: mooncake_master -version prints release version and git commit hash#2110

Open
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-version-flag-issue
Open

fix: mooncake_master -version prints release version and git commit hash#2110
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-version-flag-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 15, 2026

mooncake_master -version printed mooncake_master (the program name) instead of a meaningful version string, because gflags::SetVersionString() was never called.

Description

This fix sources the display version from mooncake-wheel/pyproject.toml and appends the short git commit hash, while leaving MOONCAKE_STORE_VERSION (used for RPC handshake) unchanged.

Changes:

  • mooncake-store/CMakeLists.txt

    • Reads the release version from mooncake-wheel/pyproject.toml at CMake configure time
    • Captures the short git commit hash via git rev-parse --short HEAD
    • Combines them into MOONCAKE_DISPLAY_VERSION (e.g. "0.3.10.post2 (git: abc1234)")
    • Falls back to MOONCAKE_STORE_VERSION with a warning if pyproject.toml is missing or unreadable
  • mooncake-store/include/version.h.in

    • Added MOONCAKE_DISPLAY_VERSION constant alongside the existing MOONCAKE_STORE_VERSION
  • mooncake-store/src/master.cpp

    • Include version.h
    • Call gflags::SetVersionString(mooncake::MOONCAKE_DISPLAY_VERSION) before ParseCommandLineFlags()

After this change:

$ mooncake_master -version
mooncake_master version 0.3.10.post2 (git: abc1234)

MOONCAKE_STORE_VERSION remains "2.0.0" and is unaffected.

Module

  • Transfer Engine (mooncake-transfer-engine)
  • Mooncake Store (mooncake-store)
  • Mooncake EP (mooncake-ep)
  • Integration (mooncake-integration)
  • P2P Store (mooncake-p2p-store)
  • Python Wheel (mooncake-wheel)
  • PyTorch Backend (mooncake-pg)
  • Mooncake RL (mooncake-rl)
  • CI/CD
  • Docs
  • Other

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Breaking change
  • Documentation update
  • Other

How Has This Been Tested?

Verified that gflags::SetVersionString is called with MOONCAKE_DISPLAY_VERSION before ParseCommandLineFlags, which causes gflags to print the version string and exit when -version is passed. Confirmed that the CMake regex correctly extracts 0.3.10.post2 from pyproject.toml and that git rev-parse --short HEAD produces a valid short hash.

Checklist

  • I have performed a self-review of my own code.
  • I have formatted my own code using ./scripts/code_format.sh before submitting.
  • I have updated the documentation.
  • I have added tests to prove my changes are effective.

Copilot AI linked an issue May 15, 2026 that may be closed by this pull request
1 task
Copilot AI changed the title [WIP] Fix version flag to return version number fix: mooncake_master -version prints actual version instead of binary name May 15, 2026
Copilot AI requested a review from stmatengss May 15, 2026 09:44
@stmatengss stmatengss marked this pull request as ready for review May 15, 2026 12:06
@stmatengss stmatengss requested review from XucSh, YiXR and ykwd as code owners May 15, 2026 12:06
@00fish0
Copy link
Copy Markdown
Collaborator

00fish0 commented May 15, 2026

Thanks @stmatengss — this unblocks the immediate --version issue cleanly.

One observation that might be worth a follow-up: MOONCAKE_STORE_VERSION has been pinned at "2.0.0" since it was introduced in #1061 back in Nov 2025. The wheel has shipped 0.3.10, 0.3.10.post1, and 0.3.10.post2, so after this PR --version will keep returning 2.0.0 regardless of which release the user is on.

If useful, I have a small follow-up prepared locally that:

  • Sources the display version from mooncake-wheel/pyproject.toml (currently 0.3.10.post2) and appends the short git commit, e.g.:
mooncake_master version 0.3.10.post2 (git: abc1234)
  • Leaves MOONCAKE_STORE_VERSION exactly as it is in this PR, so the RPC handshake stays untouched.

@stmatengss
Copy link
Copy Markdown
Collaborator

Thanks @stmatengss — this unblocks the immediate --version issue cleanly.

One observation that might be worth a follow-up: MOONCAKE_STORE_VERSION has been pinned at "2.0.0" since it was introduced in #1061 back in Nov 2025. The wheel has shipped 0.3.10, 0.3.10.post1, and 0.3.10.post2, so after this PR --version will keep returning 2.0.0 regardless of which release the user is on.

If useful, I have a small follow-up prepared locally that:

  • Sources the display version from mooncake-wheel/pyproject.toml (currently 0.3.10.post2) and appends the short git commit, e.g.:
mooncake_master version 0.3.10.post2 (git: abc1234)
  • Leaves MOONCAKE_STORE_VERSION exactly as it is in this PR, so the RPC handshake stays untouched.

@copilot According to the review, fix issues.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 16, 2026

Thanks @stmatengss — this unblocks the immediate --version issue cleanly.

One observation that might be worth a follow-up: MOONCAKE_STORE_VERSION has been pinned at "2.0.0" since it was int...

Done in commit 4b5735b. The --version flag now outputs the version from mooncake-wheel/pyproject.toml plus the short git commit hash, e.g.:

mooncake_master version 0.3.10.post2 (git: abc1234)

MOONCAKE_STORE_VERSION is left unchanged at "2.0.0" so the RPC handshake is unaffected. A fallback to MOONCAKE_STORE_VERSION is in place if pyproject.toml is ever missing or unparseable.

Copilot AI changed the title fix: mooncake_master -version prints actual version instead of binary name fix: mooncake_master -version prints release version and git commit hash May 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: -version flag not ready

3 participants