Skip to content

Latest commit

 

History

History
32 lines (29 loc) · 2.9 KB

codex-reserve-capability.md

File metadata and controls

32 lines (29 loc) · 2.9 KB

Luna Reserve Capability

codexReserveEnabled decides Luna Reserve compatibility; codexDesktopAuthless no longer does. src/config/reserve-capability.ts owns the field, its one-time seed and the read isCodexReserveEnabled. The catalog (isEffectiveCodexReserve) and request authorization (isCodexReserveRequestEligible) in src/codex/loopback-target.ts both read that one predicate, then apply their own role and listener checks; receiving-listener admission stays the request authority.

The seed copies the legacy authless value once and records codexReserveMigration; until then Reserve reads authless. Every whole-config writer projects it through projectPersistedConfigMigrations (src/config/persisted-projections.ts) against the persisted pre-write document, and records it only when the write changes authless (seeding from the persisted value, so the change cannot move Reserve), sets Reserve explicitly, or carries an already migrated file. Any other write leaves an unmarked document byte-for-byte alone, which keeps unchanged-save and generation invariants. A new document starts disabled even when created with authless on. The startup step (src/server/reserve-capability-startup.ts) records the seed for every unmarked file once (on failure it warns and leaves the legacy reading in place), so after the first start a hand edit of authless cannot move Reserve. The settings route does not seed the live object itself: an authless-only change is seeded by the live writer from the file under its lock, so a stale live object cannot overwrite another process's Reserve decision; an explicit Reserve value is recorded with the marker. PUT /api/settings persists an explicit false, refreshes the catalog when Reserve changes, and restores both fields only if the save fails before publication; after publication it adopts the Reserve fields from the published file. The startup step adopts the seed in place, because the loaded object carries file-backed provenance that a copy would lose. The live writer's three-way merge keeps another process's Reserve change rather than reapplying a stale value, and it always rebases both Reserve fields against disk (RESERVE_CAPABILITY_KEYS in src/config/live-reconcile.ts), so a value that only another process wrote survives an unrelated live save even when the live config and its baseline both omit it. After the marker exists an absent value means off, so deleting the field cannot reinstate inheritance. Enabling the capability manufactures no permission: the credential-bound upstream Reserve check (src/codex/reserve-availability.ts) still decides each request. tests/config/reserve-capability-migration.test.ts covers the combinations, the writers and the route.

The request-side contract (credential-bound authorization, the refusal for an unopted gpt-reserve, helper restrictions) is in OpenAI tiers; the catalog row is in Catalog.