From b037475c14505e463debb195dfb6a66a4f4a0174 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 16 Mar 2026 23:30:20 +0800 Subject: [PATCH] feat(build): enhance macOS application signing process - Updated the Makefile and GitHub workflows to include entitlements during the codesigning process for macOS applications, improving security and compliance. - Added timestamp and runtime options to the codesigning commands, ensuring better handling of application signatures. - Refactored the signing logic to maintain consistency across different build targets, enhancing the overall release process. --- .github/codesign/entitlements.plist | 10 ++++++++++ .github/workflows/release-macos.yml | 4 +++- Makefile | 16 ++++++++++++---- agent/sandbox/v2/claude/parse.go | 17 +++++++++++++++++ 4 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 .github/codesign/entitlements.plist diff --git a/.github/codesign/entitlements.plist b/.github/codesign/entitlements.plist new file mode 100644 index 00000000..f00fbb59 --- /dev/null +++ b/.github/codesign/entitlements.plist @@ -0,0 +1,10 @@ + + + + + com.apple.security.cs.allow-jit + + com.apple.security.cs.allow-unsigned-executable-memory + + + diff --git a/.github/workflows/release-macos.yml b/.github/workflows/release-macos.yml index 68e07d51..a6846134 100644 --- a/.github/workflows/release-macos.yml +++ b/.github/workflows/release-macos.yml @@ -156,7 +156,9 @@ jobs: for ARCH in arm64 amd64; do for SUFFIX in "" "-prod"; do BIN="dist/release/yao-${VERSION}-darwin-${ARCH}${SUFFIX}" - codesign --force --verbose --timestamp --options runtime --sign "$IDENTITY" "$BIN" + codesign --force --verbose --timestamp --options runtime \ + --entitlements .github/codesign/entitlements.plist \ + --sign "$IDENTITY" "$BIN" codesign --verify --deep --strict --verbose=2 "$BIN" done done diff --git a/Makefile b/Makefile index d43a480e..ffd4ed97 100644 --- a/Makefile +++ b/Makefile @@ -739,7 +739,9 @@ release: prepare # MacOS Application Signing @if [ "$(OS)" = "Darwin" ]; then \ - codesign --deep --force --verify --verbose --sign "${APPLE_SIGN}" dist/release/yao ; \ + codesign --deep --force --verbose --timestamp --options runtime \ + --entitlements .github/codesign/entitlements.plist \ + --sign "${APPLE_SIGN}" dist/release/yao ; \ fi # make prod (production build only, ~111M on macOS) @@ -779,7 +781,9 @@ prod: prepare # MacOS Application Signing @if [ "$(OS)" = "Darwin" ]; then \ - codesign --deep --force --verify --verbose --sign "${APPLE_SIGN}" dist/release/yao-prod ; \ + codesign --deep --force --verbose --timestamp --options runtime \ + --entitlements .github/codesign/entitlements.plist \ + --sign "${APPLE_SIGN}" dist/release/yao-prod ; \ fi @echo "" @@ -829,8 +833,12 @@ release-all: prepare # MacOS Application Signing @if [ "$(OS)" = "Darwin" ]; then \ - codesign --deep --force --verify --verbose --sign "${APPLE_SIGN}" dist/release/yao ; \ - codesign --deep --force --verify --verbose --sign "${APPLE_SIGN}" dist/release/yao-prod ; \ + codesign --deep --force --verbose --timestamp --options runtime \ + --entitlements .github/codesign/entitlements.plist \ + --sign "${APPLE_SIGN}" dist/release/yao ; \ + codesign --deep --force --verbose --timestamp --options runtime \ + --entitlements .github/codesign/entitlements.plist \ + --sign "${APPLE_SIGN}" dist/release/yao-prod ; \ fi @echo "" diff --git a/agent/sandbox/v2/claude/parse.go b/agent/sandbox/v2/claude/parse.go index af8c2a6c..e2dfa3fb 100644 --- a/agent/sandbox/v2/claude/parse.go +++ b/agent/sandbox/v2/claude/parse.go @@ -244,6 +244,23 @@ func parseStreamJSON(_ context.Context, stdout io.ReadCloser, handler message.St } } } + + // Close any open message from the streaming phase. + // stream_event text_deltas set messageStarted=true but + // nothing resets it when the turn ends — the assistant + // message marks the turn boundary, so we must close + // the message here to keep state in sync with the + // stream handler (which already sent message_end). + if handler != nil { + if toolBlockActive { + handler(message.ChunkMessageEnd, nil) + toolBlockActive = false + } + if messageStarted { + handler(message.ChunkMessageEnd, nil) + messageStarted = false + } + } } }