fix(memory): repair the MEMORY write path for thinking-mode providers - #328
Merged
Conversation
fix: memory wiring repair and dag-init GitLab probe hardening
release batch: exerciser watchdog hardening and verify-to-delivery doctrine
Guarantee the literal json token at the MemoryModel seam (providers reject json_object calls without it), size match/maintain output budgets so structured replies survive reasoning, and retire the wall-clock prepare/checkpoint/in-model timeouts that killed active reasoning calls (issue #324 tracks the remaining streaming-liveness debt). Checkpoint maintenance runs in the background with an atomic per-project in-flight guard and commits under fence+lock only; prepare/search semantics unchanged.
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 freeto 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.
问题
实机(v1.0.24,thinking 模式模型)memory 写路径 100% 失败——从未有任何话题落盘。三段因果链均有日志/实测证据:
MemoryModel走generateObject(response_format json_object),供应商拒绝 prompt 中不含字面json的调用;MAINTAIN/MATCH 系统提示词零 json 字样。证据:2026-08-17T07:11:25Z WARN pre-compaction MEMORY maintenance failed / AI_APICallError 'Prompt must contain the word json'。finish:length,reasoning_tokens 2048/2048,content_len 0。07:27:55Z WARN MEMORY checkpoint failed cause=TimeoutError。另:
08:57Z MEMORY select failed cause=LockTimeoutError显示超时中断会泄漏 fence flock——锁纪律随之成为必须项。修法
requireJsonToken一次性保证字面 json(幂等);DEFAULT_TIMEOUT 8s→RESPONSE_TIMEOUT 5min仅作"彻底无响应"兜底(不是活动预算——流式逐 chunk liveness 欠账见 fix(memory): SSE-liveness debt — wall-clock guard contradicts streaming principle; periodic prepare path still long-holds locks #324)。MATCH_OUTPUT_TOKENS 2048/MAINTAIN_OUTPUT_TOKENS 16384,让结构化回复活过思考阶段。Effect.timeout包裹全部移除。applyUpdate);维护后台 fork(原子 reserve+fork、fence 之后 kick、per-project 在途守卫、完成/中断/fork 失败都释放槽位);注入渲染用维护前话题。prepare/search 语义不变(并发查询合并、周期同步维护等钉住行为全部保持)。验证
bun typecheck干净;全 monorepo pre-commit turbo typecheck 绿test/memory/86 pass(含新回归:json 保证、预算链[2048,2048,16384]、二次 checkpoint 在途守卫不卡死)+ compaction 相关套件全绿proposeMaintenance、在途守卫改 Set 并Effect.uninterruptible原子化 reserve+fork、kick 移到身份 fence 之后、审计补测欠账与验收边界