Skip to content

feat(compat): doctor 带 in-band invocationIdentity + --nonce 缓存击穿——#197 收官 - #200

Merged
2233admin merged 3 commits into
mainfrom
claudeMaster/doctor-invocation-identity-197
Aug 5, 2026
Merged

feat(compat): doctor 带 in-band invocationIdentity + --nonce 缓存击穿——#197 收官#200
2233admin merged 3 commits into
mainfrom
claudeMaster/doctor-invocation-identity-197

Conversation

@2233admin

Copy link
Copy Markdown
Owner

内容

#197 收尾:doctor 的防重放身份 + --nonce 缓存击穿参数。至此 #197 三个缺口全部落地。

实现

  • doctor bootstrap 输出根部新增 CLI 层字段
    invocationIdentity: { id: <nanos-pid-seq hex>, nonce: <回显或空> };
    human 渲染尾部追加同信息一行。stderr 保持空——doctor 的 envelope 契约
    (doctor_envelope / doctor_bootstrap_cli 断言)不动。
  • 新 flag doctor bootstrap --nonce <value>:检测之外的预防半边——调用方
    变化 nonce 即让命令行字节唯一,按字节键控的重放缓存永远打不中;回显证明
    值到达了活进程。缺值 fail-closed(--nonce requires a value,exit 65)。

关键取舍

  • 字段只在 CLI 打印层注入,observe() 本体不动:DAG doctor 节点直接消费
    observe() 落 artifact 算 sha256,唯一 id 进去会破坏 benchmark 的
    "重放 digest 全等"契约。身份属于调用,不属于观察。
  • id 生成器在 doctor_bootstrap 内部自持(不引 crate::invocation_identity):
    本模块被集成测试的 doctor-adapter 副本当独立编译根 #[path] 引入,跨模块
    crate:: 引用在那些根里不解析——与 observe() 里 graphProvider 注释记录的
    是同一条约束。
  • 无 CLI 面破坏:--contract-probe 对 doctor bootstrap 走 unknown-argument
    路径,head-parity fixture 无需同步;help 文本不列 flag。

验证

  • 新增 3 测试:同 argv 两次运行 id 必不同 + nonce 回显、--nonce 缺值
    fail-closed、进程内 id 不重复(在主二进制与 adapter 副本两个编译根各跑一遍)。
  • orchestration/integrations.json 的 doctor toolchainDigests 重钉,且
    identity.rs 新增进声明清单与绑定测试(否则 pin 门对新文件失明——Gates are scoped to what the propagation script touches, not to the invariant #184
    同款盲区,当场堵上)。过程中复现 repin 盲区:连续两轮未提交编辑后 pin 孤儿化,repin 假报 clean #129 的 repin 二轮孤儿 pin 假 clean
    (报 0 orphaned 但绑定测试红),按声明路径手动对账修复。
  • 身份逻辑首版内联在 mod.rs 时,权威 self-scan 的 sentrux_gate 以
    quality −1 / coupling +0.09 拒绝(adapter 副本把新 import 摊进
    capability_inventory 的口径)——收进 identity.rs 子模块后指标回基线内,
    门禁按设计工作。
  • E08 hospital 退役包冻结面含 doctor_adapter.rs,按原
    EvaluatedAt=1785441780 重造,packet suite 10/10。
  • doctor_bootstrap_cli 10/10;全量 cargo test -p code-intel --locked 全绿;
    权威 self-scan(release-gate parity)exit 0——self-scan 内部 doctor 节点走
    observe() 直连,artifact digest 不受影响,恰好是本取舍的实证。
  • docs/host-command-proxy-compat.md 补 doctor in-band 身份与 nonce 语义;
    invocation_identity.rs 模块注释同步。

Closes #197

…三缺口收官

- doctor bootstrap 输出根部新增 CLI 层 invocationIdentity {id, nonce},
  human 渲染尾部同步一行;stderr 保持空,envelope 契约不动
- 新 flag --nonce <value>:调用方变化 nonce 即让命令行字节唯一,按字节
  键控的重放缓存永远打不中;缺值 fail-closed
- 身份逻辑收进 doctor_bootstrap/identity.rs 子模块(仿 config/paths/probe
  结构):observe() 不受触碰,DAG doctor 节点 artifact digest 保持重放稳定;
  不引 crate::invocation_identity(adapter 副本编译根约束)
- identity.rs 纳入 doctor toolchainDigests 声明与绑定测试(堵 pin 门盲区);
  repin 二轮孤儿 pin 假 clean 复现(#129),按声明路径手动对账修复
- E08 hospital 退役包按原 EvaluatedAt 重造(冻结面含 doctor_adapter.rs)
- docs/host-command-proxy-compat.md 补 doctor in-band 身份与 nonce 语义

Closes #197
@2233admin 2233admin added the agent-approved 人已审过该 agent PR,允许合并 label Aug 5, 2026
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@2233admin, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 24 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 15946c7b-5275-48db-b42a-18ca2c7f286b

📥 Commits

Reviewing files that changed from the base of the PR and between 5f22f2d and a57e247.

📒 Files selected for processing (22)
  • crates/code-intel-cli/src/doctor_adapter.rs
  • docs/host-command-proxy-compat.md
  • orchestration/integrations.json
  • orchestration/retirements/e08-hospital/compatibility-retirement-deletion-diff.json
  • orchestration/retirements/e08-hospital/compatibility-retirement-manifest.json
  • orchestration/retirements/e08-hospital/compatibility-retirement-ticket.json
  • orchestration/retirements/e08-hospital/e00-request.json
  • orchestration/retirements/e08-hospital/e01-request.json
  • orchestration/retirements/e08-hospital/e01-stderr.txt
  • orchestration/retirements/e08-hospital/evidence/c00-necessity.json
  • orchestration/retirements/e08-hospital/evidence/compatibility-window.json
  • orchestration/retirements/e08-hospital/evidence/contract-parity.json
  • orchestration/retirements/e08-hospital/evidence/dependency-a04.json
  • orchestration/retirements/e08-hospital/evidence/dependency-b07.json
  • orchestration/retirements/e08-hospital/evidence/effect-parity.json
  • orchestration/retirements/e08-hospital/evidence/golden-parity.json
  • orchestration/retirements/e08-hospital/evidence/independent-approval.json
  • orchestration/retirements/e08-hospital/evidence/registry-reconciliation.json
  • orchestration/retirements/e08-hospital/evidence/replacement-atom.json
  • orchestration/retirements/e08-hospital/evidence/rollback-execution.json
  • orchestration/retirements/e08-hospital/evidence/usage-observation.json
  • orchestration/retirements/e08-hospital/gate-out/compatibility-retirement-decision.json
📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added invocation identity details to Doctor bootstrap output, including a generated ID and optional echoed nonce.
    • Human-readable output now displays the same identity information.
  • Bug Fixes

    • Doctor bootstrap keeps standard error output empty while reporting identity data.
    • Missing nonce values now produce clear validation errors and appropriate failure codes.
  • Documentation

    • Updated compatibility guidance to describe invocation identity, nonce usage, and stable probe results.
  • Tests

    • Added coverage for identity uniqueness, nonce propagation, output validity, and validation behavior.

Walkthrough

Doctor bootstrap now generates invocation identities, accepts an optional nonce, and includes identity data in CLI output. Tests, documentation, integration digests, and hospital retirement snapshots were updated.

Changes

Doctor invocation identity

Layer / File(s) Summary
Bootstrap identity flow
crates/code-intel-cli/src/doctor_bootstrap/*, crates/code-intel-cli/src/invocation_identity.rs, crates/code-intel-cli/tests/doctor_bootstrap_cli.rs, docs/host-command-proxy-compat.md
Doctor bootstrap parses --nonce, generates unique invocation IDs, adds identity to JSON observations, renders identity in human-readable output, keeps stderr empty, and validates missing nonce values.
Integration digest declarations
crates/code-intel-cli/src/doctor_adapter.rs, orchestration/integrations.json
Digest coverage and Doctor compatibility digests include the new identity implementation.
Compatibility retirement snapshot refresh
orchestration/retirements/e08-hospital/*
Retirement records and evidence now reference the refreshed snapshot identity and artifact hashes. Existing retirement metadata and outcomes remain unchanged.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant doctor_bootstrap_run_raw
  participant doctor_bootstrap_identity
  participant CLIOutput
  Caller->>doctor_bootstrap_run_raw: invoke with optional --nonce
  doctor_bootstrap_run_raw->>doctor_bootstrap_identity: generate identity and augment observation
  doctor_bootstrap_identity->>CLIOutput: return JSON or human-readable identity
  doctor_bootstrap_run_raw-->>Caller: output with empty stderr
Loading

Possibly related PRs

Poem

A rabbit sees the nonce hop,
An identity blooms at every stop.
JSON carries the trail so bright,
Empty stderr keeps signals right.
Snapshots follow, neat and true. 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR meets the doctor-specific goals, but #197 also requires run identity for run execute, audit validate, and benchmark. Implement and verify the remaining command identities, or narrow the issue closure claim to the doctor-specific scope.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the doctor invocation identity and --nonce changes addressed by the pull request.
Description check ✅ Passed The description directly explains the doctor identity, nonce, compatibility, testing, and documentation changes.
Out of Scope Changes check ✅ Passed The digest, tests, documentation, and refreshed E08 artifacts directly support the doctor compatibility and retirement snapshot changes.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Code Intel change risk

Score Percentile Level
62/100 64th (vs last 47 commits) 🟡 medium

Top signals

  • Diff shape: 26 file(s), +203/-31 (max file share 0.33)
  • Test asymmetry: source changed, tests touched
  • Bug-magnet: 144 fix commit(s) in touched files (180d)
  • Churn: 299 commit(s) touching these files (90d)

revspec: origin/main..HEAD · threshold: percentile >= 90 blocks unless labeled risk-accepted · code-intel change risk

@coderabbitai coderabbitai 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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/host-command-proxy-compat.md`:
- Around line 57-62: Update the nonce command example in the documentation to
use the complete compiled CLI invocation, `code-intel doctor bootstrap --nonce
<value>`, instead of starting with `doctor`. Keep the surrounding explanation
unchanged and follow the guideline that new examples lead with `code-intel`.

In `@orchestration/integrations.json`:
- Around line 288-290: The Doctor toolchain evidence set omits a digest-bound
source and lacks validation that both declarations stay consistent. In
orchestration/integrations.json lines 288-290, add
crates/code-intel-cli/src/doctor_bootstrap/identity.rs to
toolchainDigestEvidence.inputs; in crates/code-intel-cli/src/doctor_adapter.rs
lines 470-485, update the existing validation to assert every digest-bound
source is included in toolchainDigestEvidence.inputs.

In
`@orchestration/retirements/e08-hospital/compatibility-retirement-deletion-diff.json`:
- Line 1: Remove stale Hospital and surgery consumers from the report and
summary construction, including all dereferences of $hospitalReport and
$surgeryPlan and the advertised Hospital artifact paths, while preserving the
remaining report publication flow. Update the pinned compatibility-retirement
JSON via literal string replacement, then recompute and refresh every affected
{path, sha256} or toolchainDigests pin once after all edits.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 02995742-0a38-4ae0-a6fe-0625ef781388

📥 Commits

Reviewing files that changed from the base of the PR and between 471c699 and 5f22f2d.

📒 Files selected for processing (26)
  • crates/code-intel-cli/src/doctor_adapter.rs
  • crates/code-intel-cli/src/doctor_bootstrap/identity.rs
  • crates/code-intel-cli/src/doctor_bootstrap/mod.rs
  • crates/code-intel-cli/src/invocation_identity.rs
  • crates/code-intel-cli/tests/doctor_bootstrap_cli.rs
  • docs/host-command-proxy-compat.md
  • orchestration/integrations.json
  • orchestration/retirements/e08-hospital/compatibility-retirement-deletion-diff.json
  • orchestration/retirements/e08-hospital/compatibility-retirement-manifest.json
  • orchestration/retirements/e08-hospital/compatibility-retirement-ticket.json
  • orchestration/retirements/e08-hospital/e00-request.json
  • orchestration/retirements/e08-hospital/e01-request.json
  • orchestration/retirements/e08-hospital/e01-stderr.txt
  • orchestration/retirements/e08-hospital/evidence/c00-necessity.json
  • orchestration/retirements/e08-hospital/evidence/compatibility-window.json
  • orchestration/retirements/e08-hospital/evidence/contract-parity.json
  • orchestration/retirements/e08-hospital/evidence/dependency-a04.json
  • orchestration/retirements/e08-hospital/evidence/dependency-b07.json
  • orchestration/retirements/e08-hospital/evidence/effect-parity.json
  • orchestration/retirements/e08-hospital/evidence/golden-parity.json
  • orchestration/retirements/e08-hospital/evidence/independent-approval.json
  • orchestration/retirements/e08-hospital/evidence/registry-reconciliation.json
  • orchestration/retirements/e08-hospital/evidence/replacement-atom.json
  • orchestration/retirements/e08-hospital/evidence/rollback-execution.json
  • orchestration/retirements/e08-hospital/evidence/usage-observation.json
  • orchestration/retirements/e08-hospital/gate-out/compatibility-retirement-decision.json

Comment thread docs/host-command-proxy-compat.md
Comment thread orchestration/integrations.json Outdated
…identity.rs

CI 的 atomic capability 合同测试按 inputs[i] ↔ toolchainDigests[i] 配对校验;
上一提交只在 digests[2] 插入 identity.rs 的 hash,inputs 没有同位插入路径,
计数 7≠8 且 2 号位之后全部错位。本地 cargo test + repin 全绿仍被 CI 打回——
#176 描述的门禁清单盲区的又一实证。

Refs #176
- doctor_adapter.rs 的 registry_toolchain_digests 测试从只查成员资格升级为:
  inputs/digests 计数相等 + 每个 digest-bound 源在 inputs 内 + inputs[i] 与
  toolchainDigests[i] 按下标配对——CI 才抓得到的错位从此本地 cargo test 即红
- docs 示例改为 code-intel doctor bootstrap --nonce <value>(编译 CLI 先行准则)
- doctor_adapter.rs digest 重钉;E08 包随冻结面重造(rehearsal root 需独占,
  已清残留)

Refs #176
@2233admin
2233admin merged commit 91458a2 into main Aug 5, 2026
9 checks passed
@2233admin
2233admin deleted the claudeMaster/doctor-invocation-identity-197 branch August 7, 2026 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-approved 人已审过该 agent PR,允许合并

Projects

None yet

Development

Successfully merging this pull request may close these issues.

compat: 宿主命令代理(RTK 类)下的判定完整性——重写/缓存重放/输出过滤三威胁

1 participant