Skip to content

feat(providers): add Oh My Pi provider#1545

Open
ericstumper wants to merge 56 commits into
coleam00:devfrom
ericstumper:feature/omp-provider
Open

feat(providers): add Oh My Pi provider#1545
ericstumper wants to merge 56 commits into
coleam00:devfrom
ericstumper:feature/omp-provider

Conversation

@ericstumper

@ericstumper ericstumper commented May 2, 2026

Copy link
Copy Markdown

Summary

  • Problem: Archon supported Claude, Codex, and Pi providers, but had no explicit Oh My Pi provider id or adapter despite Oh My Pi using its own SDK package family and runtime behavior.
  • Why it matters: workflow authors need a clear opt-in path for Oh My Pi without changing existing claude, codex, or pi workflows, and reviewers need the provider boundary documented because it adds new SDK dependencies and optional tool/MCP capabilities.
  • What changed: added first-class community provider: omp support across provider registration, typed config, model/session resolution, event streaming, tool/skill option translation, safe config projection, binary build support, public provider exports, API capability schemas, docs, and tests.
  • What did not change (scope boundary): existing provider ids and behavior remain unchanged. OMP does not add Claude hooks, inline sub-agents, sandboxing, or cost-limit support.

UX Journey

Before

User                   Archon workflow             Provider runtime
────                   ───────────────             ────────────────
selects Claude ─────▶  provider: claude ────────▶  Claude adapter
selects Codex ──────▶  provider: codex ─────────▶  Codex adapter
selects Pi ─────────▶  provider: pi ────────────▶  Pi adapter
wants Oh My Pi ─────▶  no dedicated provider id ─▶  unsupported / ambiguous

After

User                     Archon workflow               Provider runtime
────                     ───────────────               ────────────────
selects Claude ───────▶  provider: claude ──────────▶  Claude adapter
selects Codex ────────▶  provider: codex ───────────▶  Codex adapter
selects Pi ───────────▶  provider: pi ──────────────▶  Pi adapter
selects Oh My Pi ─────▶  [provider: omp] ═══════════▶  [Oh My Pi adapter]
receives response ◀──═  normalized MessageChunk ◀═══  OMP SDK session events

Architecture Diagram

Before

packages/providers/src/types.ts
  ├── claude/provider.ts
  ├── codex/provider.ts
  └── community/pi/provider.ts

registry.ts ──▶ claude / codex / pi registrations
config-loader.ts ──▶ safe assistant fields: claude.model, codex.model, pi.model
binary build ──▶ no OMP SDK runtime import edge
docs ──▶ Claude / Codex / Pi provider guidance

After

packages/providers/src/types.ts [~]
  ├── claude/provider.ts
  ├── codex/provider.ts
  ├── community/pi/provider.ts
  └══ [+] community/omp/
        ├── provider.ts
        ├── config.ts
        ├── model-ref.ts
        ├── session-resolver.ts
        ├── event-bridge.ts
        ├── options-translator.ts
        ├── mcp-config.ts / mcp.ts
        ├── sdk-loader.ts / sdk-runtime-imports.js
        └── ui-context-stub.ts

registry.ts [~] ════════▶ [+] OMP registration
index.ts [~] ═══════════▶ [+] @archon/providers/community/omp export
provider.schemas.ts [~] ▶ provider capabilities API schema includes agents/nativeTools
config-loader.ts [~] ═══▶ safe assistant fields include omp.model only
binary build [~] ═══════▶ OMP SDK runtime import edge retained
docs [~] ═══════════════▶ OMP setup, provider boundaries, and workflow usage

Connection inventory (list every module-to-module edge, mark changes):

From To Status Notes
packages/providers/src/registry.ts packages/providers/src/community/omp/registration.ts new Registers provider id omp as a community provider.
packages/providers/src/community/omp/registration.ts packages/providers/src/community/omp/provider.ts new Lazily constructs the OMP provider.
packages/providers/src/community/omp/provider.ts OMP SDK loader/runtime imports new Loads Oh My Pi SDK modules lazily while preserving compiled-binary import edges.
packages/providers/src/community/omp/provider.ts OMP config/model/session/event/option helpers new Owns Archon-to-OMP translation without changing existing providers.
packages/providers/src/community/omp/provider.ts optional OMP MCP/UI/env integration helpers new Wires supported OMP runtime integrations with cleanup and guardrails.
packages/providers/src/types.ts workflow/config/API consumers modified Adds typed OMP provider defaults and capabilities.
packages/providers/package.json package consumers modified Adds the @archon/providers/community/omp subpath export.
packages/providers/src/index.ts public provider exports modified Exports OMP provider APIs and native-tool type from the root package.
packages/server/src/routes/schemas/provider.schemas.ts OpenAPI provider schema modified Requires agents and nativeTools in provider capability responses.
packages/core/src/config/config-loader.ts safe assistant config projection modified Exposes only assistants.omp.model to clients.
package.json / bun.lock / binary scripts OMP SDK dependency graph modified Adds OMP runtime dependencies and binary build support.
Docs users and workflow authors modified Documents OMP setup, model refs, supported fields, and boundaries.

Capability Boundary

Capability Status Notes
Dedicated provider id Supported provider: omp, separate from provider: pi.
Model refs Supported OMP uses <omp-provider-id>/<model-id>.
Session resume Supported Archon persists and reuses OMP session ids.
Tool restrictions and skills Supported Uses OMP tool names and OMP skill discovery.
Structured output Best-effort Prompt augmentation plus JSON extraction from final assistant text.
Node-scoped MCP Supported with guardrails Explicit per-node config, disabled servers filtered, manager teardown covered by tests.
Config/env/auth handling Supported with guardrails Safe client config exposes only model; runtime env/auth paths restore and isolate mutable state.
Fallback model Supported with scoped semantics Maps to OMP retry fallback chains for retryable/rate-limit failures, not arbitrary failures.
Claude hooks / inline agents / sandbox / cost limits Not supported No compatible OMP session-level equivalent is wired in this PR.

Label Snapshot

  • Risk: risk: medium
  • Size: size: XL
  • Scope: adapters|server|web|config|docs|dependencies|tests
  • Module: adapters:providers

