Skip to content

feat(lab): CL-01 deterministic protocol conformance harness (CL-00 #1286 aligned) - #10

Closed
Wibias wants to merge 85 commits into
devfrom
feat/cl-01-conformance-harness
Closed

feat(lab): CL-01 deterministic protocol conformance harness (CL-00 #1286 aligned)#10
Wibias wants to merge 85 commits into
devfrom
feat/cl-01-conformance-harness

Conversation

@Wibias

@Wibias Wibias commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add src/lab/conformance/ deterministic protocol conformance harness loading CL-00 022_protocol_v1_cases.json fixtures
  • Execute 24 canonical scenarios across responses-core, chat-core, anthropic-core, tools-core, and codex-core using shipped parseRequest, chat/responses adapters, and bridgeToResponsesSSE / anthropic outbound translation
  • Add closed assertion DSL evaluator, observation normalization, and eight negative-control fixtures proving known defects are rejected
  • Align minimal openai-chat wire semantics for developer role preservation and single-tool required allowed_tools mapping (CL-00 contract)
  • Add tests/lab-conformance-harness.test.ts harness self-tests

Verification

  • bun x tsc --noEmit
  • bun test tests/lab-conformance-harness.test.ts (10/10; 24 canonical + 8 negative controls)
  • bun test tests/bridge.test.ts tests/responses-parser.test.ts tests/chat-completions-endpoint.test.ts (128/128)
  • Full bun run test (not run; known Windows/Bun host failures documented in CL-00 stack status)

Checklist

  • CL-01 scope only (no live probes, ledger, CLI, UI, routing-profile controls)
  • CL-02 not started
  • Independent acceptance review recorded in 051_cl01_acceptance_review.md
  • Stack status updated in 001_pr_stack_status.md

Base: accepted CL-00 tip c2113ca47b8a05c5a5f90679e4eaa640ca2c6a66

iF2007 and others added 30 commits August 8, 2026 18:31
DeepSeek routed models were rebuilt with a 128k context window after
every sync because the registry entry had no jawcodeBundle, so the
catalog metadata restore step could not resolve the provider and the
strict-fields fallback overwrote the window. Users who saved the
provider under a title-cased key ("DeepSeek") also missed the alias
table, which was case-sensitive.

Add jawcodeBundle: "deepseek" to the registry entry and fold provider
case in resolveJawcodeProvider, then regenerate the metadata snapshot
with the official 1,048,576-token window for both V4 models. Routed
deepseek entries now restore 1,048,576 instead of the 128k fallback.
deepseek-chat/deepseek-reasoner were deprecated upstream on 2026-07-24 15:59 UTC
and official identifiers are now deepseek-v4-flash/deepseek-v4-pro. The aliases
stay in the registry only as compatibility aliases so existing saved configs
and requests keep validating and routing; the comment now documents that
post-deprecation reason instead of a stale future-dated note.
…a pipeline

The metadata pipeline was de-jawcoded upstream: the bundled snapshot now
lives at scripts/model-metadata.source.json and generates
src/generated/model-metadata.ts. Move the DeepSeek V4 context-window fix
onto that pipeline (1048576 for flash and pro per DeepSeek's official
Codex setup docs) and regenerate the committed output so routed rebuilds
stop falling back to the 128k strict-fields default.
…ty list

Add deepseek to the catalog augmentation allowlist so metadata-sourced V4
rows are appended when live discovery returns nothing, and cover the
empty-discovery path with a regression test asserting the official
1,048,576 context window, auto-compact limit, and text-only input.
…tadata

fix(catalog): restore DeepSeek V4 context window on routed rebuilds
Fixed 1 file(s) based on 1 unresolved review comment.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
…e-fallback

feat(routing): fail over between policy candidates on retryable failures
…surface-parity

test(routing): lock policy evidence parity across inbound protocols
…ing-quota

feat(routing): use pool-aware quota evidence for policy profiles
Freeze the CL-00 evidence, verdict, scenario, identity, privacy, and incident contracts so conformance implementation can proceed without duplicating routing authority.
Record the accepted implementation head and draft pull request so the programme ledger is complete without authorizing CL-01.
Remove Markdown hard-break spaces so the final branch diff passes repository whitespace checks.
…lidge-jun#1287)

Replaces the full-tail allocation in the request-history indexer with a
64 KiB streaming reader. The previous `readCompleteTail` allocated
`size - indexedOffset` bytes in one shot before parsing, so a large append
created a proportional transient allocation even though the SQLite index is
a disposable projection.

Records are now assembled across chunk boundaries, and a complete record
above 1 MiB is omitted from the projection only. `usage.jsonl` stays
canonical and is never truncated or rewritten; `indexedRows` still counts
successfully projected records, and the indexed offset only advances past a
newline so a torn final record is re-read rather than skipped.

`insert.finalize()` remains unconditional in `finally` — an unterminated
prepared statement keeps the DB file busy on Windows after close.

Republished from lidge-jun#1189 by luvs01, whose branch was 300 commits behind dev.
Rebased onto f5147cb with no conflicts; authorship preserved below.

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>
…jun#1169) (lidge-jun#1289)

`ocx codex-shim install` reported a clean green success even when the
launcher was installed but Codex routing was not provably pointed at
OpenCodex — an external `model_provider`, a user-owned local or remote
gateway, or routing that cannot be verified. It now reports a warning for
those cases.

It also warns when outbound proxy variables exist only in the current
process while `config.proxy` is unset or unresolved, because Codex launchers
and background services such as launchd may not inherit that environment.
Proxy values are never printed.

The change is advisory only: install still succeeds with the same exit code,
and the shim still fail-open execs the real Codex launcher.

Republished from lidge-jun#1169 by TyroneXie, whose branch was 335 commits behind dev.
Rebased onto f5147cb with no conflicts; authorship preserved below.

Co-authored-by: TyroneXie <328347833@qq.com>
)

OpenCodex still showed the legacy 30-day Grok billing window while the
real SuperGrok gate is weekly. Prefer GET /v1/billing?format=credits and
keep monthly /v1/billing only as fallback when weekly data is unavailable.

Closes lidge-jun#1283
…dge-jun#1288)

* fix(routing): keep unbound account quota unknown (lidge-jun#1195)

Policy profiles choose a provider and model before the request path resolves
Pool/Direct identity, thread affinity, Anthropic session affinity, or
round-robin/fill-first selection. Attaching the process-global active account
during policy evaluation could therefore score or exclude a candidate using
account A's quota and then execute the request on account B.

An unbound candidate now stays quota-unknown in both the live route trace and
the management dry-run, which is more accurate than inventing an account
reference and keeps account selection, cooldowns, and session affinity
authoritative. Unknown quota already has an explicit profile policy.
Explicit `codexAccountId` and account-ref evidence remains unchanged.

Republished from lidge-jun#1195 by luvs01, whose branch was 300 commits behind dev.
Rebased onto f5147cb with no conflicts; authorship preserved below.

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>

* test(routing): prove the management dry-run leaves unbound candidates unknown

Maintainer-added coverage for the lidge-jun#1195 republish. The contributor's patch
deletes the same block from the live router and the management dry-run path,
but only the live path had a regression. The existing dry-run test covers a
candidate with an explicitly supplied codexAccountId, which stays known and
is unaffected by the fix, so the dry-run half of the parity claim was
unproven.

These two tests exercise an unbound Codex candidate with an active pool
account, and an unbound Anthropic candidate with an active account, and
assert both stay quota-unknown with no accountRef. Restoring either deleted
block fails them.

---------

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>
…) (lidge-jun#1293)

Removing a provider deleted only `config.providers[name]`. Its rows in
`config.customModels` stayed behind, and neither consumer filters them:
`/api/models` lists every row and the generated Codex catalog emits every
row keyed by slug, so the dashboard kept advertising models that resolved
to a provider which no longer existed.

This is an inconsistency rather than a missing feature. Provider *rename*
already maintains the array — `rewriteProviderReferences` rewrites
`customModels[].provider` alongside combo targets and Claude tier maps — so
the array is meant to track the provider lifecycle, and one of the two
sibling operations simply did not. `dropProviderCustomModels` is therefore
placed next to the rename pass, so the two stay visible to each other.

Both removal paths call it and report the count: `ocx provider remove`
prints it and adds `droppedCustomModels` to `--json`, and the management
DELETE returns the same field. An emptied list drops the `customModels`
field, matching the add/remove routes; the `customModelCatalogMigration`
marker is deliberately preserved, since rewriting it would change an older
binary's view of one-time row ownership.

Partial fix for lidge-jun#1273. The second defect in that report — a stale in-memory
config re-persisting deleted rows through a whole-document write — is not
addressed here and remains open; it needs a reconciliation design of its
own, keyed on the immutable `OcxCustomModel.id` rather than on a slug.

Reported by @gdxnpy with a reproduction and a before/after config diff that
showed the cooperating save path itself was healthy, which is what made the
second defect findable rather than "settings sometimes revert".
…ck (lidge-jun#1305)

A combo member whose provider row is incomplete — missing a context window,
or absent from the fetched catalog — was dropped from the generated Codex
catalog rather than synthesized. `resolveComboCatalogMember` fills the gap
from configuration, falling back to the provider's declared max input and
then to 128k, so a combo stays selectable when one member's upstream row is
thin.

Republished from lidge-jun#1163 by 关俊江, whose branch was 366 commits behind dev.
Two conflicts, both mechanical and both on a single line: `dev` renamed
`augmentRoutedModelsWithJawcodeMetadata` to `augmentRoutedModelsWithMetadata`
and added `CODEX_ACCOUNT_BOUND_CATALOG_KIND` plus a `catalog/parsing` import
block, while this branch added `resolveComboCatalogMember` to the same export
and import lines. Resolved by keeping every symbol from both sides; no
behavior was re-decided.

Co-authored-by: 关俊江 <each1024@qq.com>
* fix(google): discover Antigravity live models

* fix(security): guard Antigravity model discovery

Route Cloud Code Assist discovery POSTs through the provider outbound policy and invalidate account-scoped live model cache when OAuth credentials change.

* fix(google): scope Antigravity discovery to current account

Discard stale discovery writes after OAuth account changes, use the routed CCA project for discovery, and retain partial Gemini availability as explicit wire IDs.

* fix(google): harden Antigravity catalog discovery

Invalidate removed provider generations, migrate canonical static opt-outs, and reject malformed CCA model identifiers.

* fix(antigravity): harden live model discovery

* fix(catalog): distinguish cache eviction from authority changes
@Wibias
Wibias force-pushed the feat/cl-01-conformance-harness branch from cc447ce to 565f399 Compare August 8, 2026 22:51
@Wibias Wibias changed the title [WRONG BRANCH] feat(lab): CL-01 deterministic protocol conformance harness feat(lab): CL-01 deterministic protocol conformance harness (CL-00 #1286 aligned) Aug 8, 2026
@Wibias
Wibias changed the base branch from feat/cl-00-compatibility-contracts to dev August 8, 2026 22:51
@Wibias
Wibias force-pushed the feat/cl-01-conformance-harness branch from 565f399 to 22d608c Compare August 8, 2026 22:51
@Wibias

Wibias commented Aug 8, 2026

Copy link
Copy Markdown
Owner Author

Superseded by the upstream CL-01 PR against lidge-jun/opencodex:dev: lidge-jun#1320

This fork-local PR targeted Wibias/opencodex:dev and could not be retargeted to the correct upstream base repository. The CL-01 branch (feat/cl-01-conformance-harness) remains unchanged at d665004.

@Wibias Wibias closed this Aug 8, 2026
@Wibias Wibias reopened this Aug 9, 2026
@Wibias Wibias closed this Aug 9, 2026
@Wibias
Wibias deleted the feat/cl-01-conformance-harness branch August 9, 2026 04:10
@Wibias
Wibias restored the feat/cl-01-conformance-harness branch August 9, 2026 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants