Skip to content

feat: 增加测试版 Owner 声纹软拦截 - #2460

Draft
MomiJiSan wants to merge 2 commits into
Project-N-E-K-O:codex/voice-owner-enrollmentfrom
MomiJiSan:codex/voice-owner-soft-filter
Draft

feat: 增加测试版 Owner 声纹软拦截#2460
MomiJiSan wants to merge 2 commits into
Project-N-E-K-O:codex/voice-owner-enrollmentfrom
MomiJiSan:codex/voice-owner-soft-filter

Conversation

@MomiJiSan

Copy link
Copy Markdown
Contributor

概要

这是 #2459 之上的第二个新增堆栈 PR,为测试版 Owner 声纹增加宽松判定与 Independent ASR 当前候选软截断。

测试版目标只有一个:在尽量不影响 Owner 正常语音的前提下,截断一部分稳定、明显不匹配的长语音尾部,减少后续 ASR/LLM 消耗。它不是身份认证或安全边界。

包含 2 个逻辑 commit:

  1. 新增 provider-neutral 的 FORWARD / REJECT_CURRENT_CANDIDATE 决策契约,以及版本化 beta-v1 两阶段策略。
  2. 在 Independent ASR 公共控制层执行当前候选软截断,不进入任何 Provider worker。

判定行为

  • 功能默认关闭;无有效 Profile 时不能开启。
  • 1.5 秒与 3 秒分别产生一次独立 CAM++ 观测。
  • 两次相似度都明显低于 0.40 才允许形成拒绝结论。
  • 不读取旧 would_block 观测字段作为执行命令。
  • 不足 3 秒、Owner、边界分数、分数波动、缺失观测、模型异常、队列压力、profile revision 变化均放行。
  • 阈值固定为版本化 Beta 参数,不自动学习或调整。

执行行为

每个拒绝请求携带并在执行前复核:

  • session ID
  • detector epoch
  • candidate generation
  • candidate scope
  • profile revision
  • observation generation(额外的 shadow 防重放 fence)

命中后仅处理当前候选:

  • 使旧 Provider transport 立即失去回调资格。
  • 停止当前候选剩余 PCM 的排队与上传。
  • 释放当前候选 transcript reservation,不清除先前候选的 reservation/final。
  • 丢弃该候选尚未进入对话的 Provider partial/final,不发送 LLM。
  • 持续发声尾部保持抑制;检测到 pause 后复位 detector,下一句建立新 candidate 并正常重连。
  • Provider 已收到的约前 3 秒不可撤回,因此只承诺部分节省。

边界

  • 不修改 OpenAI/Qwen/Soniox/Grok/Step/GLM/Gemini worker。
  • 不修改 SmartTurn、server_vad 或 Provider endpointing 算法。
  • 不增加上传前暂存、hard block、整场会话封禁、多人识别、回放/克隆/活体检测。
  • 不改变 Native Omni 路径。
  • 不把该功能描述为认证或安全功能。

验证结果

  • 完整 ASR / endpointing / SmartTurn / voice-turn 回归:552 passed,3 skipped。
  • voice-identity / enrollment / persistence / UI contract / CAM++ 回归:113 passed。
  • Commit 5 定向组合回归:235 passed,1 skipped。
  • Beta 策略模块覆盖率:85%,满足 80% 门槛。
  • Ruff 与 git diff --check 通过。

覆盖场景包括:Owner 不截断、短语音/分数波动放行、稳定低分长语音减少尾部上传、旧 final 不进 LLM、下一句恢复、6 类过期 identity 拒绝执行、detector reset 失败 fail-open、旧 transcript reservation 不被当前候选清除。

Regression Report

Scope

执行能力只存在于 IndependentAsrRuntime 公共控制层;Core 负责组合当前 Profile/filter 状态并提交带完整 identity 的请求。Provider worker、模型协议和 endpointing 决策保持不变。

Risk

GitNexus 提交前检测为 HIGH,原因是公共 IndependentAsrRuntime 的 start/close/ingress 执行流受到类级变更影响,共映射到 7 条执行流程。实际变更没有改写既有 start/close/endpointing 分支,而是增加隔离的候选 fence、异步 cleanup 与 fail-open 状态;上述 552 项完整 ASR 回归用于覆盖该公共层风险。

Provider Matrix

  • OpenAI / Qwen / Soniox / Grok / Step:继续使用 provider-native endpointing;Owner 策略不等待 CAM++ 才上传。
  • GLM / Gemini:继续使用 SmartTurn;拒绝只消费公共 detector activity,不改变 SmartTurn 语义判断。
  • 所有 Provider:旧 transport 在拒绝时被公共层摘除,Provider-specific callback 因 session identity 不再匹配而失效。

Candidate / Transcript Isolation

执行同时匹配 session、detector epoch、candidate generation、scope、profile revision 与 shadow observation generation。当前 candidate 只释放自己的 transcript reservation;先前 candidate 的 reservation/final 保留。pause 后再次 reset,将持续发声尾部与下一句分开。

Fail-open

任何 identity 不匹配、Profile 更新、策略异常、detector 不可用、reset 失败或清理失败都不会升级为 hard block。reset 失败会清除尾部抑制,恢复正常上传路径。

@MomiJiSan
MomiJiSan requested a review from wehos as a code owner July 24, 2026 04:18
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (3)
  • steam
  • react-rewrite
  • plugin

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1b224944-57de-438b-b40d-1301c9e71120

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@MomiJiSan
MomiJiSan marked this pull request as draft July 24, 2026 04:18

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2252d23d44

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread main_logic/asr_client/runtime.py Outdated
Comment on lines +1619 to +1621
if detector is self._asr_detector:
try:
await detector.reset()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Defer reset until the rejected candidate pauses

Resetting the detector here immediately discards the rejected candidate's VAD/endpointing state, but suppression is only cleared later when a CANDIDATE_PAUSE is observed. If this cleanup completes before the rejected speaker's trailing silence is fed (the normal asynchronous case), that silence cannot produce a pause for the old candidate; suppression then persists through the next real utterance and drops it until its pause arrives. Keep the detector state through the suppressed tail and reset only when _finish_owner_voice_soft_suppression observes the rejected candidate's pause.

Useful? React with 👍 / 👎.

@greptile-apps

greptile-apps Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

增加测试版 Owner 声纹软拦截,并在 Independent ASR 公共控制层按候选身份执行尾部抑制喵。

  • 新增版本化双阶段声纹判定策略与完整候选身份契约喵。
  • 为声纹观测增加 1.5 秒和 3 秒检查点及候选 generation fence 喵。
  • 拒绝当前候选时停止后续音频上传、清理 Provider transport,并在 pause 后恢复下一候选喵。
  • 增加策略、候选隔离、过期决策、失败放行及恢复流程的单元测试喵。

Confidence Score: 5/5

在本次跟进审查允许的既有线程范围内,没有剩余的新阻塞问题,当前改动看起来可以合并喵。

没有发现符合跟进审查发布条件的阻塞故障喵。

Important Files Changed

Filename Overview
main_logic/asr_client/runtime.py 在公共 Independent ASR 层加入候选身份复核、Provider 分离、尾部抑制及 pause 后恢复流程喵。
main_logic/core/asr_runtime.py 将声纹 shadow observation 组合为 beta 决策,并仅在 Profile 与候选身份仍有效时请求软拒绝喵。
main_logic/voice_identity/beta_policy.py 新增固定阈值、双观测、默认放行的 beta-v1 Owner 声纹策略喵。
main_logic/voice_identity/runtime.py 将单次声纹评估扩展为按配置检查点产生多次候选观测喵。
main_logic/asr_client/detector_runtime.py 为 speaker-shadow 候选补充 generation 身份并提供当前候选匹配检查喵。

Sequence Diagram

sequenceDiagram
  participant Audio as Audio ingress
  participant Detector as Detector/CAM++
  participant Policy as Owner beta policy
  participant Runtime as Independent ASR runtime
  participant Provider as ASR provider
  Audio->>Detector: Stream candidate PCM
  Detector->>Policy: 1.5s observation
  Policy-->>Runtime: FORWARD
  Detector->>Policy: 3.0s observation
  alt Both observations clearly mismatch
    Policy-->>Runtime: REJECT_CURRENT_CANDIDATE
    Runtime->>Runtime: Validate candidate identity fences
    Runtime->>Provider: Detach and close transport
    Runtime->>Runtime: Suppress remaining candidate audio
    Audio->>Detector: Candidate pause
    Runtime->>Detector: Reset
  else Owner, uncertain, stale, or failure
    Policy-->>Runtime: FORWARD
  end
Loading

Reviews (4): Last reviewed commit: "feat(asr): 增加非 Owner 当前候选软截断" | Re-trigger Greptile

Comment thread main_logic/asr_client/runtime.py
@MomiJiSan
MomiJiSan force-pushed the codex/voice-owner-enrollment branch from 2316db4 to 65c5705 Compare July 24, 2026 04:22
@MomiJiSan
MomiJiSan force-pushed the codex/voice-owner-soft-filter branch from 2252d23 to e3c7b38 Compare July 24, 2026 04:22
@MomiJiSan
MomiJiSan marked this pull request as ready for review July 24, 2026 04:23
Comment thread main_logic/asr_client/runtime.py
Comment thread main_logic/asr_client/runtime.py
@MomiJiSan
MomiJiSan force-pushed the codex/voice-owner-soft-filter branch from e3c7b38 to 9452cc3 Compare July 24, 2026 04:27
@MomiJiSan
MomiJiSan force-pushed the codex/voice-owner-enrollment branch from 65c5705 to 479b6e6 Compare July 24, 2026 04:32
@MomiJiSan
MomiJiSan force-pushed the codex/voice-owner-soft-filter branch from 9452cc3 to 2fe886b Compare July 24, 2026 04:32
@MomiJiSan
MomiJiSan marked this pull request as draft July 24, 2026 04:40
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.

2 participants