Skip to content

fix(runner): install the Linux Docker helper on macOS - #1108

Open
crispinhu27 wants to merge 2 commits into
mainfrom
fix/macos-runner-docker-helper
Open

crispinhu27 wants to merge 2 commits into
mainfrom
fix/macos-runner-docker-helper

Conversation

@crispinhu27

Copy link
Copy Markdown
Collaborator

What changed

A macOS Runner needs a Linux executable for Git credentials and MCP calls inside Docker. The missing companion could let a conversation open a workspace and then fail before the CLI resumed.

  • Install the matching Linux Runner beside the macOS executable on fresh installs and in-place upgrades.
  • Use the same artifact path for updates and sandbox provisioning. With platform updates enabled, the macOS Runner verifies the companion at startup and retries if it is missing.
  • Keep the installed companion usable during a failed download by staging the replacement before publishing it.

Scope

  • Platform core / API / runner
  • Public adapter / deployment
  • Installer / CLI

Compatibility

Existing macOS installations receive the helper when upgraded. Intel and Apple Silicon use the artifact matching their architecture.

Validation

  • Installer and Runner update regression tests under go test -race, plus go vet ./deploy ./internal/runner ./internal/runtime and python3 scripts/check-public.py.
  • Installed real macOS and Linux build artifacts from a local release endpoint. A Runner start then restored a deliberately missing companion without an SOP claim.
  • Ran SOPs and resumed conversations with a live Git credential helper in bwrap, seatbelt, and Docker on macOS and Linux, using an isolated control plane for platform execution, cloud Runner pools, and personal Runners.
  • The full local installer suite exposed existing process recognition fixture failures. The same tests failed with the main installer, and the remaining installer tests passed.

Safety

  • Passed the public-content check.
  • Used isolated fixtures for release downloads and Git credentials.

@Robert0622 Robert0622 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.

建议合并前修复下面 4 个安装和恢复问题。

我从 4148580 编译了 Darwin/amd64 和 Linux/amd64 Runner,在 Linux 主机模拟 macOS 安装,并将安装出来的 Linux helper 放进 Alpine 容器执行。正常安装时 mcp list 和测试网关的 git-credential get 均成功。相关 Go 回归通过了 -race,仅限 macOS 的守护进程启动用例在本机跳过。各条行内评论附有额外实测结果。

Comment thread deploy/bind-cli.sh
[[ ${#header} -eq 128 && "${header:0:14}" == "7f454c46020101" &&
( "${header:14:2}" == "00" || "${header:14:2}" == "03" ) &&
( "${header:32:4}" == "0200" || "${header:32:4}" == "0300" ) &&
"${header:36:4}" == "$machine" ]]

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.

[P2] 替换旧 helper 前请校验完整的发布产物。 这里仅检查前 64 字节。我先安装了可工作的 Linux Runner,再让发布端以 HTTP 200 返回同一 ELF 的前 64 字节,Content-Length 也为 64。--upgrade 退出码为 0,原来的 16,422,325 字节文件被覆盖。同一个 Alpine 容器执行 mcp list,升级前成功,升级后报 exec format error。建议在 mv 前校验发布清单中的完整摘要,或验证 ELF 的可加载段及其文件范围,并用这个截断场景断言原 helper 仍可运行。

Comment thread internal/runner/update.go
if err != nil {
return err
}
if repairOnly && validateDockerRunnerHelper(path) == nil {

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.

[P2] 启动同步失败后,后续扫描需要重试版本比对。 我预装了基线提交构建的有效 helper,让首次元数据请求返回 503,然后恢复发布端。按五分钟扫描使用的 repairOnly=true 调用时,HTTP 请求数是 0,磁盘上仍是基线版本。再走一次启动检查就成功安装了 PR 版本。主 Runner 已升级的机器会因此长期使用旧版 Git/MCP helper。可以记录本次启动是否已成功对齐远端摘要,成功前持续重试。

Comment thread internal/runner/update.go
if runtime.GOOS != "darwin" || d.cfg.DisableAutoUpdate {
return
}
updateCtx, cancel := context.WithTimeout(ctx, 30*time.Second)

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.

[P2] 给后台下载留出完整的传输时间。 这个 30 秒期限同时覆盖元数据和整个响应体,五分钟后的重试也使用同一期限。我让本地发布端以 384 KiB/s 持续发送同一个 Linux Runner:使用这里的期限在 30 秒报 context deadline exceeded,普通下载器在 41 秒完成并通过验证。缺少 helper 的机器在这种链路上每次都从头下载。建议后台沿用下载器的传输期限,把首次工作区愿意等待的时间单独限制。

Comment thread deploy/bind-cli.sh
local source="${SOURCE_DIR:-$PWD}"
# A custom host runner may have a matching helper managed by its installer.
# A per-OS download URL can replace the helper when it is the selected source.
if [[ -x "$DOCKER_RUNNER_BINARY" && -f "$DOCKER_RUNNER_BINARY" &&

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.

[P2] 保留自定义 helper 时也应识别不兼容的文件。 我把一个有执行位的 Darwin Runner 放在 Linux helper 路径,再执行 --upgrade --from。即使发布端提供了正确的 Linux 产物,安装仍以 0 退出,Linux 下载请求数为 0,原路径留下的仍是 Mach-O。自定义安装默认关闭自动更新,Docker 工作区会持续启动失败。建议只把可在目标平台运行的文件视为已就绪;如果自定义文件不能覆盖,至少应明确报错并指出需要替换的路径。

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