Skip to content

fix(inbound): trim blocked quoted chain context - #515

Draft
soimy wants to merge 1 commit into
mainfrom
feat/dingtalk-context-visibility-subagent-alignment
Draft

fix(inbound): trim blocked quoted chain context#515
soimy wants to merge 1 commit into
mainfrom
feat/dingtalk-context-visibility-subagent-alignment

Conversation

@soimy

@soimy soimy commented Apr 9, 2026

Copy link
Copy Markdown
Owner

背景

#499 相关的上游对齐项大多已经在主干落地,但对照 docs/plans/2026-04-06-dingtalk-context-visibility-and-subagent-session-alignment.md 继续复核后,仍发现一个剩余偏差:

  • contextVisibility=allowlist / allowlist_quote 目前只按第一跳 quoted sender 做可见性判断
  • 当第一跳允许、但更深层 quoted chain 中仍有未授权 inbound hop 时,这些 deeper context 仍会通过 UntrustedContext 泄漏给 runtime

目标

  • 收口 DingTalk contextVisibility 的最后一处明显行为偏差
  • 让 group quote / quoted-chain 在 allowlistallowlist_quote 下都符合计划中的多跳过滤预期
  • 保持现有 quotedChain 对外 JSON 结构稳定,避免引入额外兼容性噪音

实现

  • quoted-context 内为 chain entry 挂载不可枚举的 sender 元数据,仅供运行时过滤使用,不改变已有序列化输出
  • inbound-handlerfilterQuotedRuntimeContext() 中改为逐跳裁剪 chain:
    • allowlist:第一跳必须可见,后续 deeper inbound hop 仅保留连续 allowlisted 部分
    • allowlist_quote:保留第一跳显式 quote,但继续裁掉 deeper blocked chain
  • 新增回归测试覆盖:
    • 第一跳 allowlisted、第二跳 blocked 时不再泄漏 UntrustedContext
    • allowlist_quote 保留第一跳显式引用但不保留 deeper blocked chain

实现 TODO

  • 根据 review 反馈决定是否需要补一条 release note / docs 说明,明确这是 #499 后续收口

验证 TODO

  • npm run type-check
  • pnpm test

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