Fix compression reference card anchoring

This commit is contained in:
Frank Song authored and Hermes Agent committed 2026-05-16 04:25:22 +00:00
1 parent a08dfffd58
commit 433ad29939
2 files changed
+14 -1

No files matched your search

+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")