Skip to content

feat(plugins): add managed Claude Code and Codex runtime - #5639

Open
KiaroSama wants to merge 3 commits into
Graphify-Labs:v8from
KiaroSama:feat/managed-plugin-runtime-5606
Open

KiaroSama wants to merge 3 commits into
Graphify-Labs:v8from
KiaroSama:feat/managed-plugin-runtime-5606

Conversation

@KiaroSama

@KiaroSama KiaroSama commented Nov 29, 2026 •

Copy link
Copy Markdown

What does this PR do?

Refs #5606. Builds on #5500 and keeps #5606 open for the full client/platform/service acceptance checklist.

The native plugins currently launch a separate PyPI environment while their skills, terminal commands and persistent integrations can still use other installations. That makes updates drift and prevents users from confidently removing the legacy setup.

This PR provides one source-pinned, plugin-managed execution path for Claude Code and Codex:

  • Private software provisioning: checksum-verified pinned uv, private Python, frozen dependency installation from the bundled Graphify source, optional profiles derived from package extras, and activation only after installation succeeds. Ambient Graphify/Python/uv are not fallback runtimes.
  • Shared execution: canonical CLI/Python APIs, MCP, generated client/shell workflows, native hooks, durable terminal launchers, Git hooks/merge driver, owned watch workers and bounded project instruction blocks. Windows includes a native executable bridge, its C source and a reproducible build check.
  • Project-aware MCP: explicit/default project selection, relative/absolute GRAPHIFY_OUT preservation, and discoverable templates for all six resources. Per-request project selection does not leak into later requests. Both MCP SDK major versions are covered.
  • Migration and lifecycle: legacy inventory; reviewed, backed-up removal of recognized JSON MCP/hook registrations; stamped skill archival; preservation of project graphs/configuration; owned integration cleanup; failed-update protection; cache-independent launchers; runtime rollback and disable/re-enable.
  • Release parity: generated native/portable manifests, full client/shell workflow references and capability inventory, drift checks before PyPI publication, three-OS bootstrap smoke jobs and a Linux complete-profile job.

See the managed runtime guide and capability/acceptance matrix.

Verification & invariants

Project graphs, provenance, output-path semantics and unrelated settings remain user-owned. Execution reuses canonical Graphify code. Runtime activation follows successful installation; cleanup targets explicitly owned integrations. Generated workflows reuse authoritative skillgen fragments.

Review follow-up (0a5f002)

Addresses the confirmed P2 custom-Markdown deletion finding, plus two reproduced hypotheses visible in the review:

  • Skill sync now records generated Markdown paths and normalized SHA-256 content hashes in plugin/generated-skills.json. It removes a retired file only when the previous inventory owns that path and its content remains unchanged. Custom Markdown is preserved and ignored by drift checks; modified obsolete references survive.
  • Missing, malformed or unsupported inventories do not establish ownership. Invalid paths/digests are ignored, linked files and ancestor aliases are preserved during cleanup, and current linked generated outputs are rejected before writing. The inventory is saved after cleanup, preserving retry information after a failed removal. CRLF checkouts and read-only --check behavior are covered.
  • Migration status reports malformed JSON structures by location, continues inspecting valid siblings/files, and does not expose configuration values or modify files.
  • Capability inventory accepts a valid project with no optional-dependencies table. Existing rollback tests/probes confirmed that the previous application runtime remains pinned; the current management dispatcher is intentional.

Verification on this follow-up:

  • Reproduced custom-file deletion/check-mode false drift, malformed migration structures and the missing-extra failure before correction. Added regression/boundary coverage for preservation, malformed inventories, aliases and cleanup failure ordering.
  • Full suite using the repository's documented parallel/serial split: pytest tests -q -n 2 -m 'not serial' --tb=short and pytest tests -q -m serial --tb=short: 12,543 passed, 122 skipped, 2 xfailed, 8 failed. The same previously reproduced environment failures remain: seven DNS lookups and one prohibited Unix-socket creation.
  • Full Ruff, both generator checks and staged whitespace checks passed; all 134 legacy artifacts still match.
  • Pyright with an explicit all-extras virtual-environment interpreter: 789 errors / 0 warnings before and after, with no added or removed diagnostic signatures against parent 32787af (file/message/rule/severity, ignoring shifted line numbers). The four changed Python files separately report 0 errors / 0 warnings. The whole project is not type-clean; the explicit interpreter resolves the dependency-import noise present in the earlier report.
  • Required graph refresh completed with one worker and no clustering: 1,383 AST files, 29,085 nodes and 63,733 edges. Generated local graph/cache data are excluded.

Review follow-up (32787af)

