Repository navigation
Refactor plugins shared webhook models into SDK - #8599
Conversation
There was a problem hiding this comment.
💡 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 |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
8 issues found across 29 files
Confidence score: 3/5
- In
plugins/apps-js/contracts/omi-webhook.schema.json, bothplugins_resultsandphotosare arrays withoutitems, so consumers can’t reliably validate payload shape and integrations may drift unexpectedly — define explicititemsschemas for both arrays before merging. - In
plugins/omi-plugin-sdk/src/omi_plugin_sdk/models.py, droppingapps_resultsduring 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 ofPath.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.pyfallback class naming andplugins/omi-dropbox-app/models.pyenum formatting can change generated schema/model names or renderCategoryEnum.<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
| from pydantic import BaseModel, Field | ||
| from pydantic import BaseModel | ||
|
|
||
| from omi_plugin_sdk.models import ActionItem, Conversation, EndpointResponse, Structured, TranscriptSegment |
There was a problem hiding this comment.
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>
There was a problem hiding this comment.
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" } |
There was a problem hiding this comment.
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" }, |
There was a problem hiding this comment.
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>
Summary
Closes #8559
Implements Wave 3 plugin consolidation:
plugins/omi-plugin-sdk(omi-plugin-sdk, importomi_plugin_sdk) with shared Omi webhook models and small auth/storage/webhook primitives.Structured,ActionItem,Event,ConversationPhoto,TranscriptSegment,Conversation, andEndpointResponsemodel surface into the SDK.backend/.structured.action_itemsthrough the shared SDK model.plugins/apps-jsas 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.mdwith deploy/model-surface classification:.github/workflows/gcp_plugins.yml->plugins/Dockerfile.../omi-plugin-sdk.omi-*-appservices: no duplicateStructuredimplementation found.Legacy monolith decision
Kept
plugins/main.py,_mem0,_multion,plugins/Dockerfile, andplugins/Dockerfile.datadog.Reason: active deploy evidence still builds
plugins/Dockerfileand startsuvicorn main:app. Addedplugins/LEGACY_MONOLITH.mdand kept rootplugins/models.pyas compatibility imports over the SDK.Validation
Passed:
python -m compileall backend plugins/omi-plugin-sdk plugins/omi-*-apppip install -e plugins/omi-plugin-sdk, model smoke parsingStructuredwithActionItem, andpytest -q plugins/omi-plugin-sdk/tests(3 passed)rg -n "^class Structured\(" backend plugins --glob '!**/__pycache__/**' --glob '!**/node_modules/**'returns onlyplugins/omi-plugin-sdk/src/omi_plugin_sdk/models.pyplugins/scripts/check_plugin_imports.py: checked 27 Python plugin apps; all imported and generated OpenAPI with declared temp dependency/env valuesid,structured.action_items,get_duration, and timestamped transcript passedplugins/workdir with templangchain-groqdependency and dummy non-secret env valuesNotes:
apps-js decision
No Node port. Added a JSON Schema and TypeScript declaration only:
plugins/apps-js/contracts/omi-webhook.schema.jsonplugins/apps-js/types/omi-webhook.d.tsOracle review
Initial Oracle review completed and returned must-fix findings. Addressed them by:
models/structured.pydeploy-safe for backend-only images with a compatibility fallback.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.