Skip to content

feat(codenexus): give codenexus_adapter.rs a real DAG caller - #215

Open
2233admin wants to merge 6 commits into
mainfrom
feature/codenexus-dag-wiring
Open

feat(codenexus): give codenexus_adapter.rs a real DAG caller#215
2233admin wants to merge 6 commits into
mainfrom
feature/codenexus-dag-wiring

Conversation

@2233admin

Copy link
Copy Markdown
Owner

Summary

A provider-usage audit found that codenexus_adapter.rs (already-compiled, already-tested, 387 lines) had zero callers from the actual DAG execution engine — reachable only via a legacy CLI compatibility route explicitly annotated "retire when the DAG exclusively calls the typed codenexus adapter seam." orchestration/internalization/codenexus.json already marked it a retirement candidate for exactly that reason.

This gives it a real production caller by mirroring the existing Sentrux/graph builtin-adapter pattern — no new architecture, just replicating a working shape:

  • builtin_provider_evidence.rs: new codenexus_admission(), collecting native evidence by shelling to legacy/Invoke-CodeNexusLite.ps1 (the same facade run-code-intel.ps1 already uses for the default-run codenexus-context.json), then running it through the existing codenexus_adapter::translate()/validate_admitted_payload() contract — reused, not reimplemented.
  • capability_inventory.rs: dispatch arm for provider.codenexus-builtin.compat.
  • execution_policy.rs: codenexus is now an independently-gateable ProviderRequirement (Optional/Required/Required/Disabled across Default/Strict/Compatibility/Offline, matching sentrux) instead of implicitly always-on.
  • dag_run.rs: evidence.codenexus is now a real conditional DAG node, feeding diagnosis.hospital exactly like evidence.graph/evidence.sentrux.
  • orchestration/integrations.json + internalization/codenexus.json: capabilityDeclaration/runtimeAdapter added for the new route; governance record updated with the new production-caller evidence.

Explicitly out of scope

  • crates/code-nexus-lite/ (a separate, empty, still CVE-2026-48504-blocked Rust worker prototype) — untouched. It's a different thing from codenexus_adapter.rs; reviving it needs upstream iii-sdk to resolve its opentelemetry_sdk CVE first, unrelated to this PR.
  • Repowise — separate PR, coming next.

Test plan

  • cargo fmt -p code-intel -- --check — clean
  • cargo check --locked — 0 errors
  • cargo test -p code-intel --locked — 3783/3783 passing across 60 suites (independently re-run, not just trusting the implementation pass)
  • Local authoritative self-scan (code-intel run execute --repo . ...) confirms evidence.codenexus node now runs and succeeds, producing real codenexus-admission.json/codenexus-payload.json artifacts where the node previously didn't exist at all
  • New tests: dag_run.rs (node presence/absence across profiles), capability_exec.rs (builtin dispatch)

A provider-usage audit found codenexus_adapter.rs (already-compiled,
already-tested) had zero callers from the actual DAG execution engine —
only reachable via a legacy CLI compatibility route explicitly annotated
"retire when the DAG exclusively calls the typed codenexus adapter seam."
This wires it in, mirroring the existing Sentrux/graph builtin-adapter
pattern exactly:

- builtin_provider_evidence.rs: new codenexus_admission(), collecting
  native evidence by shelling to legacy/Invoke-CodeNexusLite.ps1 (the
  same facade run-code-intel.ps1 already uses for the default-run
  codenexus-context.json), then running it through the existing
  codenexus_adapter::translate()/validate_admitted_payload() contract.
- capability_inventory.rs: dispatch arm for provider.codenexus-builtin.compat.
- execution_policy.rs: codenexus is now an independently-gateable
  ProviderRequirement (Optional/Required/Required/Disabled across
  Default/Strict/Compatibility/Offline, matching sentrux) instead of
  implicitly always-on.
- dag_run.rs: evidence.codenexus is now a real conditional DAG node,
  feeding diagnosis.hospital exactly like evidence.graph/evidence.sentrux.
- orchestration/integrations.json + internalization/codenexus.json:
  capabilityDeclaration/runtimeAdapter added for the new route; governance
  record updated with the new production-caller evidence without
  reviving crates/code-nexus-lite (a separate, still CVE-2026-48504-blocked
  prototype, untouched by this change).

