Skip to content

Refactor plugins shared webhook models into SDK - #8599

Merged
Git-on-my-level merged 2 commits into
mainfrom
codex/wave3-plugin-consolidation-8559
Jun 29, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
codex/wave3-plugin-consolidation-8559

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Jun 29, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes #8559

Implements Wave 3 plugin consolidation:

  • Adds neutral Python SDK at plugins/omi-plugin-sdk (omi-plugin-sdk, import omi_plugin_sdk) with shared Omi webhook models and small auth/storage/webhook primitives.
  • Moves the canonical Structured, ActionItem, Event, ConversationPhoto, TranscriptSegment, Conversation, and EndpointResponse model surface into the SDK.
  • Converts backend/root/plugin model files into SDK-backed compatibility layers where possible; backend keeps a local fallback for backend images that copy only backend/.
  • Migrates duplicated Omi webhook model definitions in Dropbox, Linear, Hive, Shopify, and ShipBob; Dropbox now parses structured.action_items through the shared SDK model.
  • Keeps plugins/apps-js as Node and adds only a typed webhook contract (contracts/omi-webhook.schema.json, types/omi-webhook.d.ts).

Audit matrix summary

Added plugins/PLUGIN_REFACTOR_AUDIT.md with deploy/model-surface classification:

  • Root monolith: active deploy evidence via .github/workflows/gcp_plugins.yml -> plugins/Dockerfile.
  • Migrated Python apps: Dropbox, Linear, Hive, Shopify, ShipBob install SDK from sibling ../omi-plugin-sdk.
  • Other Python omi-*-app services: no duplicate Structured implementation found.
  • apps-js: remains Node, no SDK port.

Legacy monolith decision

Kept plugins/main.py, _mem0, _multion, plugins/Dockerfile, and plugins/Dockerfile.datadog.

Reason: active deploy evidence still builds plugins/Dockerfile and starts uvicorn main:app. Added plugins/LEGACY_MONOLITH.md and kept root plugins/models.py as compatibility imports over the SDK.

Validation

Passed:

  • python -m compileall backend plugins/omi-plugin-sdk plugins/omi-*-app
  • Fresh venv SDK install: pip install -e plugins/omi-plugin-sdk, model smoke parsing Structured with ActionItem, and pytest -q plugins/omi-plugin-sdk/tests (3 passed)
  • Exact grep: rg -n "^class Structured\(" backend plugins --glob '!**/__pycache__/**' --glob '!**/node_modules/**' returns only plugins/omi-plugin-sdk/src/omi_plugin_sdk/models.py
  • plugins/scripts/check_plugin_imports.py: checked 27 Python plugin apps; all imported and generated OpenAPI with declared temp dependency/env values
  • Dropbox shared model smoke: id, structured.action_items, get_duration, and timestamped transcript passed
  • Backend structured compatibility smoke: category fallback/string/event helper passed
  • Legacy monolith import/OpenAPI smoke: passed from plugins/ workdir with temp langchain-groq dependency and dummy non-secret env values
  • apps-js contract check: JSON parses and schema/type coverage includes webhook, action items, transcript segments, and plugin results
  • Pre-push hooks passed

Notes:

  • A broader ad hoc backend pytest invocation for unrelated model-split/action-item tests still has test-harness path/module-stubbing failures in this manual setup. Direct backend imports for the relevant modules passed, and compileall plus targeted compatibility smokes passed.

apps-js decision

No Node port. Added a JSON Schema and TypeScript declaration only:

  • plugins/apps-js/contracts/omi-webhook.schema.json
  • plugins/apps-js/types/omi-webhook.d.ts

Oracle review

Initial Oracle review completed and returned must-fix findings. Addressed them by:

  • Ensuring all new SDK/docs/scripts/apps-js files are staged and included.
  • Switching SDK requirements from editable installs to non-editable local path installs.
  • Making backend models/structured.py deploy-safe for backend-only images with a compatibility fallback.
  • Adding Dropbox-compatible SDK regression tests.
  • Smoke-testing the legacy monolith import/OpenAPI path.
  • Including and validating apps-js contract files.
  • Grepping SDK/scripts for token/secret logging risk; no logging of extracted bearer tokens was added.

Follow-up Oracle retry attempts failed due Oracle browser transport/upstream errors after the first review completed. Must-fix feedback from the completed review was addressed before opening this PR.

Review in cubic

@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: 1f70ee265d

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

from pydantic import BaseModel, Field
from pydantic import BaseModel

from omi_plugin_sdk.models import ActionItem, Conversation, EndpointResponse, Structured, TranscriptSegment

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 Badge Preserve category rendering for Dropbox summaries

When Dropbox receives a conversation, generate_summary_markdown() still interpolates structured.category directly (plugins/omi-dropbox-app/main.py:151). Importing the SDK model here changes that field from the plugin's previous plain str to a Python Enum; f"{CategoryEnum.work}" renders as CategoryEnum.work, so saved Dropbox summary.md files get a broken Category value instead of work. Either expose/use enum values for the SDK model or update this migrated consumer to render .value.

Useful? React with 👍 / 👎.

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

