fix: detect teammate messages by tag alone, accepting both tag variants - #10
Merged
Conversation
The harness wraps a teammate message in either <teammate-message teammate_id=...> or <agent-message from=...>. Detection required the first tag plus a prose marker; 80 of 1,112 messages in a 60-day sample used the second tag and rendered as raw XML counted as user turns. Detection now matches either tag and ignores the surrounding prose, which has already been reworded once. Compaction extracts each block with its own tag's open/close pair and reads the id from whichever attribute the variant carries. The tag list lives in one place in the session package so classify and compact cannot drift apart. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TcvWErnKnuADJsomnZfwFr
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.
為什麼
teammate message 的偵測原本要求
<teammate-message標籤加上開場白或免責聲明其中之一。harness 還會用<agent-message from="X">包同一種訊息,60 天內 1,112 則裡有 80 則是這個變體,全部以原始 XML 全文渲染、算成一般 user turn。開場白和免責聲明是散文,已經改寫過一次。改了什麼
teammatePrefix、teammateWarnings、hasTeammateMarkerCompactTeammateMessage依各標籤自己的開閉對抽取 body,id 取teammate_id或from;沒有屬性時渲染為[teammate]session.TeammateTagVariants單一處,classify 與 compact 共用驗證
gofmt/go vet/go test ./...全綠;新增 agent-message 變體、無屬性變體、只有開場白沒有標籤(不分類)三組 casefc65aeeb:12 則 teammate 訊息全部壓縮,<agent-message/<teammate-message原始標籤殘留 0,[teammate: cdcv13-finish] idle與既有<teammate-message>發送者並列渲染🤖 Generated with Claude Code
https://claude.ai/code/session_01TcvWErnKnuADJsomnZfwFr