Files
llmgw/internal/cli/sourcenote.go
T
Ilker ManapandClaude Opus 5 40f5c930c4
CI / test (push) Successful in 1m43s
Say when a replica is running an edited profile, and check a source from the web too
Two defects, both of the same kind: something the CLI knew and the rest of
the system did not.

A profile can be edited while a replica is running against the old one. The
reconciler deliberately leaves it alone — churning a replica that is serving
costs more than the imperfection — but there was no way to see it, so the
cluster could disagree with its own configuration indefinitely and read as
healthy. Profile now carries a fingerprint, a replica records the one it was
placed with, and both the API and `ctl replicas` say "stale profile" when
they differ. An empty fingerprint is not stale: it means a replica adopted
from an older agent, which is unknown rather than wrong.

Adding a model from the admin page skipped the source check `ctl model add`
has done all along, so a typo or a mirror that is down became a replica
failing on a node minutes later, with an error naming the node. The check
moves out of the CLI into a package both use.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-27 22:42:26 +02:00

18 lines
698 B
Go

package cli
import "fmt"
// sourceNote is what to print about a checked source.
//
// It says where the answer came from, because the control plane's network is
// not the nodes' network: a mirror this machine can reach may be unreachable
// from a node behind a different firewall, and the reverse. The check catches
// typos and a mirror that is down, which is most of what goes wrong, and it
// should not be read as proof that the fetch will work.
func sourceNote(source string, size int64) string {
if size > 0 {
return fmt.Sprintf(" source reachable from here: %s (%s)", source, fileSize(size))
}
return fmt.Sprintf(" source reachable from here: %s (size not advertised)", source)
}