Change Metadata

  • Change type: feature
  • Primary scope: adapters

Linked Issue

  • Closes: N/A — no linked GitHub issue exists for this feature branch.
  • Related: N/A
  • Depends on: N/A
  • Supersedes: N/A

Validation Evidence (required)

Commands and result summary:

bun test packages/providers/src/community/omp/event-bridge.test.ts packages/providers/src/registry.test.ts packages/server/src/routes/api.providers.test.ts
bun run validate

Result on branch head 6caa8863: passed.

The validation command ran:

bun run check:bundled
bun run check:bundled-skill
bun run check:bundled-schema
bun run type-check
bun run lint --max-warnings 0
bun run format:check
bun run test

Observed output included:

  • Targeted tests: 73 pass, 0 fail, 227 expect() calls across 3 files.
  • bundled-defaults.generated.ts is up to date (36 commands, 20 workflows).
  • bundled-skill.ts is up to date (23 files across 2 skills).
  • bundled-schema.generated.ts is up to date.
  • All package type checks exited with code 0.
  • ESLint passed with --max-warnings 0.
  • Prettier reported: All matched files use Prettier code style!
  • Package test suites completed with zero failures.

If any command is intentionally skipped, explain why:

  • Live OMP execution against real external model credentials was not run locally; deterministic provider tests use mocked SDK surfaces.

Security Impact (required)

  • New permissions/capabilities? (Yes)
  • New external network calls? (Yes)
  • Secrets/tokens handling changed? (Yes)
  • File system access scope changed? (Yes)
  • If any Yes, describe risk and mitigation:

Risks and mitigations:

  • OMP sessions can expose agent tools selected by workflow/config options. Mitigation: provider: omp is explicit opt-in; tool allow/deny lists are translated to OMP tool names; explicit empty tool lists are preserved.
  • OMP SDK can call external model providers selected by model ref. Mitigation: model refs are explicit and resolved before session creation.
  • Provider API keys may be passed to OMP auth storage. Mitigation: only known provider env keys are mapped; safe client config exposes only assistants.omp.model.
  • Some OMP integrations need request/config env handling. Mitigation: env mutation is scoped, restored in finally, and serialized when process env is temporarily changed.
  • Node-scoped MCP can connect tools for OMP sessions. Mitigation: MCP is explicit per node, disabled servers are filtered, missing env/connection failures are surfaced, and managers are disconnected on success and failure.

Compatibility / Migration

  • Backward compatible? (Yes)
  • Config/env changes? (Yes)
  • Database migration needed? (No)
  • If yes, exact upgrade steps:
  1. Install/update dependencies from the repository lockfile.
  2. Configure .archon/config.yaml with assistants.omp.model and any server-side OMP options needed by the host.
  3. Use provider: omp only in workflows or nodes that should run through Oh My Pi.
  4. Leave existing provider: claude, provider: codex, and provider: pi workflows unchanged.

Human Verification (required)

What was personally validated beyond CI:

  • Verified scenarios:
    • Full repository validation passed on branch head 6caa8863.
    • Targeted OMP event bridge, provider registry, package export, and provider API schema tests passed.
    • Safe config exposes assistants.omp.model without exposing OMP paths, env, extension settings, or settings overrides.
    • Public package exports expose the root OMP symbols and @archon/providers/community/omp subpath.
    • API provider capability schemas include agents, tiered structuredOutput, and nativeTools.
    • Docs distinguish Pi from Oh My Pi and document OMP setup, model refs, supported fields, and provider boundaries.
  • Edge cases checked:
    • Missing/invalid OMP model refs fail early with explicit errors.
    • Dotted OMP provider refs parse correctly.
    • Unknown OMP tools and missing skills produce warnings instead of silent success.
    • Explicit empty OMP tool lists are preserved; invalid non-string tool lists are dropped rather than broadening or clearing permissions incorrectly.
    • AsyncQueue rejects undefined, accepts null, completes when closed empty, and yields items pushed after iteration starts.
    • Config env restoration and serialization prevent cross-session process env leakage.
    • Node-scoped MCP loads tools, reports connection/env problems, and disconnects managers on success and failure.
    • OMP event bridging preserves delayed terminal result metadata, propagates terminal error details, and fails fast when a prompt resolves without the required terminal agent_end result.
    • Structured output parsing handles raw JSON, fenced JSON, prose-prefixed JSON objects, and prose-prefixed JSON arrays best-effort.
    • Fallback model configuration fails fast on invalid refs or missing credentials and maps to OMP retry fallback chain semantics.
  • What was not verified:
    • Live OMP SDK execution against real external model credentials and a real provider rate-limit event was not run in local validation.

