Skip to content

feat(controller): ship the trace-aware inference control plane - #8

Merged
rachittshah merged 76 commits into
mainfrom
feat/trace-control-plane
Jul 29, 2026
Merged

feat(controller): ship the trace-aware inference control plane#8
rachittshah merged 76 commits into
mainfrom
feat/trace-control-plane

Conversation

@rachittshah

@rachittshah rachittshah commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Summary

Ships TASC as an out-of-band, trace-aware inference control plane for better evaluators and routing logic.

This is deliberately not an LLM-as-judge package. Evaluator outputs enter TASC as independently produced, provenance-bound evidence. TASC owns trace integrity, deterministic evidence joins, offline and sealed-window policy assessment, bounded shadow collection, controller decisions, and falsifiable experiment proposals. It never gains inline production-routing or deployment authority.

Authority boundary

  • P0 — deterministic controller: network-free assessment and control over immutable traces, signed evaluator evidence, frozen routing policies, sealed windows, authenticated controller journals, and reproducible artifact packets.
  • P1 — bounded inference collection: an explicit @rachittshah/tasc/runtime export that can contact pre-authorized inference endpoints only after P0 has sealed the complete plan and the operator independently supplies its expected digest.
  • Package boundary: the root package exposes P0 only; importing it cannot pull in live runtime code.

Before any external effect, P1 must exactly match the sealed runtime, backend, model, endpoint, route, transport, authentication reference, and canonical HTTP-limit fingerprint. Collection is bounded by request, token, byte, time, retry, concurrency, and cancellation budgets. Its resumable journal is HMAC-authenticated and lineage-bound; lease claims are unique; dispatch and collector receipts use separate Ed25519 signing domains; ambiguous sends become sent_unknown and are never replayed automatically.

What changed

  • Introduced v2 trace, evidence, evaluator-trust, assessment, experiment, window, controller-event, and artifact contracts.
  • Added deterministic grouped paired inference, evidence joins, trust verification, offline policy grading, sealed online-window replay, controller state transitions, and experiment nomination.
  • Added production CLI flows for evidence, assessment, policy, controller, artifact, and bounded shadow operations.
  • Added bounded HTTP/NDJSON/SSE runtime codecs, network policy, probing, invocation, metrics, orchestration provenance, and shadow execution.
  • Added immutable, deterministic control-plane fixtures plus a zero-network synthetic controller study.
  • Hardened error redaction, input bounds, DNS/address authorization, redirect rejection, decompression limits, cancellation, deadline enforcement, and durable-data minimization.
  • Split P0 and P1 package exports and added workspace, git-archive, and exact-tarball consumer verification.
  • Added Linux/macOS and Node 22/24 CI, coverage gates, MLX parser safety, dependency review, secret scanning, CodeQL, release verification, and provenance-aware publishing.
  • Reworked the README, operating guide, architecture, migration, runtime support, threat model, security policy, contribution guide, and changelog around the production boundary.

Runtime integration matrix

Runtime / orchestrator Pinned compatibility target Scope
vLLM 0.26.0 OpenAI-compatible generation, probe, usage normalization
SGLang 0.5.16 OpenAI-compatible generation and probe
TensorRT-LLM 1.2.1 OpenAI-compatible and native generation profiles
llama.cpp b10156 OpenAI-compatible and native generation profiles
Ollama 0.32.5 Native NDJSON generation and model probe
Hugging Face TGI 3.3.7 Native generation and SSE streaming
LM Studio 0.4.1 OpenAI-compatible local generation and probe
MLX-LM 0.31.3 OpenAI-compatible local generation plus offline parser benchmarks
Ray Serve 2.56.1 Provenance descriptor only
SkyPilot / SkyServe 0.13.1rc1 Provenance descriptor only

Ray and SkyPilot integrations record operator-supplied orchestration provenance around an already authorized endpoint. TASC does not use their SDKs or create, discover, scale, promote, roll back, or otherwise mutate deployments.

Real inference validation

One real, bounded Ollama call was run against the pinned ollama/ollama:0.32.5 image using smollm2:135m-instruct-q4_0 on Linux/amd64 CPU:

  • native Ollama generation path
  • 74 prompt tokens, 8 completion tokens, 82 total tokens
  • length finish reason
  • approximately 981.7 ms observed latency
  • no prompt, output, endpoint, credential, or secret material persisted
  • temporary container and model volume removed after the run

vLLM, SGLang, TensorRT-LLM, llama.cpp, TGI, LM Studio, and MLX-LM are covered by pinned source review, contract tests, codec tests, and loopback live-smoke servers. They were not claimed as real GPU/server validations in this PR.

Security and operational limits

  • The deterministic P0 core is network-free.
  • Prompts, outputs, messages, endpoint values, credentials, HMAC keys, private signing keys, and secret-header values are excluded from durable controller results.
  • Exact allowed addresses are revalidated at connection time; redirects and proxy-environment inheritance are rejected.
  • Runtime parsing is bounded before, during, and after decompression.
  • Same-UID/root custody is not presented as a hostile multi-tenant security boundary.
  • Runtime support is build- and capability-specific, not a blanket compatibility promise.
  • PASS means that the evidence contract passed; it is not production deployment approval.

Non-goals

  • No judge-model client or fallback evaluator
  • No synchronous production-routing authority
  • No autonomous experiment execution
  • No deployment, scaling, promotion, rollback, or infrastructure mutation
  • No persistence of raw inference payloads or runtime secrets

Verification

