wangdl
|
d82ae8ba71
|
feat: M-AI-03 统一 AiJob Worker Execution Engine
Deploy API Server / build-and-unit (push) Failing after 29s
Deploy API Server / current-integration (push) Has been skipped
Deploy API Server / backward-compat (push) Has been skipped
Deploy API Server / deploy (push) Has been skipped
- AiJobExecutionEngineImpl: 完整 5 阶段管线
PREPARE: read Job → terminal check → cancel check → Registry.get → CAS lockJob
RESOLVE: load Snapshot → schemaVersion check → AbortController timeout
EXECUTE: AiGatewayService.generate() (不直接导入 Provider SDK)
PROJECT: write validatedOutput + outputHash (#292 替换为 Projector)
COMPLETE: usageLog → markSucceeded
- 错误分类: classifyError() — 7 种错误码, retryable/permanent 分流
provider_rate_limited/timeout/unavailable → retryable → 抛给 BullMQ
schema/business/reference validation → permanent → markFailed
cancelled → markCancelled (3 个检查点: 执行前/Provider前/Projector前)
- Usage logging: 每次 Provider 调用写 AiUsageLog (jobId/attemptNo/credentialMode/token)
- AiJobModule: 使用 AI_JOB_EXECUTION_ENGINE token 注册,替换 #288 的 no-op
- 10 个单元测试: 全链路成功/终态跳过/取消(2)/错误分类(3)/锁冲突/Schema不兼容/UsageLog
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-06-20 18:30:02 +08:00 |
|