refactor(agent): fix grep scope loss and consolidate per-turn @mention scoping

- Fix grep_chunks dropping the full-KB scope when a turn mixes @KB with
  @tag/@file: extract scopeClause and OR knowledge-ID and (kb,tenant)
  predicates together, matching knowledge_search's fan-out.
- Consolidate the three scattered per-request @Skill/@MCP scope blocks in
  buildAgentConfig into applyPerRequestSkillScope / applyPerRequestMCPScope,
  each narrowing the whitelist and computing the must_use pin in one place.
- Dedupe the two identical selection-mode normalizers in Input-field.vue.
- Fix knowledge_create_test passing "" for the tagIDs []string parameter,
  which made the whole service test package fail to compile.
- Add unit tests for scopeClause and the per-request scope helpers.
This commit is contained in:
wizardchen
2026-06-29 17:17:38 +08:00
committed by lyingbug
parent b86efe3f92
commit d24e830c85
6 changed files with 203 additions and 83 deletions
@@ -136,7 +136,7 @@ func TestCreateKnowledgeFromFileDoesNotPersistWhenStorageSaveFails(t *testing.T)
nil,
nil,
"",
"",
nil,
"",
nil,
)
@@ -167,7 +167,7 @@ func TestCreateKnowledgeFromFilePersistsStoredFilePathOnCreate(t *testing.T) {
nil,
nil,
"",
"",
nil,
"",
nil,
)
@@ -201,7 +201,7 @@ func TestCreateKnowledgeFromFileDeletesStoredFileWhenCreateFails(t *testing.T) {
nil,
nil,
"",
"",
nil,
"",
nil,
)
@@ -239,7 +239,7 @@ func TestCreateKnowledgeFromFile_PersistsProcessOverrides(t *testing.T) {
map[string]string{"source": "test"},
nil,
"",
"",
nil,
"",
overrides,
)