liteFlow/liteflow-react-agent
everywhere.z 199d8b8fc0 fix(react-agent): migrate SkillTrackingMiddleware to reactor Context (cross-thread)
Task 6.1 遗留疑虑:SkillTrackingMiddleware 与 ChatUsage 同构的 ThreadLocal 跨线程
bug。真实 vendor 模型下 onActing 在 boundedElastic 调度线程执行(reasoningStream
的 flatMap 内构造 middleware 链),BOUND.get() 读不到 HTTP 线程写的 ThreadLocal →
usedSkills() 恒空。原 SkillTrackingMiddlewareTest 用进程内 mock(无 subscribeOn)
掩盖此 bug。

修复(镜像 ChatUsage 的 reactor Context 双源方案):
- SkillTrackingMiddleware:新增 SKILL_CONTEXT_KEY 常量、bindAndReturn():Set<String>、
  bindToContext(Mono/Flux,Set);onActing 改用 Flux.deferContextual 先读 Context
  再回退 ThreadLocal;保留 void bind() 维持二进制兼容。
- ReActAgentComponent.process():流式 + 非流式两路径把 skill tracking 集合经
  bindToContext 注入 reactor Context(与 ChatUsage contextWrite 并列)。
- StreamingReplyModel.stream(...) 末尾加 .subscribeOn(boundedElastic),镜像真实
  vendor 模型线程行为,消除"mock 掩盖 bug"。
- SkillTrackingMiddlewareTest 新增跨线程集成断言
  recordsSkillsAcrossSchedulerThreadJumpViaReactorContext(经回归窗口验证为有效断言)。

Tests run: 13, Failures: 0 (StreamingBridge/SkillTracking/ChatUsage/ProcessIntegration)。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-20 11:48:34 +08:00
..
liteflow-react-agent-anthropic liteflow-react-agent pom 添加 name 2026-06-05 00:15:33 +08:00
liteflow-react-agent-core fix(react-agent): migrate SkillTrackingMiddleware to reactor Context (cross-thread) 2026-06-20 11:48:34 +08:00
liteflow-react-agent-dashscope liteflow-react-agent pom 添加 name 2026-06-05 00:15:33 +08:00
liteflow-react-agent-gemini liteflow-react-agent pom 添加 name 2026-06-05 00:15:33 +08:00
liteflow-react-agent-openai liteflow-react-agent pom 添加 name 2026-06-05 00:15:33 +08:00
pom.xml liteflow react agent pom adjust 2026-04-30 23:52:19 +08:00