8 issues found across 29 files

Confidence score: 3/5

  • In plugins/apps-js/contracts/omi-webhook.schema.json, both plugins_results and photos are arrays without items, so consumers can’t reliably validate payload shape and integrations may drift unexpectedly — define explicit items schemas for both arrays before merging.
  • In plugins/omi-plugin-sdk/src/omi_plugin_sdk/models.py, dropping apps_results during webhook conversation parsing can silently discard app insight payloads, which is concrete data-loss behavior for SDK users — preserve/alias the current backend field and add a regression test before merge.
  • In plugins/scripts/check_plugin_imports.py, use of Path.is_relative_to() and newer typing syntax can break the smoke script in the documented Python 3.7+ environment, risking false failures or unusable tooling for plugin developers — switch to 3.7-compatible path/type patterns (or explicitly raise the minimum Python version) before merging.
  • backend/models/structured.py fallback class naming and plugins/omi-dropbox-app/models.py enum formatting can change generated schema/model names or render CategoryEnum.<name> in summaries, creating avoidable compatibility/UX regressions — align fallback models to public names and format categories via .value (or preserve string categories) before merge.
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="plugins/omi-dropbox-app/models.py">

<violation number="1" location="plugins/omi-dropbox-app/models.py:7">
P3: Dropbox summary markdown now renders categories as `CategoryEnum.<name>` instead of the category value. Use `.value` when formatting or preserve a string category in the compatibility model.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread plugins/scripts/check_plugin_imports.py Resolved
Comment thread plugins/scripts/check_plugin_imports.py Resolved
Comment thread backend/models/structured.py Resolved
from pydantic import BaseModel, Field
from pydantic import BaseModel

from omi_plugin_sdk.models import ActionItem, Conversation, EndpointResponse, Structured, TranscriptSegment

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: Dropbox summary markdown now renders categories as CategoryEnum.<name> instead of the category value. Use .value when formatting or preserve a string category in the compatibility model.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At plugins/omi-dropbox-app/models.py, line 7:

<comment>Dropbox summary markdown now renders categories as `CategoryEnum.<name>` instead of the category value. Use `.value` when formatting or preserve a string category in the compatibility model.</comment>

<file context>
@@ -1,113 +1,16 @@
-from pydantic import BaseModel, Field
+from pydantic import BaseModel
+
+from omi_plugin_sdk.models import ActionItem, Conversation, EndpointResponse, Structured, TranscriptSegment
 
 
</file context>

@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 12 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="plugins/apps-js/contracts/omi-webhook.schema.json">

<violation number="1" location="plugins/apps-js/contracts/omi-webhook.schema.json:86">
P2: photos.items missing required array — base64 should be required. All other typed item schemas in this file (action_items, events, transcript_segments) declare required. A photo object without base64 data is semantically meaningless but validates as-is.</violation>

<violation number="2" location="plugins/apps-js/contracts/omi-webhook.schema.json:102">
P2: plugins_results.items missing required array — content should be required. The pattern across action_items, events, and transcript_segments is to require the essential data field. Without it, a plugin result with no content validates.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

"additionalProperties": true,
"properties": {
"app_id": { "type": ["string", "null"] },
"content": { "type": "string" }

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: plugins_results.items missing required array — content should be required. The pattern across action_items, events, and transcript_segments is to require the essential data field. Without it, a plugin result with no content validates.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At plugins/apps-js/contracts/omi-webhook.schema.json, line 102:

<comment>plugins_results.items missing required array — content should be required. The pattern across action_items, events, and transcript_segments is to require the essential data field. Without it, a plugin result with no content validates.</comment>

<file context>
@@ -75,7 +75,45 @@
+        "additionalProperties": true,
+        "properties": {
+          "app_id": { "type": ["string", "null"] },
+          "content": { "type": "string" }
+        }
+      }
</file context>

"additionalProperties": true,
"properties": {
"id": { "type": ["string", "null"] },
"base64": { "type": "string" },

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: photos.items missing required array — base64 should be required. All other typed item schemas in this file (action_items, events, transcript_segments) declare required. A photo object without base64 data is semantically meaningless but validates as-is.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At plugins/apps-js/contracts/omi-webhook.schema.json, line 86:

<comment>photos.items missing required array — base64 should be required. All other typed item schemas in this file (action_items, events, transcript_segments) declare required. A photo object without base64 data is semantically meaningless but validates as-is.</comment>

<file context>
@@ -75,7 +75,45 @@
+        "additionalProperties": true,
+        "properties": {
+          "id": { "type": ["string", "null"] },
+          "base64": { "type": "string" },
+          "description": { "type": ["string", "null"] },
+          "created_at": { "type": ["string", "null"], "format": "date-time" },
</file context>

@Git-on-my-level
Git-on-my-level merged commit d428988 into main Jun 29, 2026
4 checks passed
@Git-on-my-level
Git-on-my-level deleted the codex/wave3-plugin-consolidation-8559 branch June 29, 2026 19:34
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.

[tech-debt] plugins: consolidate three competing architectures + dedupe Structured (defined 7 times with drift)

1 participant