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-rag-chunk-context",
"query": "If a long section is split into multiple chunks, how do we keep retrieval context?",
"retrievedAt": "2026-07-06T00:00:00Z",
"lookupResult": {
"found": true,
"evidenceBlocks": [
{
"source": "rag-chunk-context-reconstruction",
"title": "RAG Chunk Context Reconstruction",
"breadcrumb": "RAG > Chunking > Context Reconstruction",
"retrievalLayer": "L1",
"content": "After a chunk hit, expand to neighbor chunk candidates from the same section and preserve breadcrumb metadata in the evidence pack.",
"score": 0.79,
"hitReasons": ["domain_match:+0.15", "keyword_match:+0.10"]
},
{
"source": "rag-breadcrumb-embedding-gap",
"title": "RAG Breadcrumb Embedding Gap",
"breadcrumb": "RAG > Embedding > Breadcrumb",
"retrievalLayer": "L1",
"content": "Embedding title and breadcrumb with content helps recover section semantics.",
"score": 0.72,
"hitReasons": ["domain_match:+0.15"]
}
],
"contextPack": {
"packedText": "[1] RAG Chunk Context Reconstruction\nRAG > Chunking > Context Reconstruction\nAfter a chunk hit, expand to neighbor chunk candidates from the same section and preserve breadcrumb metadata in the evidence pack.",
"strategy": "top_evidence_blocks",
"charBudget": 3500,
"usedChars": 203,
"includedSources": ["rag-chunk-context-reconstruction", "rag-breadcrumb-embedding-gap"],
"omittedSources": []
"caseId" : "chat-rag-chunk-context",
"query" : "If a long section is split into multiple chunks, how do we keep retrieval context?",
"retrievedAt" : "2026-07-28T06:54:51.843450400Z",
"searchMode" : "hybrid",
"kbScope" : "rag-eval",
"lookupResult" : {
"found" : true,
"evidenceBlocks" : [ {
"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.032786883413791656,
"hitReasons" : [ "semantic_rank:1", "attempt:FILTERED_VECTOR", "l0_domain_overlap", "l0_entity_overlap", "l0_keyword_overlap" ]
}, {
"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.032258063554763794,
"hitReasons" : [ "semantic_rank:2", "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.01587301678955555,
"hitReasons" : [ "semantic_rank:3", "attempt:FILTERED_VECTOR", "l0_domain_overlap" ]
}, {
"docId" : "rag-l0-domain-entity-hint",
"chunkIndex" : 0,
"evidenceKey" : "rag-l0-domain-entity-hint#chunk-0",
"source" : "rag-l0-domain-entity-hint",
"title" : "RAG",
"breadcrumb" : "RAG > L0 > Domain Entity Hint",
"retrievalLayer" : "L1",
"content" : "# RAG",
"score" : 0.015625,
"hitReasons" : [ "semantic_rank:4", "attempt:FILTERED_VECTOR", "l0_domain_overlap" ]
} ],
"contextPack" : {
"packedText" : "[Evidence 1]\nsource: rag-chunk-context-reconstruction\ntitle: Context Reconstruction\nbreadcrumb: RAG > Chunking > Context Reconstruction\nlayer: L1\nreasons: semantic_rank:1, attempt:FILTERED_VECTOR, l0_domain_overlap, l0_entity_overlap, l0_keyword_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 2]\nsource: rag-l0-domain-entity-hint\ntitle: Domain Entity Hint\nbreadcrumb: RAG > L0 > Domain Entity Hint\nlayer: L1\nreasons: semantic_rank:2, attempt:FILTERED_VECTOR, l0_domain_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 3]\nsource: rag-chunk-context-reconstruction\ntitle: Chunking\nbreadcrumb: RAG > Chunking > Context Reconstruction\nlayer: L1\nreasons: semantic_rank:3, attempt:FILTERED_VECTOR, l0_domain_overlap\ncontent:\n## Chunking\n\n[Evidence 4]\nsource: rag-l0-domain-entity-hint\ntitle: RAG\nbreadcrumb: RAG > L0 > Domain Entity Hint\nlayer: L1\nreasons: semantic_rank:4, attempt:FILTERED_VECTOR, l0_domain_overlap\ncontent:\n# RAG",
"strategy" : "ranked_evidence_char_budget",
"charBudget" : 4000,
"usedChars" : 1966,
"includedSources" : [ "rag-chunk-context-reconstruction", "rag-l0-domain-entity-hint", "rag-chunk-context-reconstruction", "rag-l0-domain-entity-hint" ],
"omittedSources" : [ ]
},
"retrievalTrace": {
"originalQuery": "If a long section is split into multiple chunks, how do we keep retrieval context?",
"rewrittenQuery": "RAG chunk context reconstruction neighbor chunk same section breadcrumb",
"categoryFilter": "RAG",
"selectedAttempt": "FILTERED_VECTOR",
"fallbackReason": null,
"evidenceStatus": "supported",
"queryHints": {
"domains": ["RAG"],
"matched_keywords": ["neighbor chunk", "same section", "breadcrumb"],
"entities": ["chunk", "breadcrumb"],
"l0_titles": ["RAG Chunk Context Reconstruction"],
"l0_match_count": 1
"retrievalTrace" : {
"originalQuery" : "If a long section is split into multiple chunks, how do we keep retrieval context?",
"rewrittenQuery" : "If a long section is split into multiple chunks, how do we keep retrieval context?",
"categoryFilter" : "rag",
"selectedAttempt" : "FILTERED_VECTOR",
"fallbackReason" : null,
"evidenceStatus" : "supported",
"queryHints" : {
"domains" : [ "rag" ],
"matched_keywords" : [ "split into multiple chunks", "retrieval context" ],
"entities" : [ "split into multiple chunks", "retrieval context" ],
"l0_titles" : [ "RAG Chunk Context Reconstruction" ],
"l0_match_count" : 1
},
"attempts": [
{
"name": "FILTERED_VECTOR",
"query": "RAG chunk context reconstruction neighbor chunk same section breadcrumb",
"categoryFilter": "RAG",
"candidateCount": 2,
"usable": true,
"durationMs": 9,
"topScore": 0.79,
"topSimilarity": 0.79
}
]
"attempts" : [ {
"name" : "FILTERED_VECTOR",
"query" : "If a long section is split into multiple chunks, how do we keep retrieval context?",
"categoryFilter" : "rag",
"candidateCount" : 6,
"usable" : true,
"errorMessage" : null,
"durationMs" : 743,
"topScore" : 0.032786883413791656,
"topSimilarity" : 0.7487991750240326
} ]
},
"rerankTrace": {
"items": [
{
"finalRank": 1,
"source": "rag-chunk-context-reconstruction",
"baseScore": 0.79,
"finalScore": 1.04,
"boostReasons": ["domain_match:+0.15", "keyword_match:+0.10"]
},
{
"finalRank": 2,
"source": "rag-breadcrumb-embedding-gap",
"baseScore": 0.72,
"finalScore": 0.87,
"boostReasons": ["domain_match:+0.15"]
}
]
}
"rerankTrace" : {
"items" : [ {
"finalRank" : 1,
"source" : "rag-chunk-context-reconstruction",
"baseScore" : 0.7487991750240326,
"finalScore" : 0.7487991750240326,
"boostReasons" : [ "l0_domain_overlap", "l0_entity_overlap", "l0_keyword_overlap" ]
}, {
"finalRank" : 2,
"source" : "rag-l0-domain-entity-hint",
"baseScore" : 0.4840593934059143,
"finalScore" : 0.4840593934059143,
"boostReasons" : [ "l0_domain_overlap" ]
}, {
"finalRank" : 3,
"source" : "rag-chunk-context-reconstruction",
"baseScore" : 0.42978107929229736,
"finalScore" : 0.42978107929229736,
"boostReasons" : [ "l0_domain_overlap" ]
}, {
"finalRank" : 4,
"source" : "rag-l0-domain-entity-hint",
"baseScore" : 0.3859822154045105,
"finalScore" : 0.3859822154045105,
"boostReasons" : [ "l0_domain_overlap" ]
} ]
},
"evidenceCandidateCount" : 6,
"evidenceBlockCount" : 4,
"relevanceLevel" : "REFERENCE",
"completenessHint" : "当前结果为相关参考,如需更精准信息请明确缺少的具体维度",
"retrievedDomainsThisSession" : null,
"message" : null
}
}
}