Skip to content

Commit 5d86362

Browse files
authored
Pi 0.81 lockstep Node rewrite (#3)
* docs: approve Pi 0.81 lockstep rewrite design * docs: plan Pi 0.81 lockstep rewrite * feat: rewrite for Pi 0.81 lockstep runtime * fix: use valid OpenRouter Actions secret * fix: pin agentic workflow cost accounting * fix: separate GitHub App client and numeric IDs * fix: satisfy release workflow shellcheck * fix: keep workflow lint portable without Docker * fix: route OpenCode review through Z.AI proxy * fix: budget OpenCode review tool turns * fix: serialize generated workflow validation * fix: run workflow gates portably on Windows * fix: skip Docker-only gh-aw lint on Windows * fix: allow full bounded GLM runtime review * fix: finish full bounded GLM review * fix: submit bounded GLM review promptly
1 parent 02b0f3b commit 5d86362

90 files changed

Lines changed: 6744 additions & 1869 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,5 @@
3131
*.gz binary
3232
*.tgz binary
3333
*.lockb binary
34+
35+
.github/workflows/*.lock.yml linguist-generated=true merge=ours

.github/aw/actions-lock.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"entries": {
3+
"github/gh-aw-actions/setup-cli@v0.82.14": {
4+
"repo": "github/gh-aw-actions/setup-cli",
5+
"version": "v0.82.14",
6+
"sha": "b6d1443e05b8716267fa19425b99aa4f12006b4a"
7+
},
8+
"github/gh-aw-actions/setup@v0.82.14": {
9+
"repo": "github/gh-aw-actions/setup",
10+
"version": "v0.82.14",
11+
"sha": "b6d1443e05b8716267fa19425b99aa4f12006b4a"
12+
}
13+
}
14+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { readFile, writeFile } from "node:fs/promises";
2+
3+
const workflows = new URL("../workflows/", import.meta.url);
4+
5+
async function patchCopilotByokOutput() {
6+
const path = new URL("pi-upstream-lockstep.lock.yml", workflows);
7+
const source = await readFile(path, "utf8");
8+
const activation = source.match(/jobs:\n activation:[\s\S]*?\n agent:/)?.[0];
9+
if (!activation) throw new Error("gh-aw activation job not found");
10+
if (activation.includes("secret_verification_result:")) return;
11+
const marker =
12+
" stale_lock_file_failed: ${{ steps.check-lock-file.outputs.stale_lock_file_failed == 'true' }}";
13+
if (!activation.includes(marker)) throw new Error("gh-aw output marker not found");
14+
const note = "# v0.82.14 BYOK compiler workaround; remove after upstream fixes conclusion guards.";
15+
await writeFile(
16+
path,
17+
source.replace(marker, `${marker}\n ${note}\n secret_verification_result: ""`),
18+
);
19+
}
20+
21+
async function patchOpenCodeProvider() {
22+
const path = new URL("pi-runtime-review.lock.yml", workflows);
23+
const source = await readFile(path, "utf8");
24+
const markers = [
25+
['"autoupdate": false,', '"autoupdate": false,\n "model": "awf-proxy/glm-5.2",'],
26+
['"api": "http://172.30.0.30:10002"', '"api": "http://172.30.0.30:10000"'],
27+
['"apiKey": "awf-copilot-proxy"', '"apiKey": "awf-openai-proxy"'],
28+
['"claude-sonnet-4.5": {}', '"glm-5.2": {}'],
29+
];
30+
let patched = source;
31+
for (const [oldValue, newValue] of markers) {
32+
if (!patched.includes(oldValue) && !patched.includes(newValue)) {
33+
throw new Error(`gh-aw OpenCode marker not found: ${oldValue}`);
34+
}
35+
if (!patched.includes(newValue)) patched = patched.replaceAll(oldValue, newValue);
36+
}
37+
await writeFile(path, patched);
38+
}
39+
40+
async function patchMaintenanceChoice() {
41+
const path = new URL("agentics-maintenance.yml", workflows);
42+
const source = await readFile(path, "utf8");
43+
if (source.includes(" default: 'none'\n options:\n - 'none'")) return;
44+
const patched = source.replace(" default: ''\n options:\n - ''", " default: 'none'\n options:\n - 'none'");
45+
if (patched === source) throw new Error("gh-aw maintenance choice marker not found");
46+
await writeFile(path, patched);
47+
}
48+
49+
await patchCopilotByokOutput();
50+
await patchOpenCodeProvider();
51+
await patchMaintenanceChoice();
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { spawnSync } from "node:child_process";
2+
import { readdir } from "node:fs/promises";
3+
import { resolve } from "node:path";
4+
5+
const root = resolve(import.meta.dirname, "../..");
6+
const generated = [
7+
".github/workflows/pi-runtime-review.lock.yml",
8+
".github/workflows/pi-upstream-lockstep.lock.yml",
9+
".github/workflows/agentics-maintenance.yml",
10+
];
11+
12+
function result(command, args, stdio = "inherit") {
13+
return spawnSync(command, args, { cwd: root, stdio, env: process.env });
14+
}
15+
16+
function run(command, args) {
17+
const child = result(command, args);
18+
if (child.error) throw child.error;
19+
if (child.status !== 0) process.exit(child.status ?? 1);
20+
}
21+
22+
function canRun(command, args) {
23+
const child = result(command, args, "ignore");
24+
return !child.error && child.status === 0;
25+
}
26+
27+
async function conventionalWorkflows() {
28+
const directory = resolve(root, ".github/workflows");
29+
const files = await readdir(directory);
30+
return files
31+
.filter((file) => file.endsWith(".yml") && !file.endsWith(".lock.yml"))
32+
.map((file) => `.github/workflows/${file}`);
33+
}
34+
35+
function verifyGeneratedFiles() {
36+
if (canRun("git", ["diff", "--quiet", "--", ...generated])) return;
37+
console.error("Compiled gh-aw workflows are stale. Run mise run workflows and commit them.");
38+
run("git", ["diff", "--stat", "--", ...generated]);
39+
process.exit(1);
40+
}
41+
42+
run("gh-aw", ["compile", "--strict"]);
43+
run(process.execPath, [".github/scripts/patch-gh-aw-lock.mjs"]);
44+
if (process.platform !== "win32" && canRun("docker", ["info"])) run("gh-aw", ["lint"]);
45+
else console.log("Docker unavailable; strict gh-aw compile completed (generated lint runs on Docker-capable matrix jobs).");
46+
run("actionlint", await conventionalWorkflows());
47+
run("bun", ["test", "tests/workflows"]);
48+
verifyGeneratedFiles();

0 commit comments

Comments
 (0)