Repository navigation
fix(daemon,ci): tolerate unknown sessions and stop killing soldr's daemon (closes #166, #167) - #168
Merged
Conversation
…emon (closes #166, #167) Two coupled fixes for the same conflict: #167 (root cause): zccache-ci's `kill_daemon()` ran at every stop-hook startup and took down the soldr-managed daemon mid-build, severing the session soldr had just allocated. None of the current stop-hook stages (check/clippy/test --exclude zccache-daemon) actually rebuild `zccache-daemon.exe`, so the kill was never necessary on this path. Drop the unconditional call; keep `reap_orphan_daemons` since that only touches daemons whose parent PID is already gone. Doc-comment on the still-public `kill_daemon` now warns future callers. #166 (defensive): the daemon's Compile handler short-circuited with `Response::Error { "unknown session: <uuid>" }` if the session map didn't know the UUID — exactly the failure mode triggered after a kill. Mirror PR #137's idempotent SessionEnd fix: drop the gate and let the compile proceed. `record_session_stat`, `sessions.touch`, and `session_client_pid` already no-op on unknown sessions, so the only loss is per-session statistics — never a build failure. Regression test `cli_compile_unknown_uuid_is_idempotent` (mirrors `cli_session_end_unknown_uuid_is_idempotent`): sends Compile with a well-formed-but-unknown UUID and asserts the response is not an "unknown session" error. Verification: workspace check + clippy + fmt clean; daemon `--lib` tests 148 pass / 10 ignored; zccache-ci `--lib` tests 10 pass; new regression test passes under `--include-ignored`. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This was referenced May 11, 2026
Merged
zackees
added a commit
to forge-ci/soldr
that referenced
this pull request
May 11, 2026
…265) (#267) 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]>
zackees
added a commit
that referenced
this pull request
May 11, 2026
Patch bump covering everything merged since v1.4.0: - fix(daemon,ci): tolerate unknown sessions and stop killing soldr's daemon (#168, closes #166 + #167) - feat(cli): expose session_end_idempotent for all daemon callers (#163) - fix(daemon): deterministic flush primitive for event log (#162) - feat(cli,daemon): relocate daemon exe to global runtime-binaries dir (#158) - fix(depgraph): normalize workspace-path inputs out of rustc cache key (#160) - perf(ci): trim platform Test, drop --all-targets from Check, split Test/Check jobs (#161, #164, #165) - chore(ci): drop invalid target-cache-paths from build-target action (#157) 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
Two coupled fixes for the soldr/zccache daemon-restart conflict surfaced in #166 and #167.
crates/zccache-ci/src/main.rs: drop the unconditionalkill_daemon()at stop-hook startup. Every stage today iscargo check/clippy/cargo test --exclude zccache-daemon; none rebuildzccache-daemon.exe, so killing the daemon was unnecessary and actively broke soldr's session.crates/zccache-daemon/src/server.rs: the Compile handler returned a hardResponse::Error { \"unknown session: <uuid>\" }for unknown sessions. Mirror PR fix(daemon): make session-end idempotent for unknown UUIDs #137's idempotent SessionEnd fix and let the compile proceed;record_session_stat/touch/session_client_pidalready no-op on unknown sessions, so only per-session stats are lost — never the build itself.Why both at once
They're the same bug viewed from opposite ends:
kill_daemon()(in zccache-ci: kill_daemon disrupts soldr-managed daemon mid-build (root cause for #166) #167) is the trigger.handle_compile(in daemon: make Compile path idempotent for unknown sessions (mirror #137) #166) is the failure mode that made the trigger fatal.Fixing only #167 leaves the next caller that legitimately needs to kill the daemon (Windows binary replacement, antivirus quarantine, OS restart) producing the same crash. Fixing only #166 leaves zccache-ci silently nuking soldr's session every stop hook and cold-compiling the world. Together they make stop-hook behaviour both correct and resilient.
Changes
crates/zccache-ci/src/main.rskill_daemon()from startup; keepreap_orphan_daemons(). Update surrounding comment. Drop the now-unusedkill_daemonimport.crates/zccache-ci/src/lib.rskill_daemondoc comment with a WARNING pointing at #167. Function itself unchanged — still public and tested.crates/zccache-daemon/src/server.rshandle_compilewith an explanatory comment. Add regression testcli_compile_unknown_uuid_is_idempotentmirroring the existingcli_session_end_unknown_uuid_is_idempotentpattern.Net: +80 / -14 across 3 files.
Verification (local, Windows)
soldr cargo check --workspace --all-targets— passsoldr cargo clippy --workspace --all-targets -- -D warnings— passsoldr cargo fmt --all --check— cleansoldr cargo test -p zccache-daemon --lib— 148 pass / 0 fail / 10 ignoredsoldr cargo test -p zccache-daemon --lib -- cli_compile_unknown_uuid_is_idempotent --include-ignored— passsoldr cargo test -p zccache-ci --lib— 10 pass / 0 failTest plan
zccache-daemonandzccache-cilibrary tests passcli_compile_unknown_uuid_is_idempotenttest (covered bycargo test --workspace) passes when#[ignore]tests are executedunknown session: <uuid>failures fromrustc -vVprobesRelated