The mixed-tracked-repo recovery path used a fragile substring match on
the error message and re-cloned the repo via /discover to count skills
and agents. Both problems share one root cause: the counts InferTrackedKind
already computed during the failed first install were thrown away.
- Add install.TrackKindAmbiguousError carrying the discovered Skills /
Agents counts. InferTrackedKind returns it on the ambiguous branch.
Error() preserves the legacy message verbatim so CLI output is unchanged.
- Server handleInstall track branch uses errors.As to detect it and emits
writeCodedError with stable code 'install.track_kind_ambiguous' plus
skills/agents counts in error_params.
- UI replaces the substring match with an ApiError.code check and reads
counts straight from err.params, skipping the second /discover clone.
- Add unit tests asserting errors.As, count fidelity, and explicit-kind
short-circuit (no clone).
Net result: 2 clones instead of 3 on the mixed-track recovery path, and a
stable cross-language contract instead of a brittle English substring.