Repository navigation
Description
Problem
scripts/install_release.sh computes the git hash after cargo build, and uses it only to name the install directory:
Nothing passes that hash into the build. crates/jcode-build-meta/build.rs deliberately does not declare .git/HEAD as a rerun-if-changed input, and that decision is correct and well-documented (watching it turns routine git activity into a full-tree recompile). The consequence is that an incremental build reuses whatever hash was baked in last time.
So the script installs a binary containing new code into versions/<new-hash>/ while that binary reports the old hash from --version.
Observed while upgrading v0.67.1 → v0.68.0:
$ readlink -f ~/.jcode/builds/current/jcode
/home/user/.jcode/builds/versions/8bda2ebc9/jcode # named for the new commit
$ ~/.jcode/builds/current/jcode --version
jcode v0.68.0-dev (fcf53909f) # reports the PREVIOUS commit
The binary genuinely contained the new code (confirmed with strings), but nothing about its self-reported identity said so.
This matters more than a cosmetic version string, because it breaks the one verification step AGENTS.md prescribes:
cargo buildalone proves nothing about behavior. ... Confirm which binary you are actually inspecting.
Checking jcode --version after a self-dev install is precisely the recommended check, and it silently reports the wrong thing. "Is my change actually in this binary?" becomes unanswerable without resorting to strings on the artifact. For an agent doing self-dev work this is an actively misleading feedback loop: it can conclude an install failed when it succeeded, and rebuild in circles.
The build.rs comment anticipates the cosmetic case:
For ordinary dev builds the embedded git hash/dirty flag may lag the very latest commit within a session; that is a cosmetic
--versiondetail and an acceptable trade for keeping incremental builds incremental.
That trade is right for ordinary dev builds. It is not right for the install path, which is exactly where identity gets consumed. Note the in-app updater (update.rs::build_from_source) already sets JCODE_RELEASE_BUILD=1 for its build; only the manual install script omits the metadata vars.
Expected behavior
- A binary installed at
versions/<hash>/reports<hash>from--version. - Verifying an upgrade via
jcode --versionmeasures the binary that was just built.
Fix
- Resolve the git identity before
cargo buildand pass it viaJCODE_BUILD_GIT_HASH/JCODE_BUILD_GIT_DATE/JCODE_BUILD_GIT_DIRTY. These are already declaredrerun-if-env-changedinbuild.rs, so this forces exactly the metadata refresh needed without reintroducing the full-tree rebuild that watching.git/HEADcaused. - After building, assert the binary's
--versioncontains the expected commit, and refuse to install if not. A binary that misreports its own identity should fail loudly rather than get installed.
Deliberately not setting JCODE_RELEASE_BUILD: that would relabel a local source install as a release build and drop the -dev suffix, which is a different claim than "installed from a local source tree".
Affected file:
scripts/install_release.sh
Verified locally: --version now tracks HEAD exactly across successive installs, including the -dirty case. Happy to open a PR.
Activity
MatrixMagician commentedon Aug 5, 2026
The installer fix is on the same branch as #798, since both bugs surfaced from one upgrade:
https://github.com/MatrixMagician/jcode/tree/fix/sidecar-haiku-model-id
Compare view against upstream master:
master...MatrixMagician:jcode:fix/sidecar-haiku-model-id
scripts/install_release.sh(+49/-12), rebased onto current master. See the comment on #798 for why I could not open the PR directly.Verified by observing
--versionmove from a stale hash to exactly HEAD across successive installs, including the-dirtycase. Before the fix, the binary installed atversions/8bda2ebc9/reportedfcf53909f.1jehuang commentedon Aug 9, 2026
Implemented an independent fix in PR #863. The installer now supplies current git metadata to the build and rejects a binary whose reported identity is stale. Bash syntax checks and a regression covering dirty builds and stale-metadata rejection pass.
--- — Jcode agent (automated triage), on behalf of @1jehuang
fix: refresh installed binary git metadata (fixes 1jehuang#799)
chore: sync fork with upstream jcode (fresh merge onto current master) (
fix: refresh installed binary git metadata (fixes 1jehuang#799)
fix: refresh installed binary git metadata (fixes 1jehuang#799)
fix: refresh installed binary git metadata (fixes 1jehuang#799)
fix: refresh installed binary git metadata (fixes 1jehuang#799)
fix: refresh installed binary git metadata (fixes 1jehuang#799)
fix: refresh installed binary git metadata (fixes 1jehuang#799)
fix(build-meta): preserve channel segment in runtime parse_release_se…
fix(build-meta): preserve channel segment in build-time and runtime v…