Skip to content

feat(lab): CL-09 passive production evidence - #1489

Merged
Wibias merged 32 commits into
devfrom
feat/cl-09-passive-production-evidence
Aug 12, 2026
Merged

feat(lab): CL-09 passive production evidence#1489
Wibias merged 32 commits into
devfrom
feat/cl-09-passive-production-evidence

Conversation

@Wibias

@Wibias Wibias commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

Implements CL-09 V1 passive production evidence on top of merged CL-08.

  • capture the existing exact local Lab RouteSubjectV1 identity on each actual production attempt
  • preserve per-attempt fallback attribution instead of inferring from the initial selected route
  • derive bounded passive signals from existing normalized usage history only
  • expose passive summaries through existing Lab API, CLI, and Compatibility Matrix detail surfaces
  • label passive data explicitly as not_verification
  • keep passive signals outside CL-02 observations, canonical verdicts, freshness, Routing Profiles, Router Intelligence, health/fallback behavior, and CL-08 scheduling
  • guarantee zero duplicate/replayed provider requests and no outbound request/user-payload mutation
  • keep the existing Shadow Call Intercept feature unrelated and unchanged
  • defer public evidence publishing to CL-10

Base

Implementation was rebased onto then-current dev at e8db4e0365b12a314d1c08ec2cf81599efe5b2d3 before runtime work began.

Architecture

Exact attempt linkage

PersistedUsageAttempt has an optional installation-local labRouteSubjectId. Production requests use the existing Lab route-subject construction authority for the actual inbound wire (responses, chat, or anthropic). Subject construction is best-effort: failure omits the link and never changes, retries, or delays the request.

Fallback/combo recursion executes the same attempt-linkage seam for the actual child route, so different execution attempts can carry different exact subjects.

Passive query layer

src/lab/query/passive-production.ts scans at most 2,000 normalized recent usage rows and returns at most 200 signals. The reader fetches one extra row only to detect scan truncation accurately. It creates no second ledger, SQLite authority, artifact store, provider call, or Lab observation.

Lab-facing signals expose only an explicit metadata allowlist. Raw upstreamError, terminal-status strings, error-code strings, prompts, responses, tool payloads, credentials, account metadata, headers, URLs, and reasoning are not serialized. Exact known error codes are used internally only for conservative diagnostic outcome classification.

The CLI propagates its selected configDir through the passive query into the bounded usage reader, so alternate OpenCodex homes cannot be mixed with the default usage history.

Read surfaces

  • authenticated management API: GET /api/lab/production-signals
  • CLI: ocx lab production-signals --subject <id> [--limit <n>] [--json]
  • existing Compatibility Matrix detail pane: compact observed-production summary with Not Lab verification labeling

No new product area or combined compatibility score is introduced.

Safety / isolation

CL-09 V1 guarantees:

  • 0 extra provider requests
  • 0 request replay/mirroring
  • 0 outbound production-request or user-payload mutation
  • 0 passive-to-verdict promotion/degradation
  • 0 canonical freshness refresh from passive traffic
  • 0 Routing Profile / Router Intelligence feedback
  • 0 CL-08 scheduling feedback
  • no user content or secret-bearing diagnostic serialization into passive Lab output

Tests

Focused CL-09 regressions cover:

  • valid/malformed/legacy attempt linkage
  • canonical inbound-wire identity
  • exact fallback-attempt subject isolation
  • bounded scan/result limits with exact truncation detection
  • non-default configDir usage-history isolation
  • success, client_cancel, environmental, route_error, and conservative generic HTTP-failure classification
  • strict privacy allowlist with prompt/response/tool/credential/account/raw-error canaries
  • source-retention behavior
  • static no-feedback guards for routing, CL-08 planning, and the production request path

Review status

The PR remains open. Valid CodeRabbit findings have been remediated or explicitly dispositioned against the frozen CL-09 contract. The exact final head must pass Cross-platform CI and React Doctor before independent final review. Do not merge based only on implementation completion.

Summary by CodeRabbit

  • New Features

    • Added read-only production traffic insights to Compatibility Lab verdict details, including attempts, successes, route errors, and latest observation time.
    • Added CLI and API access for querying production signals by subject.
    • Added support for correlating traffic across supported inbound protocols.
    • Added localized labels across supported languages.
  • Bug Fixes

    • Production observations are clearly distinguished from Lab verification results and do not affect routing or verdicts.
  • Documentation

    • Updated compatibility phase status, scope, and acceptance records.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: dbf2d81f-abf3-4e66-8e7a-0ced27e1ddaa

