Skip to content

fix: detect teammate messages by tag alone, accepting both tag variants - #10

Merged
Mapleeeeeeeeeee merged 1 commit into
mainfrom
fix/teammate-tag-variants
Sep 1, 2026
Merged

fix: detect teammate messages by tag alone, accepting both tag variants#10
Mapleeeeeeeeeee merged 1 commit into
mainfrom
fix/teammate-tag-variants

Conversation

@Mapleeeeeeeeeee

Copy link
Copy Markdown
Owner

為什麼

teammate message 的偵測原本要求 <teammate-message 標籤加上開場白或免責聲明其中之一。harness 還會用 <agent-message from="X"> 包同一種訊息,60 天內 1,112 則裡有 80 則是這個變體,全部以原始 XML 全文渲染、算成一般 user turn。開場白和免責聲明是散文,已經改寫過一次。

改了什麼

  • 偵測只認標籤,兩個變體都收,不再看散文;移除已成死碼的 teammatePrefixteammateWarningshasTeammateMarker
  • CompactTeammateMessage 依各標籤自己的開閉對抽取 body,id 取 teammate_idfrom;沒有屬性時渲染為 [teammate]
  • 標籤清單收在 session.TeammateTagVariants 單一處,classify 與 compact 共用
  • ADR-008 第 4 節更新為標籤偵測,「沒有解決的」移除此項

驗證

  • gofmt / go vet / go test ./... 全綠;新增 agent-message 變體、無屬性變體、只有開場白沒有標籤(不分類)三組 case
  • 真實 session fc65aeeb:12 則 teammate 訊息全部壓縮,<agent-message / <teammate-message 原始標籤殘留 0,[teammate: cdcv13-finish] idle 與既有 <teammate-message> 發送者並列渲染

🤖 Generated with Claude Code

https://claude.ai/code/session_01TcvWErnKnuADJsomnZfwFr

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
@Mapleeeeeeeeeee
Mapleeeeeeeeeee merged commit 35a7654 into main Sep 1, 2026
3 checks passed
@Mapleeeeeeeeeee
Mapleeeeeeeeeee deleted the fix/teammate-tag-variants branch September 1, 2026 20:25
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.

1 participant