Skip to content

Fix async hooks for Codex - #14

Merged
gpambrozio merged 6 commits into
mainfrom
luke/fix-async-hooks-for-codex
May 28, 2026
Merged

Fix async hooks for Codex#14
gpambrozio merged 6 commits into
mainfrom
luke/fix-async-hooks-for-codex

Conversation

@lukelabonte

@lukelabonte lukelabonte commented May 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Replace plugin common symlinks with generated self-contained copies and add the sync helper. Installed plugin packages are cached and loaded independently of this repository checkout, so package contents cannot rely on symlinks that point back to root-level shared files. The sync helper keeps those committed copies in lockstep with root common/ while preserving a self-contained install.
  • Keep XcodeBuildTools background SessionStart hooks compatible with hosts that do not support async hooks while preserving sandbox ownership across /clear
  • Migrate legacy Claude command prompts to skills and update affected plugin release metadata

Copy shared common helpers into each plugin package so installed hooks do not depend on repo-local symlinks. Route XcodeBuildTools background hook work through a command wrapper instead of host-level async metadata, and add sync/check coverage.
- Replace legacy command prompts with SKILL.md files
- Register migrated skills and bump plugin release metadata
- Update docs and integrity checks for the skill-based plugin surface
- Preserve the host hook owner PID for backgrounded sandbox setup
- Release self-contained common helper copies for affected plugins
from pathlib import Path


GENERATED_MESSAGE = (

@lukelabonte lukelabonte May 26, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

These generated headers are intentional. Installed plugin packages need to be self-contained, so the copied common helpers are committed with a clear source pointer and scripts/sync-plugin-common.py --check verifies they stay in sync with root common.


plugin_root="${CLAUDE_PLUGIN_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}"
target="$plugin_root/$relative_target"
hook_owner_pid="${CLAUDE_HOOK_OWNER_PID:-$PPID}"

@lukelabonte lukelabonte May 26, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This captures the hook runner parent before the helper is backgrounded. The sandbox setup uses this as the long-lived session owner; using the background child’s $PPID would point at this wrapper and make /clear inheritance lose the prior sandbox once the wrapper exits.

{
"name": "MarvinOutputStyle",
"version": "1.3.2",
"version": "1.3.3",

@lukelabonte lukelabonte May 26, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

MarvinOutputStyle, iOSSimulator, and PluginBase get patch bumps because their package contents changed from symlinked common directories to generated committed copies. SwiftScaffolding and XcodeBuildTools already had branch-local bumps, so the common-copy note is folded into those existing release entries instead of bumping them twice.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the plugin marketplace packages to be self-contained (no repo-root symlinks), keeps XcodeBuildTools SessionStart helpers compatible with hosts that don’t support async hooks (e.g., Codex) via a background wrapper, and migrates legacy slash-command prompts into skills with corresponding metadata/version bumps.

Changes:

  • Add new Swift review skills (swift-code-analysis, swiftui-modernize) and migrate legacy command prompts to skills.
  • Replace async: true SessionStart hooks in XcodeBuildTools with a run-background.sh wrapper that backgrounds helpers while preserving sandbox ownership across /clear.
  • Generate and commit per-plugin common/ helper copies (and add scripts/sync-plugin-common.py + tests) so installed plugin packages don’t depend on symlinks escaping the plugin directory.

Reviewed changes

Copilot reviewed 65 out of 65 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
XcodeBuildTools/skills/swiftui-modernize/SKILL.md Adds SwiftUI modernization skill definition.
XcodeBuildTools/skills/swift-code-analysis/SKILL.md Adds Swift code analysis skill definition.
XcodeBuildTools/README.md Documents new skills and updated SessionStart hook behavior; adds 0.5.10 changelog.
XcodeBuildTools/info.json Registers new skills and adds 0.5.10 release notes.
XcodeBuildTools/hooks/write-env.sh Updates comments to reflect background wrapper usage.
XcodeBuildTools/hooks/setup-sandbox.sh Preserves sandbox ownership across /clear using a passed hook-owner PID.
XcodeBuildTools/hooks/run-background.sh New wrapper to background helpers without host async support.
XcodeBuildTools/hooks/lib/sandbox.sh Updates comments to reflect backgrounded setup hook.
XcodeBuildTools/hooks/hooks.json Replaces async: true with run-background.sh commands.
XcodeBuildTools/hooks/approve-xcode-mcp.sh Updates documentation comment for background wrapper execution.
XcodeBuildTools/common/version_tracker.py Adds generated, self-contained copy of shared common helper.
XcodeBuildTools/common/session-start.py Adds generated, self-contained copy of shared common helper.
XcodeBuildTools/common/pre-tool-use.py Adds generated, self-contained copy of shared common helper.
XcodeBuildTools/common/hooks.json Adds generated, self-contained copy of shared common helper config.
XcodeBuildTools/common/detect_xcode_mcp.py Adds generated, self-contained copy of shared common helper.
XcodeBuildTools/commands/swiftui-modernize.md Removes legacy slash command prompt (migrated to skill).
XcodeBuildTools/commands/analyze.md Removes legacy slash command prompt (migrated to skill).
XcodeBuildTools/.claude-plugin/plugin.json Bumps XcodeBuildTools to 0.5.10.
tests/test_repository_integrity.py Adds checks for self-contained packages, synced common copies, and no async keys in hooks.
tests/test_hooks.py Adds unit test for run-background.sh PID preservation behavior.
SwiftScaffolding/skills/scaffolding/SKILL.md Adds scaffolding skill (migrated from legacy command prompt).
SwiftScaffolding/README.md Updates usage docs and adds 0.4.3 changelog.
SwiftScaffolding/info.json Registers scaffolding skill and adds 0.4.3 release notes.
SwiftScaffolding/common/version_tracker.py Adds generated, self-contained copy of shared common helper.
SwiftScaffolding/common/session-start.py Adds generated, self-contained copy of shared common helper.
SwiftScaffolding/common/pre-tool-use.py Adds generated, self-contained copy of shared common helper.
SwiftScaffolding/common/hooks.json Adds generated, self-contained copy of shared common helper config.
SwiftScaffolding/common/detect_xcode_mcp.py Adds generated, self-contained copy of shared common helper.
SwiftScaffolding/commands/scaffolding.md Removes legacy slash command prompt (migrated to skill).
SwiftScaffolding/.claude-plugin/plugin.json Bumps SwiftScaffolding to 0.4.3.
scripts/sync-plugin-common.py New script to generate per-plugin common/ copies from root common/.
README.md Updates marketplace docs to emphasize skills/hooks and new update workflow.
PluginBase/info.json Adds 0.2.12 release notes.
PluginBase/common/version_tracker.py Adds generated, self-contained copy of shared common helper.
PluginBase/common/session-start.py Adds generated, self-contained copy of shared common helper.
PluginBase/common/pre-tool-use.py Adds generated, self-contained copy of shared common helper.
PluginBase/common/hooks.json Adds generated, self-contained copy of shared common helper config.
PluginBase/common/detect_xcode_mcp.py Adds generated, self-contained copy of shared common helper.
PluginBase/.claude-plugin/plugin.json Bumps PluginBase to 0.2.12.
MarvinOutputStyle/README.md Adds 1.3.3 changelog.
MarvinOutputStyle/info.json Adds 1.3.3 release notes.
MarvinOutputStyle/common/version_tracker.py Adds generated, self-contained copy of shared common helper.
MarvinOutputStyle/common/session-start.py Adds generated, self-contained copy of shared common helper.
MarvinOutputStyle/common/pre-tool-use.py Adds generated, self-contained copy of shared common helper.
MarvinOutputStyle/common/hooks.json Adds generated, self-contained copy of shared common helper config.
MarvinOutputStyle/common/detect_xcode_mcp.py Adds generated, self-contained copy of shared common helper.
MarvinOutputStyle/.claude-plugin/plugin.json Bumps MarvinOutputStyle to 1.3.3.
iOSSimulator/README.md Adds 0.6.5 changelog.
iOSSimulator/info.json Adds 0.6.5 release notes.
iOSSimulator/common/version_tracker.py Adds generated, self-contained copy of shared common helper.
iOSSimulator/common/session-start.py Adds generated, self-contained copy of shared common helper.
iOSSimulator/common/pre-tool-use.py Adds generated, self-contained copy of shared common helper.
iOSSimulator/common/hooks.json Adds generated, self-contained copy of shared common helper config.
iOSSimulator/common/detect_xcode_mcp.py Adds generated, self-contained copy of shared common helper.
iOSSimulator/.claude-plugin/plugin.json Bumps iOSSimulator to 0.6.5.
CLAUDE.md Updates repo architecture/docs to prefer skills over commands; adds common-sync workflow.
AGENTS.md Updates guidance to be skill-focused and host-portable.
.claude/skills/update-plugin/SKILL.md Adds update-plugin skill to replace legacy update command prompt.
.claude/commands/update-plugin.md Removes legacy update-plugin command prompt.
.claude-plugin/marketplace.json Bumps marketplace versions for affected plugins.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread XcodeBuildTools/hooks/run-background.sh
- Fall back to the wrapper parent when an inherited hook owner PID is malformed.
@lukelabonte
lukelabonte marked this pull request as ready for review May 27, 2026 00:58
@lukelabonte
lukelabonte requested a review from gpambrozio May 27, 2026 00:58
Comment thread XcodeBuildTools/skills/swiftui-modernize/SKILL.md
Comment thread iOSSimulator/common/hooks.json Outdated
@lukelabonte
lukelabonte requested a review from gpambrozio May 28, 2026 16:58
@gpambrozio
gpambrozio merged commit 3d176af into main May 28, 2026
2 checks passed
@gpambrozio
gpambrozio deleted the luke/fix-async-hooks-for-codex branch May 28, 2026 17:14
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.

3 participants