Skip to content

Report and resolve the key of the configured judgment backend - #58

Merged
DevMortimer merged 3 commits into
mainfrom
fix/backend-aware-key-status
Sep 22, 2026
Merged

DevMortimer merged 3 commits into
mainfrom
fix/backend-aware-key-status

Conversation

@DevMortimer

Copy link
Copy Markdown
Owner

Closes #57. Depends on DevMortimer/pi-typesafe#10 (pi-typesafe 0.7.0).

What was wrong

The judge gate was backend-aware but /warden status called describeAuth() and /warden enable called ensureApiKey(ctx) with no backend. With typesafeBackend: "openrouter", status reported "TypeSafe key: missing" on the same line that counted judgments, and enable opened the TypeSafe login prompt, so consent could not be saved.

Change

  • Status and enable pass config.typesafeBackend to pi-typesafe's authState and ensureApiKey. With no OpenRouter key, enable reports the variable to set instead of prompting.
  • The judge gate uses authState({ backend }).usable, which also honours a rejected key. keyAvailable is removed; it was not exported from the package.
  • src/backend.ts reads hosts and key variables from pi-typesafe's DECISIONS_BACKENDS instead of a local copy.
  • The headless hint and the enable confirmation name the backend's own variable.

Remaining before ready

  1. Publish pi-typesafe 0.7.0.
  2. npm install pi-typesafe@^0.7.0 so the lockfile resolves the registry build.
  3. Version bump commit to 0.40.0.

Verification

npm run check passes (typecheck, 668 offline tests, build) against a local npm pack of pi-typesafe 0.7.0 installed with --no-save.

/warden status called describeAuth() and /warden enable called
ensureApiKey(ctx) with no backend, so an OpenRouter user saw "TypeSafe
key: missing" beside a count of judgments, and enable opened the TypeSafe
login and could not save consent. Both now pass typesafeBackend to
pi-typesafe's backend-aware authState and ensureApiKey. The judge gate
uses authState({ backend }).usable, which also honours a rejected key.
backend.ts reads hosts and key variables from DECISIONS_BACKENDS instead
of a local copy.

Closes #57
Backend-aware authState and ensureApiKey signatures.
@DevMortimer
DevMortimer marked this pull request as ready for review September 22, 2026 14:34
@DevMortimer
DevMortimer merged commit 00f5a33 into main Sep 22, 2026
6 checks passed
@DevMortimer
DevMortimer deleted the fix/backend-aware-key-status branch September 22, 2026 23:33
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.

openrouter backend: status reports a missing key, and /warden enable cannot complete

1 participant