Skip to content

fix(skills): close RL rerank warmup TOCTOU and add test coverage#5850

Merged
bug-ops merged 1 commit into
mainfrom
fix/5845-rl-rerank-coverage-toctou
Jul 6, 2026
Merged

fix(skills): close RL rerank warmup TOCTOU and add test coverage#5850
bug-ops merged 1 commit into
mainfrom
fix/5845-rl-rerank-coverage-toctou

Conversation

@bug-ops

@bug-ops bug-ops commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • RoutingHead::rerank() (crates/zeph-skills/src/rl_head.rs) now returns a RerankOutcome { ranked, blended, update_count } capturing blended/update_count under the same lock acquisition used to rank candidates, closing a narrow TOCTOU where the assembly.rs positive-confirmation log (added in RL rerank scoring has no positive-confirmation log, blocking live cross-backend parity verification #5834) computed those values via a second, independently-locked update_count() call that could race with a concurrent background rl_head.update().
  • Added the RL-rerank branch's first automated test coverage: Agent::with_rl_head() (previously zero callers anywhere) is now exercised via a new zeph-core test harness covering match_and_rank_skills' success path and all three skip/error paths, plus an rl_head.rs test constructing a case where cosine order and RL-blended order disagree.

Closes #5845, closes #5846.

Test plan

  • cargo +nightly fmt --check
  • cargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warnings
  • cargo nextest run --config-file .github/nextest.toml --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins (12372 passed)
  • RUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace --features "desktop,ide,server,chat,pdf,scheduler"
  • cargo test --doc --workspace --features "desktop,ide,server,chat,pdf,scheduler"

RoutingHead::rerank() now returns a RerankOutcome capturing blended
and update_count under the same lock acquisition used to rank
candidates, so the assembly.rs call site no longer needs a second,
independently-locked update_count() call that could race with a
concurrent background rl_head.update().

Also adds the RL-rerank branch's first automated test coverage:
match_and_rank_skills' success path plus all three skip/error paths
via a new with_rl_head()-wired Agent test harness, and an rl_head.rs
case where cosine order and RL-blended order disagree.
@github-actions github-actions Bot added documentation Improvements or additions to documentation llm zeph-llm crate (Ollama, Claude) skills zeph-skills crate rust Rust code changes core zeph-core crate bug Something isn't working size/L Large PR (201-500 lines) labels Jul 6, 2026
@bug-ops bug-ops enabled auto-merge (squash) July 6, 2026 23:45
@bug-ops bug-ops merged commit 43e2083 into main Jul 6, 2026
43 checks passed
@bug-ops bug-ops deleted the fix/5845-rl-rerank-coverage-toctou branch July 6, 2026 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working core zeph-core crate documentation Improvements or additions to documentation llm zeph-llm crate (Ollama, Claude) rust Rust code changes size/L Large PR (201-500 lines) skills zeph-skills crate

Projects

None yet

1 participant