Skip to content

fix(hume-ai): post emotion memories to the v2 integration import route - #14342

Merged
kodjima33 merged 1 commit into
BasedHardware:mainfrom
Suyann:fix/hume-ai-memories-route
Sep 19, 2026
Merged

kodjima33 merged 1 commit into
BasedHardware:mainfrom
Suyann:fix/hume-ai-memories-route

Conversation

@Suyann

@Suyann Suyann commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

What

create_omi_memory() in the Hume emotion plugin now posts to the Integration Import route the backend actually serves, POST /v2/integrations/{app_id}/user/memories?uid=, instead of /v1/integrations/{app_id}/memories, which returns 404 in production. Fixes #14340.

Why

backend/routers/integration.py registers only the v2 import routes; there has never been a /v1/integrations/{app_id}/memories handler. Every emotion memory the plugin tried to save was rejected with 404 {"detail":"Not Found"} and only surfaced as a ✗ Omi API error log line, so the feature silently did nothing. Live proof (no key needed — a missing route 404s, a real route asks for the key):

POST https://api.omi.me/v1/integrations/testapp/memories?uid=u1        -> 404 {"detail":"Not Found"}
POST https://api.omi.me/v2/integrations/testapp/user/memories?uid=u1   -> 401 Missing or invalid Authorization header

The backend's own public-contract test says the same: backend/tests/unit/test_integration_public_contract.py enumerates every integration route in EXPECTED_OPERATIONS and contains no /v1/integrations/... entry.

The payload the plugin sends (text, timestamp, emotions) is accepted by the v2 route (ExternalIntegrationCreateMemory requires text or memories; extra keys are ignored), so only the path changes.

Changes

  • plugins/hume-ai/app.py: route /v1/integrations/{app_id}/memories → /v2/integrations/{app_id}/user/memories (comment explains why).
  • plugins/hume-ai/test_create_omi_memory_route.py (new): hermetic regression test — stubs the Hume SDK modules and httpx.AsyncClient, calls the real create_omi_memory(), and pins the route, Authorization header and text payload; also asserts the retired /v1/ path is never used and that missing config short-circuits without a request.
  • .github/checks-manifest.yaml: registers hume-ai-create-memory-route-tests (local + ci lanes, triggered by plugins/hume-ai/**).

Tests

PYTHONUTF8=1 python3 plugins/hume-ai/test_create_omi_memory_route.py
PASS test_posts_to_v2_user_memories_route
PASS test_never_uses_retired_v1_route
PASS test_missing_config_returns_error_without_network
3 tests passed

Same test against the previous app.py fails as intended:

FAIL test_posts_to_v2_user_memories_route: https://api.omi.me/v1/integrations/app123/memories?uid=user-1
FAIL test_never_uses_retired_v1_route: https://api.omi.me/v1/integrations/a/memories?uid=u

Also run: python3 plugins/oauth/test_client_log_safety.py (OK, 5 tests), git diff --check (clean). The live user-facing path (a real Hume-detected emotion → memory in an Omi account) needs a Hume key and an enabled app with an integration API key, which I do not have; the route itself was exercised live with the curl calls above.

Failure-Class

Failure-Class: none

(scripts/failure-class prepare lists no registry class for a client hard-coding a route the server does not serve; the advisory candidates it surfaced — nonexecuting-verification-command, runtime-image-boundary, secret-printed-to-plugin-logs — do not apply.)

Invariants

scripts/pr-preflight --suggest reports no affected product invariants for this diff (plugin-only change).

Bounty

Claims the US$25 proposed in #14340; payout details will be sent to [email protected] after merge as the Contribution guide asks.

Authored with Claude Code on behalf of @Suyann; every command listed was actually run on this branch.

Review in cubic

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hume-ai route fix: root cause with live curl proof, fixes #14340, scoped (146 lines), tests pin the fix and fail on old code = 5/5. mergeStateStatus UNKNOWN after refetch -- approve only per override b.

@Git-on-my-level

Copy link
Copy Markdown
Member

Verified end to end against the backend sources:

  • plugins/hume-ai/app.py: the one-line URL swap is correct. backend/routers/integration.py:184-233 serves POST /v2/integrations/{app_id}/user/memories, and the only /v1/integrations route anywhere in the backend is notification (backend/routers/notifications.py:117, also pinned at backend/tests/unit/test_integration_public_contract.py:38) — so the old URL 404'd exactly as diagnosed. The plugin's Bearer auth header and {text, timestamp, emotions} payload are accepted by ExternalIntegrationCreateMemory (extra keys are ignored; non-empty text passes the route's 422 guard), so only the path needed to change.
  • plugins/hume-ai/test_create_omi_memory_route.py: ran it locally — 3/3 pass. Nicely hermetic (stubs the Hume SDK modules and httpx.AsyncClient, so no network), and it pins the route, Authorization header, and text payload, asserts /v1/integrations/ is never used again, and checks the missing-config path makes no request. It fails on the old code, which is what a regression pin should do.
  • .github/checks-manifest.yaml: the hume-ai-create-memory-route-tests entry registers under checks: (line 1152, above the exempt: block at line 1158) with local + ci lanes — parsed the manifest to confirm, and the triggers are scoped to plugins/hume-ai/** and the manifest itself.

One non-blocking deployment note: the v2 route enforces app capability (app_can_create_memories) and per-user app enablement, so a quick smoke test with the real hume app credentials would confirm memories now land as 200 rather than surfacing a 403 config gap.

Thanks @Suyann — excellent first contribution: live reproduction of the 404, a minimal targeted fix, and a regression test that pins the contract.

AI-generated maintainer feedback on behalf of the Omi maintainers.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Confirmed /v1/integrations/{app_id}/memories (retired, 404) still used on main; v2 route fix is correct and well-tested with live curl proof. Approve only -- PR is DIRTY (merge conflict), never rebasing branches myself.

create_omi_memory targeted POST /v1/integrations/{app_id}/memories, a path
the backend never serves (curl -X POST https://api.omi.me/v1/integrations/x/memories?uid=u
-> 404 "Not Found"). The Integration Import API (backend/routers/integration.py,
docs/doc/developer/apps/Import.mdx) is POST /v2/integrations/{app_id}/user/memories?uid=,
which answers 401 for a missing key rather than 404. Every emotion memory the
plugin tried to save was therefore rejected and only surfaced as a logged error.

Adds a hermetic regression test that stubs the Hume SDK and httpx and pins the
route, header and payload, plus its checks-manifest registration.

Verification:
- PYTHONUTF8=1 python3 plugins/hume-ai/test_create_omi_memory_route.py -> 3 tests passed
- same test against the previous app.py -> 2 FAIL (url .../v1/integrations/app123/memories)

Failure-Class: none
@Suyann
Suyann force-pushed the fix/hume-ai-memories-route branch from 0ef42c0 to c95a2da Compare September 18, 2026 16:41
@Suyann

Suyann commented Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

Resolved the merge conflict: the only conflicting file was .github/checks-manifest.yaml (several PRs append at the same spot before exempt:). The entry is now registered in a stable section of the checks list (after desktop-backend-drift-fixtures) with the same command, triggers and lanes; no code change. The branch merges cleanly against current main (git merge-tree), the regression test passes, and pr-preflight passes locally.

@Git-on-my-level

Copy link
Copy Markdown
Member

Verified the rebase — no code change, ready for a quick re-approval:

  • Compared every changed file between the previous head (0ef42c0) and the rebased head (c95a2dac): plugins/hume-ai/app.py and plugins/hume-ai/test_create_omi_memory_route.py are byte-identical. The only difference is .github/checks-manifest.yaml, where the hume-ai-create-memory-route-tests entry moved to a stable spot (after desktop-backend-drift-fixtures) to clear the merge conflict — same command, triggers, and local+ci lanes, and the manifest still parses clean (221 checks, no duplicate ids).
  • Re-ran the hermetic regression test on the rebased head in a network-isolated container: 3/3 pass, and it still fails on the pre-fix code exactly as intended, so the route pin survived the rebase.
  • One process note for @kodjima33: both approvals on this PR point at the pre-rebase head 0ef42c0, so they no longer count against c95a2dac. Since the code is verified identical apart from the manifest placement, a fresh approving review on the rebased head is all that remains once the queued CI runs finish.

Thanks again @Suyann — the conflict resolution was exactly the right scope (move the entry, touch nothing else).


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Confirmed retired /v1/integrations/.../memories route (404) still on main, correct v2 fix, hermetic test, 5/5.

@kodjima33
kodjima33 merged commit 5336699 into BasedHardware:main Sep 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

positive-signal Automation verified a genuine fix/quality contribution python

Projects

None yet

3 participants