Repository navigation
feat(web): 每条持久化回复显示生成它的模型(补齐 #470 切换模型后的归属缺口) - #510
Merged
Merged
Conversation
1 task done
Qiyuanqiii
force-pushed
the
Qiyuanqiii/reply-model-attribution
branch
2 times, most recently
from
October 28, 2026 14:34
eeea0d4 to
51311c6
Compare
Model switching became a first-class mid-thread action (#470), but the transcript never says which model produced which reply. Thread the model identity (provider / model, already recorded on model-call events) through the activity projection, the thread transcript, and the HTTP view as an additive omitempty field, then join it per attempt in the web narrative projection and show it as muted attribution on durable replies. No behavior change beyond the new read-only field and badge; live streaming entries stay unattributed until their call record is durable.
P1: extract attempt_id on the model-call projection (started and completed) so the transcript items actually carry the join key the web projection needs - the first cut set model only, which real data would never join. P2: durable replies are SessionMessageEvent projections without attempt identity; the thread transcript builder now tracks each run's latest model-call attempt and the reply inherits it, so the primary surface is attributed without touching store payloads. P3: hoist the duplicated modelIdentity call (completedModelDetail now takes the identity) and backfill a merged reply's missing model from its later sibling.
…rotocol registry - Add 'model' to parseThreadTranscriptItem optional allowlist and validate bounded text in transcripts.ts. - Synchronize docs/convergence/protocol-registry.md with protocol registry. - Provide explicit setup timeout for agent browser journey on macOS desktop runners. Validation: - npm run check:api passed (16 required, 24 optional keys matched). - npm run typecheck passed (0 errors). - go run ./cmd/protocolregistry -check passed (synchronized). - go test ./internal/runactivity/ ./internal/threadtranscript/ ./internal/httpapi/ passed.
…d ambiguous fallback - Runactivity: populate ModelAttempt and ToolRound on ModelStartedEvent, ModelCompletedEvent, and ModelFailedEvent. - Threadtranscript: track producing model call per modelAttempt so durable SessionMessageEvent replies inherit the concluding model identity and attempt number. - Threadtranscript tests: add multi-model-attempt supervisor retry sequence test and multi-turn regression tests. - Narrative: strictly guard fallback attribution by bare attempt_id to only resolve when the attempt uniquely maps to exactly one model identity. Ambiguous attempts without explicit model attribution omit the badge instead of guessing. - Narrative tests: add test coverage for ambiguous attempt fallback omission and single-model attempt fallback resolution.
Qiyuanqiii
force-pushed
the
Qiyuanqiii/reply-model-attribution
branch
from
October 28, 2026 14:37
51311c6 to
d7a75f6
Compare
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.
What this adds
对照 Claude Code(verbose 中的逐轮模型标识)与 Codex(任务 UI 的模型归属):#470 使模型可中途切换后,transcript 无法回答"这条回复来自哪个模型"。本 PR 把模型调用事件已有的身份(
modelIdentity():provider / model)作为只读字段穿透四层,并在 web 叙事中显示。internal/runactivityItem.Model:ModelStarted/ModelCompleted 投影提取attempt_id与provider / model(均已在负载中,无新数据源)internal/threadtranscriptItem.Model透传;构建循环按 run 跟踪最近模型调用 attempt,最终持久回复(SessionMessageEvent)继承之(回复负载本身无 attempt)internal/httpapiThreadTranscriptItemView.Model(omitempty,只读投影)webmodelByAttempt),持久化回复操作行显示灰字徽标;流式行不显示;合并的重复收尾回复首见优先、缺失回填设计边界
docs/openapi.json与web/src/api/schema.d.ts为go run ./cmd/cyberagent api openapi纯再生成产物。Review findings and resolutions(OCR delegate 模式)
按仓库惯例执行 OCR delegate 复审(
ocr delegate preview/rule+ 独立评审子代理全文核验),4 项发现全部修复,明细见 docs/reviews/reply-model-attribution/README.md:Model未提取attempt_id,真实数据下 web join 永不命中(首版测试手写键掩盖断链)completedModelDetail改收 identity 参数previous.model ??= modelValidation
go test ./internal/runactivity/ ./internal/threadtranscript/ ./internal/httpapi/全过(含真实负载形状的贯穿测试);go build ./...、go vet通过。npm test全量通过;tsc -b零错误。Related
AI assistance and contributor review
Claude <claude@users.noreply.github.com>.