Final local verification on afab1e39df661adb3fd465827f8e4894d7b8eab3:

  • npm run typecheck — clean
  • npm test788/788 passed across 40 files
  • npm run coverage85.65% statements, 80.06% branches, 96.98% functions, 87.15% lines
  • npm run build — clean
  • npm run demoNOMINATED / DEMO_ONLY
  • npm run demo:control-plane0 network/model calls; 2/2 targets, 8/8 plan-lineage checks, 16/16 signatures, 4/4 packets
  • npm run live:smoke — vLLM, Ollama NDJSON, and TGI loopback paths passed; 6 contacts
  • workspace package smoke — 128 files, passed
  • git-archive package smoke — 128 files, passed
  • npm pack --dry-run — 128 files, 436.0 kB packed, 2.5 MB unpacked
  • npm audit --package-lock-only --audit-level=high0 vulnerabilities
  • MLX Python parser suite — 22/22 passed
  • deterministic fixture regeneration — byte-stable over two independent runs
  • tracked credential-pattern scan — clear outside the intentional redaction-test fixture
  • persisted controller-fixture raw-data scan — clear
  • exact release candidate verification — passed
  • npm publish ./release-candidate/package.tgz --dry-run --access public --provenance=false — passed
  • release-candidate SHA-512 — 40f324e2690f2c8d6c3baf552478481924b95deb2ef5498815df1c31695056fcb709cb4ea86d3080dcbe554ebb972c9db6dcaac33f9c8934e67a0c85cf40f25b
  • four read-only Claude Code / Opus reviews — CLEAR
  • independent final architecture review — CLEAR
  • independent final security review — CLEAR

The pushed SHA is additionally gated by the repository CI, release, CodeQL, dependency-review, secret-scan, GitGuardian, and CodeRabbit checks.

Design records

Merge context

  • Standalone PR targeting main
  • 76 intentionally reviewable commits
  • No dependent PRs
  • No other open PRs and no known shared-file conflicts
  • Merge order: this PR only

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The change adds deterministic TASC contracts, bounded parsing and work budgets, evaluator trust verification, evidence joining, paired assessment workflows, controller replay, atomic artifact packets, CLI v2 execution, runtime codecs and network controls, explicit public exports, extensive tests, and legacy v1 documentation updates.

Changes

TASC control-plane platform

