refactor(settings): provider facts as data
CI / ci (push) Canceled after 0s

#181: ModelProvider is the provider-descriptor table — label, effort
ladder, flagship, endpoint, env var joined by wire dialect (chat/models
paths + the SSE decoder selector), auth mode (Bearer vs Anthropic's
header pair), keyless (nous rides the Portal login), and the ONE
trailing-slash endpoint trim. The probe's URL builders, auth headers,
and stream-decoder picks select by data; the per-dialect bodies and
decoders stay separate functions, not switch clothing.

ProviderCredential.resolve is the ONE credential rail (provider key,
else the shared Portal session key for keyless providers — official
endpoint ONLY, never a user-set URL). Settings' Test Connection and the
new PassReadiness module both call it; the twice-implemented #175
fallback can no longer drift. One deliberate tightening, reviewer-
blessed: a nous pass profile on a custom base_url with no pasted key now
reads missingKey where the old session-model fallback said ready — the
old copy had no endpoint gate at all.

Pass readiness leaves the session model (PassReadiness.swift maps each
pass surface to ready/missingKey/unknown over the descriptor;
MentorSessionModel stores the verdicts and reads no keys or auth
files). runPass and blindRead run their guards through one shared rail
(guardOpenPieceRun) — identical refusal strings, blockers named
honestly. No app-side model-settings store (ADR-0014 red line).

Rider: the #179 mid-pass repoint pin polls the rig's hasHeldPrompt
before releasing the held turn — runningPass flips before the one-shot
engine parks its prompt, so firing into that window false-failed under
parallel-suite load.

Full suite 668/668 (xcresult executed count). Finish-audit: three
reviewers (ponytail/security/general), zero findings above LOW; two
ponytail trims and one pin tightening applied.

Closes #181
This commit is contained in:
AlexKucera committed 2026-11-10 10:58:29 +01:00
1 parent 218e2db397
commit f49e4b6ca0
15 files changed
+506 -184

No files matched your search

+6 -2
View File
@@ -581,9 +581,13 @@ struct PostsModelWriteRailTests {
try FileManager.default.createDirectory(at: homeB, withIntermediateDirectories: true)
rig.model.bind(home: homeB) // the Settings repoint, mid-pass
// Release the held turn as a NORMALLY ended one — .ended + no refusal.
// #require: nothing held means the parked prompt already timed out
// under machine load — fail loudly, not on a confusing nil strip.
// Poll for the PARK first: runningPass flips before the one-shot
// engine spawns, so ending the hold in that window false-fails
// under load (the #30/#147 flake family). #require afterwards:
// nothing held after the poll means the parked prompt hit its
// deadline — fail loudly, not on a confusing nil strip.
let engine = try #require(rig.mentor.host.oneShot as? ScriptedEngine)
try await pollUntil { engine.hasHeldPrompt }
try #require(engine.endHeldPrompt())
await run.value