feat(compile): 由 OV 托管外部任务生命周期 - #4436
Draft
qin-ctx wants to merge 1 commit into
Draft
Conversation
Keep durable task state, recovery, query, and cancellation in OpenViking while external providers execute the workload.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
本 PR 将 Compile 从“OV 直接代理 Bot 任务”调整为“OV 托管任务生命周期、外部 Compile Server 负责执行”,并把这套执行模型实现为可注册 Provider 的通用外部异步任务能力。
Before
ov compile直接请求/bot/v1/compile,任务由 Bot 保存和执行。CLI 需要识别cmp_前缀,并分别请求 Bot 的状态和取消接口。OV 只负责转发,无法通过统一 TaskRecord/QueueFS 提供持久状态、重启恢复和通用任务查询。After
ov compile请求POST /api/v1/compile。OV 先持久化 TaskRecord,再写入ExternalTaskQueueFS;后台消费者通过 Compile Provider 调用外部/bot/v1/compile,轮询执行状态并更新 OV TaskRecord。CLI 使用统一的/api/v1/tasks/{task_id}查询和取消任务,原/bot/v1/compile*路径保留为兼容入口。当前用户的 OV API Key 作为任务私有认证数据保存,并在调用外部 Server 时放入
openviking_connection和X-API-Key。外部 Server 根据server_url选择正确的 OV 实例,并使用该用户 Key 读取来源和写回产物。compile_api.api_key只用于 OV 到外部 Server 的服务级认证。Example
同一个输入:
/bot/v1/compile*,任务状态由 Bot 持有。/api/v1/compile获得 OV Task ID,并通过/api/v1/tasks/{task_id}等待结果;OV 使用相同 Task ID 作为Idempotency-Key调用外部 Server,崩溃恢复后重复提交不会重复执行。Flow
openviking_connection。ExternalTaskQueueFS。cancelling,再通知外部任务并在 QueueFS 工作完成后进入cancelled。Human Involvement
Related Issue
无。
Type of Change
Changes Made
ExternalTaskService、Provider 协议和 QueueFS 消费器,由 OV 统一管理持久化、重试、恢复、状态和取消。compile_api配置和/api/v1/compile,并让 CLI 状态与取消统一使用 Task API。openviking_connection构造逻辑,安全传递当前用户身份;补充外部 Compile Server 的幂等、多实例、写回和错误契约。Testing
已执行:
uv run pytest -q tests/test_config_loader.py tests/unit/service/test_core_consistency.py tests/server/test_bot_proxy_auth.py tests/test_task_tracker.py tests/storage/test_queue_manager.py --no-cov:96 passedcargo test -p ov_cli compile:6 passedcargo check -p ov_clipy_compile、变更文件rustfmt --check、git diff --checkChecklist
Screenshots (if applicable)
不适用。
Additional Notes
ovCLI;外部 Compile Server 尚未实现,因此没有进行真实端到端联调。docs/design/external-compile-server-api.md。