Skip to content

fix: make swift helper cache builds concurrent-safe#579

Merged
thymikee merged 1 commit into
mainfrom
codex/swift-cache-parallel-builds
May 21, 2026
Merged

fix: make swift helper cache builds concurrent-safe#579
thymikee merged 1 commit into
mainfrom
codex/swift-cache-parallel-builds

Conversation

@thymikee
Copy link
Copy Markdown
Member

Summary

Make Swift helper executable cache publication safe when multiple agent-device processes compile the same cache key concurrently. Helper builds now coordinate through a cache-key lock, compile into a unique temporary executable, and let losing builders reuse the completed cache entry.

Adds focused coverage for temp executable publishing and concurrent file-backed helper compiles.

Closes #570

Touched files: 2.

Validation

Verified with the focused Swift cache, recording overlay, and Swift recording-script suites; all passed. Also ran the repo quick check and formatter.

  • pnpm exec vitest run src/utils/__tests__/swift-cache.test.ts src/recording/__tests__/overlay.test.ts src/platforms/ios/__tests__/recording-scripts.test.ts
  • pnpm check:quick
  • pnpm format

Docs/skills were not updated because this is an internal cache race fix with no CLI or workflow surface change.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 21, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://callstackincubator.github.io/agent-device/pr-preview/pr-579/

Built to branch gh-pages at 2026-05-21 15:32 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@thymikee thymikee force-pushed the codex/swift-cache-parallel-builds branch from 23656b5 to 5793795 Compare May 21, 2026 15:15
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 23656b5c4f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/utils/swift-cache.ts Outdated
Comment on lines +136 to +137
if (Date.now() >= deadline) {
throw error;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Recover from stale cache locks before timing out

If a process holding this directory lock exits unexpectedly (e.g. SIGKILL, crash, machine restart), the .lock directory is never removed because cleanup only happens in ensureSwiftExecutable’s finally. Subsequent compiles for the same cache key will spin until timeoutMs and then rethrow EEXIST, effectively wedging that helper cache entry until someone manually deletes the lock directory. Please add stale-lock recovery (PID/mtime check or lock TTL) before throwing on timeout.

Useful? React with 👍 / 👎.

@thymikee thymikee force-pushed the codex/swift-cache-parallel-builds branch 3 times, most recently from 2b4a377 to 40fd2f6 Compare May 21, 2026 15:23
@thymikee thymikee force-pushed the codex/swift-cache-parallel-builds branch from 40fd2f6 to ad49824 Compare May 21, 2026 15:31
@thymikee thymikee merged commit 5b63b9b into main May 21, 2026
19 checks passed
@thymikee thymikee deleted the codex/swift-cache-parallel-builds branch May 21, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make Swift helper compile cache safe under parallel builds

1 participant