Skip to content

feat: add full Oh My Pi (OMP) support - #256

Merged
ualtinok merged 25 commits into
cortexkit:masterfrom
Lynricsy:feat/omp-support
Aug 10, 2026
Merged

feat: add full Oh My Pi (OMP) support#256
ualtinok merged 25 commits into
cortexkit:masterfrom
Lynricsy:feat/omp-support

Conversation

@Lynricsy

@Lynricsy Lynricsy commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add OMP as a first-class CLI harness with native plugin-manager detection, setup, doctor, repair, and OpenCode session migration
  • reuse the Pi-compatible runtime while preserving OMP profile, XDG, child-process, extension allowlist, and shared-memory semantics
  • discover OMP JSON model selectors and default/named-profile sessions in the dashboard
  • publish an explicit OMP extension manifest and document installation, conflicts, migration, configuration, troubleshooting, and dashboard behavior

Compatibility decisions

  • OMP uses the existing Pi runtime and keeps the harness='pi' discriminator for session-scoped rows
  • project memories remain shared across OpenCode, Pi, and OMP
  • setup disables OMP native compaction and automatic memory transactionally to avoid competing context managers
  • model discovery consumes omp models --json selectors so scoped and nested IDs are preserved

Verification

  • CLI: 292 passed, 2 skipped, 0 failed; lint, typecheck, build passed
  • Pi/OMP extension: 711 passed, 0 failed; typecheck, build, npm pack dry-run passed
  • docs: Astro build completed all 22 pages
  • real OMP 17.1.7 smoke: linked the local package through omp plugin, launched OMP, and /ctx-status reported Magic Context v0.33.0 with historian idle
  • dashboard session module: 8 Rust tests passed through an isolated crate that includes the production source; touched Rust files pass rustfmt parsing/check

Environment note

The full Tauri Cargo suite could not link on this workstation because pkg-config/DBus development metadata is absent; the failure occurs in libdbus-sys before project code compiles.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Adds full Oh My Pi (OMP) support across the CLI, Pi-compatible extension, and dashboard, including setup, doctor, and OpenCode→OMP migration. Discovery is robust (profiles, XDG, executable checks), and CI now runs a real OMP Docker E2E that executes the production subagent argv.

  • New Features

    • CLI: new omp harness adapter and end-to-end support for setup --harness omp, doctor --harness omp, and --harness opencode|pi|omp.
    • Migration: doctor migrate --from opencode --to omp writes Pi/OMP JSONL into the active OMP sessions root.
    • Provider mapping: added omp canonicalization/resolve so IDs round‑trip with the shared config.
    • Dashboard: parses omp models --json, scans OMP sessions (including profiles), and deduplicates across aliased roots.
    • CI: real OMP Docker E2E validates plugin-manager install/repair and runs the built subagent argv from @cortexkit/pi-magic-context.
  • Bug Fixes

    • CLI doctor: normalized OMP paths, hardened binary/provider lookups, and isolated repairs to host config boundaries.
    • Extension subagents: translated OMP child argv/model refs and aligned retries with Pi, accounting for OMP tool allowlist behavior.
    • Dashboard: trimmed OMP environment paths, required executable OMP evidence before discovery, merged/gated scanners, and preserved profiled XDG sessions.

Written for commit 18a5108. Summary will update on new commits.

Review in cubic

Greptile Summary

Adds first-class Oh My Pi support across the CLI, Pi-compatible extension, dashboard discovery, migration, CI, and documentation.

  • Adds OMP setup, doctor, repair, model selection, profile/XDG handling, and OpenCode-to-OMP migration.
  • Extends the Pi-compatible runtime and subagent argument handling for OMP.
  • Adds dashboard discovery for OMP models and default or named-profile sessions.
  • Adds an OMP manifest, Docker E2E coverage, and user documentation.

Confidence Score: 5/5

The PR appears safe to merge, with only a non-blocking cache-list/detail mismatch remaining from the earlier multi-root discovery thread.

Multi-root deduplication now removes duplicate logical rows, but cache listing filters eventless copies before selection while detail lookup selects from all copies, so unusual divergent copies can still resolve to different files.

Files Needing Attention: packages/dashboard/src-tauri/src/pi_sessions.rs

Important Files Changed

