fix: harden closed-subagent tombstones and kimi hooks status#285
Open
zephyr110 wants to merge 1 commit into
Open
fix: harden closed-subagent tombstones and kimi hooks status#285zephyr110 wants to merge 1 commit into
zephyr110 wants to merge 1 commit into
Conversation
Cap live closed-subagent ids with ordered O(1) lookups, tighten the Cursor routing probe, and report Kimi hooks only for the install-target config so migrated users are not false-positive "installed".
This was referenced Jul 24, 2026
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
Follow-ups for the LOW notes on #262 and #274:
closedSubagentIdsis an ordered list (newest last) with a live keep-last-256 cap, O(1)hasClosedSubagentId, and mutate-only APIs. Persist keeps insertion order (no.sorted()). Restore loads all disk ids (no fake-recency trim); the live cap applies on newrecordonly. Permission/Question suppress useshasClosedSubagentId.deinit;stopSessionDiscoveryalso invalidatesrotationTimer.agent-transcriptsplus_sourceofcursor/cursor-cli(compact literals → whitespace-tolerant regex → JSON only if\uis present). Drop write-only_cursor_subagent_session_id/_cursor_subagent_event.cli.fullPath(install target). Uninstall still scrubs modern + legacy.turn.promptover a precedingcontext.append_message; emptyturn.promptdoes not wipe append text; consecutive prompts do not drop the prior user line.discoverKimiCodeSessionFromIndexvia a test seam (private type unchanged).中文说明
针对 #262 与 #274 的 LOW 跟进:
closedSubagentIds改为有序数组(最新在末尾),运行时 keep-last-256,O(1)hasClosedSubagentId,仅经 mutate API 写入。持久化保留插入序(不再.sorted())。restore 保留磁盘全部 id(不做假 recency 截断);cap 只在新的record时生效。Permission/Question 抑制改走hasClosedSubagentId。deinit在一次主线程 hop 内拆掉 Timer + FSEvents;stopSessionDiscovery也会 invalidaterotationTimer。agent-transcripts且_source为cursor/cursor-cli(compact 字面量 → 冒号两侧空白的 regex → 仅当存在\u时才 JSON)。删除只写字段_cursor_subagent_session_id/_cursor_subagent_event。cli.fullPath(安装目标)。卸载仍同时清理 modern + legacy。context.append_message,后续turn.prompt优先替换用户文本;空的turn.prompt不擦掉 append 内容;连续turn.prompt不会丢掉上一轮用户行。discoverKimiCodeSessionFromIndex增加单测(经 test seam;DiscoveredSession仍保持 private)。Test Plan
ClosedSubagentIdsCapTestsHookServerCursorProbeTests(compact / spaced /\u/ negatives)ConfigInstallerTests(status path lock + migration false-positive)KimiCodeSessionDiscoveryTestsKimiTranscriptTests(both orders, consecutive prompts, empty prompt)CursorSessionFoldingTests,AppStateCursorSubsessionTests