Skip to content

[OMEGA-611] Fix startup when OPENAI_API_KEY is unset - #467

Open
MilaBooot wants to merge 3 commits into
BGI-Foundry:mainfrom
MilaBooot:fix/unset-openai-api-key
Open

MilaBooot wants to merge 3 commits into
BGI-Foundry:mainfrom
MilaBooot:fix/unset-openai-api-key

Conversation

@MilaBooot

@MilaBooot MilaBooot commented Dec 1, 2026 •

Copy link
Copy Markdown

Tracking

Fixes Omega startup/import failure when OpenAI credentials are unset, even when OpenAI functionality is not being used.

Omega imported PeTTa's lib_llm from lib_omega.metta, although it did not use its OpenAI or OpenRouter operations. Importing that library initialized the OpenAI client and raised a missing-credentials error for configurations such as provider=Test with local embeddings.

This change:

  • Removes the unused lib_llm import from lib_omega.metta.
  • Moves the small generic py-str helper into Omega's own utilities.
  • Adds regression coverage for importing Omega without OpenAI credentials.
  • Adds coverage for py-str.
  • Covers OpenAI embeddings with missing and configured credentials.
  • Avoids using a dummy API key, which could hide genuine configuration errors.
  • Explicitly initializes Omega's repository root on Python's module path, avoiding reliance on the removed lib_llm import's incidental path setup.

Expected behavior is preserved:

  • Non-OpenAI provider without OpenAI credentials: Omega starts/imports successfully.
  • OpenAI provider without OPENAI_API_KEY: Omega reports that OpenAI is not configured.
  • OpenAI provider with a configured key: existing behavior is unchanged.
  • OpenAI embeddings continue to use Omega's src/rag.py implementation.
  • Explicitly initializes Omega's repository root on Python's module path, avoiding reliance on the removed lib_llm import's incidental path setup.

Related to OMEGA-612 and PeTTa issue #325.

Real dependency/startup validation

The regression was also tested outside pytest against the actual affected dependency:

  • PeTTa main: ee5cacb6a6ecdd554a1c773aaf47e9a0f8a5af0f
  • Omega PR commit: 4dc8d81
  • OPENAI_API_KEY: unset
  • OPENAI_ADMIN_KEY: unset
  • No external LLM request was made.

Omega's real MeTTa import path completed successfully:

!(import! &self (library Omega lib_omega))
is true, should true. ✅

@MilaBooot

Copy link
Copy Markdown
Author

Hi @blackhammer116, could you please review this fix when you have time? It addresses OMEGA-612 by removing Omega's unnecessary import-time dependency on PeTTa's OpenAI initialization. The focused regressions and missing/configured credential scenarios are included in the PR description. Thank you.

@MilaBooot

Copy link
Copy Markdown
Author

@blackhammer116 The CI startup failure has been addressed in a35817b.

Removing lib_llm exposed an incidental dependency on its Python-path setup. Omega now initializes its repository import path explicitly. I reproduced the CI container startup locally: the security policy was applied and the agent reached iteration 1. Focused regressions now report 13 passed.

@blackhammer116

Copy link
Copy Markdown
Collaborator

@MilaBooot the CI is still failing

This branch has not been deployed

No deployments
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