Filename Overview
packages/cli/src/adapters/omp.ts Adds first-class OMP harness detection and adapter behavior.
packages/cli/src/commands/setup-omp.ts Adds transactional OMP plugin installation and conflicting native-feature configuration.
packages/cli/src/commands/doctor-omp.ts Adds OMP diagnostics and repair behavior for installation, profiles, paths, and configuration.
packages/cli/src/commands/migrate.ts Extends session migration to target active OMP session roots.
packages/pi-plugin/src/subagent-runner.ts Adapts Pi-compatible child-process arguments and model references for OMP.
packages/dashboard/src-tauri/src/pi_sessions.rs Adds OMP profile and XDG session discovery and multi-root deduplication.
packages/dashboard/src-tauri/src/commands.rs Integrates OMP model and session discovery into dashboard commands.
.github/workflows/ci.yml Adds a real OMP Docker installation and session smoke-test job.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  CLI[Magic Context CLI] --> Setup[OMP setup and doctor]
  Setup --> OMP[Oh My Pi]
  OMP --> Extension[Pi-compatible extension]
  Extension --> Store[(Shared Magic Context database)]
  OMP --> Sessions[OMP JSONL sessions]
  Sessions --> Dashboard[Dashboard discovery]
  Store --> Dashboard
  OpenCode[OpenCode sessions] --> Migration[Session migration]
  Migration --> Sessions
Loading

Reviews (10): Last reviewed commit: "test(omp): 🧪 execute production subagen..." | Re-trigger Greptile

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

Comment thread packages/pi-plugin/README.md
Comment thread packages/cli/src/commands/setup-pi.ts
Comment thread packages/cli/src/commands/doctor-omp.ts Outdated
Comment thread packages/dashboard/src-tauri/src/commands.rs Outdated
Comment thread packages/cli/src/lib/omp-helpers.ts Outdated
Comment thread packages/docs/src/content/docs/index.mdx
Comment thread packages/cli/src/commands/setup-pi.ts Outdated
Comment thread packages/cli/src/commands/doctor-omp.ts
Comment thread packages/cli/src/lib/omp-helpers.ts
Comment thread packages/dashboard/src-tauri/src/pi_sessions.rs
@Lynricsy

Copy link
Copy Markdown
Contributor Author

Addressed the multi-root session review in f979800. Dashboard discovery now canonicalizes paths, deduplicates by session ID, sorts duplicates by modified time descending with a stable path tie-break, and therefore keeps the newest continued copy rather than root-order priority. Added regression coverage for a newer duplicate in the second root; the production module now passes 9 isolated Rust tests.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 42 files

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

Comment thread packages/dashboard/src-tauri/src/pi_sessions.rs
Comment thread packages/dashboard/src-tauri/src/pi_sessions.rs Outdated
@alfonso-magic-context

Copy link
Copy Markdown
Collaborator

This is on our merge path — could you rebase onto current master? The v0.33.1 release wave landed conflicting changes in the areas this touches. Once it's green we'll do the full review pass.

Copilot AI lite review requested due to automatic review settings August 5, 2026 14:10
@Lynricsy

Lynricsy commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Rebased feat/omp-support onto current origin/master (12678424) and force-pushed with --force-with-lease. The only rebase conflict was the CLI package metadata; it now keeps v0.33.1 while retaining the OpenCode/Pi/OMP description.

I also resolved the valid review findings while re-verifying the v0.33.1 contracts: Pi setup now rolls back a newly-added package entry on later failure; OMP doctor can repair shared config without an OMP binary; OMP subprocess errors preserve timeout details and use a 10 MiB buffer; dashboard Pi login-shell discovery precedes OMP fallback; OMP profile names are validated; multi-root dedup uses explicit root priority and canonicalizes roots rather than every session; the homepage support matrix now includes OMP.

Post-rebase verification:

  • CLI: 299 passed, 2 skipped, 0 failed; lint + typecheck passed
  • Pi/OMP extension: 715 passed, 0 failed; typecheck passed
  • root typecheck + all publish builds passed
  • docs: all 22 pages built
  • dashboard production session module: 10 isolated Rust tests passed; touched Rust files pass rustfmt check

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 adds first-class Oh My Pi (OMP) support across Magic Context’s CLI, Pi-compatible extension/runtime, dashboard session/model discovery, and documentation—while keeping Pi-compatible session semantics (harness='pi') and shared project memory/database behavior.

Changes:

  • CLI: introduce an omp harness with setup/doctor flows, OMP model discovery, OMP path resolution, and OpenCode → Pi/OMP migration targeting.
  • Dashboard: expand Pi-compatible session-root discovery to include OMP profile/XDG layouts and add OMP model selector parsing.
  • Extension + docs: update Pi extension to support OMP env semantics (agent dir allowlist resolution) and document installation, conflicts, migration, and dashboard behavior.

Reviewed changes

