Skip to content

Conversation

@leavesster
Copy link
Contributor

Summary

  • Add __oomol_llm_env_warned flag to track if warning has been sent
  • Only send warnings on first access to the property

Problem

The oomol_llm_env property called send_warning() on every access:

@property
def oomol_llm_env(self):
    # ...
    for key, value in oomol_llm_env.items():
        if value == "" or value == []:
            self.send_warning(...)  # Called every time!
    return oomol_llm_env

This violates property semantics - properties should not have side effects.

Solution

Use a flag to warn only once:

if not self.__oomol_llm_env_warned:
    self.__oomol_llm_env_warned = True
    for key, value in oomol_llm_env.items():
        if value == "" or value == []:
            self.send_warning(...)

Test Plan

  • All existing tests pass
  • Warning is only sent once on first access

Property was calling send_warning on every access, which violates
property semantics. Now only warns once on first access using a
cached flag.
Copilot AI review requested due to automatic review settings January 31, 2026 09:28
@coderabbitai
Copy link

coderabbitai bot commented Jan 31, 2026

Warning

Rate limit exceeded

@leavesster has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 5 minutes and 42 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a side effect issue in the oomol_llm_env property by preventing repeated warning messages on multiple accesses. The property previously sent warnings every time it was accessed, which violates the principle that properties should be idempotent and side-effect free.

Changes:

  • Added __oomol_llm_env_warned flag to track whether warnings have been sent
  • Modified the property to only send warnings on first access by checking the flag

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if not self.__oomol_llm_env_warned:
self.__oomol_llm_env_warned = True
for key, value in oomol_llm_env.items():
if value == "" or value == []:
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

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

The comparison value == [] on line 318 will never match the "models" value when the environment variable is empty or not set. When OOMOL_LLM_MODELS is empty, "".split(",") returns [''] (a list with one empty string), not [] (an empty list). This means warnings for empty models won't be sent as intended. Consider using value == [""] or checking value == [] or value == [""] to handle this case correctly.

Suggested change
if value == "" or value == []:
if (
(isinstance(value, str) and value == "")
or (isinstance(value, list) and (value == [] or value == [""]))
):

Copilot uses AI. Check for mistakes.
@leavesster leavesster changed the title fix: prevent oomol_llm_env property side effect on repeated access fix(oocana): prevent oomol_llm_env property side effect on repeated access Jan 31, 2026
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