Repository navigation
feat: mark a provider model retired when its provider stops offering it - #898
Merged
Merged
Conversation
HugoXK
enabled auto-merge (squash)
November 16, 2026 05:01
Owner
Author
|
Written-by: Fledge Platform Lead PASS requested at This PR is the |
HugoXK-bot
approved these changes
Nov 16, 2026
HugoXK-bot
left a comment
Collaborator
There was a problem hiding this comment.
Verdict: PASS at 696a2dd
Written-by: HugoXK-bot
Author: Fledge Platform Verdict
src/gateway/gateway.ts:325-326writes the row only for the 404src/gateway/modelFallback.ts:32-34recognizes, andsrc/db.ts:4887-4893keeps the first date (WHERE retired_at IS NULL), so a 429, a 5xx and any other 404 never retire a model.src/db.ts:1498and:2849-2851add the column to a fresh and an existing database atSCHEMA_VERSION45 (src/db.ts:65);test/modelRetire.test.ts:71-113drives fake providers and pins the row, Settings, the repository page, the job line and the second-404-does-not-move rule, and:148-172pins the apply refusal plus the live selection passing.src/app.ts:4384-4388refuses an apply whose selection still holds a retired model, by name;src/views/pages.ts:1881,:1893-1894mark the retired picker/default,:2242marks Settings, and:3275namesretiredbeside the attempt status.- Non-blocking:
retired_atis written asnowIso()(a full timestamp,src/gateway/gateway.ts:326) whiledocs/architecture.md:1795calls it "the first date"; the UI slices to 10 characters, so display and tests agree — worth deciding whether the column holds a date or an instant.
Ran:
npm run checkin a fresh tree of696a2ddffe(git-init'd;package-lock.jsonsha256ef264428…matches the one CI used): lint, typecheck, 2346/2346 tests, build — exit 0npx tsx --test test/modelRetire.test.ts test/modelFallback.test.ts test/db.test.ts— 33/33 at the tip- red half: the same head tests over the merge-base
94cfaaa5a9d0sources (base side identical to this PR's diff) — 3/3 fail node scripts/risk-gate.mjs --base 97651e3 --head 6c3dc90(local commits whose trees are merge-base94cfaaa5a9d0and head696a2ddffe) —risk-tier: T3; basis: src/db.ts, 16 filesGITHUB_REPOSITORY=HugoXK/fledge GITHUB_TOKEN=… node scripts/pr-lint.mjs --pr 898—pr-lint: ok (#898, T3, 16 files)- tip check-runs
filter=latest: 28 runs, onlyreview-gatered (no verdict); 0 unresolved review threads
Not run: no real provider retiring a model, no deployed instance — the 404, 429 and 500 answers came from fake HTTP servers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Written-by: Fledge Platform Dev-1
Bot: Fledge Platform Dev-1
Fixes #852
What this builds
A provider that stops offering a model it used to serve answers
404with a body that names the model. The gateway already treated that as retryable so the job could finish elsewhere; what died with the call was the fact. It is now written down once, and every page that names a model can say it:provider_models.retired_at TEXT NULLplus the PRAGMA-guardedALTER TABLE, written bymarkProviderModelRetired()withWHERE retired_at IS NULLinside a transaction — the first date wins and a later404cannot move it.SCHEMA_VERSION44 → 45; the fouruser_version 44pins move to 45 and the opposite pin intest/db.test.tsmoves to 46, exactly as the card says.retiredModelFailure()insrc/gateway/modelFallback.tsshares one pattern withretryableModelFailure(), so "this 404 is retryable" and "this model is gone" cannot drift. The attempt recordsretired: true; a429, a5xxand any other404write neither the column nor the flag.retired by the provider on <date>in both languages, the repository page marks a retired default and every per-bot picker that points at it, and the job's model line names the reason beside the status.Readings
Red at the base
94cfaaa5a9d0cee60c3af167e353fbf07e9cd1af(the parent, read from the API in the turn this was cut):npx tsx --test test/modelRetire.test.ts→ 0 pass / 3 fail — noretired_at, no marker on any page, and the apply still succeeds.Green at the tip: the same command → 3 pass / 0 fail.
The tests assert behaviour, not calls: the fake providers are real HTTP servers, the store is
:memory:, and every assertion reads a rendered page, a stored row or a re-parsed job record.Ran:
npx tsx --test test/modelRetire.test.tsat the parent → 0 pass / 3 fail; at the tip → 3 pass / 0 failnpm run checkat the tip → 2346/2346, exit 0 (lint,tsc --noEmit, the full suite and the build)node scripts/risk-gate.mjs --base origin/main→risk-tier: T3; basis: src/db.tsNot run:
test/modelFallbackGateway.test.tsalready uses, and the store is:memory:INSTANCE_NOT_READYrefusal, so the last test proves the retirement refusal is gone for a live selection and that nothing was applied — it does not prove a container restartRisk / tier
risk-tier: T3; basis: src/db.ts— the diff touchessrc/db.tsandsrc/gateway/, both T3 paths in.github/agent/risk-rules.json.Rollback: the column is additive and nullable, so reverting the behaviour alone (keeping the 45 bump) restores the old pages with every model shown live and loses no data. A full revert also lowers
SCHEMA_VERSIONto 44, and a 45 database is then refused by the older build (newer than this build), so a full rollback restores the pre-deploy database copy from the backup path indocs/deploy.mdbefore the older image starts.Docs decision:
docs/architecture.mdgains the retirement paragraph in "Model providers and per-bot models";docs/quota.mdrecords that an unbilled attempt writes no ledger row, so a retirement never touches the balance.Changelog:
changelog.d/852-model-retired.added.md.maintainer_can_modify: true