Skip to content

fix(providers): accept the {"projects":[...]} Crush registry shape - #1510

Open
ptstory wants to merge 1 commit into
getagentseal:mainfrom
ptstory:fix/crush-registry-shape
Open

ptstory wants to merge 1 commit into
getagentseal:mainfrom
ptstory:fix/crush-registry-shape

Conversation

@ptstory

@ptstory ptstory commented Sep 20, 2026

Copy link
Copy Markdown

Summary

  • loadRegistry doesn't recognize Crush's {"projects": [...]} registry wrapper, so a standard upstream Crush registry resolves to zero projects and reports no usage
  • Accept the wrapper alongside the array and keyed-object shapes the parser already handles
  • Correct the registry-format description in docs/providers/crush.md

Detail

loadRegistry accepts a top-level array, or for any other object falls back to
Object.values(parsed). On the wrapper that yields a single element — the array
itself — which fails the per-entry path/data_dir check. Zero databases are
discovered and overview reports "No usage found" for standard upstream Crush
registries.

doctor does not surface this: probeRoots (#903) confirms projects.json
exists without parsing it, so Crush reports healthy while overview returns
nothing.

Crush's centralized project registry has used this wrapper since the feature was
introduced:

type ProjectList struct {
    Projects []Project `json:"projects"`
}

I could not find any committed Crush version that writes a bare array or a keyed
object. The provider docs currently say:

The registry shape is an object keyed by project id (modern Crush) or an array (older builds and tokscale's sample fixtures). The parser accepts both.

Current upstream Crush and tokscale's committed Crush fixtures use the wrapper.
This PR corrects that sentence but keeps both existing branches, since removing
them is a separate decision.

Testing / Verification

  • I have tested this locally against real data (not just unit tests)
  • npm test passes
  • npm run build succeeds
  • Not a UI change
  • UI change: before and after screenshots attached below

Crush v0.95.0, CodeBurn 0.9.24, macOS. Same machine, same registry, same
databases; only the parser differs.

before:  models --provider crush -p lifetime  -> No usage found
after:   models --provider crush -p lifetime  -> 40 sessions, 2,447,391 tokens

Three tests added, one per accepted registry shape, each asserting the resolved
session. npm test on this branch: 4427 passed, 5 skipped. On main: 4425
passed, 5 skipped. tsc --noEmit clean on both.

Crush's project registry has used a ProjectList wrapper since it was introduced, so loadRegistry parsed a real registry as zero entries and reported no usage. Accept the wrapper alongside the array and keyed-object shapes the parser already handles, and correct the registry-format description in the provider docs.
@ptstory
ptstory requested a review from iamtoruk as a code owner September 20, 2026 14:21

@ozymandiashh ozymandiashh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified the diff: accepts the {"projects":[...]} registry shape while keeping the array and keyed-object forms working. Tests cover all three shapes. LGTM.

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.

2 participants