Repository navigation
diag(daemon): expose key_root + path_remap state in depgraph_check log (#353) - #375
Merged
Merged
Conversation
#353) Issue #353 reports 0% hit rate in cross-runner `actions/cache@v4` scenarios despite #320's load-classifier fix shipping. Root cause is suspected to be one of: 1. The cross-runner case re-enters a different cold-classifier branch. 2. A code path embeds runner-specific state in cache keys. 3. Toolchain reinstall between runs shifts a hash input. The investigation chain in the issue text rules out (2) for the rustc binary (content hash, not absolute path; verified in `daemon/server/rustc.rs:76`) and filters env_vars to `CARGO_*` minus volatile-path variants. But the issue explicitly asks the maintainer to document `ZCCACHE_PATH_REMAP=auto`'s auto-detection contract — specifically, the silent-fallback case where the env var is set but `find_git_root` returns None. This PR makes that case visible. The `[DIAG] depgraph_check` log line now includes: key_root=<resolved-path-or-cwd-fallback> path_remap=<auto|auto_no_git|off> `auto_no_git` is the new tag: `ZCCACHE_PATH_REMAP=auto` was requested but `.git/` was not detected anywhere up the CWD ancestry, so `effective_compile_args` silently fell through without inserting `--remap-path-prefix`. Two runners that both think they're applying remap but disagree on whether git was found will produce divergent `key_root` values, divergent `context_key` hashes, and the `cold_skip` symptom #353 describes. Helper `diag_path_remap_state(client_env, worktree_root.is_some()) -> &str` lives in `daemon/server/keys.rs` next to `path_remap_auto_enabled` to keep handle_compile.rs under the 1500-LOC `loc_guard` cap. Acceptance criterion #3 from the issue (miss_reason in journal) was already shipped in #322; this PR adds the complementary human-readable diagnostic for log-grep bisection. With these two tags present, the cross-runner experiment in soldr's `cache-delta-experiment.yml` can diff the per-runner DIAG lines and say definitively whether the regression is (1) key drift or (2) load-side.
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.
Summary
Investigative diagnostic for issue #353 — cross-runner cache misses despite #337's load-classifier fix.
This PR does NOT speculatively change cache-key logic. It adds two new tags to the existing `[DIAG] depgraph_check` log line so the next experiment in soldr's `cache-delta-experiment.yml` can bisect the failure empirically rather than by guess.
New log fields
```
[DIAG] depgraph_check: -> ctx=<8hex> verdict= reason= key_root= path_remap=
```
Investigation summary (posted as issue comment)
`miss_reason` (acceptance criterion #3) is already shipped in 1.9.0 in `compile_journal` JSON entries (`context_not_found`, `input_fingerprint_mismatch`, `no_artifact_for_key`, `version_skew`, `uncacheable_input`, `unknown`).
How to use this for bisection
Re-run `cache-delta-experiment.yml` once this lands. Diff the two runners' `last-session.log`:
```bash
diff <(grep '[DIAG] depgraph_check' runner-a/last-session.log)
<(grep '[DIAG] depgraph_check' runner-b/last-session.log)
```
If `key_root=` matches and `path_remap=` matches but `ctx=` differs → cache-key derivation has a hidden runner-specific input (escalate to a focused unit test).
If `key_root=` differs → silent path-remap failure on one runner (likely `.git/` not detected); fix is to surface the failure as a hard error or have `find_git_root` walk more aggressively.
🤖 Generated with Claude Code