Verified: cargo fmt/check clean, full suite 3783/3783 passing (60
suites), and a local authoritative self-scan shows evidence.codenexus
succeeding and producing real admission/payload artifacts.
@repowise-bot

repowise-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown

✅ Health of changed files: 3.6 (unchanged)
🚨 Change risk: high, riskier than 74% of this repo's commits.

📋 At a glance
2 files changed health · 5 hotspots touched · 6 new findings introduced · 2 co-change pairs left out · 5 files with recent fix history. Scoped to crates.

✅ Health gate: passed

📌 Before you merge

  • orchestration/internalization/rg.json changed together with .../tests/capability_exec.rs in 11 past commits and isn't in this PR
  • orchestration/integrations.json changed together with .../src/capability_inventory.rs in 11 past commits and isn't in this PR
🔎 More signals (3)

🗺️ Change map

flowchart LR
  subgraph PR ["Changed in this PR (6 with dependents)"]
    f_crates_code_intel_cli_src_dag_run_rs[".../src/dag_run.rs 🔥"]:::changed
    f_crates_code_intel_cli_src_execution_policy_rs[".../src/execution_policy.rs 🔥"]:::changed
    f_crates_code_intel_cli_src_capability_inventory_rs[".../src/capability_inventory.rs"]:::changed
    f_crates_code_intel_cli_tests_artifact_ref_rs[".../tests/artifact_ref.rs"]:::changed
    f_crates_code_intel_cli_tests_capability_exec_rs[".../tests/capability_exec.rs"]:::changed
    f_crates_code_intel_cli_tests_dag_run_rs[".../tests/dag_run.rs"]:::changed
  end
  f_crates_code_intel_cli_src_authoritative_run_execution_kernel_rs[".../authoritative_run/execution_kernel.rs"]
  f_crates_code_intel_cli_src_dag_run_rs --> f_crates_code_intel_cli_src_authoritative_run_execution_kernel_rs
  f_crates_code_intel_cli_src_main_rs[".../src/main.rs"]
  f_crates_code_intel_cli_src_dag_run_rs --> f_crates_code_intel_cli_src_main_rs
  f_crates_code_intel_cli_src_run_cli_rs[".../src/run_cli.rs"]
  f_crates_code_intel_cli_src_dag_run_rs --> f_crates_code_intel_cli_src_run_cli_rs
  f_crates_code_intel_cli_src_execution_policy_rs --> f_crates_code_intel_cli_src_main_rs
  f_crates_code_intel_cli_src_execution_policy_rs --> f_crates_code_intel_cli_src_run_cli_rs
  f_crates_code_intel_cli_src_anchor_verification_mod_rs[".../anchor_verification/mod.rs"]
  f_crates_code_intel_cli_src_capability_inventory_rs --> f_crates_code_intel_cli_src_anchor_verification_mod_rs
  f_crates_code_intel_cli_src_capability_rs[".../src/capability.rs"]
  f_crates_code_intel_cli_src_capability_inventory_rs --> f_crates_code_intel_cli_src_capability_rs
  f_crates_code_intel_cli_src_edit_impact_rs[".../src/edit_impact.rs"]
  f_crates_code_intel_cli_src_capability_inventory_rs --> f_crates_code_intel_cli_src_edit_impact_rs
  f_crates_code_intel_cli_src_capability_inventory_rs --> f_crates_code_intel_cli_src_main_rs
  f_crates_code_intel_cli_tests_artifact_ref_rs --> f_crates_code_intel_cli_src_main_rs
  f_crates_code_intel_cli_tests_capability_exec_rs --> f_crates_code_intel_cli_src_main_rs
  f_crates_code_intel_cli_tests_dag_run_rs --> f_crates_code_intel_cli_src_main_rs
  w_orchestration_internalization_rg_json(["⚠️ orchestration/internalization/rg.json changed together 11×, not in PR"]):::warn
  f_crates_code_intel_cli_tests_capability_exec_rs -.- w_orchestration_internalization_rg_json
  w_orchestration_integrations_json(["⚠️ orchestration/integrations.json changed together 11×, not in PR"]):::warn
  f_crates_code_intel_cli_src_capability_inventory_rs -.- w_orchestration_integrations_json
  classDef changed fill:#dbeafe,stroke:#1d4ed8,color:#1e3a5f
  classDef warn fill:#fef3c7,stroke:#b45309,color:#78350f
  classDef guard fill:#dcfce7,stroke:#15803d,color:#14532d
Loading

Solid arrows: code that imports the changed files (6 direct dependents, from the last indexed snapshot). Dashed: history/tests.

🔥 Hotspots touched (5)

  • .../tests/capability_exec.rs: 14 commits/90d, 4 dependents
  • .../tests/dag_run.rs: 11 commits/90d, 2 dependents
  • .../src/dag_run.rs: 6 commits/90d, 3 dependents
2 more
  • .../src/execution_policy.rs: 4 commits/90d, 4 dependents
  • .../tests/artifact_ref.rs: 11 commits/90d, 3 dependents

🔗 Hidden coupling (2 files)

  • .../tests/capability_exec.rs co-changes with orchestration/internalization/rg.json (11×, 🟡 notable), not in this PR.
  • .../src/capability_inventory.rs co-changes with these files (not in this PR):
    • orchestration/integrations.json (11×, 🟡 notable)
    • orchestration/internalization/rg.json (11×, 🟡 notable)

📊 See the full report for this PR
Your repo map with this PR's blast radius lit up, every caller of the contracts it changes, and health before and after. No sign-in. · ⭐ Star Repowise · 📥 Install bot · Silence on a single PR with [skip repowise] in the title · Per-repo toggle on repowise.dev/settings?tab=bot · Updated 2026-08-07 14:52 UTC

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Code Intel change risk

Score Percentile Level
67/100 82th (vs last 45 commits) 🟡 medium

Top signals

  • Diff shape: 118 file(s), +654/-136 (max file share 0.23)
  • Test asymmetry: source changed, tests touched
  • Bug-magnet: 758 fix commit(s) in touched files (180d)
  • Churn: 1686 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 commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Too many files!

This PR contains 113 files, which is 13 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 04e5620b-7c6b-4eb1-97a0-089fea4bf6c4

📥 Commits

Reviewing files that changed from the base of the PR and between 460bcef and 3874818.

📒 Files selected for processing (113)
  • crates/code-intel-cli/src/builtin_provider_evidence.rs
  • crates/code-intel-cli/src/codenexus_scratch.rs
  • crates/code-intel-cli/tests/capability_exec.rs
  • legacy/run-code-intel.ps1
  • orchestration/integrations.json
  • orchestration/internalization/ast-grep.json
  • orchestration/internalization/c03-r05-r12-measurements.json
  • orchestration/internalization/cocoindex.json
  • orchestration/internalization/codenexus.json
  • orchestration/internalization/git.json
  • orchestration/internalization/github-research.json
  • orchestration/internalization/graph.json
  • orchestration/internalization/greenfield.json
  • orchestration/internalization/native-code-evidence.json
  • orchestration/internalization/repomix.json
  • orchestration/internalization/rg.json
  • orchestration/internalization/sentrux.json
  • orchestration/retirements/e02-recommender/compatibility-retirement-deletion-diff.json
  • orchestration/retirements/e02-recommender/compatibility-retirement-manifest.json
  • orchestration/retirements/e02-recommender/compatibility-retirement-ticket.json
  • orchestration/retirements/e02-recommender/e00-request.json
  • orchestration/retirements/e02-recommender/e01-request.json
  • orchestration/retirements/e02-recommender/e01-stderr.txt
  • orchestration/retirements/e02-recommender/evidence/c00-necessity.json
  • orchestration/retirements/e02-recommender/evidence/compatibility-window.json
  • orchestration/retirements/e02-recommender/evidence/contract-parity.json
  • orchestration/retirements/e02-recommender/evidence/dependency-d02-clean-machine.json
  • orchestration/retirements/e02-recommender/evidence/dependency-repo-snapshot.json
  • orchestration/retirements/e02-recommender/evidence/effect-parity.json
  • orchestration/retirements/e02-recommender/evidence/golden-parity.json
  • orchestration/retirements/e02-recommender/evidence/independent-approval.json
  • orchestration/retirements/e02-recommender/evidence/registry-reconciliation.json
  • orchestration/retirements/e02-recommender/evidence/replacement-atom.json
  • orchestration/retirements/e02-recommender/evidence/rollback-execution.json
  • orchestration/retirements/e02-recommender/evidence/usage-observation.json
  • orchestration/retirements/e02-recommender/gate-out/compatibility-retirement-decision.json
  • orchestration/retirements/e03-provider-preflight/compatibility-retirement-deletion-diff.json
  • orchestration/retirements/e03-provider-preflight/compatibility-retirement-manifest.json
  • orchestration/retirements/e03-provider-preflight/compatibility-retirement-ticket.json
  • orchestration/retirements/e03-provider-preflight/e00-request.json
  • orchestration/retirements/e03-provider-preflight/e01-request.json
  • orchestration/retirements/e03-provider-preflight/e01-stderr.txt
  • orchestration/retirements/e03-provider-preflight/evidence/c00-necessity.json
  • orchestration/retirements/e03-provider-preflight/evidence/compatibility-window.json
  • orchestration/retirements/e03-provider-preflight/evidence/contract-parity.json
  • orchestration/retirements/e03-provider-preflight/evidence/dependency-a04-admissibility.json
  • orchestration/retirements/e03-provider-preflight/evidence/dependency-repo-snapshot.json
  • orchestration/retirements/e03-provider-preflight/evidence/effect-parity.json
  • orchestration/retirements/e03-provider-preflight/evidence/golden-parity.json
  • orchestration/retirements/e03-provider-preflight/evidence/independent-approval.json
  • orchestration/retirements/e03-provider-preflight/evidence/registry-reconciliation.json
  • orchestration/retirements/e03-provider-preflight/evidence/replacement-atom.json
  • orchestration/retirements/e03-provider-preflight/evidence/rollback-execution.json
  • orchestration/retirements/e03-provider-preflight/evidence/usage-observation.json
  • orchestration/retirements/e03-provider-preflight/gate-out/compatibility-retirement-decision.json
  • orchestration/retirements/e04-codenexus-direct/compatibility-retirement-deletion-diff.json
  • orchestration/retirements/e04-codenexus-direct/compatibility-retirement-manifest.json
  • orchestration/retirements/e04-codenexus-direct/compatibility-retirement-ticket.json
  • orchestration/retirements/e04-codenexus-direct/e00-request.json
  • orchestration/retirements/e04-codenexus-direct/e01-request.json
  • orchestration/retirements/e04-codenexus-direct/e01-stderr.txt
  • orchestration/retirements/e04-codenexus-direct/evidence/c00-necessity.json
  • orchestration/retirements/e04-codenexus-direct/evidence/compatibility-window.json
  • orchestration/retirements/e04-codenexus-direct/evidence/contract-parity.json
  • orchestration/retirements/e04-codenexus-direct/evidence/dependency-b05.json
  • orchestration/retirements/e04-codenexus-direct/evidence/effect-parity.json
  • orchestration/retirements/e04-codenexus-direct/evidence/golden-parity.json
  • orchestration/retirements/e04-codenexus-direct/evidence/independent-approval.json
  • orchestration/retirements/e04-codenexus-direct/evidence/registry-reconciliation.json
  • orchestration/retirements/e04-codenexus-direct/evidence/replacement-atom.json
  • orchestration/retirements/e04-codenexus-direct/evidence/rollback-execution.json
  • orchestration/retirements/e04-codenexus-direct/evidence/usage-observation.json
  • orchestration/retirements/e04-codenexus-direct/gate-out/compatibility-retirement-decision.json
  • orchestration/retirements/e04-codenexus-direct/rollback-rehearsal/run-code-intel.ps1
  • orchestration/retirements/e07-native-code/compatibility-retirement-deletion-diff.json
  • orchestration/retirements/e07-native-code/compatibility-retirement-manifest.json
  • orchestration/retirements/e07-native-code/compatibility-retirement-ticket.json
  • orchestration/retirements/e07-native-code/e00-request.json
  • orchestration/retirements/e07-native-code/e01-request.json
  • orchestration/retirements/e07-native-code/e01-stderr.txt
  • orchestration/retirements/e07-native-code/evidence/c00-necessity.json
  • orchestration/retirements/e07-native-code/evidence/compatibility-window.json
  • orchestration/retirements/e07-native-code/evidence/contract-parity.json
  • orchestration/retirements/e07-native-code/evidence/dependency-inventory.json
  • orchestration/retirements/e07-native-code/evidence/dependency-snapshot.json
  • orchestration/retirements/e07-native-code/evidence/effect-parity.json
  • orchestration/retirements/e07-native-code/evidence/golden-parity.json
  • orchestration/retirements/e07-native-code/evidence/independent-approval.json
  • orchestration/retirements/e07-native-code/evidence/registry-reconciliation.json
  • orchestration/retirements/e07-native-code/evidence/replacement-atom.json
  • orchestration/retirements/e07-native-code/evidence/rollback-execution.json
  • orchestration/retirements/e07-native-code/evidence/usage-observation.json
  • orchestration/retirements/e07-native-code/gate-out/compatibility-retirement-decision.json
  • orchestration/retirements/e07-native-code/rollback-rehearsal/run-code-intel.ps1
  • 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

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

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added CodeNexus compatibility evidence collection to supported analysis runs.
    • CodeNexus results are classified as current, partial, or unavailable and published with validated evidence.
    • Added CodeNexus execution to the analysis workflow and diagnosis pipeline.
  • Behavior Changes

    • Strict profiles require CodeNexus evidence, while offline profiles omit it.
    • Updated integration metadata and toolchain evidence for CodeNexus and related capabilities.
  • Tests

    • Added coverage for CodeNexus dispatch, workflow execution, artifacts, and profile-specific behavior.

Walkthrough

CodeNexus-lite support now includes profile-based policy gating, capability dispatch, DAG execution, PowerShell-backed admission, artifact publication, integration metadata, and tests for direct and production execution paths.

Changes

CodeNexus admission flow

Layer / File(s) Summary
Policy and DAG wiring
crates/code-intel-cli/src/execution_policy.rs, crates/code-intel-cli/src/dag_run.rs
Run profiles now configure the CodeNexus requirement. Enabled runs add evidence.codenexus between repo.snapshot and diagnosis.hospital.
Builtin adapter admission
crates/code-intel-cli/src/builtin_provider_evidence.rs, crates/code-intel-cli/src/capability_inventory.rs
The builtin adapter invokes the CodeNexus-lite facade, classifies its result, validates payloads, and publishes admission artifacts.
Execution integration and validation
orchestration/integrations.json, crates/code-intel-cli/tests/capability_exec.rs, crates/code-intel-cli/tests/dag_run.rs, crates/code-intel-cli/tests/artifact_ref.rs, legacy/run-code-intel.ps1
Integration metadata declares the capability execution path. Tests cover artifact chaining, DAG output, profile gating, and updated digests.
Digest and provenance refresh
orchestration/integrations.json, orchestration/internalization/*.json
Toolchain, source, conformance, and CodeNexus operation-trace references are updated.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CapabilityExecutor
  participant codenexus_admission
  participant PowerShellFacade
  participant ArtifactStore
  participant DiagnosisHospital
  CapabilityExecutor->>codenexus_admission: dispatch provider.codenexus-builtin.compat
  codenexus_admission->>PowerShellFacade: invoke Invoke-CodeNexusLite.ps1
  PowerShellFacade-->>codenexus_admission: return parsed or unavailable result
  codenexus_admission->>ArtifactStore: publish admission and evidence payload
  ArtifactStore-->>DiagnosisHospital: supply evidence.codenexus
Loading

Possibly related PRs

Poem

A rabbit checks the snapshot trail,
Then hops through CodeNexus without fail.
A PowerShell path yields facts anew,
Evidence blooms in payloads too.
The DAG carries the proof along—
Diagnosis sings its passing song.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding a production DAG caller for the CodeNexus adapter.
Description check ✅ Passed The description directly explains the CodeNexus DAG integration, supporting changes, scope, and verification.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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.

@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

🧹 Nitpick comments (3)
crates/code-intel-cli/tests/capability_exec.rs (3)

2189-2203: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Also assert the payload artifact on the direct-dispatch path.

codenexus_admission publishes two artifacts: the evidence.admission result and an observed.evidence.payload payload. This test checks only the first. tests/dag_run.rs Line 196 already asserts the payload artifact at the DAG level, so the direct path currently proves less than the DAG path.

💚 Proposed assertion
     assert!(
         result["artifacts"]
             .as_array()
             .unwrap()
             .iter()
             .any(|artifact| artifact["type"] == "evidence.admission"),
         "result={result}"
     );
+    assert!(
+        result["artifacts"]
+            .as_array()
+            .unwrap()
+            .iter()
+            .any(|artifact| artifact["type"] == "observed.evidence.payload"),
+        "result={result}"
+    );
+    assert!(codenexus_out.join("codenexus-payload.json").is_file());
🤖 Prompt for 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.

In `@crates/code-intel-cli/tests/capability_exec.rs` around lines 2189 - 2203,
Extend the direct-dispatch test assertions around the existing
evidence.admission check to also require an artifact with type
observed.evidence.payload. Match the DAG-level assertion pattern used by the
existing test utilities, while preserving the current admission verdict
validation.

2208-2229: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Fold run_capability and run_with_request_file together.

run_capability duplicates run_with_request_file at Line 81. The only difference is the --artifact-root pair. Make the artifact root optional and keep one helper.

♻️ Proposed refactor
 fn run_capability(
     request: &Value,
     request_path: &Path,
     out: &Path,
-    artifact_root: &Path,
+    artifact_root: Option<&Path>,
     cli_capability: &str,
 ) -> std::process::Output {
     fs::write(
         request_path,
         serde_json::to_vec(request).expect("serialize request"),
     )
     .expect("write request");
-    common::cli()
-        .args(["capability", "exec", cli_capability, "--request"])
-        .arg(request_path)
-        .arg("--out")
-        .arg(out)
-        .arg("--artifact-root")
-        .arg(artifact_root)
-        .output()
-        .expect("run capability executor")
+    let mut command = common::cli();
+    command
+        .args(["capability", "exec", cli_capability, "--request"])
+        .arg(request_path)
+        .arg("--out")
+        .arg(out);
+    if let Some(artifact_root) = artifact_root {
+        command.arg("--artifact-root").arg(artifact_root);
+    }
+    command.output().expect("run capability executor")
 }

Then make run_with_request_file delegate with None.

🤖 Prompt for 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.

In `@crates/code-intel-cli/tests/capability_exec.rs` around lines 2208 - 2229,
Combine run_capability with the existing run_with_request_file helper by adding
an optional artifact-root parameter to the single helper and conditionally
appending the --artifact-root argument pair. Remove the duplicate run_capability
implementation, and update its callers to delegate through run_with_request_file
with None when no artifact root is needed.

14-22: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Read these implementations from the registry instead of duplicating them.

registry_implementation(capability) at Line 1930 already loads capabilityDeclaration.implementation from orchestration/integrations.json. REPO_SNAPSHOT_DIGEST and CODENEXUS_TOOLCHAIN_DIGESTS restate values that helper would return.

Two consequences follow. A registry digest change breaks this test with an opaque digest mismatch instead of tracking the registry. And because the constants copy the registry verbatim, the test cannot detect a wrong pin in the registry, including the builtin_provider_evidence.rs digest gap flagged on orchestration/integrations.json Line 664.

♻️ Proposed refactor
 const REPO_SNAPSHOT_DIGEST: &str =
     "1fa974b28cc2ab92b1ac04e22702b6b126023bcc0ccf1feee14e3d31a833f9dc";
-const CODENEXUS_TOOLCHAIN_DIGESTS: [&str; 5] = [
-    "e78c7c3d492c0047bd53151d83f3413d2aa937a974aed0b929b94cc4c61d86de",
-    "645675312135932dfce365a8dfc14e214cec78ee733f248606547b3eaa56edc8",
-    "52644a812174988ede91d98ddfec63c6a91f8478277d7bf74c73f106dd0f776b",
-    "98ccc64478b2c61bfd7af741ea1f8ee01a88094065c0f025700e8110b525ef26",
-    "cdd5c6d0fe940d2756c45a51095c275b13ebe64347914b581641693e1288ca56",
-];

Then build both requests from the registry:

-        "implementation": {
-            "id": "repository.snapshot.compat",
-            "version": "1.0.0",
-            "toolchainDigests": [REPO_SNAPSHOT_DIGEST]
-        },
+        "implementation": registry_implementation("repository.snapshot-identity"),
-        "implementation": {
-            "id": "provider.codenexus-builtin.compat",
-            "version": "1.0.0",
-            "toolchainDigests": CODENEXUS_TOOLCHAIN_DIGESTS
-        },
+        "implementation": registry_implementation("provider.codenexus-adapt"),

registry_implementation looks up by integration id, so confirm the exact id values before applying.

🤖 Prompt for 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.

In `@crates/code-intel-cli/tests/capability_exec.rs` around lines 14 - 22, Remove
the duplicated REPO_SNAPSHOT_DIGEST and CODENEXUS_TOOLCHAIN_DIGESTS constants
from the capability execution tests. Use registry_implementation(capability) to
obtain each integration’s implementation and build both requests from the
registry entries, verifying the exact integration id values used for the
repository snapshot and Codenexus toolchain.
🤖 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 `@crates/code-intel-cli/src/builtin_provider_evidence.rs`:
- Around line 288-299: Inspect the DAG coordinator for an enforced per-node
deadline; if none applies to this provider, update the execution around the
visible command.output() call to run pwsh with an explicit timeout, terminate
the child on expiry, and classify the result as the existing failed/unavailable
path. Preserve the current command arguments and successful output handling.
- Around line 286-315: Bind the scratch directory cleanup to scope in
codenexus_admission by introducing a ScratchDir guard near
create_codenexus_scratch_dir, exposing its path for command construction and
removing the directory in Drop. Replace direct scratch-path usage with the guard
and remove the manual fs::remove_dir_all call so cleanup also occurs when
lease.verify_after, now, or snapshot_identity returns early.

In `@orchestration/integrations.json`:
- Around line 664-670: Update the toolchainDigests list for the affected
provider declaration around toolchainDigests so the builtin_provider_evidence.rs
input uses the shared digest
5634551c7d560819289cc6aef60c32818b8e2f1a5ee310ee71e68222d0c36035. Preserve the
existing admissibility.rs and adapter_contract.rs digests and keep the list
synchronized with the graph-adapt and sentrux-adapt declarations.

---

Nitpick comments:
In `@crates/code-intel-cli/tests/capability_exec.rs`:
- Around line 2189-2203: Extend the direct-dispatch test assertions around the
existing evidence.admission check to also require an artifact with type
observed.evidence.payload. Match the DAG-level assertion pattern used by the
existing test utilities, while preserving the current admission verdict
validation.
- Around line 2208-2229: Combine run_capability with the existing
run_with_request_file helper by adding an optional artifact-root parameter to
the single helper and conditionally appending the --artifact-root argument pair.
Remove the duplicate run_capability implementation, and update its callers to
delegate through run_with_request_file with None when no artifact root is
needed.
- Around line 14-22: Remove the duplicated REPO_SNAPSHOT_DIGEST and
CODENEXUS_TOOLCHAIN_DIGESTS constants from the capability execution tests. Use
registry_implementation(capability) to obtain each integration’s implementation
and build both requests from the registry entries, verifying the exact
integration id values used for the repository snapshot and Codenexus toolchain.
🪄 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: 46060cfc-54dc-445d-bdb3-3f3a2d25e87f

📥 Commits

Reviewing files that changed from the base of the PR and between bfb1cd8 and 460bcef.

📒 Files selected for processing (14)
  • crates/code-intel-cli/src/builtin_provider_evidence.rs
  • crates/code-intel-cli/src/capability_inventory.rs
  • crates/code-intel-cli/src/dag_run.rs
  • crates/code-intel-cli/src/execution_policy.rs
  • crates/code-intel-cli/tests/artifact_ref.rs
  • crates/code-intel-cli/tests/capability_exec.rs
  • crates/code-intel-cli/tests/dag_run.rs
  • legacy/run-code-intel.ps1
  • orchestration/integrations.json
  • orchestration/internalization/ast-grep.json
  • orchestration/internalization/codenexus.json
  • orchestration/internalization/graph.json
  • orchestration/internalization/rg.json
  • orchestration/internalization/sentrux.json

Comment thread crates/code-intel-cli/src/builtin_provider_evidence.rs Outdated
Comment thread crates/code-intel-cli/src/builtin_provider_evidence.rs Outdated
Comment thread orchestration/integrations.json
Editing builtin_provider_evidence.rs to add codenexus_admission changed
the file's sha256, but only provider.codenexus-adapt's own
toolchainDigests entry got resynced -- provider.graph-adapt and
provider.sentrux-adapt each independently pin the same shared file and
were left stale, since repin's stale-detection only catches drift from
HEAD and this file had already gone through a prior repin --write round
before the final edit (the documented head-anchor blind spot).

Caught by test-atomic-capability-contract.ps1 in CI (cross-platform-smoke
failed on macos-latest/ubuntu-latest), not by cargo test, which doesn't
cover this PowerShell contract check. Verified locally: repin --write
now reports clean, the PS contract test passes, and cargo test -p
code-intel --locked (capability_exec/dag_run/declared_pins/
internalization_record/artifact_ref/repin) all still pass.
…t resync

Addresses CodeRabbit review on #215:

- builtin_provider_evidence.rs: bound the CodeNexus-lite facade's pwsh
  invocation with a 120s timeout (run_with_timeout) -- a hung script
  previously blocked evidence.codenexus, and the whole DAG run, forever.
  status: "unavailable" already handles this outcome gracefully, a
  timeout just routes into that existing branch.
- Wrap the scratch directory in a Drop-guard (ScratchDir) so it's
  cleaned up on every exit path, including the early `?` returns
  between collection and publication that the plain end-of-function
  fs::remove_dir_all was missing.
- capability_exec.rs: also assert the observed.evidence.payload
  artifact (and that codenexus-payload.json actually lands on disk) on
  the direct capability-exec dispatch path, matching what the DAG-level
  test already checks.
- Resync every toolchainDigests/conformance pin chained through
  builtin_provider_evidence.rs and capability_exec.rs after the above
  edits (graph-adapt, sentrux-adapt, codenexus-adapt, ast-grep, rg) --
  repin --write hit its own documented "internal inconsistency" limit
  on 3 of these (the same head-anchor blind spot as the prior digest
  fix commit), so they were resynced by hand and verified against a
  freshly recomputed sha256, not just repin's report.

Verified: cargo fmt/check clean, full suite 3783/3783 passing, PS
atomic-capability-contract test green, and a local self-scan confirms
evidence.codenexus still succeeds with the new timeout/cleanup path.
Retirement packets freeze a working-tree overlay taken at generation
time, not a commit -- editing any file in their frozen source set makes
them stale, and only their own New-*RetirementPacket.ps1 generator can
produce a valid replacement (never hand-edited, unlike the toolchain
digest pins).

Regenerated: e02-recommender, e03-provider-preflight,
e04-codenexus-direct, e07-native-code, e08-hospital -- all touch source
files edited across this PR's commits (builtin_provider_evidence.rs,
execution_policy.rs, capability_inventory.rs, dag_run.rs). Verified via
legacy/scripts/tests/test-retirement-packets.ps1: 8 packets, 2 audits,
0 known-blocked, all passing (was 5 of 10 checks failing before this
commit). This is what windows-build-test-package's "Compatibility
retirement packets" step was catching in CI.
…vider_evidence.rs

The sentrux architecture gate failed CI (exit 10, "god_files_increased":
builtin_provider_evidence.rs reached 814 loc / 23 functions, crossing the
loc>800 threshold) after the timeout+cleanup commit pushed it over the
limit -- a real, deterministic gate, not a flake. Missed locally because
I checked evidence.codenexus's own status but not diagnosis.hospital's.

Extracted the CodeNexus-lite-specific process/filesystem plumbing that
has nothing to do with the admission/evidence contract itself into a new
crates/code-intel-cli/src/codenexus_scratch.rs: CODENEXUS_LITE_TIMEOUT,
create_codenexus_scratch_dir, ScratchDir, run_with_timeout. Brings
builtin_provider_evidence.rs to 757 lines. codenexus_admission itself,
and the graph/sentrux admission functions, are untouched.

Resynced every toolchain digest chained through the two changed files
(graph-adapt/sentrux-adapt/codenexus-adapt, ast-grep, rg) and
regenerated the E04 retirement packet again (its frozen source set also
includes builtin_provider_evidence.rs).

Verified: cargo fmt/check clean, full suite 3783/3783, PS
atomic-capability-contract and retirement-packets suites both green,
and a local self-scan confirms diagnosis.hospital now passes (was
"architecture gate failure" / god_files_increased before this commit).
main advanced significantly (v0.7.0 GA cut, ps1-exit T2 first increment via #217) since this branch diverged. Conflicts were confined to frozen retirement-packet overlays (e02/e03/e04-codenexus-direct/e07/e08) and one internalization pin file (rg.json) -- resolved by regenerating each packet fresh via its own New-*RetirementPacket.ps1 generator against the merged tree (never hand-merged, per the documented 'frozen overlay, not a commit' convention) and letting repin resync rg.json.

No source-code conflicts. Verified post-merge: cargo fmt/check clean, full test suite green (one pre-existing, already-tracked flaky sentrux_gate/tool_path race unrelated to this branch -- see task_b5c3ea40), PS atomic-capability-contract and retirement-packets suites both green, and a local self-scan confirms diagnosis.hospital and evidence.codenexus both pass.
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