📥 Commits

Reviewing files that changed from the base of the PR and between 2c21c77 and b9b05b0.

📒 Files selected for processing (2)
  • gui/src/i18n/lab-translations.ts
  • gui/tests/compatibility-lab-i18n.test.ts

📝 Walkthrough

Walkthrough

CL-09 adds passive production evidence for Compatibility Lab. Production attempts receive exact opaque route-subject linkage, bounded usage history is queried, and summaries are exposed through the management API, CLI, and Compatibility Matrix without changing Lab verdicts or routing.

Changes

Compatibility Lab progression

Layer / File(s) Summary
Phase authorization and stack status
devlog/_plan/260807_compatibility_lab/000_master_plan.md, devlog/_plan/260807_compatibility_lab/001_pr_stack_status.md
The programme records close CL-08, authorize CL-09 contract work, and reserve CL-10 for public publishing.
Passive evidence contract and delivery boundaries
devlog/_plan/260807_compatibility_lab/009_cl09_passive_production_evidence.md, docs/superpowers/plans/2026-08-12-cl09-passive-production-evidence.md
The contract and implementation plan define exact attribution, bounded read-only signals, privacy restrictions, isolation rules, read surfaces, tests, and acceptance criteria.
Inbound route-subject linkage and persistence
src/routing/compatibility/subject.ts, src/server/responses/core.ts, src/usage/log.ts, tests/lab-passive-production-evidence.test.ts
Subject resolution now uses the inbound wire. Finalized attempts persist validated opaque route-subject digests. Linkage failures remain non-fatal.
Bounded passive signal derivation
src/lab/query/passive-production.ts, src/lab/query/index.ts
The query layer scans bounded recent usage rows, filters exact subjects, classifies outcomes, aggregates metrics, and reports truncation and observation time.
Lab read surfaces and validation
src/server/management/lab-routes.ts, src/cli/lab.ts, gui/src/pages/compatibility-matrix-api.ts, gui/src/pages/CompatibilityMatrix.tsx, gui/src/i18n/*, gui/src/i18n/lab-translations.ts, gui/tests/compatibility-lab-i18n.test.ts, tests/lab-passive-production-evidence.test.ts
The management route, CLI command, and Matrix detail pane expose passive production summaries as separate non-verification data. Localization and isolation tests cover the new surfaces.

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

Possibly related PRs

Suggested reviewers: ingwannu, lidge-jun

Sequence Diagram(s)

sequenceDiagram
  participant ProductionRequest
  participant RouteSubjectResolver
  participant UsageLog
  participant PassiveQuery
  participant CompatibilityMatrix

  ProductionRequest->>RouteSubjectResolver: resolveProductionRouteSubject(final route, inbound wire)
  RouteSubjectResolver-->>ProductionRequest: opaque subject ID
  ProductionRequest->>UsageLog: persist labRouteSubjectId
  CompatibilityMatrix->>PassiveQuery: queryPassiveProductionSignals(subject ID, limit)
  PassiveQuery->>UsageLog: read bounded recent usage entries
  UsageLog-->>PassiveQuery: usage history
  PassiveQuery-->>CompatibilityMatrix: passive production summary
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.09% 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 clearly and concisely identifies the main change: implementing CL-09 passive production evidence.
✨ 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/cl-09-passive-production-evidence

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

❤️ Share

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

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Aug 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@Wibias
Wibias marked this pull request as ready for review August 11, 2026 21:31
@Wibias
Wibias marked this pull request as draft August 11, 2026 21:32

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 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 `@devlog/_plan/260807_compatibility_lab/001_pr_stack_status.md`:
- Line 260: Add exactly one trailing newline to the end of the Markdown file
after the “CL-05: not started” entry so it satisfies the MD047 check.

In
`@devlog/_plan/260807_compatibility_lab/009_cl09_passive_production_evidence.md`:
- Around line 98-116: Clarify the CL-09 V1 invariants so “0 production request
mutation” prohibits outbound request and user-payload changes, while explicitly
permitting the metadata-only addition of labRouteSubjectId to the existing
attempt record. Apply the same clarification wherever the passive evidence
capture rules are defined, including the section around the existing
attempt-record update.
- Line 1: Rename the document title from “Passive Production Evidence / Shadow
Correlation” to “Passive Production Evidence / Exact-Route Correlation,” leaving
the rest of the document unchanged.
- Around line 174-188: Constrain the diagnostic fields in PassiveRouteSignalV1
by replacing unrestricted terminalStatus, closeReason, and errorCode values with
finite allowlisted or bounded normalized tokens. Update the usage normalizer to
validate and map unrecognized values to unknown or omit them, and apply the same
validation before every Lab projection and API, CLI, or UI serialization.
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c50b6160-58ab-4db2-a4db-f270a8399169

📥 Commits

Reviewing files that changed from the base of the PR and between 3b8f948 and 263cc12.

📒 Files selected for processing (3)
  • devlog/_plan/260807_compatibility_lab/000_master_plan.md
  • devlog/_plan/260807_compatibility_lab/001_pr_stack_status.md
  • devlog/_plan/260807_compatibility_lab/009_cl09_passive_production_evidence.md

Comment thread devlog/_plan/260807_compatibility_lab/001_pr_stack_status.md Outdated
Comment thread devlog/_plan/260807_compatibility_lab/009_cl09_passive_production_evidence.md Outdated
@Wibias
Wibias force-pushed the feat/cl-09-passive-production-evidence branch from 263cc12 to 597b684 Compare August 12, 2026 01:01
@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

✅ READY

  • all PR quality gates passed.

UI screenshot waived by the gui-screenshot-waived label.

Hygiene

Deterministic PR hygiene checks passed.

@Wibias Wibias changed the title docs(lab): define CL-09 passive production evidence contract feat(lab): CL-09 passive production evidence Aug 12, 2026
@github-actions github-actions Bot added enhancement New feature or request and removed documentation Improvements or additions to documentation labels Aug 12, 2026
@Wibias
Wibias marked this pull request as ready for review August 12, 2026 01:53
@Wibias
Wibias marked this pull request as draft August 12, 2026 01:53

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 9

🤖 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 `@devlog/_plan/260807_compatibility_lab/001_pr_stack_status.md`:
- Around line 30-31: Choose one authoritative CL-09 lifecycle state, using
001_pr_stack_status.md as the source of truth, and update its lines 30-31 and
170-171 to match the actual PR scope and phase table. Reconcile
devlog/_plan/260807_compatibility_lab/009_cl09_passive_production_evidence.md
lines 13 and 449-460 with that authorization, removing or updating claims that
runtime implementation proceeds or is absent. Update
docs/superpowers/plans/2026-08-12-cl09-passive-production-evidence.md lines
66-70 so its implementation claim is retained only if authorized; otherwise make
it contract-only.

In
`@devlog/_plan/260807_compatibility_lab/009_cl09_passive_production_evidence.md`:
- Around line 288-290: Redact the internal requestRef and decisionRef fields
before exposing passive production signals through the management API and CLI
JSON output. Add or reuse a public DTO/serializer around
queryPassiveProductionSignals, while retaining both references for internal
correlation, and add tests covering both output paths.

In `@docs/superpowers/plans/2026-08-12-cl09-passive-production-evidence.md`:
- Line 7: Update the “Current base” entry in the plan document to retain SHA
e8db4e0365b12a314d1c08ec2cf81599efe5b2d3 and explicitly identify it as a later
dev descendant of the CL-08 merge 3b8f9487676fe258d76295e49e7db75aca26a4cb.

In `@gui/src/pages/CompatibilityMatrix.tsx`:
- Around line 194-203: Add locale entries for the production section title,
status text, and each metric label shown in the production block, then update
the JSX in the CompatibilityMatrix production section to render all of them
through t(). Preserve the existing detail values and conditional rendering.

In `@src/cli/lab.ts`:
- Around line 241-247: Update the production-signals flow in the CLI case to
pass the resolved deps.configDir into queryPassiveProductionSignals(), then
propagate that directory through queryPassiveProductionSignals() to
readRecentUsageEntries() so usage.jsonl is read from the selected configuration
directory. Add a regression test covering a non-default config directory.

In `@src/lab/query/passive-production.ts`:
- Around line 132-134: Update queryPassiveProductionSignals and its
readRecentUsageEntries call to fetch one row beyond
PASSIVE_PRODUCTION_MAX_SCAN_ROWS, then ensure derivation caps processing while
detecting that extra row and reports scan truncation accurately. Replace the
exact-length signals.length === maxResults heuristic with an overflow-aware
result, preserving the separate max-results truncation behavior only when an
additional matching signal is found.
- Around line 106-115: Add a short comment immediately before the scanRows
selection in readRecentUsageEntries documenting that the selected append-only
log entries are ordered oldest-first. Explicitly note that tail selection,
reverse iteration, and the signals[0].observedAt calculation rely on this
ordering contract.

In `@src/server/responses/core.ts`:
- Around line 1788-1794: Memoize installation-salt reads in the flow used by
readExistingInstallationSalt/readSaltFile with a module-wide cache keyed by the
resolved salt path, avoiding repeated synchronous file reads. Update or
invalidate the corresponding cache entry whenever readInstallationSalt creates
or reads a salt, while preserving existing salt values and lookup behavior.

In `@tests/lab-passive-production-evidence.test.ts`:
- Around line 108-117: Add focused tests near the existing passive-production
tests to cover all remaining classifyOutcome branches: a final attempt with
closeReason "client_cancel" should produce "client_cancel", an error code from
ENVIRONMENTAL_ERROR_CODES should produce "environmental", and an error code from
ROUTE_ERROR_CODES should produce "route_error" while incrementing
recentRouteErrorSignals. Reuse the existing usageEntryWithAttempt setup and
subject identifier patterns.
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c874aa9a-29ed-42be-afda-ea991dce817d

📥 Commits

Reviewing files that changed from the base of the PR and between 263cc12 and c9b244a.

📒 Files selected for processing (13)
  • devlog/_plan/260807_compatibility_lab/001_pr_stack_status.md
  • devlog/_plan/260807_compatibility_lab/009_cl09_passive_production_evidence.md
  • docs/superpowers/plans/2026-08-12-cl09-passive-production-evidence.md
  • gui/src/pages/CompatibilityMatrix.tsx
  • gui/src/pages/compatibility-matrix-api.ts
  • src/cli/lab.ts
  • src/lab/query/index.ts
  • src/lab/query/passive-production.ts
  • src/routing/compatibility/subject.ts
  • src/server/management/lab-routes.ts
  • src/server/responses/core.ts
  • src/usage/log.ts
  • tests/lab-passive-production-evidence.test.ts

Comment thread devlog/_plan/260807_compatibility_lab/001_pr_stack_status.md Outdated
Comment thread docs/superpowers/plans/2026-08-12-cl09-passive-production-evidence.md Outdated
Comment thread gui/src/pages/CompatibilityMatrix.tsx Outdated
Comment thread src/cli/lab.ts
Comment thread src/lab/query/passive-production.ts
Comment thread src/lab/query/passive-production.ts
Comment thread src/server/responses/core.ts
Comment thread tests/lab-passive-production-evidence.test.ts
@Wibias
Wibias marked this pull request as ready for review August 12, 2026 02:10
@github-actions
github-actions Bot marked this pull request as draft August 12, 2026 02:11
@Wibias Wibias added the gui-screenshot-waived Maintainer waiver for false-positive GUI screenshot requirements label Aug 12, 2026
@Wibias
Wibias marked this pull request as ready for review August 12, 2026 02:12
coderabbitai[bot]

This comment was marked as outdated.

coderabbitai[bot]

This comment was marked as outdated.

Wibias commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator Author

Review triage on head 29b1dab15e4b7d756761369f1ee73790c2e6f2e4:

Fixed and validated: CL-09 lifecycle-state consistency, non-default configDir propagation, exact scan/result truncation reporting, installation-salt read memoization, oldest-first ordering documentation, missing outcome-classifier coverage, and the implementation-plan base wording.

Skipped as not applicable: the requestRef / decisionRef redaction request. The frozen CL-09 contract defines these as installation-local correlation references and separately defers public export/publishing to CL-10. The authenticated local management API and local CLI are CL-09 read surfaces, not CL-10 public export surfaces, so removing the references there would weaken the exact-correlation contract without closing a defined privacy boundary.

Stale: the three findings against .github/workflows/cl09-dedupe-lab-translations.yml. That temporary helper workflow is no longer present in the PR tree.

@Wibias
Wibias merged commit 4fed8d3 into dev Aug 12, 2026
23 checks passed
@Wibias
Wibias deleted the feat/cl-09-passive-production-evidence branch August 12, 2026 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request gui-screenshot-waived Maintainer waiver for false-positive GUI screenshot requirements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant