openclaw/scripts/generate-ci-git-owner.mts
Peter Steinberger 6711815b75
fix(macos): recover rejected AI setup tests without discarding pending writes (#138814)
* fix(onboarding): recover rejected AI tests without releasing uncertain writes

Record finalized pre-promotion probe rejection at the activation owner and carry
it through the direct and wizard protocols. Native setup can retry known
rejections while preserving exact-owner leases for ambiguous errors, lost
replies, replacement attempts, and potentially committed settings. Keep Check
again observational and fence late UI continuations after awaited validation.

Retire stale wizard progress before terminal settlement and preserve the
persistent-effect guard through provider capability consent. No discovery,
configuration, SQLite schema, or protocol-version change is introduced.

Repair the generated CI checkout bootstrap's large-heredoc pipe deadlock found
during verification, preserving the canonical Python owner and its deadlines.

Release-note context: native macOS AI setup now recovers rejected connection
tests without treating every terminal failure as proof that settings were not
saved. Runtime plugin preparation may remain persisted.
Refs: https://github.com/openclaw/openclaw/issues/138660

* build(ci): refresh generated checkout bootstrap after main integration

* test(ios): await Watch receipt transport events

Replace the two missed main-actor polling waits with the existing buffered send event, retaining the two-second deadline and exact transfer, receipt, and ACK assertions. Covers the original-order failure in CI run 33941478427 without changing production behavior.

* fix(macos): restore explicit setup choices after pending recovery

Keep initial automatic setup distinct from observation and pending-attempt
recovery. Preserve that intent across transport blockers and actual deadline
callbacks so a legacy Gateway's generic terminal error cannot start another
automatic test of the same failed credential after the wait expires.

Retain exact receipt ownership, live verification, and admission/cancellation
fences. Restore choices with the failure visible; require explicit selection
to start another activation. Initial no-receipt setup still auto-tests.

The mounted-view deadline regression fails on the preceding commit in both
missing-model and configured-but-invalid cases (21 assertions), then passes
with all 108 signed native tests in the same isolated Mac. Six sibling cases
cover initial/prior-attempt retry, reconnect, and inspection. Update operator
docs and remove the duplicate intent/blocker setter (net -15 production LOC).

Refs: https://github.com/openclaw/openclaw/issues/138660
Refs: https://github.com/openclaw/openclaw/pull/138814

* test(macos): emit elevation helper without a heredoc pipe

Two identity-checked stack captures caught mock ditto blocked in Bash
heredoc_write before the installer entered custody. Emit the same helper
through builtin printf and the existing quoteCliArg instead of pre-filling
a pipe before its reader starts.

Independently verify all 3,842 bytes against the prior template under both
system and Homebrew Bash. Keep installer production, shell/child boundaries,
fault injection, ordering, assertions, and timeouts unchanged.

Refs: https://github.com/openclaw/openclaw/pull/138814
2026-09-05 01:55:41 -07:00

42 lines
2 KiB
TypeScript

#!/usr/bin/env node
// This dependency-free closure also runs before workspace dependencies exist.
import { readFileSync } from "node:fs";
import { fileURLToPath } from "node:url";
import { writeGeneratedOutput } from "./lib/generated-output-utils.mts";
try {
const args = process.argv.slice(2);
if (args.some((arg) => arg !== "--check")) {
throw new Error("Usage: node scripts/generate-ci-git-owner.mts [--check]");
}
const repoRoot = fileURLToPath(new URL("../", import.meta.url));
const workflowPath = ".github/workflows/ci.yml";
const workflow = readFileSync(new URL(`../${workflowPath}`, import.meta.url), "utf8");
const source = readFileSync(
new URL("../.github/actions/git-owner/owner.py", import.meta.url),
"utf8",
);
const marker =
" # Generated from .github/actions/git-owner/owner.py; do not edit here.\n";
const endMarker = " # End generated CI Git owner.\n";
const start = workflow.indexOf(marker) + marker.length;
const end = workflow.indexOf(endMarker, start);
if (workflow.split(marker).length !== 2 || end < start) {
throw new Error("Expected exactly one CI Git owner projection");
}
// Bash can block before starting the reader of a large heredoc on Darwin.
// A literal argument preserves the source without pre-filling an unread pipe.
const projection = `run_owner '${source.replaceAll("'", "'\\''")}'\n`;
const next =
workflow.slice(0, start) + projection.replace(/^(?=.)/gmu, " ") + workflow.slice(end);
const check = args.includes("--check");
const result = writeGeneratedOutput({ check, next, outputPath: workflowPath, repoRoot });
if (check && result.changed) {
throw new Error("Stale CI Git owner projection; run pnpm ci:git-owner:gen");
}
console.log(`[ci-git-owner] ${check ? "checked" : "generated"} ${workflowPath}`);
} catch (error) {
console.error(error instanceof Error ? error.message : String(error));
console.error("[ci-git-owner] FAILED (exit 1)");
process.exitCode = 1;
}