Layer / File(s) Summary
Contracts and trusted evidence
src/determinism.ts, src/bounded-input.ts, src/evidence.ts, src/evaluator-trust.ts, src/evidence-join.ts, src/assessment-contract.ts
Adds canonical identities, bounded immutable contracts, signed evaluator evidence verification, deterministic joins, diagnostics, and strict assessment decision validation.
Evaluation and assessment workflows
src/schema.ts, src/policy.ts, src/statistics.ts, src/evaluate.ts, src/assessment.ts, src/window.ts, src/experiments.ts
Adds resolved specs, grouped paired inference, nullable service-throughput semantics, policy bundles, phase-specific decisions, sealed windows, and bounded experiment proposals.
Controller and artifact lifecycle
src/controller-events.ts, src/controller.ts, src/artifacts.ts, src/report.ts
Adds versioned controller events and snapshots, replay/checkpoint recovery, atomic artifact packets, and packaged legacy reports.
CLI and runtime execution
src/cli-args.ts, src/cli-v2.ts, src/cli.ts, src/runtime/*, src/redaction.ts, src/references.ts, src/index.ts, package.json
Adds structured CLI commands, bounded input errors, runtime profiles and codecs, collector request controls, redacted persistence, controlled references, explicit exports, and the HTTP transport dependency.
Validation, fixtures, and documentation
tests/*, README.md, docs/*, examples/synthetic/spec.json, .gitignore
Adds contract, security, integration, runtime, CLI, artifact, controller, and determinism coverage; documents legacy v1 HOLD boundaries and v2 migration; updates the synthetic threshold and ignore rules.

Estimated code review effort: 5 (Critical) | ~120 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.60% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the main change: shipping the trace-aware inference control plane.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/trace-control-plane

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.

rachittshah and others added 15 commits July 27, 2026 05:08
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rachittshah
rachittshah marked this pull request as ready for review July 27, 2026 18:41

@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: 2

🧹 Nitpick comments (3)
tests/statistics.test.ts (1)

2-8: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Import bootstrapGroupedWeightedMeanCI directly instead of casting the namespace to any.

The function is exported from ../src/statistics.js, so the four (statistics as any) lookups (Lines 37, 62, 91, 111) discard type checking and would silently keep passing if the signature or export name changed.

♻️ Proposed refactor
-import * as statistics from "../src/statistics.js";
 import {
   bootstrapMeanCI,
+  bootstrapGroupedWeightedMeanCI,
   median,
   mulberry32,
   quantile,
 } from "../src/statistics.js";

Then drop the four local aliases and call bootstrapGroupedWeightedMeanCI(...) directly.

Also applies to: 36-116

🤖 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 `@tests/statistics.test.ts` around lines 2 - 8, Update the imports in
statistics.test.ts to include bootstrapGroupedWeightedMeanCI directly from
../src/statistics.js. Remove the four local aliases and replace each (statistics
as any) lookup with direct bootstrapGroupedWeightedMeanCI calls, preserving the
existing arguments and assertions.
src/schema.ts (1)

322-336: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Drop the unused arrayLengthLimits option.

No tracked TypeScript call site passes arrayLengthLimits, making the contextual limit branch inaccessible. Wire this up for the intended caller if needed, or remove the option until it is required.

🤖 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 `@src/schema.ts` around lines 322 - 336, Remove the unused arrayLengthLimits
option from snapshotPlainDataTree and stop forwarding it to
snapshotPlainDataTreeAt, unless an existing intended caller is first wired to
provide it. Keep the snapshot behavior and other traversal options unchanged.
src/evidence.ts (1)

906-913: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low value

Optional: deepFreezeContract recurses infinitely on a cyclic graph.

The Object.isFrozen short-circuit doesn't protect against cycles because the parent is frozen only after its children are visited. Every in-repo caller passes acyclic, snapshot-validated values, so this is not currently reachable — but the function is exported, so a WeakSet of visited objects would make the public surface safe by construction.

🤖 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 `@src/evidence.ts` around lines 906 - 913, Update deepFreezeContract to track
already-visited objects with a WeakSet and stop recursion when an object has
been seen, while preserving recursive freezing and the DeepReadonly return type
for acyclic values.
🤖 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 `@README.md`:
- Around line 237-240: Align all six migration references with the
implementation plan: update README.md lines 237-240 and 274-276, docs/design.md
lines 17 and 227, and docs/operating-guide.md lines 185-188 and 288-291 to
identify the later milestone when controller assessment and CLI
production-recommendation support are complete, or describe it as a future
release; do not attribute this behavior to Task 5, which only delivers the
assessment engine and does not change production status.

In `@src/policy.ts`:
- Around line 131-133: Update isRegisteredLegacyCandidate to compare
policy.criticalSlices against normalizedCriticalSlices(spec.criticalSlices)
rather than the raw spec array, preserving element-wise matching against the
canonical sorted, deduplicated values.

---

Nitpick comments:
In `@src/evidence.ts`:
- Around line 906-913: Update deepFreezeContract to track already-visited
objects with a WeakSet and stop recursion when an object has been seen, while
preserving recursive freezing and the DeepReadonly return type for acyclic
values.

In `@src/schema.ts`:
- Around line 322-336: Remove the unused arrayLengthLimits option from
snapshotPlainDataTree and stop forwarding it to snapshotPlainDataTreeAt, unless
an existing intended caller is first wired to provide it. Keep the snapshot
behavior and other traversal options unchanged.

In `@tests/statistics.test.ts`:
- Around line 2-8: Update the imports in statistics.test.ts to include
bootstrapGroupedWeightedMeanCI directly from ../src/statistics.js. Remove the
four local aliases and replace each (statistics as any) lookup with direct
bootstrapGroupedWeightedMeanCI calls, preserving the existing arguments and
assertions.
🪄 Autofix (Beta)

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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 81ec5032-1ccf-477b-ac09-21a73cb5aa0b

📥 Commits

Reviewing files that changed from the base of the PR and between bd58a19 and 9a7c618.

📒 Files selected for processing (35)
  • .gitignore
  • README.md
  • docs/design.md
  • docs/operating-guide.md
  • docs/superpowers/plans/2026-07-27-trace-control-plane.md
  • docs/superpowers/specs/2026-07-27-trace-control-plane-design.md
  • examples/synthetic/spec.json
  • src/assessment-context.ts
  • src/determinism.ts
  • src/evaluate.ts
  • src/evaluator-trust.ts
  • src/evidence-join.ts
  • src/evidence.ts
  • src/index.ts
  • src/integrity.ts
  • src/legacy-work-budget.ts
  • src/policy.ts
  • src/report.ts
  • src/schema.ts
  • src/statistics.ts
  • src/work-budget.ts
  • tests/assessment-context.test.ts
  • tests/cli.test.ts
  • tests/determinism.test.ts
  • tests/evaluate.test.ts
  • tests/evaluator-trust.test.ts
  • tests/evidence-join-operations.test.ts
  • tests/evidence-join.test.ts
  • tests/evidence.test.ts
  • tests/fixtures/evidence.ts
  • tests/policy.test.ts
  • tests/public-api.test.ts
  • tests/schema.test.ts
  • tests/statistics.test.ts
  • tests/work-budget.test.ts

Comment thread README.md Outdated
Comment thread src/policy.ts
rachittshah and others added 5 commits July 28, 2026 04:00
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@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: 1

🤖 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 `@tests/window.test.ts`:
- Around line 239-250: Correct the golden-vector test around
deriveWindowMembershipBucket so the documented SHA-256 digest and its modulo
result match the asserted bucket. Recompute or update the stale digest/comment
and corresponding hexadecimal assertion, or change the bucket expectation if the
implementation’s output is correct; ensure both assertions validate the same
domain-separated selection rather than unrelated values.
🪄 Autofix (Beta)

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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 38602bc0-885b-439f-b2d4-a481a29972f3

📥 Commits

Reviewing files that changed from the base of the PR and between 9a7c618 and 808a3fb.

📒 Files selected for processing (14)
  • src/assessment-contract.ts
  • src/assessment.ts
  • src/evidence-join.ts
  • src/evidence.ts
  • src/index.ts
  • src/policy.ts
  • src/statistics.ts
  • src/window.ts
  • tests/assessment-contract.test.ts
  • tests/assessment.test.ts
  • tests/evidence-join.test.ts
  • tests/evidence.test.ts
  • tests/fixtures/evidence.ts
  • tests/window.test.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • tests/fixtures/evidence.ts
  • tests/evidence-join.test.ts
  • src/evidence.ts
  • tests/evidence.test.ts

Comment thread tests/window.test.ts
rachittshah and others added 2 commits July 28, 2026 04:08
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
rachittshah and others added 9 commits July 29, 2026 05:01
Add sealed P0 run plans, independent digest admission, authenticated resumable journals, exact target provenance, distinct dispatch and collector signatures, and the opt-in P1 runtime surface.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Keep loopback as the safe default while allowing one explicitly opted-in, pinned inference call with no deployment, retry, probe, or sensitive artifact persistence authority.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Require an independently supplied plan digest before reading P1 configuration, validate exact runtime and collector bindings, and expose bounded collection without widening controller authority.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Ship reproducible signed fixtures, a deterministic offline replay, exact P0-to-P1 lineage checks, and a regeneration path that preserves the evidence-only authority boundary.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Document the trace-aware controller premise, P0/P1 boundary, runtime support evidence, authenticated recovery model, operational limits, migration contract, and residual same-UID risk.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Require the P1 runtime entry point in exact release artifacts and compile a clean external TypeScript consumer with explicit Node type roots while preserving actionable subprocess diagnostics.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Seal normalized invocation limits into P0 targets, CLI/P1 admission, signed collection provenance, and trace identity; reject substitution before effects and regenerate the signed study with deterministic public fixture-only keys.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Document exact P0 HTTP-limit lineage, pre-effect substitution rejection, migration requirements, and the explicitly public deterministic key material used only to reproduce the signed synthetic study.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Exercise fail-closed report inputs, every evidence-driven experiment branch, and direct nominated artifact publication so the enforced coverage floor remains green without weakening it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rachittshah rachittshah changed the title feat(controller): build the trace-aware inference control plane feat(controller): ship the trace-aware inference control plane Jul 29, 2026
@rachittshah

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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: 6

♻️ Duplicate comments (1)
src/runtime/http.ts (1)

1476-1503: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Body idle timer includes consumer work, and the threat model claims it does not. One root cause: resetBodyTimer() runs before yield chunk, so caller processing time is charged to bodyTimeoutMs.

  • src/runtime/http.ts#L1476-L1503: move resetBodyTimer() to after yield chunk resumes (keeping a reset on the empty-chunk continue path) so the timer measures transport idle time only.
  • docs/threat-model.md#L184-L184: keep the “body idle timing excludes bounded consumer work” control only once the timer placement is fixed; otherwise reword it.
🤖 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 `@src/runtime/http.ts` around lines 1476 - 1503, The body idle timer currently
includes consumer processing because resetBodyTimer runs before yield in the
response-body loop. In src/runtime/http.ts lines 1476-1503, keep the reset for
empty chunks but move the non-empty-chunk reset until after yield chunk resumes,
so it measures transport idle time only. In docs/threat-model.md line 184,
retain the statement that bounded consumer work is excluded once this timer
placement is corrected; otherwise reword it to match the implementation.
🧹 Nitpick comments (15)
src/evidence.ts (2)

631-655: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Spread-based payload construction is fragile compared to the explicit field list used by dispatchIntentSigningBytes. ...trace relies on traceEnvelopeBodySchema.strict() to keep the preimage raw-free; any future non-strict relaxation silently widens what gets signed. Consider mirroring the explicit projection style of Line 591-618 for symmetry and defense against later refactors.

🤖 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 `@src/evidence.ts` around lines 631 - 655, The payload construction in
collectorAttestationSigningBytes should avoid spreading the entire trace object.
Mirror the explicit field projection used by dispatchIntentSigningBytes, listing
only the approved trace fields and the selected collectorAttestation fields
before parsing with collectorAttestationPayloadSchema; preserve the existing
signing domain and canonicalization.

278-288: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

collectorAuthoritySchema duplicates dispatchAuthoritySchema verbatim. Extract one authoritySchema and reuse it; the distinctness rule already lives in assertProtocolSemantics.

♻️ Proposed consolidation
-const dispatchAuthoritySchema = z.object({
-  keyId: contractSlugSchema,
-  algorithm: z.literal("ed25519"),
-  publicKeySpki: canonicalBase64UrlSchema,
-}).strict();
-
-const collectorAuthoritySchema = z.object({
-  keyId: contractSlugSchema,
-  algorithm: z.literal("ed25519"),
-  publicKeySpki: canonicalBase64UrlSchema,
-}).strict();
+const authoritySchema = z.object({
+  keyId: contractSlugSchema,
+  algorithm: z.literal("ed25519"),
+  publicKeySpki: canonicalBase64UrlSchema,
+}).strict();
+const dispatchAuthoritySchema = authoritySchema;
+const collectorAuthoritySchema = authoritySchema;
🤖 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 `@src/evidence.ts` around lines 278 - 288, Replace the duplicate
dispatchAuthoritySchema and collectorAuthoritySchema definitions with one shared
authoritySchema containing the common strict object shape, then reuse it for
both authority validations. Keep the existing distinctness handling in
assertProtocolSemantics unchanged.
src/runtime/probe.ts (1)

520-589: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low value

Add an exhaustiveness guard in canaryBody.

body is left undefined if route.wireProtocol is ever outside the seven handled cases; JSON.stringify(undefined) then makes Buffer.from(undefined, "utf8") throw a raw TypeError instead of a RuntimeProbeInputError. A default: fail() (or never assignment) keeps a future route addition failing closed.

🤖 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 `@src/runtime/probe.ts` around lines 520 - 589, Add an exhaustiveness guard to
the switch in canaryBody for any unhandled route.wireProtocol, using the
established fail mechanism or a never assignment so execution cannot continue
with body undefined. Preserve the existing request bodies and ensure unsupported
future protocols produce RuntimeProbeInputError rather than reaching
Buffer.from.
src/artifacts.ts (1)

1763-1783: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Forward options to the snaphotted artifact writer

writeSnapshottedArtifactPacket still receives Options by name, but this path only passes { filesystem }. With ArtifactWriterOptions currently containing only filesystem, the behavior is functionally equivalent, but this loses future writer options just as easily as a larger options interface.

🤖 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 `@src/artifacts.ts` around lines 1763 - 1783, Update the
writeSnapshottedArtifactPacket call in the surrounding artifact-writing flow to
forward the complete options object instead of constructing an object containing
only filesystem. Preserve the existing filesystem fallback behavior while
ensuring future ArtifactWriterOptions fields in options reach the writer.
src/cli-args.ts (1)

424-441: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Derive the capability/effect validators from single source-of-truth tuples.

RUNTIME_PROBE_CAPABILITIES/RUNTIME_PROBE_EFFECTS restate the literals of RuntimeProbeCapability/RuntimeProbeObservationEffect (Lines 113-128). Adding a capability in one place silently diverges from the other, and the as casts in parseRuntimeCommand hide it from the compiler.

♻️ Derive types from the runtime tuples
-const RUNTIME_PROBE_CAPABILITIES: ReadonlySet<string> = new Set([
-  "modelDiscovery",
-  "liveness",
-  "readiness",
-  "prometheusMetrics",
-  "jsonMetrics",
-  "chatCompletions",
-  "completions",
-  "responses",
-  "nativeChat",
-  "nativeGenerate",
-]);
-
-const RUNTIME_PROBE_EFFECTS: ReadonlySet<string> = new Set([
-  "non-mutating",
-  "inference-canary",
-  "consumptive",
-]);
+const RUNTIME_PROBE_CAPABILITY_VALUES = Object.freeze([
+  "modelDiscovery",
+  "liveness",
+  "readiness",
+  "prometheusMetrics",
+  "jsonMetrics",
+  "chatCompletions",
+  "completions",
+  "responses",
+  "nativeChat",
+  "nativeGenerate",
+] as const);
+
+const RUNTIME_PROBE_EFFECT_VALUES = Object.freeze([
+  "non-mutating",
+  "inference-canary",
+  "consumptive",
+] as const);
+
+const RUNTIME_PROBE_CAPABILITIES: ReadonlySet<string> = new Set(
+  RUNTIME_PROBE_CAPABILITY_VALUES,
+);
+const RUNTIME_PROBE_EFFECTS: ReadonlySet<string> = new Set(
+  RUNTIME_PROBE_EFFECT_VALUES,
+);

Then define the exported unions as typeof RUNTIME_PROBE_CAPABILITY_VALUES[number] (Lines 113-128) and replace the as casts with narrowing type guards.

🤖 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 `@src/cli-args.ts` around lines 424 - 441, Make the runtime probe value tuples
the single source of truth: define capability and observation-effect tuples,
derive RuntimeProbeCapability and RuntimeProbeObservationEffect from their
indexed element types, and build
RUNTIME_PROBE_CAPABILITIES/RUNTIME_PROBE_EFFECTS from those tuples. In
parseRuntimeCommand, replace the unsafe as casts with type guards that narrow
values by membership in the corresponding readonly sets.
tests/control-plane-demo.test.ts (1)

114-119: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

expect(result.stderr).toBe("") is a likely cross-version flake source.

Running the child with --import tsx and a data: loader can emit Node ExperimentalWarning lines on some Node 22.x patch releases, which would fail this assertion for reasons unrelated to the demo. Consider filtering known warning lines instead of demanding an exactly empty stderr.

♻️ Proposed tolerance for benign Node warnings
-  expect(result.stderr).toBe("");
+  const unexpectedStderr = result.stderr
+    .split("\n")
+    .filter((line) =>
+      line.trim() !== ""
+      && !/^\(node:\d+\) (?:Experimental)?Warning:/u.test(line)
+      && !/^\s+\(Use `node --trace-warnings/u.test(line)
+    );
+  expect(unexpectedStderr).toEqual([]);
🤖 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 `@tests/control-plane-demo.test.ts` around lines 114 - 119, Update the stderr
assertion in the control-plane demo test to tolerate known benign Node
ExperimentalWarning lines emitted by the --import tsx/data loader, while still
failing on unexpected stderr output. Filter only the documented warning pattern
before asserting that the remaining stderr is empty; keep the result.error,
status, and artifact-root checks unchanged.
scripts/live-smoke.ts (1)

322-335: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

generation ignores route and always emits a prompt-shaped request.

Fine today because the loopback matrix only uses completions/nativeGenerate, but adding a chat route to the matrix would silently produce an invalid shape rejected deep inside normalizeInvocation. Either drop the parameter or branch on it the way operatorGeneration (Line 441-465) does.

🤖 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 `@scripts/live-smoke.ts` around lines 322 - 335, Update generation to stop
ignoring its route parameter: either remove route from the function and all call
sites, or branch on route like operatorGeneration so chat routes produce the
appropriate chat request shape while completions/nativeGenerate retain the
existing prompt request.
tests/runtime-invoke.test.ts (1)

804-838: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

The clock spy depends on an internal function name appearing in new Error().stack.

Renaming or inlining pinAuthorizedCollectorRequest (or any stack-depth/trace-limit change) breaks this test in a way that looks like a behavior regression rather than a test-coupling issue. Consider driving the advance from an observable seam instead — e.g. a counted number of bigint() calls, or an injected signal/limits hook — so the intent ("time advances between pin and contact") survives refactors.

🤖 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 `@tests/runtime-invoke.test.ts` around lines 804 - 838, Update the clock
control in this test around prepareRuntimeInvocation and
dispatchPreparedRuntimeInvocation to avoid matching
pinAuthorizedCollectorRequest in Error.stack. Trigger the nanosecond advance
through a stable observable seam, such as a precisely counted
process.hrtime.bigint call or an existing injected signal/limits hook, while
preserving the assertion that time advances between pinning and contact and the
existing expiration expectations.
tests/shadow-runner.test.ts (1)

406-413: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Dead conditional: both ternary branches are "support-routing-study".

♻️ Proposed simplification
   const terminalOutputIdentity = createStudyPayloadIdentity(
-    prepared.requestIdentity.keyId === "shadow-key"
-      ? "support-routing-study"
-      : "support-routing-study",
+    "support-routing-study",
     "shadow-key",
🤖 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 `@tests/shadow-runner.test.ts` around lines 406 - 413, Update the
terminalOutputIdentity construction to remove the redundant conditional
expression and pass the constant "support-routing-study" value directly to
createStudyPayloadIdentity. Preserve the remaining arguments and
identity-generation behavior unchanged.
scripts/package-smoke.mjs (1)

83-117: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Environment isolation covers userconfig but not the global/builtin npm config.

npm_config_userconfig is redirected into the temp dir, yet a machine-level /usr/etc/npmrc (globalconfig/builtin) can still inject registry, proxy, or lifecycle settings and make this smoke non-hermetic. Consider also pinning npm_config_globalconfig to the temp config directory.

🔒️ Proposed hardening
     npm_config_userconfig: join(configDirectory, ".npmrc"),
+    npm_config_globalconfig: join(configDirectory, "global-npmrc"),
🤖 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 `@scripts/package-smoke.mjs` around lines 83 - 117, Update safeEnvironment to
set npm_config_globalconfig to a configuration file under configDirectory,
alongside npm_config_userconfig, so npm cannot read machine-level global or
builtin configuration during the smoke test. Preserve the existing environment
isolation and immutable return value.
src/shadow-plan.ts (1)

578-589: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

isShadowRunPlanMember re-validates the whole plan on every membership decision.

parseShadowRunPlan re-runs bounded snapshotting, protocol normalization, policy matching, target re-derivation, and a full canonical digest recomputation. Since membership is evaluated per case × replicate, this turns a cheap seeded hash into a heavyweight revalidation per call. Consider validating once at the call site (or memoizing on planDigest) and keeping this helper to the membership rule only.

♻️ Sketch
 export function isShadowRunPlanMember(
   planInput: ShadowRunPlan,
   caseId: string,
   replicateId: string,
 ): boolean {
-  const plan = parseShadowRunPlan(planInput);
+  // Callers admit the plan once (CLI/runner already verify expectedPlanDigest).
+  const plan = verifiedPlanCache.get(planInput) ?? cacheVerified(planInput);
   return isWindowMembershipSelected(
     plan.window.membershipRule,
     caseId,
     replicateId,
   );
 }
🤖 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 `@src/shadow-plan.ts` around lines 578 - 589, Update isShadowRunPlanMember so
it does not call parseShadowRunPlan for each membership decision; use the
already validated ShadowRunPlan input and pass its window.membershipRule
directly to isWindowMembershipSelected. Ensure validation remains performed once
by the calling flow, preserving the helper’s existing caseId and replicateId
behavior.
.github/workflows/ci.yml (1)

32-33: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Ten copies of an off-lockfile global npm pin across CI and release (zizmor adhoc-packages). Every job repeats npm install --global npm@11.6.1, so the toolchain version is duplicated instead of declared once, and each install resolves outside any lockfile.

  • .github/workflows/ci.yml#L32-L33: replace the per-job pin with a single declared source (e.g. packageManager in package.json plus actions/setup-node, or a reusable composite step) and reuse it in the typecheck, build, test, package-smoke, demo, live-smoke, coverage, and audit jobs.
  • .github/workflows/release.yml#L34-L35: drop the duplicated pins in the candidate and publish jobs and consume the same shared definition so release and CI cannot drift.
🤖 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 @.github/workflows/ci.yml around lines 32 - 33, Centralize the npm version
currently installed by the CI and release workflows instead of repeating global
npm pins. Update .github/workflows/ci.yml lines 32-33 and reuse the shared
definition across the typecheck, build, test, package-smoke, demo, live-smoke,
coverage, and audit jobs; update .github/workflows/release.yml lines 34-35 to
remove the candidate and publish pins and consume the same definition, using a
lockfile-aware packageManager/setup-node approach or reusable composite step so
both workflows cannot drift.

Source: Linters/SAST tools

tests/fixtures/evidence.ts (1)

528-537: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Type the unsigned-evidence parameter instead of Record<string, unknown>.

Using the fixture's own shape (ReturnType<typeof unsignedEvaluatorEvidence>) keeps field renames caught at compile time and removes the as any mutations consumers currently need (see verificationFor in tests/assessment.test.ts).

♻️ Proposed change
-export const signEvaluatorEvidence = (
-  privateKey: KeyObject,
-  unsigned: Record<string, unknown> = unsignedEvaluatorEvidence(),
-) => ({
+export const signEvaluatorEvidence = (
+  privateKey: KeyObject,
+  unsigned: ReturnType<typeof unsignedEvaluatorEvidence> = unsignedEvaluatorEvidence(),
+) => ({
🤖 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 `@tests/fixtures/evidence.ts` around lines 528 - 537, Update
signEvaluatorEvidence so its unsigned parameter uses ReturnType<typeof
unsignedEvaluatorEvidence> instead of Record<string, unknown>. Preserve the
existing default and signing behavior, allowing consumers such as
verificationFor to pass the strongly typed unsigned-evidence shape without any
casts.
src/index.ts (2)

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

Residual wildcard re-exports undercut the enumerated surface.

./integrity.js, ./report.js, and ./work-budget.js (plus ./determinism.js at Line 1) still leak anything newly added in those modules, which is the failure mode the rest of this file was rewritten to prevent. Consider enumerating them too, or add a public-API snapshot test asserting the full export list.

Also applies to: 272-272, 375-375

🤖 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 `@src/index.ts` at line 252, Replace the remaining wildcard exports for
integrity.js, report.js, work-budget.js, and determinism.js in the main barrel
with explicit named exports, preserving only the intended public API and
preventing future module additions from leaking automatically.

56-71: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Expose the artifact filesystem contract in the root barrel export.

ArtifactVerificationOptions and ArtifactWriterOptions expose a filesystem member, but ArtifactFilesystem, ArtifactFileHandle, and nodeArtifactFilesystem are only reachable via src/artifacts.js imports. Add these to src/index.ts so consumers can type and override the filesystem option through the published package surface.

♻️ Proposed addition
 export {
   ARTIFACT_MANIFEST_FILENAME,
   MAX_ARTIFACT_FILES,
   MAX_ARTIFACT_FILE_BYTES,
   MAX_ARTIFACT_TOTAL_BYTES,
   NO_DEPLOYMENT_AUTHORITY,
   PURE_NODE_NAMESPACE_LIMITATION,
+  nodeArtifactFilesystem,
   readArtifactPacketIfPresent,
   verifyArtifactPacket,
   writeArtifactPacket,
   writeArtifactPacketOrVerifyIdentical,
 } from "./artifacts.js";
 export type {
   ArtifactDurability,
   ArtifactDurabilityLimitation,
+  ArtifactFileHandle,
+  ArtifactFilesystem,
   ArtifactManifest,
🤖 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 `@src/index.ts` around lines 56 - 71, Update the root barrel export in
src/index.ts to also re-export ArtifactFilesystem, ArtifactFileHandle, and
nodeArtifactFilesystem alongside the existing artifact symbols, making the
filesystem contract and implementation available through the published package
surface.
🤖 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 `@examples/control-plane/protocol.json`:
- Around line 156-196: Update the protocol fixture’s minimumCriticalSliceGroups
value to 1 so it matches the single criticalSlices entry, account-recovery. Keep
the existing criticalSlices and related protocol configuration unchanged.

In `@src/runtime/invoke.ts`:
- Around line 964-971: Update the endpoint-binding validation around
fingerprintCollectorEndpointBinding to catch malformed snapshot.policy or other
fingerprinting failures and normalize them through inputFail(). Reuse the parsed
CollectorTrustPolicy to pass maximumRequestDurationMs into the subsequent
deadline check, while preserving the existing digest mismatch handling.

In `@tests/cli.test.ts`:
- Around line 517-520: Extend the redaction assertions in tests/cli.test.ts at
lines 517-520 to verify malformed.stdout omits secret, and at lines 560-584 to
verify both stdout and stderr omit sourceSecret and pathSecret for rejected,
successful, and repeated invocations. Keep the existing status, stderr, and
output-directory assertions unchanged.

In `@tests/live-smoke-operator.test.ts`:
- Around line 187-190: Update the test cases in
tests/live-smoke-operator.test.ts that use PROCESS_TIMEOUT_MS so their Vitest
timeout is explicitly greater than the 15-second subprocess budget, either
through each relevant it(...) call or the applicable configuration. Preserve the
existing timedOut handling and ensure Vitest does not terminate these tests
before the subprocess timeout callback runs.

In `@tests/report-diagnostics.test.ts`:
- Around line 98-112: Canonicalize the temporary root before constructing the
test output path. In the test setup around mkdtemp, resolve tmpdir() with
realpath (as done in control-plane-demo.ts) so the root has no symlinked
components, while preserving the existing artifact creation and verification
assertions.

In `@vitest.config.ts`:
- Around line 12-15: Update the coverage-rationale comment in vitest.config.ts
to reference the final 788-test suite and its reported 85.65% statement
coverage, along with the corresponding final branch, function, and line
percentages. Preserve the existing explanation about integer floors and
instrumentation margin.

---

Duplicate comments:
In `@src/runtime/http.ts`:
- Around line 1476-1503: The body idle timer currently includes consumer
processing because resetBodyTimer runs before yield in the response-body loop.
In src/runtime/http.ts lines 1476-1503, keep the reset for empty chunks but move
the non-empty-chunk reset until after yield chunk resumes, so it measures
transport idle time only. In docs/threat-model.md line 184, retain the statement
that bounded consumer work is excluded once this timer placement is corrected;
otherwise reword it to match the implementation.

---

Nitpick comments:
In @.github/workflows/ci.yml:
- Around line 32-33: Centralize the npm version currently installed by the CI
and release workflows instead of repeating global npm pins. Update
.github/workflows/ci.yml lines 32-33 and reuse the shared definition across the
typecheck, build, test, package-smoke, demo, live-smoke, coverage, and audit
jobs; update .github/workflows/release.yml lines 34-35 to remove the candidate
and publish pins and consume the same definition, using a lockfile-aware
packageManager/setup-node approach or reusable composite step so both workflows
cannot drift.

In `@scripts/live-smoke.ts`:
- Around line 322-335: Update generation to stop ignoring its route parameter:
either remove route from the function and all call sites, or branch on route
like operatorGeneration so chat routes produce the appropriate chat request
shape while completions/nativeGenerate retain the existing prompt request.

In `@scripts/package-smoke.mjs`:
- Around line 83-117: Update safeEnvironment to set npm_config_globalconfig to a
configuration file under configDirectory, alongside npm_config_userconfig, so
npm cannot read machine-level global or builtin configuration during the smoke
test. Preserve the existing environment isolation and immutable return value.

In `@src/artifacts.ts`:
- Around line 1763-1783: Update the writeSnapshottedArtifactPacket call in the
surrounding artifact-writing flow to forward the complete options object instead
of constructing an object containing only filesystem. Preserve the existing
filesystem fallback behavior while ensuring future ArtifactWriterOptions fields
in options reach the writer.

In `@src/cli-args.ts`:
- Around line 424-441: Make the runtime probe value tuples the single source of
truth: define capability and observation-effect tuples, derive
RuntimeProbeCapability and RuntimeProbeObservationEffect from their indexed
element types, and build RUNTIME_PROBE_CAPABILITIES/RUNTIME_PROBE_EFFECTS from
those tuples. In parseRuntimeCommand, replace the unsafe as casts with type
guards that narrow values by membership in the corresponding readonly sets.

In `@src/evidence.ts`:
- Around line 631-655: The payload construction in
collectorAttestationSigningBytes should avoid spreading the entire trace object.
Mirror the explicit field projection used by dispatchIntentSigningBytes, listing
only the approved trace fields and the selected collectorAttestation fields
before parsing with collectorAttestationPayloadSchema; preserve the existing
signing domain and canonicalization.
- Around line 278-288: Replace the duplicate dispatchAuthoritySchema and
collectorAuthoritySchema definitions with one shared authoritySchema containing
the common strict object shape, then reuse it for both authority validations.
Keep the existing distinctness handling in assertProtocolSemantics unchanged.

In `@src/index.ts`:
- Line 252: Replace the remaining wildcard exports for integrity.js, report.js,
work-budget.js, and determinism.js in the main barrel with explicit named
exports, preserving only the intended public API and preventing future module
additions from leaking automatically.
- Around line 56-71: Update the root barrel export in src/index.ts to also
re-export ArtifactFilesystem, ArtifactFileHandle, and nodeArtifactFilesystem
alongside the existing artifact symbols, making the filesystem contract and
implementation available through the published package surface.

In `@src/runtime/probe.ts`:
- Around line 520-589: Add an exhaustiveness guard to the switch in canaryBody
for any unhandled route.wireProtocol, using the established fail mechanism or a
never assignment so execution cannot continue with body undefined. Preserve the
existing request bodies and ensure unsupported future protocols produce
RuntimeProbeInputError rather than reaching Buffer.from.

In `@src/shadow-plan.ts`:
- Around line 578-589: Update isShadowRunPlanMember so it does not call
parseShadowRunPlan for each membership decision; use the already validated
ShadowRunPlan input and pass its window.membershipRule directly to
isWindowMembershipSelected. Ensure validation remains performed once by the
calling flow, preserving the helper’s existing caseId and replicateId behavior.

In `@tests/control-plane-demo.test.ts`:
- Around line 114-119: Update the stderr assertion in the control-plane demo
test to tolerate known benign Node ExperimentalWarning lines emitted by the
--import tsx/data loader, while still failing on unexpected stderr output.
Filter only the documented warning pattern before asserting that the remaining
stderr is empty; keep the result.error, status, and artifact-root checks
unchanged.

In `@tests/fixtures/evidence.ts`:
- Around line 528-537: Update signEvaluatorEvidence so its unsigned parameter
uses ReturnType<typeof unsignedEvaluatorEvidence> instead of Record<string,
unknown>. Preserve the existing default and signing behavior, allowing consumers
such as verificationFor to pass the strongly typed unsigned-evidence shape
without any casts.

In `@tests/runtime-invoke.test.ts`:
- Around line 804-838: Update the clock control in this test around
prepareRuntimeInvocation and dispatchPreparedRuntimeInvocation to avoid matching
pinAuthorizedCollectorRequest in Error.stack. Trigger the nanosecond advance
through a stable observable seam, such as a precisely counted
process.hrtime.bigint call or an existing injected signal/limits hook, while
preserving the assertion that time advances between pinning and contact and the
existing expiration expectations.

In `@tests/shadow-runner.test.ts`:
- Around line 406-413: Update the terminalOutputIdentity construction to remove
the redundant conditional expression and pass the constant
"support-routing-study" value directly to createStudyPayloadIdentity. Preserve
the remaining arguments and identity-generation behavior unchanged.
🪄 Autofix (Beta)

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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9fb0c502-d80a-4b6c-8fa4-e12d491b3baa

📥 Commits

Reviewing files that changed from the base of the PR and between 6852a60 and ae617da.

⛔ Files ignored due to path filters (3)
  • benchmarks/mlx/build-requirements.lock is excluded by !**/*.lock
  • benchmarks/mlx/requirements.lock is excluded by !**/*.lock
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (97)
  • .github/workflows/ci.yml
  • .github/workflows/codeql.yml
  • .github/workflows/release.yml
  • .gitignore
  • CHANGELOG.md
  • CONTRIBUTING.md
  • README.md
  • SECURITY.md
  • benchmarks/mlx/README.md
  • benchmarks/mlx/build-requirements.txt
  • benchmarks/mlx/requirements.txt
  • benchmarks/mlx/run_benchmarks.py
  • benchmarks/mlx/test_run_benchmarks.py
  • docs/design.md
  • docs/migration-v2.md
  • docs/operating-guide.md
  • docs/runtime-support.md
  • docs/superpowers/plans/2026-07-27-trace-control-plane.md
  • docs/superpowers/specs/2026-07-27-trace-control-plane-design.md
  • docs/threat-model.md
  • examples/control-plane/README.md
  • examples/control-plane/collector-trust.json
  • examples/control-plane/controller-snapshot.json
  • examples/control-plane/development-context.json
  • examples/control-plane/development-evidence.ndjson
  • examples/control-plane/development-traces.ndjson
  • examples/control-plane/experiment-budget.json
  • examples/control-plane/experiment-history.json
  • examples/control-plane/online-context.json
  • examples/control-plane/online-evidence.ndjson
  • examples/control-plane/online-traces.ndjson
  • examples/control-plane/protocol.json
  • examples/control-plane/shadow-profiles.json
  • examples/control-plane/shadow-run-plan.json
  • examples/control-plane/trust-snapshot.json
  • examples/control-plane/window-manifest.json
  • examples/control-plane/work-budget.json
  • package.json
  • scripts/control-plane-demo.ts
  • scripts/live-smoke-config.ts
  • scripts/live-smoke.ts
  • scripts/package-smoke.mjs
  • scripts/regenerate-control-plane-fixtures.mjs
  • scripts/release-artifact.mjs
  • src/artifacts.ts
  • src/bounded-input.ts
  • src/cli-args.ts
  • src/cli-v2.ts
  • src/cli.ts
  • src/evidence-join.ts
  • src/evidence.ts
  • src/experiments.ts
  • src/index.ts
  • src/runtime-http-limits.ts
  • src/runtime/http.ts
  • src/runtime/index.ts
  • src/runtime/invoke.ts
  • src/runtime/metrics.ts
  • src/runtime/ndjson.ts
  • src/runtime/network-policy.ts
  • src/runtime/orchestration.ts
  • src/runtime/probe.ts
  • src/runtime/profiles.ts
  • src/runtime/shadow.ts
  • src/runtime/sse.ts
  • src/runtime/types.ts
  • src/shadow-plan.ts
  • tests/artifacts.test.ts
  • tests/assessment.test.ts
  • tests/bounded-input.test.ts
  • tests/cli-args.test.ts
  • tests/cli-runtime.test.ts
  • tests/cli-v2.test.ts
  • tests/cli.test.ts
  • tests/control-plane-demo.test.ts
  • tests/controller.test.ts
  • tests/evidence-join.test.ts
  • tests/evidence.test.ts
  • tests/experiments.test.ts
  • tests/fixtures/cli-v2.ts
  • tests/fixtures/evidence.ts
  • tests/live-smoke-config.test.ts
  • tests/live-smoke-operator.test.ts
  • tests/network-policy.test.ts
  • tests/package-lock.test.ts
  • tests/public-api.test.ts
  • tests/report-diagnostics.test.ts
  • tests/runtime-codecs.test.ts
  • tests/runtime-http-limits.test.ts
  • tests/runtime-http.test.ts
  • tests/runtime-invoke.test.ts
  • tests/runtime-probe.test.ts
  • tests/runtime-profiles.test.ts
  • tests/shadow-plan.test.ts
  • tests/shadow-runner.test.ts
  • tests/window.test.ts
  • vitest.config.ts
🚧 Files skipped from review as they are similar to previous changes (26)
  • .gitignore
  • tests/public-api.test.ts
  • tests/cli-args.test.ts
  • src/runtime/orchestration.ts
  • docs/superpowers/specs/2026-07-27-trace-control-plane-design.md
  • tests/runtime-profiles.test.ts
  • src/bounded-input.ts
  • tests/evidence-join.test.ts
  • docs/superpowers/plans/2026-07-27-trace-control-plane.md
  • tests/assessment.test.ts
  • tests/fixtures/cli-v2.ts
  • src/runtime/types.ts
  • src/cli.ts
  • src/runtime/sse.ts
  • src/runtime/profiles.ts
  • tests/experiments.test.ts
  • src/runtime/metrics.ts
  • tests/window.test.ts
  • src/runtime/network-policy.ts
  • tests/cli-v2.test.ts
  • tests/controller.test.ts
  • src/runtime/ndjson.ts
  • tests/runtime-codecs.test.ts
  • src/experiments.ts
  • src/evidence-join.ts
  • tests/network-policy.test.ts

Comment thread examples/control-plane/protocol.json
Comment thread src/runtime/invoke.ts Outdated
Comment thread tests/cli.test.ts
Comment thread tests/live-smoke-operator.test.ts
Comment thread tests/report-diagnostics.test.ts Outdated
Comment thread vitest.config.ts Outdated
rachittshah and others added 14 commits July 29, 2026 06:05
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rachittshah

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@rachittshah
rachittshah merged commit 3093d8d into main Jul 29, 2026
21 checks passed
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