feat(skills): add cross-platform install fallback for non-brew environments#17687
Conversation
src/agents/skills/types.ts
Outdated
| export type SkillInstallSpec = { | ||
| id?: string; | ||
| kind: "brew" | "node" | "go" | "uv" | "download"; | ||
| kind: "brew" | "node" | "go" | "uv" | "download" | "apt" | "dnf" | "pacman" | "apk"; |
There was a problem hiding this comment.
New kind values are dead code
The type was expanded with "apt" | "dnf" | "pacman" | "apk", but neither the parser nor the installer handles them:
parseInstallSpecinsrc/agents/skills/frontmatter.ts:32still only acceptsbrew,node,go,uv,download— any skill withkind: "apt"(etc.) will be silently dropped (returnsundefined).buildInstallCommandinsrc/agents/skills-install.ts:168has no cases for these new kinds — they'd hit thedefaultbranch returning"unsupported installer".selectPreferredInstallSpecinsrc/agents/skills-status.tsdoesn't look for any of the new kinds.
The type union suggests these are intended install paths, but without corresponding implementation they'll only cause confusion. Either add handling throughout (parser + installer + status), or remove the new kinds from the type until they're ready.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agents/skills/types.ts
Line: 5:5
Comment:
**New `kind` values are dead code**
The type was expanded with `"apt" | "dnf" | "pacman" | "apk"`, but neither the parser nor the installer handles them:
1. `parseInstallSpec` in `src/agents/skills/frontmatter.ts:32` still only accepts `brew`, `node`, `go`, `uv`, `download` — any skill with `kind: "apt"` (etc.) will be silently dropped (returns `undefined`).
2. `buildInstallCommand` in `src/agents/skills-install.ts:168` has no cases for these new kinds — they'd hit the `default` branch returning `"unsupported installer"`.
3. `selectPreferredInstallSpec` in `src/agents/skills-status.ts` doesn't look for any of the new kinds.
The type union suggests these are intended install paths, but without corresponding implementation they'll only cause confusion. Either add handling throughout (parser + installer + status), or remove the new kinds from the type until they're ready.
How can I resolve this? If you propose a fix, please make it concise.
src/agents/skills-install.ts
Outdated
| const aptResult = await runCommandWithTimeout( | ||
| ["sudo", "apt-get", "install", "-y", "golang-go"], | ||
| { timeoutMs }, | ||
| ); |
There was a problem hiding this comment.
Missing apt-get update before install
On fresh containers and minimal Docker images, the apt package lists are typically empty (or stale). Running sudo apt-get install -y golang-go without a preceding sudo apt-get update will fail with "Unable to locate package golang-go" in most container environments — which is precisely the target use case for this fallback. Consider running apt-get update first, or at minimum mentioning it in the error message when apt-get install fails.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agents/skills-install.ts
Line: 685:688
Comment:
**Missing `apt-get update` before install**
On fresh containers and minimal Docker images, the apt package lists are typically empty (or stale). Running `sudo apt-get install -y golang-go` without a preceding `sudo apt-get update` will fail with "Unable to locate package golang-go" in most container environments — which is precisely the target use case for this fallback. Consider running `apt-get update` first, or at minimum mentioning it in the error message when `apt-get install` fails.
How can I resolve this? If you propose a fix, please make it concise.196bec2 to
e9be19c
Compare
|
Addressed both review comments:
Force-pushed with both fixes. Tests pass. |
64b6ce4 to
0edc357
Compare
…nments - Extend SkillInstallSpec to support native package managers (apt, dnf, pacman, apk) - Add platform detection utilities to identify Linux distro and available package managers - Update install selection logic to prefer native package managers on Linux - Improve install fallback chain: native PM → brew → go → node → uv → download - Enhance error messages when brew is unavailable with platform-specific guidance - Respect existing preferBrew config; add automatic fallback for Linux without brew - Add comprehensive tests for package manager detection Closes openclaw#9420 Relates to openclaw#3987, #2478, openclaw#6654
0edc357 to
3ed4850
Compare
…nments (openclaw#17687) Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 3ed4850 Co-authored-by: mcrolly <[email protected]> Co-authored-by: sebslight <[email protected]> Reviewed-by: @sebslight
Supersedes #17661 — addresses all review feedback from @sebslight and Greptile.
Changes
Adds cross-platform skill installation support for non-Homebrew environments (Linux distros, containers, CI).
New:
src/infra/package-managers.ts/etc/os-releaseUpdated:
src/agents/skills-install.tsGo fallback (apt-get): Checks
sudo -n truebefore attemptingsudo apt-get install. If passwordless sudo is unavailable (containers, restricted environments), returns a helpful error with https://go.dev/doc/install link instead of hanging.uv fallback: Removed curl-pipe-sh auto-install entirely (security anti-pattern, PATH issues). Returns clear error message with install link when uv is missing and brew is unavailable.
Feedback addressed
Tests
Greptile Summary
Adds cross-platform skill installation fallbacks for non-Homebrew environments. Key changes: apt-get fallback for Go with passwordless sudo check, removal of insecure curl-pipe-sh auto-install for uv, improved error messages with install links, and smarter install spec selection that skips brew when unavailable.
SkillInstallSpec.kindintypes.tswas expanded with"apt" | "dnf" | "pacman" | "apk", but the frontmatter parser (frontmatter.ts:32) still rejects those kinds, and neitherbuildInstallCommandnorselectPreferredInstallSpechandle them. These new kind values are dead code that will silently fail if used.apt-get update: The new apt-get fallback for Go runssudo apt-get install -y golang-gowithout a precedingapt-get update, which will fail on fresh containers with empty package lists — the primary target environment for this fallback.src/infra/package-managers.ts(Linux distro detection, PM discovery) is not imported anywhere outside its own tests. It appears to be groundwork for future use but is currently dead code.Confidence Score: 3/5
src/agents/skills/types.ts(dead type expansion),src/agents/skills/frontmatter.ts(parser doesn't accept new kinds), andsrc/agents/skills-install.ts(missing apt-get update).Last reviewed commit: 196bec2
(5/5) You can turn off certain types of comments like style here!