WeKnora/internal
young1lin 29bec4204a fix(agent/tools): sort function definitions for deterministic ordering
`ToolRegistry.GetFunctionDefinitions` and `ListTools` previously ranged
over the internal map directly. Go map iteration is intentionally
randomized, so the resulting `tools` array reshuffled on every request.

That reshuffling silently breaks provider-side prompt caches that key on
a byte-level prefix match — most visibly Qwen explicit caching, which
requires the messages (system + tools + history) to be byte-identical up
to the `cache_control` marker. With random ordering the serialized tools
block changes every call, so the cache prefix never matches and the
hit rate stays at 0%.

Sort by tool name in both functions. Output is now byte-stable across
calls and `cache_control: ephemeral` can actually take effect.

Tests in registry_test.go cover:
- Deterministic ordering across 50 iterations
- JSON byte-stability across 20 iterations (the real motivation)
- Field projection (Name / Description / Parameters)
- Empty registry returns `[]` not `null`
- ListTools sorting
- First-wins duplicate registration policy (GHSA-67q9-58vj-32qx)
2026-05-25 16:47:14 +08:00
..
agent fix(agent/tools): sort function definitions for deterministic ordering 2026-05-25 16:47:14 +08:00
application feat(retriever): add OpenSearch type prep ahead of Phase 3 driver 2026-05-22 20:43:50 +08:00
assets feat(assets): add ASR test audio file and embed it in the application 2026-04-02 21:27:27 +08:00
common feat: Implement deadlock retry mechanism for chunk creation 2026-04-22 21:17:21 +08:00
config docs: add Chinese RBAC guide and link with shared space docs 2026-05-21 12:28:31 +08:00
container feat(obs): 支持华为云obs存储 2026-05-18 19:38:23 +08:00
database feat(system-info): surface DB migration errors with troubleshooting links 2026-05-14 16:34:50 +08:00
datasource fix(feishu): tolerate partial wiki node listing failures 2026-05-12 17:40:59 +08:00
errors feat(tenant): implement tenant creation limit and error handling 2026-05-18 17:28:58 +08:00
event feat(agent): human-in-the-loop approval for MCP tool calls (#1173) 2026-05-10 22:57:12 +08:00
handler feat: expose KB ↔ vector store binding in list, editor, and detail UI 2026-05-22 17:40:10 +08:00
im fix(agent): exclude wiki-only KBs from quick-answer (RAG) mode 2026-05-12 16:27:28 +08:00
infrastructure fix(docparser): address review feedback on PR #1404 2026-05-21 11:42:56 +08:00
logger refactor(logger): support LOG_FORMAT template and harden level coloring 2026-05-22 20:31:54 +08:00
mcp feat(mcp): implement reconnection logic for MCP tool calls and tool listing 2026-03-31 11:57:15 +08:00
middleware chore(rbac): update default behavior for tenant RBAC configuration 2026-05-18 21:24:28 +08:00
models fix(moonshot): pin temperature=1 for models that reject other values moonshot-v1-* and kimi-k2.5/k2.6 reject any temperature ≠ 1 with HTTP 400. Detect these models in BuildChatCompletionRequest and force Temperature=1 while leaving kimi-k2/k2-turbo/k2-thinking unaffected. 2026-05-18 21:28:40 +08:00
router feat(knowledge-base): implement per-user pinning for knowledge bases 2026-05-18 17:28:58 +08:00
runtime chore(runtime): silence gin per-route logs and emit env config banner at startup 2026-05-17 15:27:52 +08:00
sandbox feat: optimize security and deployment of agent skills 2026-02-04 20:08:49 +08:00
searchutil fix(summary): preserve image caption/OCR text in document summaries 2026-05-22 17:25:39 +08:00
stream feat(redis): add REDIS_USERNAME support for Redis ACL 2026-02-04 19:38:40 +08:00
tracing feat(observability): extend Langfuse tracing across asynq pipeline 2026-04-24 13:16:47 +08:00
types feat(retriever): add OpenSearch type prep ahead of Phase 3 driver 2026-05-22 20:43:50 +08:00
utils fix(initialization): surface upstream and SSRF errors verbatim in test-connection responses 2026-05-17 15:27:52 +08:00