Repository navigation
Conversation
DSH 把本地 CLI agent(codex / antigravity / claude code / opencode / grok)包成 provider 为 local-* 的会话,这些 turn 的用量已经由该 CLI 自己的采集器上报, dsh 采集器再记一遍会让同一批 token 在 events 里出现两行。 判据用每条 assistant 消息自带的 source.provider(回落 request/header 的 config.provider):以 local- 开头即跳过。DSH 原生 provider 是 magpie / magpie-responses / deepseek-account 这类普通名字,不受影响。 实测:包裹会话插入 0 条,原生会话照常插入。
This branch has not been deployed
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.
问题
DSH 会把本地 CLI agent(codex / antigravity / claude code / opencode / grok)包成 provider 为
local-*的会话。这些 turn 的用量已经由该 CLI 自己的采集器上报(tool=codex/antigravity/claude-code/opencode/grok),dsh采集器再记一遍,同一批 token 就在events里出现两行。实测 2026-11-23 当天:上报总量 370,912,676,其中重复 156,179,643(42.1%);11-19 到 11-23 累计 462 行 / 1,309,465,707 token。
改动
isWrappedCliProvider():provider 以local-开头即视为被包裹的 CLI agentrecord()增加recProvider参数,命中直接returnrequest/header分支记录provider,作为逐请求判据的回落assistant/message传入data.message.source.provider只动
src/collectors/dsh.js,+19 / −2。测试
用真实会话文件跑
collectDshFile(假 store 只统计插入条数):local-codex-clilocal-antigravitylocal-claude-codemagpiemagpie装到本机后重启采集器,14:02 之后新写入的 CLI 模型
dsh行 0 条,同期 DSH 原生会话正常写入 8 行 / 2,358,770 token。注意
判据是前缀
local-。若将来 DSH 出现local-路由但没有对应采集器,这里需要改成白名单映射,否则会漏计。关联 issue:#23