Skip to content

Commit ecb0386

Browse files
authored
fix(ci): own Mantis installer Git processes (#133060)
1 parent c7e48bd commit ecb0386

13 files changed

Lines changed: 442 additions & 70 deletions

‎.github/workflows/mantis-discord-status-reactions.yml‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ jobs:
126126
persist-credentials: false
127127
fetch-depth: 0
128128

129+
- name: Prepare Git owner
130+
uses: openclaw/openclaw/.github/actions/git-owner@dd4528b6393e7d00063067a080ca7241b48ce475
131+
129132
- name: Setup Node environment
130133
uses: ./.github/actions/setup-node-env
131134
with:
@@ -148,7 +151,7 @@ jobs:
148151
set -euo pipefail
149152
install_dir="${RUNNER_TEMP}/crabbox"
150153
mkdir -p "$install_dir" "$HOME/.local/bin"
151-
timeout --signal=TERM --kill-after=10s 120s git clone --depth 1 https://github.com/openclaw/crabbox.git "$install_dir/src"
154+
python3 -I -S "$CI_GIT_OWNER" --git 120 clone --depth 1 https://github.com/openclaw/crabbox.git "$install_dir/src"
152155
go build -C "$install_dir/src" -o "$HOME/.local/bin/crabbox" ./cmd/crabbox
153156
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
154157
"$HOME/.local/bin/crabbox" --version
@@ -164,8 +167,8 @@ jobs:
164167
165168
worktree_root=".artifacts/qa-e2e/mantis/discord-status-reactions-worktrees"
166169
mkdir -p "$worktree_root"
167-
git worktree add --detach "$worktree_root/baseline" "$BASELINE_SHA"
168-
git worktree add --detach "$worktree_root/candidate" "$CANDIDATE_SHA"
170+
python3 -I -S "$CI_GIT_OWNER" --checkout-git 0 worktree add --detach "$worktree_root/baseline" "$BASELINE_SHA"
171+
python3 -I -S "$CI_GIT_OWNER" --checkout-git 0 worktree add --detach "$worktree_root/candidate" "$CANDIDATE_SHA"
169172
170173
for lane in baseline candidate; do
171174
lane_dir="$worktree_root/${lane}"

‎.github/workflows/mantis-discord-thread-attachment.yml‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ jobs:
128128
persist-credentials: false
129129
fetch-depth: 0
130130

131+
- name: Prepare Git owner
132+
uses: openclaw/openclaw/.github/actions/git-owner@dd4528b6393e7d00063067a080ca7241b48ce475
133+
131134
- name: Setup Node environment
132135
uses: ./.github/actions/setup-node-env
133136
with:
@@ -150,7 +153,7 @@ jobs:
150153
set -euo pipefail
151154
install_dir="${RUNNER_TEMP}/crabbox"
152155
mkdir -p "$install_dir" "$HOME/.local/bin"
153-
timeout --signal=TERM --kill-after=10s 120s git clone --depth 1 https://github.com/openclaw/crabbox.git "$install_dir/src"
156+
python3 -I -S "$CI_GIT_OWNER" --git 120 clone --depth 1 https://github.com/openclaw/crabbox.git "$install_dir/src"
154157
go build -C "$install_dir/src" -o "$HOME/.local/bin/crabbox" ./cmd/crabbox
155158
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
156159
"$HOME/.local/bin/crabbox" --version
@@ -165,8 +168,8 @@ jobs:
165168
166169
worktree_root=".artifacts/qa-e2e/mantis/discord-thread-attachment-worktrees"
167170
mkdir -p "$worktree_root"
168-
git worktree add --detach "$worktree_root/baseline" "$CANDIDATE_SHA"
169-
git worktree add --detach "$worktree_root/candidate" "$CANDIDATE_SHA"
171+
python3 -I -S "$CI_GIT_OWNER" --checkout-git 0 worktree add --detach "$worktree_root/baseline" "$CANDIDATE_SHA"
172+
python3 -I -S "$CI_GIT_OWNER" --checkout-git 0 worktree add --detach "$worktree_root/candidate" "$CANDIDATE_SHA"
170173
171174
baseline_file="$worktree_root/baseline/extensions/discord/src/actions/handle-action.guild-admin.ts"
172175
node - "$baseline_file" <<'NODE'

‎.github/workflows/mantis-slack-desktop-smoke.yml‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ jobs:
137137
persist-credentials: false
138138
fetch-depth: 0
139139

140+
- name: Prepare Git owner
141+
uses: openclaw/openclaw/.github/actions/git-owner@dd4528b6393e7d00063067a080ca7241b48ce475
142+
140143
- name: Setup Node environment
141144
uses: ./.github/actions/setup-node-env
142145
with:
@@ -169,10 +172,13 @@ jobs:
169172
set -euo pipefail
170173
install_dir="${RUNNER_TEMP}/crabbox"
171174
mkdir -p "$install_dir" "$HOME/.local/bin"
172-
git init "$install_dir/src"
173-
git -C "$install_dir/src" remote add origin https://github.com/openclaw/crabbox.git
174-
timeout --signal=TERM --kill-after=10s 120s git -C "$install_dir/src" fetch --depth 1 origin "$CRABBOX_REF"
175-
git -C "$install_dir/src" checkout --detach FETCH_HEAD
175+
python3 -I -S "$CI_GIT_OWNER" --git 0 init "$install_dir/src"
176+
(
177+
cd "$install_dir/src"
178+
python3 -I -S "$CI_GIT_OWNER" --checkout-git 0 remote add origin https://github.com/openclaw/crabbox.git
179+
python3 -I -S "$CI_GIT_OWNER" --checkout-git 120 fetch --depth 1 origin "$CRABBOX_REF"
180+
python3 -I -S "$CI_GIT_OWNER" --checkout-git 0 checkout --detach FETCH_HEAD
181+
)
176182
go build -C "$install_dir/src" -o "$HOME/.local/bin/crabbox" ./cmd/crabbox
177183
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
178184
"$HOME/.local/bin/crabbox" --version
@@ -188,7 +194,7 @@ jobs:
188194
set -euo pipefail
189195
worktree_root=".artifacts/qa-e2e/mantis/slack-desktop-smoke-worktrees"
190196
mkdir -p "$worktree_root"
191-
git worktree add --detach "$worktree_root/candidate" "$CANDIDATE_SHA"
197+
python3 -I -S "$CI_GIT_OWNER" --checkout-git 0 worktree add --detach "$worktree_root/candidate" "$CANDIDATE_SHA"
192198
pnpm --dir "$worktree_root/candidate" install --frozen-lockfile --prefer-offline
193199
pnpm --dir "$worktree_root/candidate" build
194200

‎.github/workflows/mantis-web-ui-chat-proof.yml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ jobs:
123123
persist-credentials: false
124124
fetch-depth: 0
125125

126+
- name: Prepare Git owner
127+
uses: openclaw/openclaw/.github/actions/git-owner@dd4528b6393e7d00063067a080ca7241b48ce475
128+
126129
- name: Setup Node environment
127130
uses: ./.github/actions/setup-node-env
128131
with:
@@ -139,7 +142,7 @@ jobs:
139142
set -euo pipefail
140143
worktree_root=".artifacts/qa-e2e/mantis/web-ui-chat-proof-worktrees"
141144
mkdir -p "$worktree_root"
142-
git worktree add --detach "$worktree_root/candidate" "$CANDIDATE_SHA"
145+
python3 -I -S "$CI_GIT_OWNER" --checkout-git 0 worktree add --detach "$worktree_root/candidate" "$CANDIDATE_SHA"
143146
pnpm --dir "$worktree_root/candidate" install --frozen-lockfile --prefer-offline
144147
145148
- name: Run web UI chat proof

‎docs/ci.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ Workflow Sanity is the first external pinned typed-policy adopter: after Python
194194

195195
QA Profile Evidence is another pinned terminal adopter of `git-owner@dd4528b6393e7d00063067a080ca7241b48ce475`. Each Git-using job prepares the owner outside later checkouts using the established system Python bootstrap. Its four validation/protocol fetches retain 120-second operation deadlines; its six trusted-harness and selected-source bootstrap fetches retain no operation deadline. All ten use straight-line `--checkout-git` calls with one attempt, so ownership failure or cancellation stops before downstream checkout, readback, or publication. Called-workflow identity and selected-source trust classification remain separate and unchanged.
196196

197-
Mantis ref validation uses the same pinned owner. The shared `mantis-validate-trusted-ref` action owns one unbounded main fetch, even with both baseline and candidate refs. Discord smoke validation owns two fetch sites with 120-second deadlines: main, then the exact release branch when needed. Each fetch has one attempt and must drain before trust probes or outputs. The validators retain distinct trust policies and output contracts; a Discord release-branch mismatch never falls through to PR lookup. Mantis Crabbox clone/fetch and Git worktree-add/install callers remain pending for the next migration sub-batch.
197+
Mantis ref validation uses the same pinned owner. The shared `mantis-validate-trusted-ref` action owns one unbounded main fetch, even with both baseline and candidate refs. Discord smoke validation owns two fetch sites with 120-second deadlines: main, then the exact release branch when needed. Each fetch has one attempt and must drain before trust probes or outputs. The validators retain distinct trust policies and output contracts; a Discord release-branch mismatch never falls through to PR lookup.
198+
199+
Mantis installers and worktree preparation also use that pinned owner, prepared immediately after the harness checkout in each run job. Discord status reactions and thread attachment retain their two depth-one Crabbox clones with 120-second deadlines through `--git 120`. Slack desktop retains init, remote-add, one depth-one fetch of `main`, and detached `FETCH_HEAD` checkout; only its fetch has a 120-second deadline. All six worktree additions across status reactions, thread attachment, Slack desktop, and Web UI chat proof use `--checkout-git 0` from the harness checkout. Local init, remote-add, checkout, and worktree operations have no operation deadline. Ownership failure or cancellation is terminal before subsequent Git operations, Go/pnpm builds, probes, or outputs. No current Mantis Git invocation uses GNU `timeout`.
198200

199201
To use the standalone action from another workflow, pin `openclaw/openclaw/.github/actions/git-owner@<full-40-character-commit-SHA>` to a reviewed revision containing the action. Supply policy from the trusted workflow inline or from the same trusted action package, never from the selected candidate. Within `ci.yml`, the existing bundled-protocol and CI-routing matrix tasks smoke-test the action from the separately pinned `.ci-harness` checkout before Node setup, compare its output and copied bytes, and run owned `git --version` without network access. Other workflows' direct Git commands remain outside this ownership coverage until they adopt it.
200202

@@ -207,7 +209,7 @@ Release screenshot routing is deliberately conservative because an app change ca
207209
Separate iOS and macOS Periphery workflows enforce a zero-findings dead-code policy. Each runs only when a non-draft pull request touches its native scan scope, or when manually dispatched.
208210

209211
- **CI workflow edits** validate the Node CI graph, workflow linting, and the Windows lane (`ci.yml` executes it), but do not force iOS, Android, or macOS native builds by themselves; those platform lanes stay scoped to platform source changes.
210-
- **Git-owner changes** to its action, base-commit policy, projection generator, lifecycle tests and support, or named owner-adopting workflows such as Workflow Sanity, QA Profile Evidence, and Mantis ref validation select the existing `macos-node` and Windows lanes. These run native checkout ownership proof without selecting Swift, iOS, or Android jobs; Mac app and shared-native changes retain their existing Mac lanes.
212+
- **Git-owner changes** to its action, base-commit policy, projection generator, lifecycle tests and support, or named owner-adopting workflows such as Workflow Sanity, QA Profile Evidence, and Mantis ref validation, installer, and worktree workflows select the existing `macos-node` and Windows lanes. These run native checkout ownership proof without selecting Swift, iOS, or Android jobs; Mac app and shared-native changes retain their existing Mac lanes.
211213
- **macOS Swift runner budgets** are 20 minutes on Blacksmith and 30 minutes on every GitHub-hosted route, including first-attempt pull requests from untrusted contributors.
212214
- **Workflow Sanity** runs `actionlint`, `zizmor` over all workflow YAML files, the composite-action interpolation guard, and the conflict-marker guard. The PR-scoped `security-fast` job also runs `zizmor` over changed workflow files so workflow security findings fail early in the main CI graph.
213215
- **Docs on `main` pushes** are checked by the standalone `Docs` workflow with the same ClawHub docs mirror used by CI, so mixed code+docs pushes do not also queue the CI `check-docs` shard. Pull requests and manual CI still run `check-docs` from CI when docs changed.

‎scripts/ci-changed-scope.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const APPLE_SHARED_CONTRACT_FIXTURE_RE =
4848
const MACOS_NATIVE_RE =
4949
/^(apps\/macos\/|apps\/macos-mlx-tts\/|apps\/shared\/|apps\/swabble\/|Swabble\/)/;
5050
const GIT_OWNER_SCOPE_RE =
51-
/^(?:\.github\/(?:actions\/(?:git-owner|ensure-base-commit|mantis-validate-trusted-ref)\/|workflows\/(?:workflow-sanity|qa-profile-evidence|mantis-discord-smoke)\.yml$)|scripts\/generate-ci-git-owner\.mts$|test\/scripts\/(?:ci-(?:checkout|git-owner|linux-git|platform-checkout)\.test(?:-support)?\.ts|fixtures\/ci-platform-checkout\.mjs)$)/;
51+
/^(?:\.github\/(?:actions\/(?:git-owner|ensure-base-commit|mantis-validate-trusted-ref)\/|workflows\/(?:workflow-sanity|qa-profile-evidence|mantis-(?:discord-(?:smoke|status-reactions|thread-attachment)|slack-desktop-smoke|web-ui-chat-proof))\.yml$)|scripts\/generate-ci-git-owner\.mts$|test\/scripts\/(?:ci-(?:checkout|git-owner|linux-git|platform-checkout)\.test(?:-support)?\.ts|fixtures\/ci-platform-checkout\.mjs)$)/;
5252
const MACOS_SCRIPT_SCOPE_RE =
5353
/^(?:scripts\/(?:check-swift-tools|codesign-mac-app|create-dmg|format-swift|install-swift-tools|install-xcodegen|lint-swift|mac-elevation-host|notarize-mac-artifact|package-mac-app|package-mac-dist|restart-mac|stage-cua-driver-macos|stage-mac-node-worker)\.sh|scripts\/test-macos-native\.mts|scripts\/(?:verify-mac-node-worker(?:-fs)?|lib\/(?:mac-node-worker-proof-state|mac-worker-portability))\.mjs|scripts\/(?:materialize-mac-node-worker|lib\/(?:mac-native-inventory|mac-bundle-mutation))\.py|scripts\/lib\/(?:mac-app-bundle|plistbuddy|swift-toolchain)\.sh|test\/helpers\/mac-(?:native|signing)\.ts|test\/scripts\/(?:codesign-mac-app|create-dmg|mac-elevation-host|mac-node-worker|macos-native-test-launch|notarize-mac-artifact|package-mac-app|package-mac-dist|restart-mac|verify-mac-node-worker-fs)\.test\.ts|test\/scripts\/(?:mac-elevation-artifact|mac-native-fixtures|mac-node-worker-materialization)\.test-support\.ts)$/;
5454
const WORKSPACE_RSYNC_RECEIVER_SCOPE_RE =

‎scripts/test-projects.test-support.mts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2395,7 +2395,7 @@ const SEMANTIC_TOOLING_TARGET_PATTERNS: Array<[RegExp, string[]]> = [
23952395
],
23962396
[/^\.github\/workflows\/android-release\.yml$/u, [packageAcceptance, workflowGuards]],
23972397
[
2398-
/^\.github\/(?:actions\/(?:ensure-base-commit|git-owner|mantis-validate-trusted-ref)\/|workflows\/(?:workflow-sanity|qa-profile-evidence|mantis-discord-smoke)\.yml$)/u,
2398+
/^\.github\/(?:actions\/(?:ensure-base-commit|git-owner|mantis-validate-trusted-ref)\/|workflows\/(?:workflow-sanity|qa-profile-evidence|mantis-(?:discord-(?:smoke|status-reactions|thread-attachment)|slack-desktop-smoke|web-ui-chat-proof))\.yml$)/u,
23992399
["ci-git-owner", "ci-linux-git", "ci-platform-checkout"],
24002400
],
24012401
[/^tsconfig\.scripts\.json$/u, ["changed-lanes", "test-projects"]],

‎src/scripts/ci-changed-scope.test.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,10 @@ describe("detectChangedScope", () => {
404404
".github/workflows/qa-profile-evidence.yml",
405405
".github/actions/mantis-validate-trusted-ref/action.yml",
406406
".github/workflows/mantis-discord-smoke.yml",
407+
".github/workflows/mantis-discord-status-reactions.yml",
408+
".github/workflows/mantis-discord-thread-attachment.yml",
409+
".github/workflows/mantis-slack-desktop-smoke.yml",
410+
".github/workflows/mantis-web-ui-chat-proof.yml",
407411
".github/actions/git-owner/owner.py",
408412
".github/actions/ensure-base-commit/action.yml",
409413
".github/actions/ensure-base-commit/policy.py",

‎test/scripts/ci-git-owner.test-support.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ export async function runCiGitStep(options: {
8787
step?: string;
8888
env?: Record<string, string>;
8989
fetchResults: FetchResult[];
90+
cloneResults?: FetchResult[];
91+
worktreeResults?: FetchResult[];
9092
checkoutResults?: number[];
9193
mergeSnapshots?: { sha: string; head: string }[];
9294
prepare?: boolean;
@@ -209,6 +211,8 @@ export async function runCiGitStep(options: {
209211
mergeBase: options.mergeBase,
210212
workingDirectory: step["working-directory"],
211213
fetchResults: options.fetchResults,
214+
cloneResults: options.cloneResults,
215+
worktreeResults: options.worktreeResults,
212216
checkoutResults: options.checkoutResults,
213217
mergeSnapshots: options.mergeSnapshots,
214218
consumers: Boolean(options.prepare || externalOwner),
@@ -276,6 +280,11 @@ ${run}`;
276280
...report.commands
277281
.filter(({ tool, args }) => tool === "git" && args[0] === "fetch")
278282
.map(({ cwd }) => cwd),
283+
...report.commands
284+
.filter(
285+
({ tool, args }) => tool === "git" && (args[0] === "clone" || args[0] === "worktree"),
286+
)
287+
.map(({ cwd, args }) => path.resolve(cwd, args.at(args[0] === "clone" ? -1 : -2)!)),
279288
])) {
280289
expect(readFileSync(path.join(directory, ".git/preexisting.lock"), "utf8")).toBe(
281290
"not invocation-owned\n",
@@ -313,6 +322,12 @@ ${run}`;
313322
trustedZizmor: readOutput("temp/zizmor-base.yml"),
314323
runnerTemp: path.join(root, "temp"),
315324
fetches: report.commands.filter(({ tool, args }) => tool === "git" && args[0] === "fetch"),
325+
clones: report.commands.filter(({ tool, args }) => tool === "git" && args[0] === "clone"),
326+
worktrees: report.commands.filter(
327+
({ tool, args }) => tool === "git" && args[0] === "worktree",
328+
),
329+
go: report.commands.filter(({ tool }) => tool === "go"),
330+
crabbox: report.commands.filter(({ tool }) => tool === "crabbox"),
316331
checkouts: report.commands.filter(
317332
({ tool, args }) => tool === "git" && args[0] === "checkout",
318333
),

0 commit comments

Comments
 (0)