Copilot reviewed 42 out of 43 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
README.md Updates top-level product messaging and setup/doctor guidance to include OMP.
packages/plugin/scripts/build-config-docs.ts Updates generated config-doc preface to reflect shared config across OpenCode/Pi/OMP.
packages/pi-plugin/src/subagent-runner.ts Resolves relative allowlisted extensions from PI_CODING_AGENT_DIR for Pi/OMP parity.
packages/pi-plugin/src/subagent-runner.test.ts Adds test coverage for host agent-dir based allowlist resolution.
packages/pi-plugin/README.md Updates extension docs for shared config paths and adds OMP installation/troubleshooting guidance.
packages/pi-plugin/package.json Publishes explicit OMP extension manifest metadata and keywords/description updates.
packages/docs/src/content/docs/reference/dashboard.md Documents dashboard behavior for Pi-compatible sessions including OMP.
packages/docs/src/content/docs/reference/configuration.md Updates configuration reference header to include OMP.
packages/docs/src/content/docs/index.mdx Updates docs landing page to include OMP and “three harnesses” messaging.
packages/docs/src/content/docs/help/troubleshooting.md Adds OMP-specific restart guidance (/reload-plugins) and wording updates.
packages/docs/src/content/docs/help/faq.md Updates FAQ for shared DB across OpenCode/Pi/OMP and migration to Pi/OMP.
packages/docs/src/content/docs/help/compatibility.md Adds OMP compaction/memory conflict documentation and resolution steps.
packages/docs/src/content/docs/getting-started/migrating-between-harnesses.md Extends migration guide to cover OpenCode → Pi/OMP.
packages/docs/src/content/docs/getting-started/introduction.md Updates intro narrative to include OMP as a supported harness.
packages/docs/src/content/docs/getting-started/installation.md Adds OMP as a first-class install target and documents OMP-specific setup actions.
packages/docs/src/content/docs/concepts/mural.md Clarifies mural support across OpenCode and Pi-compatible hosts (Pi/OMP).
packages/docs/src/content/docs/concepts/memory.md Updates memory-sharing explanation to include OMP.
packages/dashboard/src-tauri/src/pi_sessions.rs Adds OMP profile/XDG root discovery and deduplication across multiple Pi-compatible roots.
packages/dashboard/src-tauri/src/commands.rs Adds omp models --json parsing and OMP model discovery fallback for dashboard.
packages/cli/src/lib/v22-backfill-commands.ts Updates schema-fence restart warning to include OMP.
packages/cli/src/lib/paths.ts Adds OMP path resolution helpers (profiles, overrides, XDG data layout).
packages/cli/src/lib/paths-omp.test.ts Adds tests for OMP path resolution behavior.
packages/cli/src/lib/omp-helpers.ts Adds OMP binary detection, command helpers, settings access, and model/plugin parsing.
packages/cli/src/lib/omp-helpers.test.ts Adds tests for OMP model parsing and command timeout/buffer behavior.
packages/cli/src/lib/harness-select.ts Extends harness selection/validation to include --harness omp.
packages/cli/src/index.ts Updates CLI help text to reflect OMP support and Pi/OMP migration.
packages/cli/src/commands/setup.ts Dispatches setup to OMP setup flow and updates next-steps messaging.
packages/cli/src/commands/setup-pi.ts Refactors setup into a Pi-compatible host abstraction and adds rollback support.
packages/cli/src/commands/setup-pi.test.ts Adds rollback tests for Pi settings package registration.
packages/cli/src/commands/setup-omp.ts Implements OMP setup via Pi-compatible setup host + transactional OMP conflict disabling.
packages/cli/src/commands/setup-omp.test.ts Adds tests for OMP transactional rollback behavior.
packages/cli/src/commands/migrate.ts Extends migration target to --to omp and routes output to OMP sessions root.
packages/cli/src/commands/migrate.test.ts Adds CLI parsing test coverage for --to omp.
packages/cli/src/commands/doctor.ts Dispatches doctor to OMP doctor flow.
packages/cli/src/commands/doctor-omp.ts Adds OMP-specific doctor/repair/issue-report logic.
packages/cli/src/commands/doctor-omp.test.ts Adds tests for healthy OMP doctor flow and config creation when OMP is missing.
packages/cli/src/adapters/types.ts Extends adapter types to include `HarnessKind = ...
packages/cli/src/adapters/omp.ts Adds an OMP adapter covering detection, plugin enablement, cache/log paths, and install hint.
packages/cli/src/adapters/omp.test.ts Adds adapter tests for detecting an enabled plugin via omp plugin list --json.
packages/cli/src/adapters/index.ts Registers OMP adapter in the global adapter list and exports it.
packages/cli/package.json Updates CLI package metadata/keywords to include OMP.
CONFIGURATION.md Updates shared-config + doctor documentation to include OMP behavior.
.gitignore Ignores agent log directories (AgentLogs/, .agent-logs/).
Suppressed comments (2)

packages/dashboard/src-tauri/src/pi_sessions.rs:154

  • PI_CONFIG_DIR isn’t trimmed before converting to PathBuf. If the env var contains leading/trailing whitespace it will resolve to a different directory than the CLI uses (which trims), causing session-root discovery to diverge across components.
    let config_dir = std::env::var_os("PI_CONFIG_DIR")
        .filter(|v| !v.is_empty())
        .map(PathBuf::from)
        .unwrap_or_else(|| PathBuf::from(".omp"));

packages/dashboard/src-tauri/src/pi_sessions.rs:169

  • XDG_DATA_HOME is also consumed without trimming. Trimming avoids treating whitespace-only values as valid and keeps behavior aligned with the CLI path resolver (which trims).
    if let Some(xdg_data) = std::env::var_os("XDG_DATA_HOME").filter(|v| !v.is_empty()) {
        let app_root = PathBuf::from(xdg_data).join("omp");
        append_omp_profile_roots(&mut roots, &app_root.join("profiles"), true);

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

Comment on lines +217 to +228
const reportedAgentDir = options.deps.runOmpCommand(omp.path, ["config", "path"], 10_000);
if (!reportedAgentDir.ok)
add(results, "warn", "Could not verify OMP active agent directory");
else if (reportedAgentDir.stdout === getOmpAgentDir()) {
add(results, "pass", `OMP agent directory resolved to ${getOmpAgentDir()}`);
} else {
add(
results,
"fail",
`OMP reports agent directory ${reportedAgentDir.stdout}, but Magic Context resolved ${getOmpAgentDir()}`,
);
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 9730e23. Doctor now resolves both the reported and expected agent directories before comparison, and the healthy-install regression test returns an equivalent path with a trailing /./ segment.

Comment on lines +147 to +149
if let Some(agent_dir) = std::env::var_os("PI_CODING_AGENT_DIR").filter(|v| !v.is_empty()) {
roots.push(PathBuf::from(agent_dir).join("sessions"));
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in c683ddb. PI_CODING_AGENT_DIR, PI_CONFIG_DIR, and XDG_DATA_HOME now share one trimming helper; blank values are ignored. Added direct regression coverage, and the production session module passes 11 isolated Rust tests.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 3 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread packages/dashboard/src-tauri/src/pi_sessions.rs Outdated
Comment thread packages/cli/src/commands/doctor-omp.ts
@alfonso-magic-context

Copy link
Copy Markdown
Collaborator

Thanks for the rebase — we did the full review. The direction is right and several pieces are exactly how we'd want them (probing the distinct omp executable instead of treating Pi as OMP, the OMP-only adapter/setup/doctor shape). Not merge-ready yet though: the review found five required changes, and the two that matter most are plain-Pi regressions hiding in shared code:

  1. Pi child-extension resolution changes for plain Pi installs. getHostAgentSettingsDir() (subagent-runner.ts) re-roots relative allowlist entries whenever PI_CODING_AGENT_DIR is set — but that's a supported plain-Pi setting, so Pi users without OMP get different extension resolution after this PR. The OMP-specific resolution needs to sit behind a positively-identified OMP host (or be injected from the OMP adapter), with a negative regression test proving the pre-PR argv when OMP is absent.

  2. The dashboard Pi scanner becomes an unconditional all-OMP-profile scanner. pi_sessions.rs scans every ~/.omp/profiles root on every Pi scan without detecting OMP, so stale .omp data surfaces as Pi sessions and plain-Pi results change. OMP needs its own separately-named scanner, invoked only after explicit OMP detection, with OMP-absent tests.

The remaining three: complete the OMP path/config contract (PI_PACKAGE_DIR, PI_CONFIG_FILES overlays, and omp config set write-scope — a project-tier OMP file must not cause global settings changes), give OMP an explicit provider-translation contract at the harness-provider-map chokepoint (bidirectional, round-trip tested — right now OMP selectors ride Pi's openai-codex rewrite unproven), and at least one real-OMP CI smoke job (all current tests use fake binaries/fixtures; a harness leg we can't test in CI becomes a liability on every future Pi-parity change).

Happy to re-review as soon as these land — the containment shape you already have (own adapter, own commands) makes them all tractable.

@cubic-dev-ai cubic-dev-ai 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.

2 issues found across 43 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/cli/src/commands/doctor-omp.ts">

<violation number="1" location="packages/cli/src/commands/doctor-omp.ts:92">
P3: The new OMP doctor reimplements the same semver triple-parse/compare that `comparePiVersion` in `commands/setup-pi.ts` already provides for the same Pi-compatible flow. The two functions parse `X.Y.Z` with the identical regex and compare component-by-component, so a future change to how Pi/OMP versions are treated must be made in two places and can drift. Consider extracting a shared semver helper (e.g. in `lib`) and having both the Pi setup and the OMP doctor use it, matching the existing repo convention of shared CLI helpers.</violation>

<violation number="2" location="packages/cli/src/commands/doctor-omp.ts:221">
P2: The OMP path check compares `omp config path` with the agent directory instead of the OMP config path, which can make every healthy installation fail its doctor check. Compare against `getOmpConfigPath()` (and label the result as a config path) or invoke the command that actually reports the agent directory.</violation>
</file>

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

Comment thread packages/cli/src/commands/doctor-omp.ts
Comment thread packages/cli/src/commands/setup-pi.ts Outdated
Comment thread packages/cli/src/lib/omp-helpers.ts Outdated
Comment thread packages/cli/src/commands/doctor-omp.ts Outdated
if (!reportedAgentDir.ok) {
add(results, "warn", "Could not verify OMP active agent directory");
} else {
const reportedPath = resolve(reportedAgentDir.stdout);

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: The OMP path check compares omp config path with the agent directory instead of the OMP config path, which can make every healthy installation fail its doctor check. Compare against getOmpConfigPath() (and label the result as a config path) or invoke the command that actually reports the agent directory.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/cli/src/commands/doctor-omp.ts, line 221:

<comment>The OMP path check compares `omp config path` with the agent directory instead of the OMP config path, which can make every healthy installation fail its doctor check. Compare against `getOmpConfigPath()` (and label the result as a config path) or invoke the command that actually reports the agent directory.</comment>

<file context>
@@ -0,0 +1,425 @@
+        if (!reportedAgentDir.ok) {
+            add(results, "warn", "Could not verify OMP active agent directory");
+        } else {
+            const reportedPath = resolve(reportedAgentDir.stdout);
+            const expectedPath = resolve(getOmpAgentDir());
+            if (reportedPath === expectedPath) {
</file context>

Comment thread packages/dashboard/src-tauri/src/pi_sessions.rs Outdated
Comment thread packages/dashboard/src-tauri/src/pi_sessions.rs Outdated
Comment thread packages/cli/src/commands/setup-omp.test.ts
Comment thread packages/cli/src/commands/setup-pi.ts Outdated
return match ? [Number(match[1]), Number(match[2]), Number(match[3])] : null;
}

function isOlderThan(value: string | null, minimum: string): boolean {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: The new OMP doctor reimplements the same semver triple-parse/compare that comparePiVersion in commands/setup-pi.ts already provides for the same Pi-compatible flow. The two functions parse X.Y.Z with the identical regex and compare component-by-component, so a future change to how Pi/OMP versions are treated must be made in two places and can drift. Consider extracting a shared semver helper (e.g. in lib) and having both the Pi setup and the OMP doctor use it, matching the existing repo convention of shared CLI helpers.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/cli/src/commands/doctor-omp.ts, line 92:

<comment>The new OMP doctor reimplements the same semver triple-parse/compare that `comparePiVersion` in `commands/setup-pi.ts` already provides for the same Pi-compatible flow. The two functions parse `X.Y.Z` with the identical regex and compare component-by-component, so a future change to how Pi/OMP versions are treated must be made in two places and can drift. Consider extracting a shared semver helper (e.g. in `lib`) and having both the Pi setup and the OMP doctor use it, matching the existing repo convention of shared CLI helpers.</comment>

<file context>
@@ -0,0 +1,425 @@
+    return match ? [Number(match[1]), Number(match[2]), Number(match[3])] : null;
+}
+
+function isOlderThan(value: string | null, minimum: string): boolean {
+    const left = parseSemver(value);
+    const right = parseSemver(minimum);
</file context>

@ualtinok

ualtinok commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Hey @Lynricsy, please address cubic findings also. Thanks!

@Lynricsy

Lynricsy commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

@waltino Thanks for the detailed containment review. I addressed all five merge blockers and pushed three atomic commits:

  • c83e6d70 fix(omp): 🐛 isolate host config boundaries

    • plain Pi keeps the pre-OMP ~/.pi/agent relative-extension behavior even when PI_CODING_AGENT_DIR is set
    • OMP agent paths are consumed only after positive host identification (@oh-my-pi/pi-coding-agent package/binary); default OMP correctly falls back to ~/.omp/agent
    • PI_PACKAGE_DIR, PI_CONFIG_FILES, and project .omp/config.yml are now explicit contracts; setup/doctor refuse global omp config set writes while a higher-precedence project/overlay layer is active
    • OMP now has explicit bidirectional provider transforms (ompModelRefToCanonical / resolveModelRefForOmp) at setup and runtime boundaries, with scoped/nested selector round-trip tests
    • also closes the valid Cubic findings around failed-write rollback, absent packages restoration, invalid config arrays, refused legacy migration, Windows npm/Bun detection, and OMP doctor repair safety
  • a00685dc fix(dashboard): 🐛 gate and merge OMP discovery

    • OMP profile/XDG roots are added only after explicit OMP detection
    • detector covers GUI PATH gaps (/usr/local, Homebrew, mise/asdf/volta, Windows npm/Bun)
    • plain Pi roots remain unchanged; default OMP roots remain visible with named profiles
    • XDG scanning now matches OMP's Unix/default-agent guard
    • Pi and OMP model catalogs are merged/deduplicated instead of OMP-only selectors disappearing when Pi is installed
    • non-UTF-8 environment paths retain native bytes
  • cad987e8 test(omp): 🧪 add real runtime smoke

    • CI installs current @oh-my-pi/pi-coding-agent@latest in Docker, uses the native plugin manager, runs OMP doctor repair, and executes a real one-turn mock-provider session
    • smoke explicitly asserts process exit 0, terminal agent_end, plugin log, shared DB, and harness='pi' persistence

Verification completed:

  • real OMP 17.2.9 Docker smoke: 12 pass / 0 fail
  • repository tests: plugin 3313, Pi/OMP extension 717, CLI 309 passed + 2 skipped, all 0 failed
  • dashboard Rust: 260 passed / 0 failed
  • TypeScript typecheck and all plugin/Pi/CLI builds passed
  • CLI lint and changed provider-map Biome checks passed
  • docs: all 22 pages built
  • npm pack dry-run passed
  • git diff --check passed

Two unrelated current-master gates remain visible but were not changed/suppressed here: Dashboard ConfigEditor schema parity has four pre-existing unclassified fields (36 pass / 2 fail), and root/Pi lint reports pre-existing unused-symbol diagnostics outside these touched paths. Rust 1.77 source checking is additionally blocked before project compilation by the current lockfile's serde_spanned 1.1.1 edition-2024 manifest; the new code itself avoids post-1.77 APIs and passes the current full Cargo suite.

The branch is pushed at cad987e8 and ready for re-review.

@Lynricsy

Lynricsy commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up documentation consistency fix pushed as d231001b docs(pi): 📝 clarify host-scoped extension paths. packages/pi-plugin/README.md now matches the tested implementation: plain Pi resolves relative pi.subagent_extensions from ~/.pi/agent; only a positively identified OMP host consumes PI_CODING_AGENT_DIR, with the OMP config/profile agent directory as its fallback.

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 20 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="tests/docker/Dockerfile.omp">

<violation number="1" location="tests/docker/Dockerfile.omp:69">
P3: The new OMP E2E image isn't wired into the local runner: `tests/docker/run-e2e.sh` only accepts `opencode|pi|all`, so `run-e2e.sh omp` fails with "Unknown target" and `all` never runs it. Add an `omp` arm to `run_target` so developers can reproduce the CI e2e-omp job locally, matching the existing pi/opencode targets.</violation>
</file>

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread packages/cli/src/lib/omp-helpers.ts
Comment thread packages/dashboard/src-tauri/src/pi_sessions.rs Outdated
Comment thread packages/cli/src/commands/setup-pi.ts
Comment thread packages/plugin/src/shared/harness-provider-map.ts
Comment thread packages/dashboard/src-tauri/src/pi_sessions.rs Outdated
Comment thread packages/dashboard/src-tauri/src/pi_sessions.rs Outdated
RUN chmod +x /test/test-omp-e2e.sh

WORKDIR /test/project
ENTRYPOINT ["/test/test-omp-e2e.sh"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: The new OMP E2E image isn't wired into the local runner: tests/docker/run-e2e.sh only accepts opencode|pi|all, so run-e2e.sh omp fails with "Unknown target" and all never runs it. Add an omp arm to run_target so developers can reproduce the CI e2e-omp job locally, matching the existing pi/opencode targets.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At tests/docker/Dockerfile.omp, line 69:

<comment>The new OMP E2E image isn't wired into the local runner: `tests/docker/run-e2e.sh` only accepts `opencode|pi|all`, so `run-e2e.sh omp` fails with "Unknown target" and `all` never runs it. Add an `omp` arm to `run_target` so developers can reproduce the CI e2e-omp job locally, matching the existing pi/opencode targets.</comment>

<file context>
@@ -0,0 +1,69 @@
+RUN chmod +x /test/test-omp-e2e.sh
+
+WORKDIR /test/project
+ENTRYPOINT ["/test/test-omp-e2e.sh"]
</file context>

Comment thread tests/docker/test-omp-e2e.sh Outdated
Comment thread tests/docker/test-omp-e2e.sh
@Lynricsy

Lynricsy commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

All nine findings from the latest cubic review were valid and are fixed in f00c0dd7, 16e96e81, and 1f6d4171.

P1 — package-only OMP discovery produced an unusable binary
OMP's published CLI is a Bun script (#!/usr/bin/env bun), which Windows cannot spawn at all. PI_PACKAGE_DIR discovery now reports a package install only when a Bun runtime is resolvable, and the new getOmpCommandInvocation routes .js entries through Bun while native paths keep the existing Windows shim handling. Covered by four new tests, including the no-Bun negative case.

P1 — active-profile sessions vanished under the XDG guard
OMP exports PI_CODING_AGENT_DIR pointing at the profile agent directory, so comparing against the default one disabled XDG discovery for exactly the profile in use. The guard now compares against the active profile's expected agent directory, extracted as omp_xdg_allowed with direct unit coverage (default, profile, custom dir, non-Unix).

P2 — non-array packages was silently discarded
This was worse than a rollback gap: the success path replaced the value with [] too. writePiSettingsPackage now refuses to rewrite a non-array packages and ensurePluginEntry surfaces that as a failed registration, so user configuration is never overwritten. Regression test asserts the file is byte-identical after the refusal.

P2 — prototype-member provider ids were rewritten
remapProviderPrefix now uses Object.hasOwn, so constructor/model, toString/model, __proto__/model, and hasOwnProperty/model stay identities across all four Pi/OMP transforms.

P2 — non-executable file counted as an OMP install
PATH and fallback probes now use an executable test that checks POSIX execute permission, with a test that flips the mode bit.

P2 — OMP_PROFILE alone treated as OMP evidence
Dropped. Detection requires the same positive package/binary evidence the Pi runtime uses.

P3 — run-e2e.sh missing an omp arm
Added omp as a target and to all. Also pre-builds packages/cli dist, which both Dockerfile.pi and Dockerfile.omp COPY.

P3 — version floor not asserted
The smoke now asserts the 17.1.7 floor via sort -V -C instead of a non-empty check.

P3 — whitespace-sensitive agent_end grep
Now grep -qE '"type"[[:space:]]*:[[:space:]]*"agent_end"'.

Verification after these changes:

  • real OMP 17.2.9 Docker smoke: 12 pass / 0 fail (now including the version floor and exit-code assertions)
  • plugin 3314, Pi/OMP extension 717, CLI 313 passed + 2 skipped, all 0 failed
  • dashboard Rust: 262 passed / 0 failed; rustfmt --check clean
  • full typecheck and CLI lint pass; bash -n clean on both scripts
  • git diff --check clean

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 9 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread packages/dashboard/src-tauri/src/pi_sessions.rs Outdated
@alfonso-magic-context

Copy link
Copy Markdown
Collaborator

Full re-review done on the current branch head (1f6d417). Four of the five required changes are verified addressed with real regression coverage — the plain-Pi child-extension resolution (with the negative test proving pre-PR argv when OMP is absent), the path/config contract with the global write-scope guard, the explicit bidirectional provider mapping with round-trip tests, and the real-OMP CI job. Good work, genuinely.

Two things remain before merge:

  1. Rebase: the branch is now unmergeable against master — conflicts in packages/cli/package.json, packages/docs/src/content/docs/reference/configuration.md (now generator-owned: regenerate via bun packages/plugin/scripts/build-config-docs.ts rather than hand-editing), packages/pi-plugin/package.json, packages/pi-plugin/src/subagent-runner.test.ts, and packages/plugin/scripts/build-config-docs.ts.

  2. Dashboard scanner split (the one partial from the review): OMP roots are now gated on package/binary evidence, which fixes the unconditional scan — but they still merge into pi_compatible_session_roots rather than a separately-named OMP scanner, and the current test injects a boolean into a helper, so an unconditional public scan_pi_session_dir call would still pass. Please split the scanner and add an OMP-absent regression test through the public scan entry point (with a positive OMP-present counterpart).

With those two, this merges. Thanks for the persistence through the review rounds.

@alfonso-magic-context

Copy link
Copy Markdown
Collaborator

Thorough revision round — thank you. Re-reviewed against current master: 4 of the 5 requested changes are verified addressed, with real regression tests (the plain-Pi child-extension resolution fix in particular is exactly right, and its negative test fails on the pre-fix code as it should).

Two remaining asks before merge:

  1. Rebase onto current master — the branch now conflicts in five files (packages/cli/package.json, docs/.../configuration.md, pi-plugin/package.json, subagent-runner.test.ts, build-config-docs.ts) after the v0.35.0 prompt-surface work landed.
  2. Split the dashboard OMP scanner from the Pi scanner — OMP roots are now gated on detection (good) but still merge into pi_compatible_session_roots with no separately-named scanner. The current test exercises a helper with an injected boolean, so an unconditional public scan would still pass it. A named OMP scanner plus a regression test that performs a real scan with OMP absent (and its positive counterpart with OMP present) closes that gap.

Merge on green after those two.

Lynricsy and others added 8 commits August 10, 2026 21:46
Co-authored-by: Wine Fox <fox@ling.plus>
Co-authored-by: Wine Fox <fox@ling.plus>
Co-authored-by: Wine Fox <fox@ling.plus>
Co-authored-by: Wine Fox <fox@ling.plus>
Co-authored-by: Wine Fox <fox@ling.plus>
Co-authored-by: Wine Fox <fox@ling.plus>
Co-authored-by: Wine Fox <fox@ling.plus>
Co-authored-by: Wine Fox <fox@ling.plus>
Lynricsy and others added 12 commits August 10, 2026 21:47
Co-authored-by: Wine Fox <fox@ling.plus>
Co-authored-by: Wine Fox <fox@ling.plus>
Co-authored-by: Wine Fox <fox@ling.plus>
Co-authored-by: Wine Fox <fox@ling.plus>
Co-authored-by: Wine Fox <fox@ling.plus>
Co-authored-by: Wine Fox <fox@ling.plus>
Co-authored-by: Wine Fox <fox@ling.plus>
Co-authored-by: Wine Fox <fox@ling.plus>
Co-authored-by: Wine Fox <fox@ling.plus>
Co-authored-by: Wine Fox <fox@ling.plus>
Co-authored-by: Wine Fox <fox@ling.plus>
Co-authored-by: Wine Fox <fox@ling.plus>
Co-authored-by: Wine Fox <fox@ling.plus>
@Lynricsy

Copy link
Copy Markdown
Contributor Author

Addressed the two remaining merge asks and the outstanding named-profile XDG finding.

  • Rebasing: feat/omp-support is now based on current master (328c0fdc). The five conflict areas keep the v0.35.1 prompt-surface/package changes; packages/docs/src/content/docs/reference/configuration.md was regenerated from packages/plugin/scripts/build-config-docs.ts rather than hand-edited.
  • Scanner split: scan_pi_session_dir and scan_omp_session_dir now have separate roots and public entry points. Existing dashboard consumers use explicit Pi-compatible aggregation so OMP still retains the shared harness='pi' semantics.
  • Detection regression: the public OMP scanner is tested with a stale OMP session root both without installation evidence (excluded) and with a valid @oh-my-pi/pi-coding-agent package (included).
  • Named profiles: an active OMP profile is authoritative for its initialized XDG root even when inherited PI_CODING_AGENT_DIR is stale/custom; the default-profile and non-Unix guards remain intact.

New commits:

  • 403265c2 fix(dashboard): 🐛 split OMP session scanner
  • 76747703 fix(dashboard): 🐛 preserve profiled OMP XDG sessions

Verification on rebased head:

  • Dashboard Rust library: 220 passed, 0 failed
  • Pi session module: 16 passed, 0 failed
  • CLI: lint + typecheck + build passed; 326 passed, 2 skipped, 0 failed
  • Pi/OMP extension: typecheck + build passed; 743 passed, 0 failed
  • Docs: Astro built all 22 pages
  • touched Rust files pass rustfmt --check; generated configuration reference is reproducible; git diff --check passes

Branch force-pushed with lease and is mergeable; hosted checks are running on 76747703.

Lynricsy and others added 3 commits August 10, 2026 23:29
Co-authored-by: Wine Fox <fox@ling.plus>
Co-authored-by: Wine Fox <fox@ling.plus>
Co-authored-by: Wine Fox <fox@ling.plus>
@Lynricsy

Copy link
Copy Markdown
Contributor Author

Compared this branch directly with #297 and ported the parts that materially improve runtime behavior. Credit to @randomvariable / Naadir Jeewa for identifying and validating the strict OMP child-argv contract.

The important gap was real: #256 still emitted Pi-only child flags (--no-prompt-templates, --no-context-files) and Pi-only/extension tool names (find, ls, aft_*, ctx_*) through OMP's strict --tools parser. OMP rejects those before the extension loads, so historian/dreamer/sidekick children could exit 2 without a plugin-visible error.

Improvements now on #256:

  • host-specific child startup flags: OMP gets --no-rules; Pi retains --no-prompt-templates --no-context-files
  • Pi find/ls map to deduplicated OMP glob; extension tool names are removed from OMP's built-in-only --tools list; extension-only budgets become --no-tools
  • one host detection snapshot per argv build; ~/... package overrides work
  • named OMP profiles override stale PI_CODING_AGENT_DIR for relative child extensions
  • explicit documentation that OMP flags restrict built-ins, not discovered extension tools
  • real Docker smoke now executes a historian-shaped translated child argv and verifies exit 0 + terminal agent_end

I also fixed all seven valid findings currently reported against #297 rather than importing them:

  • dashboard expands PI_PACKAGE_DIR=~/...
  • doctor --force performs a missing-config-only repair
  • doctor DB tests explicitly redirect XDG_DATA_HOME
  • setup transaction tests use isolated temp cwd values
  • compaction accessor guard documents/allows OMP CLI string literals accurately
  • OMP version-floor smoke rejects empty/unparseable versions with numeric semver comparison
  • README documents the additional compaction-disabled ctx_reduce case

Commits:

  • 0fdc0cda fix(pi): 🐛 translate OMP subagent argv
  • d4120daa fix(cli): 🐛 complete OMP repair isolation
  • d8c2eb3e test(omp): 🧪 harden host detection smoke

Verification on d8c2eb3e:

  • real OMP 17.2.9 Docker E2E: 14 pass / 0 fail, including translated subagent argv
  • Pi/OMP extension: 746 pass / 0 fail; lint, typecheck, build pass
  • CLI: 327 pass / 2 skip / 0 fail; lint, typecheck, build pass
  • shared plugin: 3632 pass / 0 fail; typecheck pass
  • dashboard Rust library: 220 pass / 0 fail; rustfmt check passes
  • working tree clean; git diff --check passes

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 10 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread tests/docker/test-omp-e2e.sh Outdated
Co-authored-by: Wine Fox <fox@ling.plus>
@ualtinok
ualtinok merged commit 455fa5f into cortexkit:master Aug 10, 2026
5 checks passed
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.

4 participants