Skip to content

refactor(adapters): centralize runtime adapter authority - Part 1 - #1721

Merged
lidge-jun merged 120 commits into
devfrom
refactor/adapter-registry-authority
Aug 15, 2026
Merged

refactor(adapters): centralize runtime adapter authority - Part 1#1721
lidge-jun merged 120 commits into
devfrom
refactor/adapter-registry-authority

Conversation

@Wibias

@Wibias Wibias commented Aug 15, 2026

Copy link
Copy Markdown
Owner

Stack

  1. This PR: adapter registry + runtime construction authority with behavior parity
  2. test(adapters): derive routed tool conformance from registry - Part 2 #1722 registry-derived routed-tool conformance
  3. test(adapters): cover buffered freeform restoration - Part 3 #1723 buffered parser conformance

Scope

Fresh reimplementation of the architecture slice from #1623 on current dev.

  • one authoritative runtime adapter registry
  • resolveAdapter() constructs through that registry
  • Azure / Azure OpenAI declare semantic inheritance from OpenAI Responses without constructor rewrites
  • MiMo Free declares semantic inheritance from OpenAI Chat without constructor rewrites
  • Cursor remains a direct contract because its runTurn transport and gated native-file fallback are distinct
  • persisted adapter ids remain runtime-validated strings
  • wrapper-cycle, runtime-validation, and extension policy documented in structure/10_adapter-registry.md

Deliberately not included

Verification

The registry contract was added test-first. The red run failed only because src/adapters/registry.ts did not yet exist. On the implementation tree, TypeScript/gates and all four Linux test shards passed before the branch was squashed to one commit.

The PR remains draft while exact-head post-squash CI finishes.

Summary by CodeRabbit

  • New Features

    • Added centralized adapter registration, inheritance, discovery, and creation.
    • Added privacy-safe public evidence preview, export, verification, import, listing, and revocation workflows.
    • Added Codex app-server status and restart controls, including stale-model notifications.
    • Added custom-model reasoning-effort configuration across the CLI, API, and GUI.
    • Added community evidence summaries to the compatibility view.
    • Added static model catalogs and improved provider discovery controls.
  • Bug Fixes

    • Improved schema normalization, model metadata, Windows process handling, and transport timeout reporting.
  • Documentation

    • Documented adapter registration and public evidence workflows.

Wibias added 30 commits August 14, 2026 21:18
Rebased onto current dev with the reviewed public evidence trust core, consumer durability recovery, sparse-array JCS hardening, and required Windows publisher-key ACL hardening.
Rebase the reviewed CL-10 operator/community layer onto the current public-evidence core. This squashes the child history onto cl10-public-core while preserving the exact conflict-free GitHub merge tree, including the final review fixes.
The sidebar button is the fix; the models tab is where the belief that something
is wrong actually forms. Someone comparing the picker against this list is
already looking at this page, so the recovery belongs here too.

A banner appears only when the proxy reports a running app-server older than the
catalog. Every other verdict renders nothing: telling a user "we could not tell"
on a page about models is noise, and a locked-down host where enumeration fails
would otherwise show a permanent warning.

The reading is fetched once on mount and on invalidation, never on a timer.
Enumeration shells out to ps, procfs, or PowerShell CIM, and this workspace
already gates its own catalog poll on tab activity for that reason.

Cross-surface invalidation is an epoch rather than a shared controller: App bumps
a counter when a restart settles anywhere, Models takes it as a prop and re-reads.
The backend is already single-flight, so what was missing was invalidation, not
mutual exclusion — without it a restart from the sidebar left the banner on screen.

Two defects the earlier string-matching tests could not see are now covered by
real DOM tests: a page-head restart did not refresh staleness at all, and the
settled callback fired after unmount. The hook also lost its timeout translation
in a rewrite, so a timeout showed the transport's hardcoded English.

Naming note: this file already binds catalogState to the /api/catalog resource,
so the new value is appServerState.

Verification: gui bun test 846 pass / 0 fail; lint, lint:i18n, build green; root
typecheck and privacy:scan green. Live proxy on a fresh build returned
{"state":"fresh","runningCount":4} for the authenticated GET, 401 unauthenticated,
and 403 for an admin token from a foreign origin.
restartCodexAppServers sent process.kill(pid, "SIGTERM") on every platform. On
Windows that is not a graceful signal — it is an unconditional terminate of one
process, and it leaves the process tree behind. The repository already knew this
and already had the right ladder for the proxy in process-control.ts; app-servers
never got it.

That gap matters most exactly where this feature is most needed. Windows has no
Ctrl+Q, so users close the Codex window and the app-server keeps running in the
background holding a catalog snapshot — the stale picker this whole unit exists
to fix.

Windows now uses taskkill /PID <pid> /T /F, resolved from a trusted system
directory rather than PATH, with a fallback to the old process.kill so the new
path can never be worse than the one it replaces. Unix keeps SIGTERM only: there
the signal really is graceful, and following it with SIGKILL would ask a harsher
consent than a restart click gives. Survivors are reported instead.

The asymmetry is recorded in the function comment and the phase doc so a later
reader does not "fix" it into symmetry.

Tests drive each branch through injected io: Windows exec receives /PID /T /F and
no signal follows, a throwing taskkill falls back to SIGTERM, and Linux and macOS
stay SIGTERM-only with no exec and no SIGKILL.
The CLI parity sweep reads GUI sources for /api paths, so naming the catalog
route inside a comment made it look like an endpoint the GUI calls with no CLI
mirror. The comment only needed to explain why the new value is appServerState
rather than catalogState; it did not need to spell the route.
Resolve purge.ts: re-express #1706 export-purge deferral inside #1709 withLedgerMutation
Resolve i18n-allowlist: take #1714 case-insensitive HTTP match (superset of #1715)
@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

✅ READY

  • all PR quality gates passed.

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

@github-actions
github-actions Bot marked this pull request as draft August 15, 2026 05:29
@Wibias Wibias added the gui-screenshot-waived Maintainer waiver for false-positive GUI screenshot requirements label Aug 15, 2026
@lidge-jun
lidge-jun merged commit 88463de into dev Aug 15, 2026
51 of 54 checks passed
@github-actions
github-actions Bot marked this pull request as ready for review August 15, 2026 05:32
@lidge-jun
lidge-jun deleted the refactor/adapter-registry-authority branch August 15, 2026 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature). gui-screenshot-waived Maintainer waiver for false-positive GUI screenshot requirements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants