Stage 366: PR #2357 — Fix compression reference card anchoring by @franksong2702

This commit is contained in:
Hermes Agent
2026-05-16 04:26:08 +00:00
2 changed files with 14 additions and 1 deletions
+1 -1
View File
@@ -5562,7 +5562,7 @@ function renderMessages(options){
const turn=anchorSeg.closest('.assistant-turn');
const blocks=_assistantTurnBlocks(turn);
if(blocks){
blocks.appendChild(node);
blocks.insertBefore(node, anchorSeg);
return;
}
const turnParent=turn && turn.parentElement;
+13
View File
@@ -274,6 +274,19 @@ def test_reference_message_uses_raw_transcript_position_before_anchor_fallback()
assert "else _insertCompressionLikeNode(referenceNode);" in src
def test_reference_message_inserted_before_future_assistant_anchor():
src = _read("static/ui.js")
start = src.find("function _insertCompressionLikeNodeByRawIdx")
assert start != -1, "raw-index insertion helper not found"
end = src.find("const preservedOnlyNode", start)
assert end != -1, "raw-index insertion helper end marker not found"
helper = src[start:end]
assert "const anchorSeg=assistantSegments.get(anchorRawIdx);" in helper
assert "blocks.insertBefore(node, anchorSeg);" in helper
assert helper.index("blocks.insertBefore(node, anchorSeg);") < helper.index("const userRow=userRows.get(anchorRawIdx);")
def test_reference_message_selection_prefers_latest_matching_marker():
src = _read("static/ui.js")
start = src.find("function _latestCompressionReferenceMessage")