fix(skills): enforce fail-closed semantic scan provider validation#4721
Merged
Conversation
d8720e5 to
6f0bb0e
Compare
…4706, #4709) When semantic_scan is enabled but semantic_scan_provider is empty or refers to an unknown provider, plugin add now returns an explicit CommandError instead of silently proceeding with the primary provider. - Trim provider name before empty check to prevent whitespace bypass - Add registry lookup before resolve_background_provider; unknown provider names are rejected rather than silently falling back - resolve_background_provider itself is unchanged — other callers retain their intentional fallback semantics Closes #4709 Closes #4706
6f0bb0e to
1b0f1b7
Compare
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
semantic_scan = truebutsemantic_scan_provideris empty or whitespace-only,plugin addnow returns an explicitCommandErrorinstead of silently falling back to the primary provider (semantic_scan=true with empty semantic_scan_provider silently falls back to primary provider #4709)semantic_scan_provideris set to an unknown provider name,plugin addis also rejected with a descriptive error — the registry is checked beforeresolve_background_provideris called (enhancement(skills): semantic scan is fail-open when no provider configured — should warn loudly #4706)resolve_background_provideritself is unchanged; other callers retain their intentional fallback semanticsChanges
crates/zeph-core/src/agent/agent_access_impl.rs— fail-closed guard inhandle_plugins:.trim().is_empty()check + registry presence check before scanner construction; 4 regression tests addedcrates/zeph-core/src/agent/builder.rs—with_semantic_scan(enabled, provider_name)test builder methodTest plan
semantic_scan=true, provider="" →CommandError(new regression test)semantic_scan=true, provider=" " →CommandError(trim guard)semantic_scan=true, provider="nonexistent" →CommandError(registry check)semantic_scan=false→ install proceeds normally (existing behavior preserved)cargo +nightly fmt --check— cleancargo clippy --workspace -- -D warnings— cleancargo nextest run --workspace --lib --bins— 10414 passedCloses #4709
Closes #4706