Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(release): drop the certificate prefix electron-builder rejects

vastsa7b3144cc1f04
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 47061e255..27aaab4fd 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -239,7 +239,10 @@ jobs:
env:
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
- CSC_NAME: "Developer ID Application: XingYu Liu (DUV63RKYTW)"
+ # electron-builder rejects the "Developer ID Application:" prefix on
+ # identity names and resolves the certificate itself, so CSC_NAME
+ # carries the bare common name only.
+ CSC_NAME: "XingYu Liu (DUV63RKYTW)"
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
@@ -248,7 +251,6 @@ jobs:
# Artifact names are defined in apps/desktop/package.json: the mac
# pattern labels ZIPs, and the dmg target pattern labels DMGs.
pnpm --filter @pi-desktop/desktop run dist:mac -- --${{ matrix.arch }} \
- -c.mac.identity="Developer ID Application: XingYu Liu (DUV63RKYTW)" \
-c.mac.forceCodeSigning=true \
-c.mac.notarize=true
diff --git a/apps/desktop/test/ci-workflow.test.mjs b/apps/desktop/test/ci-workflow.test.mjs
index 5259fe16d..e4b2024c2 100644
--- a/apps/desktop/test/ci-workflow.test.mjs
+++ b/apps/desktop/test/ci-workflow.test.mjs
@@ -248,15 +248,12 @@ test("macOS release signing is required on tag pushes", () => {
]) {
assert.match(signedBlock, new RegExp(`${secret}:\\s*\\$\\{\\{\\s*secrets\\.${secret}\\s*\\}\\}`));
}
- assert.match(
- signedBlock,
- /CSC_NAME: "Developer ID Application: XingYu Liu \(DUV63RKYTW\)"/,
- );
- assert.match(
- signedBlock,
- /-c\.mac\.identity="Developer ID Application: XingYu Liu \(DUV63RKYTW\)"/,
- );
- assert.match(signedBlock, /-c\.mac\.forceCodeSigning=true/);
+ // electron-builder throws InvalidConfigurationError when an identity name
+ // keeps the "Developer ID Application:" prefix, so CSC_NAME carries the bare
+ // common name and the CLI must not pass -c.mac.identity.
+ assert.match(signedBlock, /CSC_NAME: "XingYu Liu \(DUV63RKYTW\)"/);
+ assert.doesNotMatch(signedBlock, /-c\.mac\.identity=/);
+ assert.doesNotMatch(signedBlock, /CSC_NAME: "Developer ID Application:/);
assert.match(signedBlock, /-c\.mac\.notarize=true/);
assert.match(
releaseWorkflowSource,
@@ -270,6 +267,11 @@ test("the signed local macOS lane selects the native runner architecture", () =>
assert.match(releaseMacScriptSource, /must match the host/);
assert.match(releaseMacScriptSource, /electron-builder --mac "--\$\{MAC_ARCH\}"/);
assert.match(releaseMacScriptSource, /XingYu Liu \(DUV63RKYTW\)/);
+ assert.match(
+ releaseMacScriptSource,
+ /MAC_SIGNING_IDENTITY="\$\{MAC_SIGNING_IDENTITY#Developer ID Application: \}"/,
+ "the local lane strips the prefix electron-builder rejects",
+ );
assert.doesNotMatch(
releaseMacScriptSource,
/-c\.(?:dmg|zip)\.artifactName/,
diff --git a/apps/desktop/test/macos-release-verification.test.mjs b/apps/desktop/test/macos-release-verification.test.mjs
index 14f7bfe6e..6fe68da31 100644
--- a/apps/desktop/test/macos-release-verification.test.mjs
+++ b/apps/desktop/test/macos-release-verification.test.mjs
@@ -15,6 +15,7 @@ const stapleScript = new URL(
);
const SIGNING_IDENTITY = "Developer ID Application: XingYu Liu (DUV63RKYTW)";
+const SIGNING_IDENTITY_NAME = "XingYu Liu (DUV63RKYTW)";
async function writeSignedAppFixture(release) {
const app = join(release, "mac-arm64", "PI-Desktop.app");
@@ -80,10 +81,13 @@ test("macOS release verification requires a notarized Developer ID app and DMG",
["codesign", "spctl", "xcrun"].map((name) => chmod(join(bin, name), 0o755)),
);
+ // The local lane passes the bare common name; the script must still match the
+ // prefixed Authority line codesign prints.
const result = spawnSync("bash", [verifyScript.pathname, release], {
encoding: "utf8",
env: {
...process.env,
+ MAC_SIGNING_IDENTITY: SIGNING_IDENTITY_NAME,
PATH: `${bin}:${process.env.PATH}`,
STAPLER_LOG: staplerLog,
},
@@ -128,3 +132,70 @@ test("macOS release verification rejects a Developer ID app without notarization
assert.equal(result.status, 1);
assert.match(result.stderr, /did not recognize .* as notarized/);
});
+
+test("macOS release verification accepts the prefixed identity form", async (t) => {
+ const root = await mkdtemp(join(tmpdir(), "pi-desktop-macos-prefixed-"));
+ t.after(() => rm(root, { recursive: true, force: true }));
+
+ const release = join(root, "release");
+ const bin = join(root, "bin");
+ await writeSignedAppFixture(release);
+ await mkdir(bin, { recursive: true });
+ await writeFile(
+ join(bin, "codesign"),
+ `#!/usr/bin/env bash\nif [[ "$*" == *"-dv"* ]]; then echo 'Authority=${SIGNING_IDENTITY}' >&2; echo 'flags=0x10000(runtime)' >&2; fi\n`,
+ );
+ await writeFile(
+ join(bin, "spctl"),
+ "#!/usr/bin/env bash\necho 'source=Notarized Developer ID' >&2\n",
+ );
+ await writeFile(join(bin, "xcrun"), "#!/usr/bin/env bash\nexit 0\n");
+ await Promise.all(
+ ["codesign", "spctl", "xcrun"].map((name) => chmod(join(bin, name), 0o755)),
+ );
+
+ const result = spawnSync("bash", [verifyScript.pathname, release], {
+ encoding: "utf8",
+ env: {
+ ...process.env,
+ MAC_SIGNING_IDENTITY: SIGNING_IDENTITY,
+ PATH: `${bin}:${process.env.PATH}`,
+ },
+ });
+
+ assert.equal(result.status, 0, `${result.stdout}\n${result.stderr}`);
+});
+
+test("macOS release verification rejects a different signing identity", async (t) => {
+ const root = await mkdtemp(join(tmpdir(), "pi-desktop-macos-wrong-id-"));
+ t.after(() => rm(root, { recursive: true, force: true }));
+
+ const release = join(root, "release");
+ const bin = join(root, "bin");
+ await writeSignedAppFixture(release);
+ await mkdir(bin, { recursive: true });
+ await writeFile(
+ join(bin, "codesign"),
+ "#!/usr/bin/env bash\nif [[ \"$*\" == *\"-dv\"* ]]; then echo 'Authority=Developer ID Application: Someone Else (ZZZZZZZZZZ)' >&2; fi\n",
+ );
+ await writeFile(
+ join(bin, "spctl"),
+ "#!/usr/bin/env bash\necho 'source=Notarized Developer ID' >&2\n",
+ );
+ await writeFile(join(bin, "xcrun"), "#!/usr/bin/env bash\nexit 0\n");
+ await Promise.all(
+ ["codesign", "spctl", "xcrun"].map((name) => chmod(join(bin, name), 0o755)),
+ );
+
+ const result = spawnSync("bash", [verifyScript.pathname, release], {
+ encoding: "utf8",
+ env: {
+ ...process.env,
+ MAC_SIGNING_IDENTITY: SIGNING_IDENTITY_NAME,
+ PATH: `${bin}:${process.env.PATH}`,
+ },
+ });
+
+ assert.equal(result.status, 1);
+ assert.match(result.stderr, /is not signed with/);
+});
diff --git a/docs/adr/0289-signed-macos-github-releases.md b/docs/adr/0289-signed-macos-github-releases.md
index 2ec07ae4d..af86b0dba 100644
--- a/docs/adr/0289-signed-macos-github-releases.md
+++ b/docs/adr/0289-signed-macos-github-releases.md
@@ -27,9 +27,12 @@ for the official `vastsa/PI-Desktop` release lane.
staples the DMG, and verifies the app as `Notarized Developer ID` before
upload. Missing signing or notarization secrets fail the job; unsigned
macOS artifacts must not be published from a tag.
-2. The signing identity is
- `Developer ID Application: XingYu Liu (DUV63RKYTW)`. CI pins it with
- `CSC_NAME` and `-c.mac.identity`. The Apple team id is `DUV63RKYTW`.
+2. The signing certificate is
+ `Developer ID Application: XingYu Liu (DUV63RKYTW)`; Apple team id
+ `DUV63RKYTW`. CI pins it with `CSC_NAME=XingYu Liu (DUV63RKYTW)`. The name
+ must be the bare common name: electron-builder 26 rejects an identity that
+ keeps the `Developer ID Application:` prefix, and the verification step
+ re-adds that prefix when it compares the `codesign` authority.
3. Certificate material stays in GitHub Actions secrets:
`CSC_LINK` (p12, file path or base64), `CSC_KEY_PASSWORD`, `APPLE_ID`,
`APPLE_APP_SPECIFIC_PASSWORD`, and `APPLE_TEAM_ID`. Nothing of that set is
diff --git a/docs/spec/06-delivery/06-release-runbook.md b/docs/spec/06-delivery/06-release-runbook.md
index 602590e97..3a00a1df3 100644
--- a/docs/spec/06-delivery/06-release-runbook.md
+++ b/docs/spec/06-delivery/06-release-runbook.md
@@ -46,10 +46,12 @@ when macOS `iconutil` is available, without overwriting the canonical source.
## 2. Prerequisites (release lane)
1. Apple Developer account with a **Developer ID Application** certificate in
- the login keychain. Official identity:
+ the login keychain. Official certificate:
`Developer ID Application: XingYu Liu (DUV63RKYTW)` (Team ID `DUV63RKYTW`).
2. Environment variables for the local signed lane:
- - `MAC_SIGNING_IDENTITY` — defaults to the official identity above
+ - `MAC_SIGNING_IDENTITY` — bare common name `XingYu Liu (DUV63RKYTW)`;
+ electron-builder rejects a name that keeps the
+ `Developer ID Application:` prefix, so the script strips it
- `APPLE_ID`, `APPLE_APP_SPECIFIC_PASSWORD`, `APPLE_TEAM_ID` — required for
notarization (`APPLE_TEAM_ID` must be `DUV63RKYTW`)
3. Rust toolchain and pnpm workspace installed. The Rust toolchain must run on
@@ -182,7 +184,7 @@ Pre-tag checklist:
### 4.2 Build / package
```bash
-export MAC_SIGNING_IDENTITY="Developer ID Application: ... (TEAMID)"
+export MAC_SIGNING_IDENTITY="XingYu Liu (DUV63RKYTW)"
export APPLE_ID=...
export APPLE_APP_SPECIFIC_PASSWORD=...
export APPLE_TEAM_ID=...
@@ -224,8 +226,9 @@ Each job verifies `uname -m`, passes the matching `--arm64` or `--x64` flag to
electron-builder, and builds `pi-desktop-host-core` on that same native
runner. Tag builds and `sign_macos: true` (the dispatch default) receive
`CSC_LINK`, `CSC_KEY_PASSWORD`, `APPLE_ID`, `APPLE_APP_SPECIFIC_PASSWORD`, and
-`APPLE_TEAM_ID` only from GitHub Actions secrets, pin identity
-`Developer ID Application: XingYu Liu (DUV63RKYTW)`, force code signing and
+`APPLE_TEAM_ID` only from GitHub Actions secrets, pin the certificate through
+`CSC_NAME=XingYu Liu (DUV63RKYTW)` (bare common name — electron-builder rejects
+the `Developer ID Application:` prefix), force code signing and
`notarytool` notarization, verify that identity, code-signing integrity
(including `pi-desktop-host-core`), Gatekeeper `Notarized Developer ID`, and
the stapled app ticket, and staple and validate the DMG before any artifact
diff --git a/docs/zh-CN/spec/06-delivery/06-release-runbook.md b/docs/zh-CN/spec/06-delivery/06-release-runbook.md
index e54d7fa68..f15c58c26 100644
--- a/docs/zh-CN/spec/06-delivery/06-release-runbook.md
+++ b/docs/zh-CN/spec/06-delivery/06-release-runbook.md
@@ -43,11 +43,10 @@ Windows 可执行文件和原生窗口图标中使用 `build/icon.ico`。渲染
## 2. 先决条件(发布通道)
-1. Apple 开发者帐户,具有 **开发者 ID 应用程序** 证书
- 登录钥匙串。
-2、环境变量:
- - `MAC_SIGNING_IDENTITY` — 例如`Developer ID Application: <Name> (<TEAMID>)`
- - `APPLE_ID`、`APPLE_APP_SPECIFIC_PASSWORD`、`APPLE_TEAM_ID` — 公证所必需。
+1. Apple 开发者帐户,登录钥匙串中具有 **Developer ID Application** 证书。正式证书为 `Developer ID Application: XingYu Liu (DUV63RKYTW)`(Team ID `DUV63RKYTW`)。
+2. 本地签名通道的环境变量:
+ - `MAC_SIGNING_IDENTITY` — 裸通用名 `XingYu Liu (DUV63RKYTW)`;electron-builder 拒绝保留 `Developer ID Application:` 前缀的名称,脚本会自动去掉该前缀
+ - `APPLE_ID`、`APPLE_APP_SPECIFIC_PASSWORD`、`APPLE_TEAM_ID` — 公证所必需(`APPLE_TEAM_ID` 必须为 `DUV63RKYTW`)
3. 安装 Rust 工具链和 pnpm 工作区。Rust 必须在 macOS 本机运行器上运行:
Apple Silicon 使用 arm64,Intel 使用 x86_64。
@@ -159,7 +158,7 @@ Windows 可执行文件和原生窗口图标中使用 `build/icon.ico`。渲染
### 4.2 构建/打包
```bash
-export MAC_SIGNING_IDENTITY="Developer ID Application: ... (TEAMID)"
+export MAC_SIGNING_IDENTITY="XingYu Liu (DUV63RKYTW)"
export APPLE_ID=...
export APPLE_APP_SPECIFIC_PASSWORD=...
export APPLE_TEAM_ID=...
@@ -225,7 +224,7 @@ xattr -r -d com.apple.quarantine /Applications/PI-Desktop.app
该助手仅适用于可信来源的未签名工件在 macOS 上提示应用已损坏的场景;已签名并公证
的版本无需执行它。
-标签构建和 `sign_macos: true`(手动运行的默认值)仅从 GitHub Actions 密钥接收 `CSC_LINK`、`CSC_KEY_PASSWORD`、`APPLE_ID`、`APPLE_APP_SPECIFIC_PASSWORD` 和 `APPLE_TEAM_ID`,固定身份 `Developer ID Application: XingYu Liu (DUV63RKYTW)`,强制代码签名与 `notarytool` 公证,然后验证该身份、代码签名完整性(含 `pi-desktop-host-core`)、Gatekeeper `Notarized Developer ID` 以及已装订的应用票据。生成的 DMG 也会在任何工件上传前显式装订并验证。
+标签构建和 `sign_macos: true`(手动运行的默认值)仅从 GitHub Actions 密钥接收 `CSC_LINK`、`CSC_KEY_PASSWORD`、`APPLE_ID`、`APPLE_APP_SPECIFIC_PASSWORD` 和 `APPLE_TEAM_ID`,通过 `CSC_NAME=XingYu Liu (DUV63RKYTW)`(裸通用名——electron-builder 拒绝 `Developer ID Application:` 前缀)固定证书,强制代码签名与 `notarytool` 公证,然后验证该身份、代码签名完整性(含 `pi-desktop-host-core`)、Gatekeeper `Notarized Developer ID` 以及已装订的应用票据。生成的 DMG 也会在任何工件上传前显式装订并验证。
DMG、ZIP、NSIS、AppImage、deb、rpm、块图和更新程序提要输出已
压缩或压缩不敏感。因此,工作流程会上传它们的
diff --git a/scripts/release-macos.sh b/scripts/release-macos.sh
index 19951e45b..9d5bd2f1d 100755
--- a/scripts/release-macos.sh
+++ b/scripts/release-macos.sh
@@ -4,7 +4,9 @@
# Local builds without a certificate remain unsigned. This script injects a
# real signing identity and requires notarization credentials:
#
-# MAC_SIGNING_IDENTITY default: "Developer ID Application: XingYu Liu (DUV63RKYTW)"
+# MAC_SIGNING_IDENTITY default: "XingYu Liu (DUV63RKYTW)" — bare common
+# name; electron-builder rejects the
+# "Developer ID Application:" prefix
# APPLE_ID Apple ID email for notarization
# APPLE_APP_SPECIFIC_PASSWORD app-specific password for the Apple ID
# APPLE_TEAM_ID Apple Developer Team ID (must be DUV63RKYTW)
@@ -44,7 +46,8 @@ if [[ "$MAC_ARCH" != "$DEFAULT_MAC_ARCH" ]]; then
exit 1
fi
-MAC_SIGNING_IDENTITY="${MAC_SIGNING_IDENTITY:-Developer ID Application: XingYu Liu (DUV63RKYTW)}"
+MAC_SIGNING_IDENTITY="${MAC_SIGNING_IDENTITY:-XingYu Liu (DUV63RKYTW)}"
+MAC_SIGNING_IDENTITY="${MAC_SIGNING_IDENTITY#Developer ID Application: }"
APPLE_TEAM_ID="${APPLE_TEAM_ID:-DUV63RKYTW}"
if [[ -z "${APPLE_ID:-}" || -z "${APPLE_APP_SPECIFIC_PASSWORD:-}" ]]; then
diff --git a/scripts/verify-macos-release.sh b/scripts/verify-macos-release.sh
index b99f88760..a99b388ff 100755
--- a/scripts/verify-macos-release.sh
+++ b/scripts/verify-macos-release.sh
@@ -6,7 +6,11 @@ set -euo pipefail
RELEASE_DIR="${1:-apps/desktop/release}"
PRODUCT_NAME="PI-Desktop"
-EXPECTED_IDENTITY="${MAC_SIGNING_IDENTITY:-Developer ID Application: XingYu Liu (DUV63RKYTW)}"
+# Accepts either the bare common name ("XingYu Liu (DUV63RKYTW)") or the full
+# certificate label ("Developer ID Application: XingYu Liu (DUV63RKYTW)").
+IDENTITY_NAME="${MAC_SIGNING_IDENTITY:-XingYu Liu (DUV63RKYTW)}"
+IDENTITY_NAME="${IDENTITY_NAME#Developer ID Application: }"
+EXPECTED_IDENTITY="Developer ID Application: ${IDENTITY_NAME}"
if [[ ! -d "$RELEASE_DIR" ]]; then
echo "error: release directory does not exist: $RELEASE_DIR" >&2