Addresses the confirmed shell-reader finding and two reproduced generated-guidance defects:

  • Bash command lookup (type), ambiguous gc, quoted prose and heredoc data no longer enter the PowerShell reader path or spend the read-nudge budget. Exactly one parser handles each command.
  • Literal Get-Content and constrained pwsh/powershell -Command invocations retain PowerShell reading, including type/gc aliases in the explicit wrapper. Current Codex hooks omit the selected shell, so a bare ambiguous alias remains advisory-silent; command execution is unaffected. The limitation and immutable upstream evidence are documented.
  • Generated hook references retain the canonical post-commit, existing-hook preservation and source-freshness guidance while installation/removal uses managed ownership. Codex references name AGENTS.md.
  • The entire obsolete subcommand interpreter-resolution paragraph is replaced by managed-launcher guidance. All eight affected references were regenerated from the generator.

Verification for this follow-up:

  • Reproduced the original false read nudges and the leading-Get-Content heredoc edge case before their fixes. Both new generator regressions also failed before correction.
  • Final affected selection: 255 passed, covering shell readers, guard token matching, read/search/strict/freshness behavior and plugin manifests.
  • Broad run: uv run --frozen --all-extras pytest tests -q --tb=short produced 12,515 passed, 122 skipped, 2 xfailed, 8 failed. The failures are the previously reproduced environment restrictions: seven DNS lookups and one Unix-socket creation. This broad run preceded the final conservative heredoc gate; the 255-test selection above includes that final gate.
  • Final full Ruff and both generation checks passed; all 134 legacy artifacts still match.
  • Full-project Pyright comparison in the same all-extras environment: 1,238 errors / 232 warnings before, 1,237 errors / 232 warnings after, with no new diagnostics. This compares the review follow-up against fc032e1, not the entire feature against upstream; it does not claim a clean full-project type check.
  • Required repository graph refresh completed with GRAPHIFY_MAX_WORKERS=1 graphify update . --no-cluster: 1,382 AST files, 29,062 nodes and 63,673 edges, with graph.json saved. Local graph/cache data are excluded from this PR.

Initial implementation checks

  • Full uv run pytest tests: 12,476 passed, 122 skipped, 2 xfailed, 8 failed. All eight failures reproduced on unchanged upstream HEAD: one prohibited Unix-socket creation and seven DNS-resolution failures.
  • Final affected tests: 90 passed across runtime, manifests, integrations, MCP project selection and shell-read hooks.
  • MCP compatibility selection: 65 passed with SDK 2.x and 65 passed with SDK 1.30.0.
  • Final uv run ruff check .: passed.
  • Final focused Pyright: 9 files, zero errors/warnings, covering the new runtime/integrations, hooks, tests, smoke driver and generators. Separate serve.py baseline comparison: 78 diagnostics before and after, with no new messages.
  • Full-project Pyright was not clean: its earlier run reported 797 diagnostics, including eight new diagnostics subsequently fixed and cleared by the focused check. A completed full-project baseline comparison is unavailable; this PR does not claim a clean full-project type check.
  • python scripts/sync_plugin_manifests.py --check: no drift. Legacy python -m tools.skillgen --check: all 134 generated artifacts match. Native skill validation passed.
  • Real Linux private bootstrap succeeded, including a separate 150-package all-profile installation. The default python tools/plugin_smoke.py passed: hostile ambient PATH/Python settings, managed package identity, real stdio MCP A/B/A tool/resource selection, cached offline preparation, both clients' owned instructions, disable refusal/re-enable and preserved project hashes.
  • Rebuilding the Windows bridge with Zig 0.15.2 produced a byte-identical executable.
  • The full --all-features smoke was interrupted: uncached dependency access was policy-blocked, and the environment became unavailable during a local-cache retry. Its final canonical update remains a CI acceptance item.
  • The original repository graph refresh was interrupted; the successful follow-up refresh is recorded above.

Acceptance boundaries

  • Real Claude Code/Codex plugin-manager installation, hook approval/activation, and macOS/Windows execution still need the corresponding clients/runners. Added CI jobs are not represented as passed runs.
  • Authenticated providers/databases/Google/browser flows and GPU/model workloads remain service/hardware acceptance. Dependency provisioning is reported separately.
  • Codex portable MCP starts in the package directory; generated instructions pass the actual workspace as project_path. Compatibility-only releases need upgrading.
  • Runtime rollback pins the previous complete environment. The host still owns cached plugin metadata/skills; graph edits and service actions are not reversed.
  • Run managed disable/uninstall before host removal to clean persistent owned integrations. Host file removal alone is not assumed to call a cleanup callback; user data and runtime history are preserved.
  • Ambiguous registrations, including Codex TOML and compound shell hooks, remain visible for review. Legacy packages are removed with their original package manager after migration verification.
  • The Windows bridge is x86-64; Windows ARM64 requires OS x64 application support and is not claimed as native ARM64 validation.

