Skip to content

fix: keep resumed turns open during stale session cleanup - #75

Merged
forrestlinfeng merged 5 commits into
EvoMap:mainfrom
imxyanua:codex/keep-resumed-session-open
Nov 11, 2026
Merged

forrestlinfeng merged 5 commits into
EvoMap:mainfrom
imxyanua:codex/keep-resumed-session-open

Conversation

@imxyanua

Copy link
Copy Markdown
Contributor

Summary

An older SessionEnd could resume after a new prompt and close the new turn, clear its identity and mark the range closed.

Guard the turn and epoch before closing and before cleanup. Prompt opening and the final session/range writes use a dedicated per-session lifecycle lock. Outbox writes, recall and ancestry probing stay outside that lock. The existing correction-lock fallback remains available.

Evidence

  • Regressions pause before closing the old turn, during outbox enqueue and during range cleanup, then resume the same session.
  • The new turn remains open with its identity and evidence. The real-store lock also prevents a prompt from interleaving the final session and range writes.
  • Driver, lifecycle, distillation, publication and architecture tests passed 136/136 on Windows Node 22 and 26.
  • Includes the captured-null owner fix from fix: preserve replacement drafts and captured native owners #70 for the existing Windows CI budget.

Merge Danger

Two-way. Adds a bounded lifecycle lock using the existing runtime lock implementation. #68 changes the session-end entry path and needs the same expected-turn guard preserved when synchronized.

@evomap-aiqa-bot

evomap-aiqa-bot Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Sentinel 已审核此变更,未发现已核验问题,但发现需要人工确认的风险。

另有 3 个需要人工确认的风险;黄色 advisory 不阻塞合并,建议开发 agent review advisory 评论并逐条确认。

开发 agent 查询详情: 调用 MCP 工具 sentinel_pr_review_context,传入 owner_repo="evomap/evolver-agent-plugin"、pr_number=75、head_sha="c9860118c0f1ca1d088defa3cf44ac6b57d67c93",并按条目追加 finding_id 或 finding_key。

由 Sentinel 审核 · 目标提交 c9860118c0f1

@evomap-aiqa-bot

Copy link
Copy Markdown

Sentinel 保留了 3 个尚未确认的审核候选。这些黄色条目不阻塞合并;红色 P0/P1 与其他独立硬门禁不受影响。 单一猜测、缺少变更行证据或纯 checklist 的候选会统一降为 P3。
开发 agent:请 review 以下 advisory,并逐条给出“已验证无风险 / 已修复 / 转为后续事项”的结论;不要只做整体确认。

  • [P3] 旧 session-end 入队成功后未提交消费状态,后续结束会重复入队 — 报告和 pendingControls 先成功入队,之后新增的 turn fencing 因 session 已进入下一 turn 而跳过 m...(truncated) · lib/app/session-end.js·advisory_27a0378b841456384415aba7`
  • [P3] 会话清理超过 2 秒时,新提示在部分提交后失败 — 新锁把跨 store 清理放入无时限的临界区,但等待者固定在 2 秒后抛出 ELOCKED。promptSubmitted...(truncated) · lib/runtime/store/file-stores.js·advisory_b1d9ebe7e37541a6226b4cf7`
  • [P3] 不可逆的报告入队发生在生命周期锁之前 — sessionEnded 先执行 reports.enqueue,之后才获取新增的 sessions.withSession 锁。锁超时或 turn 已...(truncated) · lib/app/session-end.js`、`lib/app/prompt.js · advisory_a17ffa417765d1b069519d4c

需要完整证据时,可用行末 finding_key 查询 Sentinel PR review context。

由 Sentinel 审核 · 目标提交 c9860118c0f1

forrestlinfeng and others added 3 commits November 11, 2026 10:12
Session end now closes an open turn through closeUnfinishedTurn (EvoMap#68); the lifecycle fence and same-turn guards
apply to that path. The owner fix in turn-end.js is reviewed with EvoMap#70; main's finalization code replaced it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A prompt resumed while a session end was closing its open turn had its new turn closed instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A session-end hook killed while holding the lock would otherwise fail every prompt of the resumed session until the
lock goes stale, as the draft correction lock already avoids.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@forrestlinfeng
forrestlinfeng merged commit 1b86d41 into EvoMap:main Nov 11, 2026
6 checks passed
@evomap-aiqa-bot

evomap-aiqa-bot Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Sentinel 已审核此变更,未发现已核验问题,但发现需要人工确认的风险。

另有 2 个需要人工确认的风险;黄色 advisory 不阻塞合并,建议开发 agent review advisory 评论并逐条确认。

开发 agent 查询详情: 调用 MCP 工具 sentinel_pr_review_context,传入 owner_repo="evomap/evolver-agent-plugin"、pr_number=75、head_sha="9cadb2bd592fe78a32bc53758b04dd987abb06d6",并按条目追加 finding_id 或 finding_key。

由 Sentinel 审核 · 目标提交 9cadb2bd592f

@forrestlinfeng

Copy link
Copy Markdown
Contributor

Merged with maintainer changes: main merged in (session end now goes through closeUnfinishedTurn; the session-activity update moved into the prompt's locked section); closeUnfinishedTurn now passes expectedTurn on non-native hosts too, so a session end paused mid-close can't close a newer prompt's turn (test fails without it); and a stuck lifecycle lock no longer makes every prompt fail for ~2 min — the prompt opens without it and reports ELOCKED, like the draft-correction lock. Thanks!

@evomap-aiqa-bot

Copy link
Copy Markdown

Sentinel 保留了 2 个尚未确认的审核候选。这些黄色条目不阻塞合并;红色 P0/P1 与其他独立硬门禁不受影响。 单一猜测、缺少变更行证据或纯 checklist 的候选会统一降为 P3。
开发 agent:请 review 以下 advisory,并逐条给出“已验证无风险 / 已修复 / 转为后续事项”的结论;不要只做整体确认。

  • [P2] 锁超时降级会让新会话被旧清理再次关闭 — sessionEnded 在生命周期锁内先结束 session,再清理 candidates 和 notes;提示等待锁 2 秒后,fen...(truncated) · lib/app/prompt.js·advisory_b08a189a4feeded7bcaf1df3`
  • [P3] 旧 session-end 报告入队后可能被重复入队 — 报告及 pendingControls 在生命周期锁之前已经不可逆地入队;如果期间 prompt 开启了新 turn,�...(truncated) · lib/app/session-end.js · advisory_7d20d6c5d9d82e6925fdd234

需要完整证据时,可用行末 finding_key 查询 Sentinel PR review context。

由 Sentinel 审核 · 目标提交 9cadb2bd592f

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.

2 participants