-
Notifications
You must be signed in to change notification settings - Fork 0
Release 0.3.7 with native hooks in public uploads #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| #!/usr/bin/env python3 | ||
| """Build the OpenAI upload artifact without repository lifecycle hooks.""" | ||
| """Build the OpenAI skills-only upload, including native Codex lifecycle hooks.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
|
|
@@ -17,7 +17,9 @@ | |
| def write_file(archive: ZipFile, source: Path, destination: Path) -> None: | ||
| info = ZipInfo(str(PACKAGE_ROOT / destination), FIXED_TIMESTAMP) | ||
| info.compress_type = ZIP_DEFLATED | ||
| info.external_attr = 0o100644 << 16 | ||
| info.create_system = 3 | ||
| mode = 0o100755 if source.stat().st_mode & 0o111 else 0o100644 | ||
| info.external_attr = mode << 16 | ||
| archive.writestr(info, source.read_bytes()) | ||
|
|
||
|
|
||
|
|
@@ -35,6 +37,9 @@ def build(destination: Path) -> None: | |
| for path in sorted((PLUGIN / "assets").rglob("*")): | ||
| if path.is_file(): | ||
| write_file(archive, path, path.relative_to(PLUGIN)) | ||
| for name in ("codex-hooks.json", "codex-hook.sh"): | ||
| path = PLUGIN / "hooks" / name | ||
| write_file(archive, path, path.relative_to(PLUGIN)) | ||
|
Comment on lines
+40
to
+42
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2. Homebrew users get unsupported hooks build() now includes native lifecycle hooks that require Tree Ring Memory CLI 0.15.6 or newer, while the live Homebrew formula still installs 0.15.3. When a Homebrew user installs this public upload without a project-local binary, codex-hook.sh resolves the outdated executable from PATH, reaching unsupported automatic recall and checkpoint behavior. Agent Prompt
|
||
| for name in ("LICENSE", "PRIVACY.md", "SECURITY.md", "TERMS.md"): | ||
| write_file(archive, PLUGIN / name, Path(name)) | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| #!/usr/bin/env python3 | ||
| """Validate the deterministic public upload and its native lifecycle hooks.""" | ||
| import json | ||
| import subprocess | ||
| import sys | ||
| import tempfile | ||
| from pathlib import Path | ||
| from zipfile import ZipFile | ||
|
|
||
| ROOT = Path(__file__).resolve().parents[1] | ||
| PLUGIN = ROOT | ||
| CODEX_SKILLS_ONLY = ROOT / "packaging/codex-skills-only" | ||
| CODEX_SKILLS_BUILDER = ROOT / "packaging/build-codex-skills-only.py" | ||
|
|
||
|
|
||
| def require(condition, message): | ||
| if not condition: | ||
| raise SystemExit(message) | ||
|
|
||
|
|
||
| def load_json(path): | ||
| return json.loads(path.read_text()) | ||
|
|
||
|
|
||
| def validate_codex_skills_only() -> None: | ||
| repository_manifest = load_json(PLUGIN / ".codex-plugin" / "plugin.json") | ||
| skills_manifest = load_json(CODEX_SKILLS_ONLY / ".codex-plugin" / "plugin.json") | ||
| expected_manifest = dict(repository_manifest) | ||
| require(skills_manifest == expected_manifest, "skills-only Codex manifest drifted from repository metadata") | ||
| for unsupported in ("mcpServers", "apps"): | ||
| require(unsupported not in skills_manifest, f"skills-only Codex ZIP must not declare {unsupported}") | ||
| require("screenshots" not in skills_manifest.get("interface", {}), "skills-only Codex ZIP must not declare screenshots") | ||
|
|
||
| with tempfile.TemporaryDirectory() as temporary: | ||
| first = Path(temporary) / "first.zip" | ||
| second = Path(temporary) / "second.zip" | ||
| for destination in (first, second): | ||
| subprocess.run([sys.executable, str(CODEX_SKILLS_BUILDER), str(destination)], check=True) | ||
| require(first.read_bytes() == second.read_bytes(), "skills-only Codex ZIP must be deterministic") | ||
| with ZipFile(first) as archive: | ||
| names = set(archive.namelist()) | ||
| prefix = "tree-ring-memory/" | ||
| require(names and all(name.startswith(prefix) for name in names), "skills-only Codex ZIP needs one package root") | ||
| manifest_name = prefix + ".codex-plugin/plugin.json" | ||
| require(manifest_name in names, "skills-only Codex ZIP manifest is missing") | ||
| built_manifest = json.loads(archive.read(manifest_name)) | ||
| require(built_manifest == skills_manifest, "skills-only Codex ZIP manifest is stale") | ||
| require( | ||
| not any( | ||
| marker in name | ||
| for name in names | ||
| for marker in ("/commands/", "/.claude-plugin/", "/packaging/") | ||
| ), | ||
| "skills-only Codex ZIP contains repository-only components", | ||
| ) | ||
| for hook_name in ("codex-hooks.json", "codex-hook.sh"): | ||
| archive_path = prefix + "hooks/" + hook_name | ||
| require(archive_path in names, "public upload is missing its native lifecycle hook") | ||
| require(archive.read(archive_path) == (PLUGIN / "hooks" / hook_name).read_bytes(), "public upload hook differs from the validated runtime hook") | ||
| hook_mode = archive.getinfo(prefix + "hooks/codex-hook.sh").external_attr >> 16 | ||
| require(hook_mode & 0o111 != 0, "public upload hook script must remain executable") | ||
| require( | ||
| prefix + "skills/tree-ring-memory/SKILL.md" in names, | ||
| "skills-only Codex ZIP is missing its skill", | ||
| ) | ||
| require( | ||
| prefix + "assets/tree-ring-memory-logo.png" in names, | ||
| "skills-only Codex ZIP is missing its declared assets", | ||
| ) | ||
|
|
||
|
|
||
| validate_codex_skills_only() | ||
| print("Public upload retains validated executable lifecycle hooks") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. Users see the wrong release version
🐞 Bug≡ CorrectnessAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools