feat(compaction): 跨压缩边界携带未完成任务 + 强化 task 对账提示#203
Merged
Conversation
cron 驱动的长跑 session 里,agent 标了 in_progress 的任务在一次压缩后 就从上下文消失(TaskCreate/TaskUpdate 记录被摘要掉),于是再也不回头 关闭它们 —— 生产 session 攒了 6 个孤儿 in_progress + 5 个没消费的 pending。 根因是任务这种持久状态在压缩边界被丢失、且没有机制提醒 agent 对账。 两层修复: - **awareness**:新增 `OutstandingTasksDigest` trait(loopal-tool-api), AgentShared 从 TaskStore 拉未完成任务拼成 digest;compaction 在 CompactionSummary.summary_text 末尾确定性追加(仅压缩时一次,resume 自动覆盖,不做每轮注入)。注入链复刻 one_shot_chat 模式,runtime 依赖 trait 抽象、由 agent-server 注入,无新增跨层依赖。 - **action**:`task-decomposition.md` 加 "Reconcile your task list every turn" 段 —— 关闭已完成、绝不遗留 in_progress、drain/prune pending、 resumed/scheduled 轮次先 TaskList。 测试:`outstanding_digest` 格式化单测(非完成/状态/active_form/空→None) + e2e 证明 digest 端到端进入 CompactionSummary。全量 94/94、clippy 零警告。
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.
Summary
in_progress的任务在一次压缩后从上下文消失(TaskCreate/TaskUpdate 记录被摘要掉),于是再也不回头关闭 —— 生产 session 攒了 6 个孤儿in_progress+ 5 个没消费的pending。Changes
loopal-tool-api:新增OutstandingTasksDigesttrait(outstanding_tasks.rs)。loopal-agent:AgentShared实现它,从TaskStore拉未完成任务拼 digest(独立文件outstanding_tasks_impl.rs,含纯函数 + 单测)。loopal-runtime:params/builder 注入字段;compaction_run在CompactionSummary.summary_text末尾确定性追加 digest(仅压缩时一次,resume 自动覆盖,不做每轮注入)。loopal-agent-server:factory + agent_setup 注入agent_shared(复刻one_shot_chat注入链,runtime 依赖 trait 抽象、无新增跨层依赖)。loopal-prompt-system:task-decomposition.md加 "Reconcile your task list every turn" 段(关闭已完成 / 绝不遗留 in_progress / drain pending / resumed 轮次先 TaskList)。loopal-test-supportharness 加注入选项。Test plan
outstanding_digest格式化(非完成/状态/active_form/空→None)。compaction_summary_carries_outstanding_tasks_forward—— mock digest 经 harness 注入 → force_compact → 断言 CompactionSummary 携带任务。