feat(harness,rag): dual LLM audit fields, run conclusion, and hybrid quality

Persist provider reasoning and assistant text separately on agent_reasoning_audit
(DeepSeekAssistantMessage path), extract diagnosis_run.conclusion, enrich RAG
tool audit (step_id/query/qualityScore), gate empty mysql tools, drop devtools,
and align MVP docs after live E2E verification.
This commit is contained in:
zhuyongxin
2026-07-28 19:43:13 +08:00
parent 2f40536248
commit 7ae9707a3b
116 changed files with 8364 additions and 1141 deletions
@@ -1,81 +1,122 @@
{
"caseId": "chat-l0-domain-hint",
"query": "Should L0 keyword matching decide the final retrieval result?",
"retrievedAt": "2026-07-06T00:00:00Z",
"lookupResult": {
"found": true,
"evidenceBlocks": [
{
"source": "rag-l0-domain-entity-hint",
"title": "RAG L0 Domain Entity Hint",
"breadcrumb": "RAG > L0 > Domain Entity Hint",
"retrievalLayer": "L1",
"content": "L0 should be retained as a domain detector, entity extractor, metadata filter generator, and explainability signal, not as the final retrieval decision.",
"score": 0.88,
"hitReasons": ["domain_match:+0.15", "keyword_match:+0.10"]
},
{
"source": "rag-l0-l1-fusion-ranking",
"title": "RAG L0 L1 Fusion Ranking",
"breadcrumb": "RAG > Ranking > Fusion",
"retrievalLayer": "L1",
"content": "L0 and L1 candidates should eventually be fused rather than handled as an early-return branch.",
"score": 0.75,
"hitReasons": ["domain_match:+0.15"]
}
],
"contextPack": {
"packedText": "[1] RAG L0 Domain Entity Hint\nRAG > L0 > Domain Entity Hint\nL0 should be retained as a domain detector, entity extractor, metadata filter generator, and explainability signal, not as the final retrieval decision.",
"strategy": "top_evidence_blocks",
"charBudget": 3500,
"usedChars": 219,
"includedSources": ["rag-l0-domain-entity-hint", "rag-l0-l1-fusion-ranking"],
"omittedSources": []
"caseId" : "chat-l0-domain-hint",
"query" : "Should L0 keyword matching decide the final retrieval result?",
"retrievedAt" : "2026-07-28T06:54:51.843450400Z",
"searchMode" : "hybrid",
"kbScope" : "rag-eval",
"lookupResult" : {
"found" : true,
"evidenceBlocks" : [ {
"docId" : "rag-l0-domain-entity-hint",
"chunkIndex" : 2,
"evidenceKey" : "rag-l0-domain-entity-hint#chunk-2",
"source" : "rag-l0-domain-entity-hint",
"title" : "Domain Entity Hint",
"breadcrumb" : "RAG > L0 > Domain Entity Hint",
"retrievalLayer" : "L1",
"content" : "### Domain Entity Hint\n\nL0 keyword matching should not decide the final retrieval result.\nIn the modular RAG pipeline, L0 behaves like a lightweight domain detector and entity extractor.\n\nThe output can provide:\n\n1. Candidate domain hints.\n2. Matched entities and keywords.\n3. An optional metadata filter for the first vector retrieval attempt.\n\nFinal evidence still comes from L1 vector retrieval, post-retrieval normalization, rerank, and context packing.\nThe important terms are domain detector, entity extractor, and metadata filter.",
"score" : 0.032786883413791656,
"hitReasons" : [ "semantic_rank:1", "attempt:FILTERED_VECTOR", "l0_domain_overlap", "l0_entity_overlap", "l0_keyword_overlap" ]
}, {
"docId" : "rag-chunk-context-reconstruction",
"chunkIndex" : 2,
"evidenceKey" : "rag-chunk-context-reconstruction#chunk-2",
"source" : "rag-chunk-context-reconstruction",
"title" : "Context Reconstruction",
"breadcrumb" : "RAG > Chunking > Context Reconstruction",
"retrievalLayer" : "L1",
"content" : "### Context Reconstruction\n\nWhen a long section is split into multiple chunks, retrieval should keep enough local structure for the answer.\n\nRecommended behavior:\n\n1. Store the breadcrumb with every chunk.\n2. Preserve the same section identity across adjacent chunks.\n3. During context packing, include a neighbor chunk when the selected chunk depends on nearby setup or definitions.\n4. Prefer concise evidence blocks that show the breadcrumb and the relevant content span.\n\nThe key concepts are neighbor chunk, same section, and breadcrumb.",
"score" : 0.032258063554763794,
"hitReasons" : [ "semantic_rank:2", "attempt:FILTERED_VECTOR", "l0_domain_overlap" ]
}, {
"docId" : "rag-l0-domain-entity-hint",
"chunkIndex" : 1,
"evidenceKey" : "rag-l0-domain-entity-hint#chunk-1",
"source" : "rag-l0-domain-entity-hint",
"title" : "L0",
"breadcrumb" : "RAG > L0 > Domain Entity Hint",
"retrievalLayer" : "L1",
"content" : "## L0",
"score" : 0.0317460335791111,
"hitReasons" : [ "semantic_rank:3", "attempt:FILTERED_VECTOR", "l0_domain_overlap" ]
}, {
"docId" : "rag-chunk-context-reconstruction",
"chunkIndex" : 1,
"evidenceKey" : "rag-chunk-context-reconstruction#chunk-1",
"source" : "rag-chunk-context-reconstruction",
"title" : "Chunking",
"breadcrumb" : "RAG > Chunking > Context Reconstruction",
"retrievalLayer" : "L1",
"content" : "## Chunking",
"score" : 0.015625,
"hitReasons" : [ "semantic_rank:4", "attempt:FILTERED_VECTOR", "l0_domain_overlap" ]
} ],
"contextPack" : {
"packedText" : "[Evidence 1]\nsource: rag-l0-domain-entity-hint\ntitle: Domain Entity Hint\nbreadcrumb: RAG > L0 > Domain Entity Hint\nlayer: L1\nreasons: semantic_rank:1, attempt:FILTERED_VECTOR, l0_domain_overlap, l0_entity_overlap, l0_keyword_overlap\ncontent:\n### Domain Entity Hint\n\nL0 keyword matching should not decide the final retrieval result.\nIn the modular RAG pipeline, L0 behaves like a lightweight domain detector and entity extractor.\n\nThe output can provide:\n\n1. Candidate domain hints.\n2. Matched entities and keywords.\n3. An optional metadata filter for the first vector retrieval attempt.\n\nFinal evidence still comes from L1 vector retrieval, post-retrieval normalization, rerank, and context packing.\nThe important terms are domain detector, entity extractor, and metadata filter.\n\n[Evidence 2]\nsource: rag-chunk-context-reconstruction\ntitle: Context Reconstruction\nbreadcrumb: RAG > Chunking > Context Reconstruction\nlayer: L1\nreasons: semantic_rank:2, attempt:FILTERED_VECTOR, l0_domain_overlap\ncontent:\n### Context Reconstruction\n\nWhen a long section is split into multiple chunks, retrieval should keep enough local structure for the answer.\n\nRecommended behavior:\n\n1. Store the breadcrumb with every chunk.\n2. Preserve the same section identity across adjacent chunks.\n3. During context packing, include a neighbor chunk when the selected chunk depends on nearby setup or definitions.\n4. Prefer concise evidence blocks that show the breadcrumb and the relevant content span.\n\nThe key concepts are neighbor chunk, same section, and breadcrumb.\n\n[Evidence 3]\nsource: rag-l0-domain-entity-hint\ntitle: L0\nbreadcrumb: RAG > L0 > Domain Entity Hint\nlayer: L1\nreasons: semantic_rank:3, attempt:FILTERED_VECTOR, l0_domain_overlap\ncontent:\n## L0\n\n[Evidence 4]\nsource: rag-chunk-context-reconstruction\ntitle: Chunking\nbreadcrumb: RAG > Chunking > Context Reconstruction\nlayer: L1\nreasons: semantic_rank:4, attempt:FILTERED_VECTOR, l0_domain_overlap\ncontent:\n## Chunking",
"strategy" : "ranked_evidence_char_budget",
"charBudget" : 4000,
"usedChars" : 1965,
"includedSources" : [ "rag-l0-domain-entity-hint", "rag-chunk-context-reconstruction", "rag-l0-domain-entity-hint", "rag-chunk-context-reconstruction" ],
"omittedSources" : [ ]
},
"retrievalTrace": {
"originalQuery": "Should L0 keyword matching decide the final retrieval result?",
"rewrittenQuery": "RAG L0 keyword matching domain entity hint final retrieval decision",
"categoryFilter": "RAG",
"selectedAttempt": "FILTERED_VECTOR",
"fallbackReason": null,
"evidenceStatus": "supported",
"queryHints": {
"domains": ["RAG"],
"matched_keywords": ["domain detector", "entity extractor", "metadata filter"],
"entities": ["L0"],
"l0_titles": ["RAG L0 Domain Entity Hint"],
"l0_match_count": 1
"retrievalTrace" : {
"originalQuery" : "Should L0 keyword matching decide the final retrieval result?",
"rewrittenQuery" : "Should L0 keyword matching decide the final retrieval result?",
"categoryFilter" : "rag",
"selectedAttempt" : "FILTERED_VECTOR",
"fallbackReason" : null,
"evidenceStatus" : "supported",
"queryHints" : {
"domains" : [ "rag" ],
"matched_keywords" : [ "L0 keyword matching", "final retrieval result" ],
"entities" : [ "L0 keyword matching", "final retrieval result" ],
"l0_titles" : [ "RAG L0 Domain Entity Hint" ],
"l0_match_count" : 1
},
"attempts": [
{
"name": "FILTERED_VECTOR",
"query": "RAG L0 keyword matching domain entity hint final retrieval decision",
"categoryFilter": "RAG",
"candidateCount": 2,
"usable": true,
"durationMs": 9,
"topScore": 0.88,
"topSimilarity": 0.88
}
]
"attempts" : [ {
"name" : "FILTERED_VECTOR",
"query" : "Should L0 keyword matching decide the final retrieval result?",
"categoryFilter" : "rag",
"candidateCount" : 6,
"usable" : true,
"errorMessage" : null,
"durationMs" : 850,
"topScore" : 0.032786883413791656,
"topSimilarity" : 0.6438122987747192
} ]
},
"rerankTrace": {
"items": [
{
"finalRank": 1,
"source": "rag-l0-domain-entity-hint",
"baseScore": 0.88,
"finalScore": 1.13,
"boostReasons": ["domain_match:+0.15", "keyword_match:+0.10"]
},
{
"finalRank": 2,
"source": "rag-l0-l1-fusion-ranking",
"baseScore": 0.75,
"finalScore": 0.9,
"boostReasons": ["domain_match:+0.15"]
}
]
}
"rerankTrace" : {
"items" : [ {
"finalRank" : 1,
"source" : "rag-l0-domain-entity-hint",
"baseScore" : 0.6438122987747192,
"finalScore" : 0.6438122987747192,
"boostReasons" : [ "l0_domain_overlap", "l0_entity_overlap", "l0_keyword_overlap" ]
}, {
"finalRank" : 2,
"source" : "rag-chunk-context-reconstruction",
"baseScore" : 0.41426247358322144,
"finalScore" : 0.41426247358322144,
"boostReasons" : [ "l0_domain_overlap" ]
}, {
"finalRank" : 3,
"source" : "rag-l0-domain-entity-hint",
"baseScore" : 0.3964804410934448,
"finalScore" : 0.3964804410934448,
"boostReasons" : [ "l0_domain_overlap" ]
}, {
"finalRank" : 4,
"source" : "rag-chunk-context-reconstruction",
"baseScore" : 0.28678786754608154,
"finalScore" : 0.28678786754608154,
"boostReasons" : [ "l0_domain_overlap" ]
} ]
},
"evidenceCandidateCount" : 6,
"evidenceBlockCount" : 4,
"relevanceLevel" : "REFERENCE",
"completenessHint" : "当前结果为相关参考,如需更精准信息请明确缺少的具体维度",
"retrievedDomainsThisSession" : null,
"message" : null
}
}
}