Skip to content

fix: preserve DCP state across compaction and inject continuation nudge after compress#547

Open
LeXwDeX wants to merge 3 commits into
Opencode-DCP:masterfrom
LeXwDeX:fix/preserve-state-and-continuation-nudge
Open

fix: preserve DCP state across compaction and inject continuation nudge after compress#547
LeXwDeX wants to merge 3 commits into
Opencode-DCP:masterfrom
LeXwDeX:fix/preserve-state-and-continuation-nudge

Conversation

@LeXwDeX
Copy link
Copy Markdown

@LeXwDeX LeXwDeX commented May 23, 2026

Summary

  • Persist lastCompaction and messageIds across process restarts
  • Make resetOnCompaction inert — opencode /compact preserves all msg_* rows
  • Inject continuation nudge after DCP compress tool so model resumes task

Bug Details

Bug 1: State lost on compaction restart

lastCompaction was never persisted → restart re-triggered resetOnCompaction → wiped ALL DCP state.

Bug 2: Model stops after DCP compress

injectCompressNudges cleared anchors and returned early, leaving model with no guidance.

Test Results

82 pass / 1 fail (pre-existing Bun issue)
Refs: PR #530

lex added 3 commits May 24, 2026 01:47
…ge after compress

- Persist lastCompaction and messageIds to disk so restarts preserve DCP state
- Make resetOnCompaction inert (opencode /compact preserves all msg_* rows in DB)
- Save messageIds immediately after assignMessageRefs in chat transform hook
- Inject continuation system-reminder after DCP compress tool execution so model
  resumes its previous task instead of stopping
- Update message-ids test to assert preservation instead of reset after compaction

Refs: PR Opencode-DCP#530 (tracycam/fix/compress-summary-limits)
- system.ts: 系统提示词全中文,强化禁止 XML 标签
- compress-range.ts: 范围压缩指令全中文,输出格式改为 Markdown
- compress-message.ts: 消息压缩指令全中文
- extensions/tool.ts: 工具扩展提示全中文
- extensions/nudge.ts: 提醒提示全中文
- extensions/system.ts: 系统扩展提示全中文
- turn-nudge.ts: 轮次提醒全中文
- iteration-nudge.ts: 迭代提醒全中文

目的:避免英文术语(如 summary)激活 qwen3.7-max 模型的训练记忆,
减少 <analysis>/<summary> XML 标签幻觉问题。
- Remove verbose comments in inject.ts, state.ts, utils.ts
- Clean up test file comments
- Keep code concise and maintainable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant