ac4af582301a4e8a29245dbba767eba31334ddf9
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
6712e367e8 |
agent: a look at the stash shares one read of it
Each /api/state and /api/drift poll asked the stash (stash.json) for one value hundreds of times, through Detected, Drift and the agents' wiring checks, and each ask read the file and parsed it again. In a real-account heap profile (20 rounds of drift, state and providers) stashLoad was 24-34 MB of what was allocated. stashShared reads it through filememo.Read, so every look shares one parse until the file changes, by magpie or by another process. Every read-only caller uses it now, the 24 files here and QwenPaw's unstashPeek. stashLoad, which callers change and write back, still gives each its own map, cloned from the same parse. Real use: the owner's real-account sandbox, offline (proxy to :9), 20 warm rounds of /api/drift, /api/state and /api/providers: - allocated 477 MB ( |
||
|
|
579de3baa0 |
agent: enabledModels lose a deselected model's entries after the catalog sync (#2055)
misaka9981: models deselected in a provider's editor left magpie's provider in Pi's models.json, but their magpie/<provider>/<model> entries stayed in settings.json's enabledModels, and Pi warned "No models match pattern" for each at every start. Pi's resolver (model-resolver.js resolveModelScope, 1.1.0) only warns, never prunes. After the sync writes magpie's provider block, an enabledModels entry that names one of magpie's models outright (no glob; a thinking level read off) whose model the block no longer has is taken out. As the entry may be the user's own, it is remembered in stash.json (<agent>.scope.gone) and goes back on the list's end once the model is offered again; a provider rename moves the remembered entries too and a disconnect forgets them. Globs, entries on other providers and on models still offered stay, in order, comments kept. A list left with nothing is removed (never written []) and made again when its entries come back, with the model picked meanwhile; a list the user removed isn't made again. When the agent's model list can't be read, nothing is taken out. The same holds for the siblings with such a list: OmO and Prime Agent (piLike), StepCode (config.toml; its wiring state's last scope follows, so a disconnect still puts the user's list back) and omp (config.yml's plain entries; folder-scoped entries are left alone). Run: - TestPiEnabledModelsLoseDeselected (pi, omo, prime-agent) with the reporter's provider and four models, beside the user's own entries (another provider at a level, a magpie glob, a model still offered at a level): deselect, select again, rename. TestPiEnabledModelsEmptiedAndBack: emptied and back; removed by the user stays removed; other providers' and globs' file byte for byte; an unreadable models.json prunes nothing. TestStepCodeAndOmpEnabledModelsLoseDeselected, StepCode's disconnect putting the original list back included. - TestPiEnabledModelsFollowRename and TestStepCodeEnabledModelsFollowRename keep a magpie/deepseekx/flash entry to show a rename leaves a name sharing a prefix alone; deepseekx is now a real provider there, as the sync would otherwise (rightly) take an entry naming nothing out. - Broken by hand, each red: Pi's, StepCode's and omp's Sync hook off; the put-back off; the rename of remembered entries off. - Real Pi 1.1.0 (@earendil-works/pi-coding-agent) under a sandbox HOME, `pi -p`: the stale exact entries gave the reporter's warnings; the list as pruned gave none. - gofmt -l clean; go vet darwin, linux -tags nogui, windows; go test -tags nogui ./... green on origin/main |