makecindy / makecindy/cindy

任务生命周期缺持久化权威源:后台任务状态靠读时拼装,device-link 镜像缺对账协议

Open
#824 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2.7k
Forks
401
Avg merge
21h 48m
Merged PRs (30d)
776

Description

## 背景

PR #627(后台任务面板)的 14 轮机器 review 产出 50+ 条意见,其中 ≥15 条可归因到同一个架构缺口,且该类意见可无限衍生(重连 × 一次性读取 × 缓存记忆的组合格子)。本 issue 把病灶从 PR review 的拉锯里提出来留档。

## 病灶

后台任务(子 Agent / 后台 Bash / Workflow)的状态**没有持久化权威源**,真相分散在四个残缺数据源:

1. `agent_task_update` 事件流 —— LIVE-only,重载/重启即失;
2. wf 记录文件 —— SDK 内部产物,无公开契约,SSH 远端不可读;
3. DB 消息(tool_use/tool_result)—— workflow 的 result 只是启动回执,失败也存在,推导会假绿;同步 Task 强杀后永远无 result;
4. main 侧快照(listSessionBackgroundTasks)—— 只返回 running,区分不了「权威空」与「降级空」。

任何任务 UI 都只能**读时拼装**四源,每种缺失组合都是一个边角;device-link 镜像会话再乘上「断连丢事件、无对账」,格子组合爆炸。#627 里的文件终态补读、快照水合、重连重试、合成详情兜底等一批补丁,都是在为这些格子逐个打补丁。

## 建议方向

1. **任务表落库**:任务启动/终态写 DB,成为跨重启的权威源(消息扫描与文件读取降级为补充);
2. **device-link 任务对账协议**:重连后 reconcile taskUpdates(与消息 reconcile 同位),协议层区分「任务确实结束」与「读取失败」;
3. 落地后可删除 #627 中的一批 UI 层拼装补丁(标注见该 PR 各「转跟进」review 回复)。

## 关联

- PR #627 及其中多条标注「转架构级跟进」的 review thread。

Contributor guide

Open the contributing guide

Research direction

Start by reviewing PR #627 and its threads marked for architectural follow-up. Trace the agent_task_update stream, workflow records, DB messages, listSessionBackgroundTasks, and device-link behavior described here. Done means task state has a persistent authority across restarts and reconnection reconciliation distinguishes confirmed completion from read failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend, databases, distributed-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.