Files
newgrok/patches/0001-Brand-fork-builds-in-version-output.patch
iceBear67 a968ad297c
CI / test (push) Canceled after 0s
CI / grok-linux-amd64 (push) Canceled after 0s
CI / grok-windows-amd64 (push) Canceled after 0s
CI / grok-macos-arm64 (push) Canceled after 0s
CI / release (push) Canceled after 0s
Update upstream to 5163763
Forward-port the six local patches onto the two new monorepo syncs
(SOURCE_REV e6a67a54 -> 84ae1223). Resolved 0001 against the runtime
full_version() injection and 0005 against the Option-wrapped
UserPromptSubmit hook payload.
2026-08-16 03:22:31 +00:00

67 lines
2.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: iceBear67 <icebear67@sfclub.cc>
Date: Fri, 14 Aug 2026 04:47:50 +0000
Subject: [PATCH] Brand fork builds in --version output
Adds FORK_NAME/fork_tag() to xai-grok-version and splices the tag into
the pager's version line, so a locally built binary reads
grok [newgrok] 1.0.3 (abc1234)
and is never mistaken for an official xAI release.
The tag is placed immediately after "grok " rather than appended,
because main.rs's version_output_writer_preserves_channel_aware_contract
test asserts the line still ends with the channel label (or ")").
[EXAMPLE PATCH] Demonstrates patching upstream Rust source. Safe to drop:
delete the patch file and run 'make apply'.
diff --git a/crates/codegen/xai-grok-pager-bin/src/main.rs b/crates/codegen/xai-grok-pager-bin/src/main.rs
index 29beeff904c352b1c4f029c972312a83521f44db..0a618cf1b6331e5d9699ea4c44a99ae081fcc1bf 100644
--- a/crates/codegen/xai-grok-pager-bin/src/main.rs
+++ b/crates/codegen/xai-grok-pager-bin/src/main.rs
@@ -1787,7 +1787,8 @@ fn install_heap_profile_hooks() {
}
fn version_text(channel_label: &str) -> String {
format!(
- "grok {}\n",
+ "grok {} {}\n",
+ xai_grok_version::fork_tag(),
xai_grok_version::display_version_with_commit(
xai_grok_version::full_version(),
channel_label,
diff --git a/crates/codegen/xai-grok-version/src/lib.rs b/crates/codegen/xai-grok-version/src/lib.rs
index b7d224fc92d5e25ba5dae888fb60335c3c0933ad..200d31e3d27e71bae5537ad93e210cbfd86adc3e 100644
--- a/crates/codegen/xai-grok-version/src/lib.rs
+++ b/crates/codegen/xai-grok-version/src/lib.rs
@@ -11,6 +11,15 @@ pub const VERSION: &str = match option_env!("GROK_VERSION") {
None => env!("CARGO_PKG_VERSION"),
};
+/// Name of this downstream fork. Builds from this tree are not official xAI
+/// releases, so every user-facing version line carries the tag below.
+pub const FORK_NAME: &str = "newgrok";
+
+/// Bracketed fork marker for version output, e.g. `"[newgrok]"`.
+pub fn fork_tag() -> String {
+ format!("[{FORK_NAME}]")
+}
+
/// Runtime-injected `"<version> (<shortcommit>)"` string. Only the release
/// binary stamps the commit hash in its own build.rs and injects it here at
/// startup, so the big lib crates don't recompile on every commit.
@@ -100,4 +109,12 @@ mod tests {
set_full_version("second (bbbbbbb)");
assert_eq!(full_version(), "first (aaaaaaa)");
}
+
+ /// The fork marker must stay non-empty and bracketed -- the pager splices it
+ /// into `--version` output, whose format test asserts the surrounding shape.
+ #[test]
+ fn test_fork_tag_is_bracketed_fork_name() {
+ assert!(!FORK_NAME.is_empty());
+ assert_eq!(fork_tag(), format!("[{FORK_NAME}]"));
+ }
}