fix: sdk promptSource no longer overrides a recognized harness shape - #14
Merged
Conversation
promptSource reflects the session's driver, so in an SDK-driven session harness injections such as task notifications also carry "sdk". ADR-009's human-source override reset those to plain text and rendered the notification XML in full under user (sdk):, growing one measured session's output by 5.7%. The override now applies only to typed, queued, and suggestion_accepted; an sdk entry with a recognized harness shape keeps its compact form and the shape's own turn verdict. 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.
為什麼
v0.1.76 的 benchmark 有一個 session(
5646d1ce)變貴 5.7%。原因:SDK 驅動的 session 裡,harness 塞的 task-notification 也帶promptSource: "sdk",欄位反映的是 session 的驅動方式,不是那則訊息的作者。ADR-009 決定 4 把sdk當人的來源,把已認出的 task-notification 重置成純文字,XML 全文渲染在user (sdk):底下。ADR-009 量衝突時只查了 typed、queued、suggestion_accepted(三者仍是 0),漏掉 sdk。補量 60 天:
sdk來源有 196 則 task-notification,分布在 15 個 session。改了什麼
IsHumanPromptSource不再包含sdk;決定 4 的覆蓋只對 typed、queued、suggestion_accepted 生效sdk對上已認出的 harness 形狀時,保留 compact 形式與harness:標籤,turn 判定回到該形狀在 ADR-008 的結論;只有形狀認不出的 sdk 訊息才標user (sdk):驗證
gofmt/go vet/go test ./...全綠;新增 parser、角色標籤、turn 政策三層 regression 測試5646d1ce:v0.1.75 為 24 user / 30 harness、217,272 bytes;v0.1.76 為 52 sdk / 2 harness、234,940 bytes;修後 24 sdk / 30 harness、217,416 bytes,多出的 144 bytes 正好是 24 個(sdk)7f4f1af5仍標user (sdk):,ca1581db的排程 prompt 仍標harness:,b11858cfmd5 不變🤖 Generated with Claude Code
https://claude.ai/code/session_01TcvWErnKnuADJsomnZfwFr