Repository navigation
fix(cli): resync zccache session on "unknown session:" wrapper error (#265) - #267
Merged
Merged
Conversation
…265) When the managed zccache daemon is killed mid-build (e.g. zccache-ci's stop hook on older zccache, Windows binary replacement, or AV quarantine), every subsequent wrapper invocation fails with `zccache error: unknown session: <uuid>` and the build dies. The Windows wrapper path now self-heals: it tees zccache's stderr while the child runs, scans for the `unknown session:` marker on failure, allocates a fresh session via `zccache session-start`, and retries the wrapper invocation exactly once with the new session id. On the retry's own failure the exit code is propagated unchanged. The Unix exec() path is intentionally left alone — once exec() replaces the wrapper process there is nowhere left to observe stderr or retry. A TODO references the issue for the future port. The original symptom in #265 is Windows-only. Refs forge-ci/zccache#166, forge-ci/zccache#167, forge-ci/zccache#168. Partially addresses #265 (Windows; integration test deferred). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
3 tasks
zackees
added a commit
to forge-ci/zccache
that referenced
this pull request
May 12, 2026
soldr 0.7.16 ships fix(cli): resync zccache session on "unknown session:" wrapper error (forge-ci/soldr#267) and bundles managed zccache 1.4.2 (forge-ci/soldr#270), which carries the idempotent client_session_end fix from this branch. Updates all setup-soldr@v0 invocations across workflows and the build-target composite action, plus the dev dependency in pyproject.toml. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
3 tasks
zackees
added a commit
to forge-ci/zccache
that referenced
this pull request
May 12, 2026
…hook perf (#172) * fix(cli): make client_session_end idempotent on vanished daemon The Windows Test job has been failing PR teardown with soldr: zccache session-end <uuid> failed: cannot connect to daemon at \.\pipe\zccache-...: I/O error: The system cannot find the file specified. (os error 2) ##[error]Process completed with exit code 1. even when every workspace test passed. Root cause: `client_session_end` is the in-process entry point that soldr's `rust-plan save` and the Python `ZccacheClient.session_end` binding call. It was the only session-end path that did NOT yet adopt the idempotency contract from #137 / #151 / #159 — connect-time `NotFound` on the named pipe was returned as a hard `Err(String)` rather than `Ok(None)`. The CLI subcommand was switched to `session_end_idempotent` in #163, but library callers were left on the old, non-idempotent path. Fix: collapse `client_session_end` to a thin String-error wrapper around `session_end_idempotent`. All callers (CLI, Python, soldr, future tools) now share one definition of "the daemon already died". Regression test `client_session_end_swallows_vanished_daemon` mirrors the existing `session_end_idempotent_swallows_vanished_daemon`: bind no listener, call with a fresh UUID, assert `Ok(None)`. Verification: `soldr cargo test -p zccache-cli --lib` — 4 / 4 relevant tests pass; `soldr cargo clippy -p zccache-cli --all-targets -D warnings` clean. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * ci(check): ignore soldr at-exit session-end teardown on vanished daemon The Windows Test job has been failing every PR teardown with soldr: zccache session-end <uuid> failed: cannot connect to daemon at \.\pipe\zccache-...: I/O error: The system cannot find the file specified. (os error 2) ##[error]Process completed with exit code 1. even after every workspace test passed. The bundled zccache 1.4.0 binary inside soldr 0.7.14 still uses the non-idempotent `client_session_end` (fixed at the source level in the prior commit on this branch). Source fix can't help in CI until soldr ships a new release bundling zccache 1.4.1+, which is out of band. Workflow-level workaround: after `cargo test`, if soldr exited non-zero, check the captured output. If cargo itself reported no failed tests AND the output contains exactly the soldr session-end teardown error, treat the run as success and emit a GitHub workflow warning. Other non-zero exits — real test failures, panics, build errors — still propagate unchanged. Targeted by: - "test result: FAILED" / "panicked at" must be absent (no real failure) - "soldr: zccache session-end .* failed: cannot connect to daemon" must be present (the specific teardown bug) Once soldr's bundled zccache picks up the idempotent `client_session_end`, this carve-out becomes dead code and can be removed. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * chore(release): bump workspace to 1.4.2 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * ci: bump GitHub Actions to Node 24 compatible versions GitHub deprecated Node 20 actions: they will be forced to Node 24 by June 2, 2026 and removed by Sept 16, 2026. - actions/checkout v4 -> v6 - actions/setup-python v5 -> v6 - actions/upload-artifact v4 -> v7 - actions/download-artifact v4 -> v8 - actions/cache v4 -> v5 - softprops/action-gh-release v2 -> v3 All targets verified to use `node24` runtime. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * ci(release): auto-trigger Auto-Release on workspace version bump Previously the release workflow only fired on tag push or workflow_dispatch. Merging "chore(release): bump workspace to X.Y.Z" to main did nothing — the operator had to remember to push a matching tag, which is how v1.4.1 shipped to main but never reached PyPI/crates.io. Add a `push: branches: [main]` trigger gated by a new detect-bump job: - workflow_dispatch: always proceeds (manual override) - push to main: only proceeds when Cargo.toml workspace version differs from the previous commit - tag push: proceeds unless the GitHub release already exists (avoids the duplicate run that publish-release creates by pushing the tag) When detect-bump returns should_release=false, preflight (and the rest of the chain via existing `needs` graph) skip cleanly with no failures. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * chore(deps): bump soldr from 0.7.14 to 0.7.16 soldr 0.7.16 ships fix(cli): resync zccache session on "unknown session:" wrapper error (forge-ci/soldr#267) and bundles managed zccache 1.4.2 (forge-ci/soldr#270), which carries the idempotent client_session_end fix from this branch. Updates all setup-soldr@v0 invocations across workflows and the build-target composite action, plus the dev dependency in pyproject.toml. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * perf(stop-hook): route every stage through soldr cargo zccache-ci's stages were a mix of toolchains: Full mode: lint -> uv run python -m ci.lint --fix (uses soldr cargo) cross-check -> cargo check --target musl ... (bare cargo) test -> cargo test ... (bare cargo) Quick mode: quick-check -> uv run cargo check ... (bare cargo via uv) soldr passes `--target <host triple>` to cargo, so its invocations land in `target/x86_64-pc-windows-msvc/debug/`. Bare cargo with no `--target` lands in `target/debug/`. The two trees don't share rlib/ rmeta artifacts — only the proc-macro/build-script subtree. Cold-cache bench in this branch showed `clippy --all-targets` populates both dirs in a single invocation (615MB to msvc, 522MB to debug for proc-macros). The downstream test stage then re-compiled the whole workspace from scratch because its `target/debug/` was missing the real rlibs. zccache showed a 0% hit rate for a normal stop-hook run. Switching every stage to `soldr cargo` consolidates to one target dir (`target/x86_64-pc-windows-msvc/debug/`) so clippy's artifacts are reused by test/check. zccache's rustc-wrapper cache also starts hitting. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
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
When the managed zccache daemon is killed mid-build (e.g. by a stop hook in the project being built, by Windows binary replacement, or by antivirus quarantine), every subsequent wrapper invocation fails with
zccache error: unknown session: <uuid>and the build dies. This change makes the Windows wrapper path self-heal: detect the marker in zccache's stderr, allocate a fresh session viazccache session-start, retry the wrapper invocation once, and propagate the exit code unchanged on second failure.Changes
crates/soldr-cli/src/main.rsrun_wrapper_through_zccache(Windows path): tee zccache stderr while waiting, scan forunknown session:, and retry once with a freshly-allocated session.stderr_indicates_unknown_sessionpure helper for testability.allocate_replacement_sessionhelper that runszccache session-start --stats --log <path> --journal <path>and returns the parsed session id.stderr_indicates_unknown_session(empty / matching / sibling-mention / utf-8 lossy / partial-marker).Scope / non-goals
exec()path is left intact — once exec replaces the process there is nowhere to retry. Tracked as a follow-up. The original symptom in Detect zccache "unknown session" and resync before failing the build #265 is Windows-only.Refs forge-ci/zccache#166, forge-ci/zccache#167, forge-ci/zccache#168.
Partially addresses #265 (Windows path; Unix follow-up and integration test tracked separately).
Test plan
cargo test -p soldr-cli(97 tests pass on MSVC)cargo fmt --all -- --checkcargo clippy -p soldr-cli --no-deps -- -D warningsGenerated with Claude Code