fix(wework): track project tasks with stable APIs - #2427
Conversation
📝 WalkthroughWalkthroughWework now performs cloud runtime-task tracking and status synchronization locally. Backend tracking schemas, endpoints, helper logic, and tests were removed. Project submission now supplies cloud IDs only for backend projects. ChangesRuntime task tracking
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Wework
participant CloudContext as Cloud task context API
participant LoopItems as Loop item API
Wework->>CloudContext: Resolve task context
Wework->>LoopItems: Find or create and bind loop item
Wework->>CloudContext: Resolve context for status update
Wework->>LoopItems: Patch item status with version
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/zh/wegent/developer-guide/cloud-project-collaboration.md`:
- Around line 149-150: Add /v1/runtime-tasks/cloud-context to the cloud-project
API inventory in both
docs/zh/wegent/developer-guide/cloud-project-collaboration.md (lines 149-150)
and docs/en/wegent/developer-guide/cloud-project-collaboration.md (lines
149-150), identifying it as the task-context lookup API used before TODO
updates.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: b1d0373c-e0a0-45b7-b8c1-0acefd8a1021
📒 Files selected for processing (12)
backend/app/api/endpoints/deliveries.pybackend/app/schemas/delivery.pybackend/app/services/loop_items/service.pybackend/tests/api/test_cloud_projects_api.pydocs/en/wegent/developer-guide/cloud-project-collaboration.mddocs/zh/wegent/developer-guide/cloud-project-collaboration.mdwework/src/api/deliveries.test.tswework/src/api/deliveries.tswework/src/api/local/localDelivery.tswework/src/components/layout/DesktopWorkbenchMain.tsxwework/src/features/todo/projectSpaceSelection.test.tswework/src/features/todo/projectSpaceSelection.ts
💤 Files with no reviewable changes (4)
- backend/tests/api/test_cloud_projects_api.py
- backend/app/services/loop_items/service.py
- backend/app/schemas/delivery.py
- backend/app/api/endpoints/deliveries.py
| Wework 把新运行任务加入云项目空间时,使用已有的基础能力组合完成:先创建 `LoopItem`,再绑定运行任务;运行状态变化时先读取任务上下文,再更新对应 TODO。Backend 不提供仅为这条编排流程设计的聚合追踪接口,因此桌面端和 Backend 可以独立发布,同时仍由 TODO 创建、任务绑定和乐观锁更新这三类稳定 API 保证行为一致。桌面端会对同一运行任务的并发关联请求去重;如果绑定临时失败,会复用已创建的 TODO 后重试,避免产生重复卡片。 | ||
|
|
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Document the cloud-context API route.
The tracking flow reads task context before it updates a TODO. The API inventories list /v1/runtime-tasks/loop-item, but the implementation uses /v1/runtime-tasks/cloud-context. Add this route and identify it as the task-context lookup API.
docs/zh/wegent/developer-guide/cloud-project-collaboration.md#L149-L150: Add/v1/runtime-tasks/cloud-contextand name its task-context purpose.docs/en/wegent/developer-guide/cloud-project-collaboration.md#L149-L150: Add/v1/runtime-tasks/cloud-contextand name its task-context purpose.
📍 Affects 2 files
docs/zh/wegent/developer-guide/cloud-project-collaboration.md#L149-L150(this comment)docs/en/wegent/developer-guide/cloud-project-collaboration.md#L149-L150
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/zh/wegent/developer-guide/cloud-project-collaboration.md` around lines
149 - 150, Add /v1/runtime-tasks/cloud-context to the cloud-project API
inventory in both docs/zh/wegent/developer-guide/cloud-project-collaboration.md
(lines 149-150) and
docs/en/wegent/developer-guide/cloud-project-collaboration.md (lines 149-150),
identifying it as the task-context lookup API used before TODO updates.
Summary
Root cause
The desktop client called newly added aggregate endpoints that were not present on the deployed Backend, causing route-level
404 Not Foundwhen a task was created from a linked project space.Validation
pnpm --filter wework exec vitest run src/api/deliveries.test.ts src/api/local/localDelivery.test.ts src/features/todo/projectSpaceSelection.test.tspnpm --filter wework exec tsc --noEmituv run pytest tests/api/test_cloud_projects_api.py tests/api/test_deliveries_api.py(37 passed)pnpm --filter wework e2e:desktop -- --segment core-task-flow(passed; 6m 57s)Summary by CodeRabbit
New Features
Documentation
Bug Fixes