Repository navigation
Conversation
…a frozen watermark Three root causes behind "session hangs / context keeps growing after a restart or model switch": 1. A plain prompt_cache_key is not plugin ownership. Only a real omp registration or a persisted pluginAgent may unwrap the |sub: namespace; otherwise instructions drift (model switch, async tool registration) forked the main conversation into an empty namespace whose compression state was gone, so every existing block was invalidated. 2. Existing conversation mappings now restore their original session and compression blocks instead of minting a fresh bare-id session. 3. A failed preflight freezes the original history BOUNDARY rather than the range worklist it happened to select: every successful fold changes which ranges stay viable, so replaying a stale worklist compressed nothing and the retry looked bigger. The walk now recomputes remaining viable ranges against that boundary after each fold, including the soft-protected recent zone under overflow, while turns appended during the failure window stay out of the compression input. # Conflicts: # CHANGELOG.md # src/plugin.ts # src/preflight.ts # src/server.ts
Review complete — code verified green on CURRENT master. What I did:
Code-review verdict:
Per §7.4 this is not auto-merge eligible (identity/session-binding logic + preflight wire behavior) — human merge decision. Since this is the base of your 4-PR stack, recommend merging the rebased branch; #1004 will need its own rebase on top once this lands. 修复了 omp 在切换模型/恢复会话后压缩状态丢失的三连败(主/子代理身份隔离失效、映射会话恢复为空会话、preflight 冻结 range 导致失败后无法恢复);已 rebase 到最新 master 并本地全量验证通过(typecheck/test/build 全绿、两个新回归测试均通过),可以合并。 |
|
Closing as stacked — this is the base layer of @asuan-dev's chain: #1003 ⊂ #1004 ⊂ #1006 ⊂ #1008. All of this PR's commits are carried verbatim inside #1008 ( |
问题
omp(经
bili plugin install omp接入)在模型切换或恢复会话后,压缩状态三连败:压缩 block 丢失、nudge 每轮重发、上下文只涨不降。#739。根因(3 处,均已先复现再修复)
isRegisteredPluginConversation()只检查conversations.has(id),任何带prompt_cache_key的请求都会写入该表,导致 omp 主会话与 guardian 子代理共享同一份压缩状态。conversationId -> conversationId|sub:oldFingerprint,原实现只检查映射存在、忽略存储的sessionId,恢复时选中空的裸 id 会话(复现:旧 namespace 3 个 block,恢复后 0 个)。preflightPin冻结整个 range 列表,部分成功后重试 stale ranges,永远到不了 soft-protected-zone 释放。修复
registeredPluginSessionId():只有真正的 omp 注册或持久化的session.metadata.pluginAgent才绕过子代理分区,返回映射后的 sessionId;裸prompt_cache_key不行(src/plugin.ts)。codexTurn?.value ?? registeredSessionId ?? protocol chain(bodyIdentity = responsesIdentity ?? openaiIdentity ?? anthropicIdentity)。|sub:namespace 和已持久化 blocks),而非新建空 session。preflightPin改存endRef水位(^m\d+$),每轮 fold 后重算viableRanges、clampendRef;非 abort 失败存{ endRef: watermark },payload 放得下时删除 pin。失败窗口内追加的 turns 不被吞。验证
tests/subagent-namespace.test.ts:注册 omp 跨 instructions 漂移恢复映射 blocks(3 block 持久化 → 恢复后 3 active,upstream payload < baseline 一半,resumed id = LEGACY_ID)。tests/preflight-fail-fast.test.ts:失败 preflight 在水位内恢复,soft-protected history(Message 7)可达,无消息被摘要两次,失败窗口 turn(FAILURE_WINDOW_NOISE)不进压缩输入。