Type of change

  • New feature
  • Bug fix
  • Documentation
  • Tests or CI

Graphify-specific checklist

  • Read CONTRIBUTING.md, ARCHITECTURE.md and relevant security guidance.
  • Added boundary/regression coverage and retained the final implementation's verification limits.
  • Regenerated plugin artifacts from source fragments and checked legacy artifacts.
  • Reviewed shell quoting, interpreter isolation, ownership and update failure handling.
  • No credentials, local graph data or runtime caches are included.
  • Disclosed AI assistance in commit metadata.

Unify CLI, MCP, generated workflows and owned integrations behind a
source-pinned private runtime. Add optional software provisioning,
project-aware MCP resources, migration and lifecycle management, and
release/CI parity gates while preserving user graph and configuration data.

Refs Graphify-Labs#5606

Co-Authored-By: ChatGPT <noreply@openai.com>
@github-actions

Copy link
Copy Markdown

Thanks for the pull request, @KiaroSama. A maintainer will review it soon.

Want to talk it through while it is in review? Come join us on our Discord server. For longer-form discussion there is also GitHub Discussions.

A couple of things that speed up review: make sure the test suite passes on Python 3.11 and 3.13, and that the change keeps extraction deterministic.

@graphify-labs graphify-labs Bot 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.

Graphify review View in Graphify

Nothing blocking · 20 possible issues to check · Merge confidence 5/5

20 possible issues to check · High impact

The changes add managed-plugin support for shell-read nudges, Git hook interpreter selection, project-specific MCP resources, and plugin-owned integrations.

20 possible issues we couldn't confirm

They don't change the score.

What this review covered
  • This review stopped before it finished; findings are from the part that ran.
  • The AI model asked for code in a way the review could not use.
  • We didn't review 66 files that aren't source code, such as docs, config, images, or generated or third-party code.
  • 2 more possible issues from the per-file sweep were left out to keep the report to its limit.
  • 15 of 15 changed files inspected. This is scope, not a correctness guarantee.
Code graph · 2120 functions depend on this change
  • 17 functions became more coupled. Largest: install() (58 callers), uninstall() (15 callers), sync_manifests() (13 callers).
  • 661 of 661 test files are affected by this change.
  • Gate, test list and every flagged function: in the Graphify check.

Review stopped early on 0a5f002 · 17 earlier findings not re-checked

Comment thread graphify/cli.py Resolved
Keep Bash command lookup and heredoc content out of the PowerShell reader
path. Recognize literal PowerShell commands without guessing the selected
shell from Codex's compatibility hook name, and cover the original false
nudges plus supported PowerShell readers with regression tests.

Preserve canonical hook/freshness guidance in generated plugin references
and replace the complete obsolete interpreter-resolution paragraph with
the managed runtime contract.

Refs Graphify-Labs#5639
Refs Graphify-Labs#5606

Co-Authored-By: ChatGPT <noreply@openai.com>
Comment thread scripts/sync_plugin_manifests.py Outdated
Comment on lines +154 to +157
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(content, encoding="utf-8", newline="\n")
expected = set(generated)
for path in (repo / "skills" / "graphify").rglob("*.md"):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2  Sync deletes custom Markdown files from the plugin skill directory

Running the manifest sync can remove Markdown files that were not generated by Graphify.

Limit the cleanup in sync_manifests() in scripts/sync_plugin_manifests.py to files owned by the sync.

Evidence · checked against the code

Expected: Files not owned or generated by the sync are preserved.
Actually: The cleanup loop unlinks every Markdown path under that directory that is not in the generated-file set.

  • Independent source review: Checked the --check branch: it records stale paths but skips both writes and unlinks. That protects check-only invocations, not normal sync runs. The existing test verifies a generated reference file survives; it does not test preservation of extra Markdown files.
Prompt to fix with AI
In scripts/sync_plugin_manifests.py, sync_manifests (lines 154-157):
Problem: Sync deletes custom Markdown files from the plugin skill directory
Expected: Files not owned or generated by the sync are preserved.
Actually: The cleanup loop unlinks every Markdown path under that directory that is not in the generated-file set.
Fix it at the cause, and add a test that fails without the fix.

Graphify · Checked against the code · View in Graphify

Track generated Markdown ownership and normalized content hashes before pruning obsolete references. Preserve custom or modified files and path aliases, reject malformed inventory entries, and retain ownership metadata when cleanup fails.

Report malformed migration configuration sections without exposing their values, and support projects without an optional-dependencies table. Add regression coverage and document the preservation rules.

Refs Graphify-Labs#5639 and Graphify-Labs#5606.

Co-Authored-By: ChatGPT <noreply@openai.com>

This branch has not been deployed

No deployments
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.

1 participant