fix(scripts): inject GIT_SHA in dogfood-build.sh so provenance check passes#2996
Merged
code-yeongyu merged 2 commits intomainfrom May 4, 2026
Merged
fix(scripts): inject GIT_SHA in dogfood-build.sh so provenance check passes#2996code-yeongyu merged 2 commits intomainfrom
code-yeongyu merged 2 commits intomainfrom
Conversation
…passes
cargo build without GIT_SHA env var → option_env!("GIT_SHA") = None
→ version JSON returns git_sha:null → dogfood-build.sh fails its own
provenance check every time.
Fix: pass GIT_SHA=$(git rev-parse --short HEAD) to cargo build.
The script now:
1. Sets GIT_SHA to current HEAD before cargo build
2. Reads git_sha from the built binary
3. Compares against HEAD — fails if still null or mismatched
Also adds latency note: cargo run = ~1s overhead/invocation vs 7ms
for pre-built binary; pre-built is recommended for dogfood loops.
Closes the broken provenance check introduced in the initial
dogfood-build.sh commit.
…ation
Two gaps from Gaebal's 21:30 dogfood round:
1. cargo compile noise leaked to stderr during dogfood probes
2. real user config (~/.claw/settings.json) bled in via deprecation
warnings ("enabledPlugins") even for purely local introspection
Changes:
- Redirect cargo build stderr to /dev/null (-q flag + 2>/dev/null)
with a fallback re-run on failure so errors remain visible
- Document CLAW_CONFIG_HOME isolation pattern in script output:
CLAW_ISOLATED=$(mktemp -d)
CLAW_CONFIG_HOME=$CLAW_ISOLATED $CLAW <cmd> --output-format json
rm -rf $CLAW_ISOLATED
- With isolation: zero stderr lines for plugins list probe, pure
JSON stdout, no config warnings
Verified: exit 0, kind:plugin, 0 stderr lines, 0 sessions created.
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.
Problem
The
dogfood-build.shadded in #2995 fails its own provenance check every time becausecargo buildwithoutGIT_SHAenv var causesoption_env!("GIT_SHA")→None→version --output-format jsonreturnsgit_sha: null→ script exits 1.Root Cause
GIT_SHAmust be injected as an environment variable at build time — it's not read fromgitat runtime. The CI pipeline injects it; local builds don't.Fix
Pass
GIT_SHA=$(git rev-parse --short HEAD)tocargo buildin the script. The provenance check now passes on local builds.Verification
Also documents latency:
cargo run= ~1s overhead/invocation vs 7ms for pre-built binary.