Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

ci: run processtree tests on macOS for PRs that touch it (MUL-9168) (#10509)

Jiayuan Zhang250ecacf4ab1
diff --git a/.github/ci-paths.json b/.github/ci-paths.json
index 2fa6a63558..f3f220ea1f 100644
--- a/.github/ci-paths.json
+++ b/.github/ci-paths.json
@@ -56,6 +56,13 @@
"scripts/ci-scope.mjs",
"scripts/ci-scope.test.mjs"
],
+ "processtree": [
+ "server/internal/daemon/processtree/**",
+ ".github/workflows/ci.yml",
+ ".github/ci-paths.json",
+ "scripts/ci-scope.mjs",
+ "scripts/ci-scope.test.mjs"
+ ],
"quality": [
".github/actions/frontend-quality/**",
"apps/**",
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 9017d815b3..fc42cd119c 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -26,6 +26,7 @@ jobs:
backend: ${{ steps.decide.outputs.backend }}
sqlc: ${{ steps.decide.outputs.sqlc }}
runtime: ${{ steps.decide.outputs.runtime }}
+ processtree: ${{ steps.decide.outputs.processtree }}
quality_only: ${{ steps.decide.outputs.quality_only }}
scripts: ${{ steps.decide.outputs.scripts }}
installer: ${{ steps.decide.outputs.installer }}
@@ -509,7 +510,7 @@ jobs:
# Preserve the existing required-check name while allowing tests, generated
# SQL verification, and the vulnerability scan to run independently.
backend:
- needs: [changes, backend-tests, backend-agent-tests, sqlc-check, go-vulnerability-scan, macos-runtime, windows-execenv, script-checks, installer]
+ needs: [changes, backend-tests, backend-agent-tests, sqlc-check, go-vulnerability-scan, macos-runtime, macos-processtree, windows-execenv, script-checks, installer]
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
steps:
@@ -517,7 +518,7 @@ jobs:
- name: Check backend job results
env:
NEEDS_JSON: ${{ toJSON(needs) }}
- JOB_SCOPES: '{"backend-tests":"backend","backend-agent-tests":"backend","sqlc-check":"sqlc","go-vulnerability-scan":"backend","macos-runtime":"full","windows-execenv":"runtime","script-checks":"scripts","installer":"installer"}'
+ JOB_SCOPES: '{"backend-tests":"backend","backend-agent-tests":"backend","sqlc-check":"sqlc","go-vulnerability-scan":"backend","macos-runtime":"full","macos-processtree":"processtree","windows-execenv":"runtime","script-checks":"scripts","installer":"installer"}'
run: node scripts/ci-scope.mjs gate
windows-execenv:
@@ -796,7 +797,7 @@ jobs:
# backend job still covers the untagged and Unix arms.
run: go test -race ./pkg/agent -v -run 'TestCursorBackground|TestCaptureCursorBackground' -count=1 -timeout=5m
- # The only macOS runner here, and the only place cursor_background_process_darwin.go
+ # The daily macOS runtime runner, and the only place cursor_background_process_darwin.go
# is ever built: it signals a process group through XNU's per-process unique
# identity so a recycled PID cannot redirect a kill, and the two tests pinning
# that are `//go:build darwin`. Windows keeps its arm as a step in
@@ -837,6 +838,31 @@ jobs:
working-directory: server
run: CGO_ENABLED=0 go test ./pkg/agent -run '^TestCaptureCursorBackground(KernelRejectsStaleIdentity|DetachedSession|LateDescendant)$' -count=1
+ # MUL-9162: Darwin's kill(-pgid) skips group members that are exiting or
+ # zombies and returns EPERM instead of ESRCH while the group drains, so
+ # processtree treats that EPERM as "nothing left to signal". The branch is
+ # gated on runtime.GOOS, so the ubuntu backend job passes the same tests
+ # without ever reaching it; only a macOS host proves the handling is still
+ # there. Scoped to the package itself (stdlib-only, ~10s at -count=3) so a
+ # macOS runner is charged only to PRs that touch it, plus every full run.
+ # -count=3 because the test lands in the drain window only a few times per
+ # thousand iterations.
+ macos-processtree:
+ needs: changes
+ if: ${{ needs.changes.outputs.processtree == 'true' }}
+ runs-on: macos-latest
+ steps:
+ - uses: actions/checkout@v6
+ - uses: actions/setup-go@v5
+ with:
+ go-version: "~1.27.4"
+ check-latest: true
+ cache-dependency-path: server/go.sum
+ - name: Test macOS process-group drain handling
+ shell: bash
+ working-directory: server
+ run: go test ./internal/daemon/processtree/ -v -count=3 -timeout=5m
+
image-budget:
# Soft gate against the 21.7MB of raw PNG/JPG that MUL-6352 cleared out:
# a bitmap added or grown past 300KB fails until the PR description says
diff --git a/scripts/ci-scope.test.mjs b/scripts/ci-scope.test.mjs
index c54f3e330a..ea7fe2f998 100644
--- a/scripts/ci-scope.test.mjs
+++ b/scripts/ci-scope.test.mjs
@@ -23,6 +23,8 @@ for (const [name, files, selected] of [
["migration only", ["server/migrations/999_example.up.sql"], ["backend", "sqlc"]],
["agent process code", ["server/pkg/agent/cursor_background.go"], ["backend", "runtime"]],
["daemon dependency", ["server/internal/skill/service.go"], ["backend", "runtime"]],
+ ["process-group control", ["server/internal/daemon/processtree/controller_unix.go"], ["backend", "runtime", "processtree"]],
+ ["process-group caller", ["server/internal/daemon/gc.go"], ["backend", "runtime"]],
["native test compilation dependency", ["server/pkg/db/generated/issues.sql.go"], ["backend", "sqlc", "runtime"]],
["Go dependencies", ["server/go.mod", "server/go.sum"], ["backend", "runtime"]],
["Helm only", ["deploy/helm/multica/templates/deployment.yaml"], ["scripts"]],