Side Effects / Blast Radius (required)

  • Affected subsystems/workflows:
    • @archon/providers registry, package exports, provider types, OMP community provider internals, and provider tests.
    • Server OpenAPI provider capability schema and generated web API types.
    • Core safe assistant config projection.
    • Workflow authoring/provider docs.
    • Binary build dependency retention for OMP SDK packages.
  • Potential unintended effects:
    • Dependency footprint increases for @oh-my-pi/* packages and related runtime packages.
    • OMP runtime behavior depends on installed credentials, model catalog state, and optional extensions that CI cannot fully emulate.
    • OMP and Pi share base lineage but have distinct runtime surfaces; over-sharing implementation would risk hiding provider-specific behavior.
  • Guardrails/monitoring for early detection:
    • Unit tests cover OMP config parsing, model refs, option translation, auth/env mapping, session resolution, event bridging, MCP loading/teardown, queue behavior, provider sendQuery behavior, provider exports, and provider API schema shape.
    • Registry tests cover provider registration and exports.
    • Full validation suite maps to the repo's pre-PR CI expectations.

Rollback Plan (required)

  • Fast rollback command/path:
    • Revert this PR before merge, or revert the OMP provider feature changes as a unit after merge.
  • Feature flags or config toggles (if any):
    • Do not set provider: omp; existing providers continue to work.
    • Do not configure OMP-specific assistant settings if OMP behavior must remain unused.
  • Observable failure symptoms:
    • Workflows using provider: omp fail to start or emit OMP provider errors.
    • Valid OMP model refs fail lookup or parse incorrectly.
    • OMP event streams produce missing or malformed Archon message chunks.
    • OMP MCP/session cleanup errors appear in provider logs.

Risks and Mitigations

  • Risk: OMP behavior may diverge from Pi despite shared base lineage.
    • Mitigation: OMP has provider-specific config, translation, event bridge, MCP, session, queue, and registry tests.
  • Risk: Real OMP credentials/extensions are not exercised by CI.
    • Mitigation: Runtime use is opt-in through provider: omp; deterministic tests cover Archon-owned contracts and unsupported capabilities are documented.
  • Risk: New SDK dependencies may affect install size, binary bundling, or dependency resolution.
    • Mitigation: Dependencies are isolated to @archon/providers, captured in bun.lock, and validated by bundled checks plus full test/type/lint/format validation.
  • Risk: Node-scoped MCP broadens what an OMP node can reach.
    • Mitigation: MCP is explicit per node, disabled servers are filtered, tool restrictions still apply, failures are surfaced, and managers are disconnected after each session.

Summary by CodeRabbit

  • New Features

    • Added Oh My Pi (OMP) community provider with sessions, streaming results, tools/skills, MCP support, structured output, env injection, thinking/effort mapping, and fallback/retry behavior.
  • Documentation

    • Updated guides, quick reference, and getting-started with OMP examples, model formats, node options, MCP/skills guidance, capabilities, and troubleshooting.
  • Bug Fixes / Improvements

    • Preserve OMP model in safe assistant defaults and include OMP in provider validation messages.
  • Tests

    • Large expansion of test coverage for OMP workflows, parsing, bridging, MCP, options translation, and queue utilities.
  • Chores

    • Build/runtime tooling and packaging script updates.

@coderabbitai

coderabbitai Bot commented May 2, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds the Oh My Pi (OMP) community provider: config/types, SDK loader, session and MCP resolution, event-to-chunk bridge with structured-output parsing, OmpProvider orchestration, async utilities, comprehensive tests, documentation updates, registry wiring, and build/runtime dependency updates.

Changes

OMP Community Provider Implementation

Layer / File(s) Summary
Configuration and types
packages/providers/src/community/omp/config.ts, packages/providers/src/community/omp/config.test.ts, packages/providers/src/community/omp/model-ref.ts, packages/providers/src/community/omp/model-ref.test.ts, packages/providers/src/community/omp/capabilities.ts
Defines OmpProviderDefaults and nested settings types, parseOmpConfig, parseOmpModelRef, and OMP_CAPABILITIES.
SDK loader and session resolver
packages/providers/src/community/omp/sdk-loader.ts, packages/providers/src/community/omp/sdk-runtime-imports.d.ts, packages/providers/src/community/omp/sdk-runtime-imports.js, packages/providers/src/community/omp/session-resolver.ts, packages/providers/src/community/omp/session-resolver.test.ts
Typed SDK surface for OMP, dynamic runtime imports, loadOmpSdk(), and resolveOmpSession with resume/fallback handling and tests.
Async queue & UI context
packages/providers/src/community/omp/async-queue.ts, packages/providers/src/community/omp/async-queue.test.ts, packages/providers/src/community/omp/ui-context-stub.ts, packages/providers/src/community/omp/ui-context-stub.test.ts
Single-consumer AsyncQueue for streaming, and a stubbed OMP UI bridge/context for extension integration.
Options translator and env helpers
packages/providers/src/community/omp/options-translator.ts, packages/providers/src/community/omp/options-translator.test.ts
Resolves thinking/effort, tool/skill names, builds settings overrides, applies/restores config env, and computes runtime auth overrides.
MCP config loading and resolution
packages/providers/src/community/omp/mcp-config.ts, packages/providers/src/community/omp/mcp-config.test.ts, packages/providers/src/community/omp/mcp.ts
Loads MCP JSON, expands $VAR refs in env/headers, reports missing vars, constructs MCPManager sources, connects, extracts tool names, and handles cleanup/aggregate errors.
Event bridge and streaming
packages/providers/src/community/omp/event-bridge.ts, packages/providers/src/community/omp/event-bridge.test.ts
Maps OMP session events to MessageChunk arrays, builds enriched terminal result chunks (usage/error metadata), parses structured JSON output, and bridgeSession to stream chunks with lifecycle/abort/cleanup handling.
Provider implementation and tests
packages/providers/src/community/omp/provider.ts, packages/providers/src/community/omp/provider.test.ts
OmpProvider implementing IAgentProvider with sendQuery async-generator: config parsing/validation, auth discovery, model resolution, MCP wiring, env lease, extension flags, prompt augmentation for JSON schema, streaming via bridgeSession, and robust teardown. Comprehensive test coverage.
Registration & registry wiring
packages/providers/src/community/omp/registration.ts, packages/providers/src/community/omp/index.ts, packages/providers/src/registry.ts, packages/providers/src/registry.test.ts
Adds idempotent registerOmpProvider(), re-exports, and registers omp during community provider bootstrap; tests assert metadata, idempotency, and capability flags.
Core safe-config and type docs
packages/core/src/config/config-loader.ts, packages/core/src/config/config-loader.test.ts, packages/providers/src/types.ts
Adds omp: ['model'] to SAFE_ASSISTANT_FIELDS and a test to ensure safe-config sanitization; adjusts JSDoc for settingSources.
Docs: getting-started, guides, quick-reference
CLAUDE.md, packages/docs-web/src/content/docs/getting-started/ai-assistants.md, packages/docs-web/src/content/docs/getting-started/overview.md, packages/docs-web/src/content/docs/book/quick-reference.md, packages/docs-web/src/content/docs/guides/*
Adds "Oh My Pi (Community Provider)" docs, expands multi-provider guidance for node options (allowed_tools, denied_tools, skills, mcp), updates registered-provider lists to include omp, and adjusts MCP/skills compatibility notes.
Build/runtime and packaging
packages/providers/package.json, package.json, Dockerfile, scripts/build-binaries.sh, scripts/prepare-compiled-markit.ts
Adds OMP runtime deps (@oh-my-pi/*), updates test scripts to include OMP tests, bumps Bun dev-types and engine requirement to >=1.3.14, updates Docker Bun image, and adds a script to patch/restore markit-ai PDF conversion for compiled builds.
Claude provider MCP loader
packages/providers/src/claude/provider.ts
Implements a local loadMcpConfig variant (env/header $VAR expansion) used by in-file node MCP handling.
Test harness & extensive tests
many packages/providers/src/community/omp/* test files
Adds broad unit/integration test coverage across config parsing, options translation, MCP loading, session resolving, event bridging, provider behavior, async queue, and UI stubs.

Sequence Diagram (high level)

sequenceDiagram
  participant Workflow
  participant OmpProvider
  participant OmpSDK
  participant MCPManager
  participant OmpSession
  participant EventBridge
  Workflow->>OmpProvider: sendQuery(prompt, cwd, resumeId, opts)
  OmpProvider->>OmpSDK: loadOmpSdk() / refreshModelRegistry()
  OmpProvider->>MCPManager: resolveOmpMcp(...) (optional)
  OmpProvider->>OmpSDK: createAgentSession(sessionOptions)
  OmpSDK->>OmpSession: new session
  OmpProvider->>OmpSession: prompt(augmentedPrompt)
  OmpSession->>EventBridge: emit events
  EventBridge->>Workflow: yield MessageChunk(s)
  Workflow->>OmpProvider: consumer cancellation / abort
  OmpProvider->>OmpSession: dispose()
  OmpProvider->>MCPManager: disconnectAll()
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • coleam00/Archon#1505: Related safe-assistant allowlist update and provider validation messaging for new community providers.
  • coleam00/Archon#1384: Related SAFE_ASSISTANT_FIELDS and community-provider allowlist changes.
  • coleam00/Archon#1195: Related provider-ID handling and config-default selection refactor.

Suggested labels

enhancement

Suggested reviewers

  • Wirasm
  • coleam00

"I hopped through code and docs today,
Oh My Pi now joins the play.
Sessions, MCP, and event streams sing,
Tests and docs make the whole thing spring.
A rabbit cheers: new provider, hooray!" 🐇

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 89ea8bef0e

ℹ️ 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 packages/providers/src/community/omp/event-bridge.ts Outdated
Comment thread packages/providers/src/community/omp/session-resolver.ts Outdated

@coderabbitai coderabbitai 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.

Actionable comments posted: 12

🧹 Nitpick comments (1)
packages/providers/src/mcp-config.ts (1)

27-27: ⚡ Quick win

Align the log event name with the project’s structured event format.

mcp_env_value_coerced_to_string doesn’t follow the documented {domain}.{action}_{state} convention, which makes log querying less consistent.

As per coding guidelines: "Use structured logging with Pino for events following format {domain}.{action}_{state}."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/providers/src/mcp-config.ts` at line 27, Summary: The structured log
event name used in the getLog().warn call doesn’t follow the required
{domain}.{action}_{state} format. Fix: update the event name string in the
getLog().warn call in mcp-config.ts (the line calling getLog().warn({ key,
valueType: typeof val }, 'mcp_env_value_coerced_to_string')) to follow the
convention, e.g. 'mcp.env_value_coerced_to_string' (domain.action_state),
leaving the metadata object ({ key, valueType: typeof val }) unchanged; ensure
any tests or log consumers expecting the old event name are updated accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@CLAUDE.md`:
- Line 285: Add the missing "omp" provider entry to all provider lists in
CLAUDE.md to make them consistent with the new community/omp line; search for
other provider-set arrays or bullet lists that enumerate providers (e.g., the
pre-OMP provider lists and any occurrences around the existing community/omp
mention) and add the provider id `omp` (and the same descriptor style
"OmpProvider (builtIn: false) — `@oh-my-pi/pi-coding-agent`, provider id `omp`"
where appropriate) so every list matches and no sections omit `omp`.

In `@packages/docs-web/src/content/docs/guides/mcp-servers.md`:
- Line 170: Replace the internal camelCase usage `allowedTools` with the
user-facing snake_case `allowed_tools` in the sentence "When a Claude node loads
MCP servers, tool wildcards are automatically added to `allowedTools`." in the
MCP servers guide (packages/docs-web/src/content/docs/guides/mcp-servers.md);
update any nearby examples or YAML snippets in the same guide that use
`allowedTools` to `allowed_tools` so the docs and schema consistently show the
user-facing field name.

In `@packages/docs-web/src/content/docs/guides/skills.md`:
- Around line 68-69: The doc uses the camelCase key `allowedTools` but the
workflow YAML expects snake_case `allowed_tools`; update the text string in the
sentence to `allowed_tools` (wherever `allowedTools` appears in this guide) so
it matches the documented schema and examples.

In `@packages/providers/src/community/omp/config.ts`:
- Around line 9-13: The helper stringArray currently collapses empty arrays to
undefined which causes allowlist fields like toolNames to be omitted; update
stringArray so it preserves an explicit empty array (return filtered even when
filtered.length === 0) while still returning undefined when the input is not an
array or contains no string items due to type mismatch; specifically modify the
function stringArray(value: unknown) to return the filtered string[] (possibly
empty) for Array inputs so toolNames: [] remains [] rather than undefined.

In `@packages/providers/src/community/omp/event-bridge.ts`:
- Around line 337-349: The current logic pushes a {kind: 'done'} into queue when
session.prompt() resolves, which can cause early return in the for-await loop
and drop the final result; remove or change the success handler on promptPromise
so it does not enqueue 'done' on resolution, and instead enqueue the terminal
'done' only when the SDK emits its terminal event (e.g., the agent_end/result
finalization handler) that you already subscribe to; specifically update the
session.prompt promise handling around promptPromise and the queue usage so only
rejection pushes {kind: 'error'} from the promptPromise, and ensure the 'done'
item is enqueued by the agent_end or final-result handler that signals
completion (affecting promptPromise, session.prompt, queue, and the for-await
loop).

In `@packages/providers/src/community/omp/mcp.ts`:
- Around line 42-45: The connect step using sdk.MCPManager is not cleaned up on
failure: wrap the call to manager.connectServers(servers,
buildSources(serverNames, resolvedPath)) in a try/catch, and in the catch call
manager.disconnectAll() (or the appropriate cleanup method on sdk.MCPManager)
before rethrowing the error; ensure this occurs after creating manager (new
sdk.MCPManager(cwd, null)) so any partial connections are torn down and the
original error is propagated back to the caller that returns resolvedMcp.

In `@packages/providers/src/community/omp/options-translator.ts`:
- Around line 119-123: The current initialization of base treats an explicit
empty defaults.toolNames as "unset" and falls back to DEFAULT_OMP_TOOL_NAMES,
broadening permissions; change the logic in options-translator.ts so that if
defaults has an explicit toolNames property (use
Object.prototype.hasOwnProperty.call(defaults, 'toolNames') or check
defaults.toolNames !== undefined) you use that array (even if empty), otherwise
fall back to [...DEFAULT_OMP_TOOL_NAMES]; update the declaration that sets base
(the const base = ... line) to follow this presence-check semantics instead of
truthiness/length.

In `@packages/providers/src/community/omp/provider.ts`:
- Around line 60-71: The prompt string in augmentPromptForJsonSchema currently
forces "ONLY a JSON object", which breaks cases where outputFormat.schema may be
an array, string, number, or null; update the prompt to request "valid JSON
matching the schema below" (or equivalent wording) instead of specifying "JSON
object", remove any object-specific language like "Just the raw JSON object",
and ensure the instruction aligns with the parser contract so structuredOutput
can accept arrays, strings, numbers, or null as described by
outputFormat.schema.
- Around line 262-266: getRuntimeAuthOverride is only checking
requestOptions?.env and misses config-scoped env (e.g. assistants.omp.env) so
ensureProviderCredentials fails; update the call site that sets runtimeOverride
(where parsed.provider is used) to merge or pass the config env (parsed.env or
similar) together with requestOptions?.env into getRuntimeAuthOverride, and use
that merged env when calling authStorage.setRuntimeApiKey; apply the same fix
for the other occurrence around resolveSessionModel/ensureProviderCredentials
(lines near 313-315) so provider auth resolution considers config-scoped
environment variables as well.

In `@packages/providers/src/community/omp/session-resolver.ts`:
- Around line 32-38: The code currently lets errors from
sdk.SessionManager.list(...) or sdk.SessionManager.open(...) bubble up and fail
the request; modify the logic in session-resolver.ts to catch exceptions from
the resume path (both the list call and the open call) and fall back to
returning { sessionManager: sdk.SessionManager.create(cwd, dir), resumeFailed:
true } when any error occurs; specifically wrap the SessionManager.list(cwd,
dir) and the subsequent open(match.path, dir) in a try/catch around the
resumeSessionId match branch and on catch return the fresh session from
SessionManager.create with resumeFailed true.

In `@packages/providers/src/community/omp/ui-context-stub.ts`:
- Line 103: The stubbed async function custom<T>() currently returns undefined
as T; replace this with an explicit throw so unsupported calls fail fast —
update the custom<T>() implementation to immediately throw a clear
UnsupportedOperation/Error (e.g., "custom() not supported in UI context stub")
instead of returning undefined; ensure the thrown error is created inside the
async function so callers receive a rejected Promise and adjust any tests that
expected undefined accordingly.

In `@packages/providers/src/mcp-config.ts`:
- Around line 50-58: When `server.env` or `server.headers` is present, validate
they are plain non-null objects (reject arrays/other types) before calling
expandEnvVarsInRecord; replace the existing guards with checks like `server.env
!= null && typeof server.env === 'object' && !Array.isArray(server.env)` (and
similarly for `server.headers`), and if a value is present but fails the check
throw a clear error (e.g. mentioning "invalid shape for server.env" or "invalid
shape for server.headers") instead of silently skipping or passing it into
expandEnvVarsInRecord; keep using expandEnvVarsInRecord and missingVars for the
happy path.

---

Nitpick comments:
In `@packages/providers/src/mcp-config.ts`:
- Line 27: Summary: The structured log event name used in the getLog().warn call
doesn’t follow the required {domain}.{action}_{state} format. Fix: update the
event name string in the getLog().warn call in mcp-config.ts (the line calling
getLog().warn({ key, valueType: typeof val },
'mcp_env_value_coerced_to_string')) to follow the convention, e.g.
'mcp.env_value_coerced_to_string' (domain.action_state), leaving the metadata
object ({ key, valueType: typeof val }) unchanged; ensure any tests or log
consumers expecting the old event name are updated accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 99e1d94e-233c-4da7-9962-be8c98fe08d5

📥 Commits

Reviewing files that changed from the base of the PR and between 69b2c89 and 89ea8be.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (34)
  • CLAUDE.md
  • packages/core/src/config/config-loader.ts
  • packages/docs-web/src/content/docs/book/quick-reference.md
  • packages/docs-web/src/content/docs/getting-started/ai-assistants.md
  • packages/docs-web/src/content/docs/guides/authoring-workflows.md
  • packages/docs-web/src/content/docs/guides/index.md
  • packages/docs-web/src/content/docs/guides/mcp-servers.md
  • packages/docs-web/src/content/docs/guides/skills.md
  • packages/providers/package.json
  • packages/providers/src/claude/provider.ts
  • packages/providers/src/community/omp/capabilities.ts
  • packages/providers/src/community/omp/config.test.ts
  • packages/providers/src/community/omp/config.ts
  • packages/providers/src/community/omp/event-bridge.test.ts
  • packages/providers/src/community/omp/event-bridge.ts
  • packages/providers/src/community/omp/index.ts
  • packages/providers/src/community/omp/mcp.ts
  • packages/providers/src/community/omp/model-ref.test.ts
  • packages/providers/src/community/omp/model-ref.ts
  • packages/providers/src/community/omp/options-translator.test.ts
  • packages/providers/src/community/omp/options-translator.ts
  • packages/providers/src/community/omp/provider.test.ts
  • packages/providers/src/community/omp/provider.ts
  • packages/providers/src/community/omp/registration.ts
  • packages/providers/src/community/omp/sdk-loader.ts
  • packages/providers/src/community/omp/session-resolver.test.ts
  • packages/providers/src/community/omp/session-resolver.ts
  • packages/providers/src/community/omp/ui-context-stub.ts
  • packages/providers/src/index.ts
  • packages/providers/src/mcp-config.test.ts
  • packages/providers/src/mcp-config.ts
  • packages/providers/src/registry.test.ts
  • packages/providers/src/registry.ts
  • packages/providers/src/types.ts

Comment thread CLAUDE.md
Comment thread packages/docs-web/src/content/docs/guides/mcp-servers.md Outdated
Comment thread packages/docs-web/src/content/docs/guides/skills.md Outdated
Comment thread packages/providers/src/community/omp/config.ts Outdated
Comment thread packages/providers/src/community/omp/event-bridge.ts Outdated
Comment thread packages/providers/src/community/omp/provider.ts
Comment thread packages/providers/src/community/omp/provider.ts Outdated
Comment thread packages/providers/src/community/omp/session-resolver.ts Outdated
Comment thread packages/providers/src/community/omp/ui-context-stub.ts Outdated
Comment thread packages/providers/src/mcp-config.ts Outdated
@ericstumper ericstumper marked this pull request as draft May 2, 2026 21:04
@Wirasm

Wirasm commented May 4, 2026

Copy link
Copy Markdown
Collaborator

@ericstumper related to #1245 — Oh My Pi provider vs codex binary resolver security concerns.

@ericstumper

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f398084d59

ℹ️ 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 packages/providers/src/community/omp/event-bridge.ts Outdated
Comment thread packages/providers/src/community/omp/event-bridge.ts Outdated
@ericstumper

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 489c2ed3a1

ℹ️ 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 packages/providers/src/community/omp/provider.ts Outdated
Comment thread packages/providers/src/community/omp/event-bridge.ts Outdated
@ericstumper

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

ℹ️ 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".

@ericstumper

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c4d0a7a5e5

ℹ️ 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 packages/providers/src/community/omp/provider.ts
Comment thread packages/providers/src/community/omp/event-bridge.ts Outdated
@ericstumper

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d71e739550

ℹ️ 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 packages/providers/src/types.ts
@ericstumper

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 37642143b4

ℹ️ 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 packages/providers/src/community/omp/event-bridge.ts Outdated
@ericstumper

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 456093fa0e

ℹ️ 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 packages/providers/src/community/omp/provider.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 456093fa0e

ℹ️ 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 packages/providers/src/community/omp/options-translator.ts
@ericstumper

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e4c8808f67

ℹ️ 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 packages/providers/src/community/omp/event-bridge.ts Outdated
Comment thread packages/providers/src/community/omp/event-bridge.ts Outdated
@ericstumper

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fee10bb796

ℹ️ 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 packages/providers/src/community/omp/event-bridge.ts Outdated
Comment thread packages/providers/src/community/omp/config.ts Outdated
@ericstumper

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f843ea09ba

ℹ️ 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 packages/providers/src/community/omp/event-bridge.ts
@ericstumper

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

ℹ️ 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".

@ericstumper ericstumper marked this pull request as ready for review May 15, 2026 12:55
@ericstumper ericstumper force-pushed the feature/omp-provider branch from 8ec0130 to 05229cc Compare May 26, 2026 19:51
@ericstumper

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 26, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai 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.

Actionable comments posted: 9

🧹 Nitpick comments (1)
packages/providers/package.json (1)

24-24: ⚡ Quick win

Remove duplicate OMP test invocation in the test script.

src/community/omp/mcp-config.test.ts is executed twice in the same test script. This adds avoidable runtime and duplicate failure noise in CI.

💡 Suggested cleanup
-    "test": "bun test src/community/omp/mcp-config.test.ts && bun test src/claude/provider.test.ts && ... && bun test src/community/omp/mcp-config.test.ts && bun test src/community/omp/async-queue.test.ts && ..."
+    "test": "bun test src/claude/provider.test.ts && ... && bun test src/community/omp/mcp-config.test.ts && bun test src/community/omp/async-queue.test.ts && ..."

As per coding guidelines: “When adding a new test file with mock.module(), ensure its package.json test script runs it in a separate bun test invocation from any conflicting files.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/providers/package.json` at line 24, The test script in package.json
contains a duplicated entry for src/community/omp/mcp-config.test.ts which
causes the same test to run twice; edit the "test" script string to remove the
redundant src/community/omp/mcp-config.test.ts occurrence so each test path
appears only once (inspect the "test" field in packages/providers/package.json
and remove the duplicate entry for src/community/omp/mcp-config.test.ts).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/core/src/config/config-loader.test.ts`:
- Around line 536-538: The test "toSafeConfig exposes only safe OMP defaults"
references a now-undefined mockReadConfigFile; update the test to use the new
file I/O mocks (e.g., replace mockReadConfigFile with mockFsReadFile and call
mockFsReadFile.mockResolvedValue(...) or otherwise wire
mockFsWriteFile/mockFsReadFile consistently) so the test uses the current mocks;
modify the test body where mockReadConfigFile is used to call mockFsReadFile (or
add a small alias const mockReadConfigFile = mockFsReadFile) and ensure the rest
of the test references the same mock symbol.

In `@packages/docs-web/src/content/docs/book/quick-reference.md`:
- Line 143: Update the MCP provider description in the quick-reference table row
for the `mcp` option: change the provider list string that currently reads
"Claude and Oh My Pi" to include "Codex" (e.g., "Claude, Codex, and Oh My Pi")
so the `mcp` table entry matches the rest of the docs.

In `@packages/providers/src/claude/provider.ts`:
- Around line 222-228: The replacement currently done in result[key] via
val.replace(...) only matches $VAR and ignores ${VAR} syntax; update the regex
used in the val.replace call to recognize both $VAR and ${VAR} forms (capture
the variable name into varName), then look up process.env[varName], push into
missingVars when undefined, and return envVal ?? '' so both placeholder styles
are expanded; keep the existing symbols result[key], val.replace, missingVars
and process.env in the fix so the logic and error collection remain unchanged.

In `@packages/providers/src/community/omp/event-bridge.ts`:
- Around line 137-139: The parseToolInput function currently accepts arrays as
objects which can break the expected Record<string, unknown> shape for
toolInput; update parseToolInput to only return args when it is a non-null,
non-array plain object (e.g., typeof args === 'object' && args !== null &&
!Array.isArray(args')), otherwise return an empty object so callers using
toolInput get a safe Record<string, unknown>; refer to parseToolInput and any
places that consume toolInput to verify they now receive a properly-guarded
object.

In `@packages/providers/src/community/omp/options-translator.ts`:
- Around line 341-359: envFlagEnabled currently reads only process.env so
request-scoped CLAUDE_CODE_USE_FOUNDRY in the supplied env is ignored; update
the logic so the Foundry flag is read from the same request env passed into
getRuntimeAuthOverride. Either change envFlagEnabled to accept an optional env:
Record<string,string>|undefined and prefer env[envName] (falling back to
process.env[envName]) or, inside getRuntimeAuthOverride, replace
envFlagEnabled('CLAUDE_CODE_USE_FOUNDRY') with a call that checks the flag via
findEnvValue(['CLAUDE_CODE_USE_FOUNDRY'], env) (normalizing the returned value
the same way) before returning findEnvValue(['ANTHROPIC_FOUNDRY_API_KEY',
...OMP_PROVIDER_ENV_VARS.anthropic], env); ensure you reference envFlagEnabled,
getRuntimeAuthOverride, findEnvValue, CLAUDE_CODE_USE_FOUNDRY and
ANTHROPIC_FOUNDRY_API_KEY when making the change.

In `@packages/providers/src/community/omp/provider.test.ts`:
- Around line 842-845: The test uses a setTimeout-based 10ms race to detect the
second prompt entering (secondPromptEntered / resolveSecondPromptEntered), which
makes the assertion flaky; replace that timing-based approach with explicit
synchronization by wiring the test to a deterministic barrier: create a Promise
that you resolve from the exact code path where the second prompt is
enqueued/handled (e.g., the callback or mock that represents "second prompt
entered" used by the provider under test) and remove the setTimeout; update the
spots around secondPromptEntered/resolveSecondPromptEntered (and the similar
block at 898-900) so the test awaits that Promise instead of racing with
setTimeout, ensuring the promise is resolved when the provider's second prompt
handler is invoked.

In `@packages/providers/src/community/omp/provider.ts`:
- Around line 98-113: acquireConfigEnvLease currently queues waiters in
configEnvWaiters without any abort handling, so pass the caller's abort signal
(requestOptions.abortSignal) into the function and store it on the waiter
object, attach an abort event listener that removes the waiter from
configEnvWaiters and rejects the Promise with an AbortError if triggered, and
ensure the listener is removed when the waiter resolves (both in the resolve
callback pushed into configEnvWaiters and inside
createReaderRelease/createWriterRelease cleanup) so cancelled callers are
removed and don't later acquire the lease; also check signal.aborted before
pushing a waiter to short-circuit immediate aborts and ensure
flushConfigEnvWaiters still works with the augmented waiter shape.

In `@packages/providers/src/community/omp/sdk-loader.ts`:
- Around line 3-117: The file declares local duplicates of the OMP SDK types
(e.g., OmpAuthStorage, OmpModelRegistry, OmpMcpManager,
OmpCreateAgentSessionOptions/Result, OmpCodingAgentSdk) which risks drifting
from the real SDK surface; remove these local interface/type declarations and
instead use "import type" to pull the official types from
`@oh-my-pi/pi-coding-agent` (e.g., SessionManager, MCPManager,
CreateAgentSessionOptions, CreateAgentSessionResult, and exported extension
APIs), then update any structural casts and variable signatures in sdk-loader.ts
to use the imported SDK types and keep only Archon-specific adapter types/glue
in this file.

In `@packages/providers/src/community/omp/session-resolver.ts`:
- Around line 43-59: The code wraps non-missing errors from
sdk.SessionManager.open twice (both in the inner catch and again in the outer
catch), producing duplicated "Oh My Pi session resume failed..." text; to fix,
change the inner catch (around sdk.SessionManager.open) to rethrow the original
error (throw error) instead of throwing a new Error, or alternatively remove the
inner wrapping so only the outer catch constructs the new Error; target the
catch blocks that reference sdk.SessionManager.open, isMissingSessionError and
resumeSessionId and ensure only one place creates the `new Error('Oh My Pi
session resume failed...')`.

---

Nitpick comments:
In `@packages/providers/package.json`:
- Line 24: The test script in package.json contains a duplicated entry for
src/community/omp/mcp-config.test.ts which causes the same test to run twice;
edit the "test" script string to remove the redundant
src/community/omp/mcp-config.test.ts occurrence so each test path appears only
once (inspect the "test" field in packages/providers/package.json and remove the
duplicate entry for src/community/omp/mcp-config.test.ts).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6d0655a4-45fd-4040-a8a5-80c74337a82e

📥 Commits

Reviewing files that changed from the base of the PR and between ea7c021 and 05229cc.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (45)
  • CLAUDE.md
  • Dockerfile
  • package.json
  • packages/core/src/config/config-loader.test.ts
  • packages/core/src/config/config-loader.ts
  • packages/docs-web/src/content/docs/book/quick-reference.md
  • packages/docs-web/src/content/docs/getting-started/ai-assistants.md
  • packages/docs-web/src/content/docs/getting-started/overview.md
  • packages/docs-web/src/content/docs/guides/authoring-workflows.md
  • packages/docs-web/src/content/docs/guides/index.md
  • packages/docs-web/src/content/docs/guides/mcp-servers.md
  • packages/docs-web/src/content/docs/guides/skills.md
  • packages/providers/package.json
  • packages/providers/src/claude/provider.ts
  • packages/providers/src/community/omp/async-queue.test.ts
  • packages/providers/src/community/omp/async-queue.ts
  • packages/providers/src/community/omp/capabilities.ts
  • packages/providers/src/community/omp/config.test.ts
  • packages/providers/src/community/omp/config.ts
  • packages/providers/src/community/omp/event-bridge.test.ts
  • packages/providers/src/community/omp/event-bridge.ts
  • packages/providers/src/community/omp/index.ts
  • packages/providers/src/community/omp/mcp-config.test.ts
  • packages/providers/src/community/omp/mcp-config.ts
  • packages/providers/src/community/omp/mcp.ts
  • packages/providers/src/community/omp/model-ref.test.ts
  • packages/providers/src/community/omp/model-ref.ts
  • packages/providers/src/community/omp/options-translator.test.ts
  • packages/providers/src/community/omp/options-translator.ts
  • packages/providers/src/community/omp/provider.test.ts
  • packages/providers/src/community/omp/provider.ts
  • packages/providers/src/community/omp/registration.ts
  • packages/providers/src/community/omp/sdk-loader.ts
  • packages/providers/src/community/omp/sdk-runtime-imports.d.ts
  • packages/providers/src/community/omp/sdk-runtime-imports.js
  • packages/providers/src/community/omp/session-resolver.test.ts
  • packages/providers/src/community/omp/session-resolver.ts
  • packages/providers/src/community/omp/ui-context-stub.test.ts
  • packages/providers/src/community/omp/ui-context-stub.ts
  • packages/providers/src/index.ts
  • packages/providers/src/registry.test.ts
  • packages/providers/src/registry.ts
  • packages/providers/src/types.ts
  • scripts/build-binaries.sh
  • scripts/prepare-compiled-markit.ts
💤 Files with no reviewable changes (6)
  • packages/providers/src/types.ts
  • packages/providers/src/registry.ts
  • scripts/build-binaries.sh
  • packages/providers/src/registry.test.ts
  • packages/providers/src/index.ts
  • scripts/prepare-compiled-markit.ts
✅ Files skipped from review due to trivial changes (8)
  • packages/providers/src/community/omp/index.ts
  • packages/docs-web/src/content/docs/getting-started/overview.md
  • CLAUDE.md
  • packages/docs-web/src/content/docs/guides/skills.md
  • packages/docs-web/src/content/docs/guides/index.md
  • Dockerfile
  • packages/docs-web/src/content/docs/getting-started/ai-assistants.md
  • packages/providers/src/community/omp/options-translator.test.ts

Comment thread packages/core/src/config/config-loader.test.ts
Comment thread packages/docs-web/src/content/docs/book/quick-reference.md Outdated
Comment thread packages/providers/src/claude/provider.ts Outdated
Comment thread packages/providers/src/community/omp/event-bridge.ts
Comment thread packages/providers/src/community/omp/options-translator.ts Outdated
Comment thread packages/providers/src/community/omp/provider.test.ts Outdated
Comment thread packages/providers/src/community/omp/provider.ts Outdated
Comment thread packages/providers/src/community/omp/sdk-loader.ts
Comment thread packages/providers/src/community/omp/session-resolver.ts Outdated
@Wirasm

Wirasm commented May 27, 2026

Copy link
Copy Markdown
Collaborator

@ericstumper this PR looks similar to #1616, which was closed on 2026-05-08 (closed without merging). You may want to read the discussion there before pushing further.

@ericstumper

Copy link
Copy Markdown
Author

@Wirasm are these automated comments?

This or is not about opencode.

In the last comment of yours it said: "The OMP provider implementation is excellent — solid error handling, comprehensive tests, clean resource cleanup, and thoughtful patterns (the config-env lease mechanism, AsyncQueue single-consumer enforcement, MCP teardown covering both Archon-resolved and SDK-managed sessions). Two critical issues must be addressed before this can merge."

I tried to fix your remarks but couldn't review all the latest changes yet that the agent pushed for review.

@ericstumper

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/providers/src/claude/provider.test.ts`:
- Around line 101-120: The test that manipulates
process.env.TEST_CLAUDE_MCP_TOKEN should preserve and restore any pre-existing
value instead of always deleting it; update the test 'expands ${VAR}
placeholders in env and headers' to capture the original value (e.g. const prev
= process.env.TEST_CLAUDE_MCP_TOKEN) before setting it, and in the finally block
restore it by setting process.env.TEST_CLAUDE_MCP_TOKEN = prev when prev is
defined or deleting the variable only when prev is undefined (delete
process.env.TEST_CLAUDE_MCP_TOKEN); this ensures deterministic tests and avoids
leaking environment state.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7c669f2f-be5c-4cda-ae88-351952782cda

📥 Commits

Reviewing files that changed from the base of the PR and between 05229cc and 6db22ea.

📒 Files selected for processing (13)
  • packages/core/src/config/config-loader.test.ts
  • packages/docs-web/src/content/docs/book/quick-reference.md
  • packages/providers/src/claude/provider.test.ts
  • packages/providers/src/claude/provider.ts
  • packages/providers/src/community/omp/event-bridge.test.ts
  • packages/providers/src/community/omp/event-bridge.ts
  • packages/providers/src/community/omp/mcp-config.test.ts
  • packages/providers/src/community/omp/mcp-config.ts
  • packages/providers/src/community/omp/options-translator.test.ts
  • packages/providers/src/community/omp/options-translator.ts
  • packages/providers/src/community/omp/provider.test.ts
  • packages/providers/src/community/omp/provider.ts
  • packages/providers/src/community/omp/session-resolver.ts
✅ Files skipped from review due to trivial changes (1)
  • packages/docs-web/src/content/docs/book/quick-reference.md
🚧 Files skipped from review as they are similar to previous changes (11)
  • packages/core/src/config/config-loader.test.ts
  • packages/providers/src/community/omp/mcp-config.test.ts
  • packages/providers/src/community/omp/mcp-config.ts
  • packages/providers/src/community/omp/session-resolver.ts
  • packages/providers/src/claude/provider.ts
  • packages/providers/src/community/omp/options-translator.test.ts
  • packages/providers/src/community/omp/event-bridge.ts
  • packages/providers/src/community/omp/provider.ts
  • packages/providers/src/community/omp/event-bridge.test.ts
  • packages/providers/src/community/omp/options-translator.ts
  • packages/providers/src/community/omp/provider.test.ts

Comment thread packages/providers/src/claude/provider.test.ts
@ericstumper

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 31, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

# Conflicts:
#	CLAUDE.md
#	bun.lock
#	packages/docs-web/src/content/docs/guides/authoring-workflows.md
#	packages/docs-web/src/content/docs/guides/skills.md
#	packages/providers/package.json
Also mark OMP structured output as best-effort and fail fast when the prompt resolves before the terminal agent_end result arrives.
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.

2 participants