Skip to content

Conversation

@KYN4
Copy link
Collaborator

@KYN4 KYN4 commented Oct 24, 2025

Summary by CodeRabbit

  • New Features
    • Added optional control over profile validation during agent configuration builds, allowing validation to be enabled or skipped when constructing configurations.
  • Chores
    • Project version bumped to 2.7.2.

@KYN4 KYN4 requested review from cguiguet and plfavreau October 24, 2025 09:39
@KYN4 KYN4 self-assigned this Oct 24, 2025
@KYN4 KYN4 added the bug Something isn't working label Oct 24, 2025
@coderabbitai
Copy link

coderabbitai bot commented Oct 24, 2025

Walkthrough

Adds a validation control flag that is threaded through profile addition and build steps, allowing optional profile validation and influencing default-profile selection and creation during AgentConfigBuilder.build().

Changes

Cohort / File(s) Summary
Profile validation control
minitap/mobile_use/sdk/builders/agent_config_builder.py
Added optional validate parameter to add_profile() and propagated to add_profiles(). Extended build(validate_profiles: bool = True) to control profile validation. Conditionalized default-profile addition and LLM-config selection to honor the flag.
Version bump
pyproject.toml
Updated package version from 2.7.1 to 2.7.2.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Builder as AgentConfigBuilder
    participant Validator as ProfileValidator
    participant ConfigRepo as ConfigDefaults

    Client->>Builder: add_profiles(profiles, validate=True)
    loop per profile
        Builder->>Builder: add_profile(profile, validate)
        alt validate == True
            Builder->>Validator: validate(profile)
            Validator-->>Builder: validation result
        end
    end

    Client->>Builder: build(validate_profiles=True)
    Builder->>Builder: if no profiles -> request default
    alt no profiles
        Builder->>ConfigRepo: get_default_minitap_llm_config(validate=validate_profiles)
        ConfigRepo-->>Builder: default_profile
        Builder->>Builder: add_profile(default_profile, validate=validate_profiles)
    else profiles exist
        Builder->>ConfigRepo: get_default_llm_config()
        ConfigRepo-->>Builder: default_profile
        Builder->>Builder: use existing profiles (no forced add)
    end
    Builder-->>Client: final configuration
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I hopped through fields of code tonight,
A flag in paw to make things right,
Validate when you wish, or let it be,
Default profiles spring more gently.
Hooray — a tidy change from me! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "fix(sdk): allow LLM config validation to to be disabled" directly relates to the main change in the changeset. The primary modification adds a validate_profiles parameter to the build() method and propagates it through the configuration logic, enabling developers to control whether LLM config validation occurs. The title accurately captures this core functionality—allowing validation to be disabled—and is specific enough that a teammate reviewing history would understand the change's purpose without examining the full diff.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch disable-llm-config-validation

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fe9b671 and 4d72db8.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • pyproject.toml (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • pyproject.toml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: dockerhub
  • GitHub Check: docker-gcp

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Collaborator

@plfavreau plfavreau left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (5)
minitap/mobile_use/sdk/builders/agent_config_builder.py (5)

49-59: Document the new validate parameter and consider guarding duplicate names.

  • Docstring omits validate; please document its purpose and side effects.
  • Optional: prevent silent overwrites when adding a profile with an existing name.

Apply this doc tweak:

 def add_profile(self, profile: AgentProfile, validate: bool = True) -> "AgentConfigBuilder":
     """
     Add an agent profile to the mobile-use agent.
 
     Args:
-        profile: The agent profile to add
+        profile: The agent profile to add.
+        validate: When True (default), run profile.llm_config.validate_providers().
     """
-    self._agent_profiles[profile.name] = profile
+    # Optionally guard duplicates (consider raising or warning instead if you prefer):
+    # if profile.name in self._agent_profiles:
+    #     raise ValueError(f"Profile '{profile.name}' already exists")
+    self._agent_profiles[profile.name] = profile
     if validate:
         profile.llm_config.validate_providers()
     return self

61-65: Propagate and document validate in add_profiles; consider Sequence over list.

  • Docstring also omits validate.
  • Using collections.abc.Sequence improves flexibility for callers.

Doc + type tweaks:

-from typing import List
+from collections.abc import Sequence
@@
-    def add_profiles(
-        self,
-        profiles: list[AgentProfile],
-        validate: bool = True,
-    ) -> "AgentConfigBuilder":
+    def add_profiles(
+        self,
+        profiles: Sequence[AgentProfile],
+        validate: bool = True,
+    ) -> "AgentConfigBuilder":
         """
         Add multiple agent profiles to the mobile-use agent.
 
         Args:
-            profiles: List of agent profiles to add
+            profiles: Agent profiles to add.
+            validate: When True (default), validate each profile’s providers.
         """
     for profile in profiles:
         self.add_profile(profile=profile, validate=validate)

Also applies to: 73-74


169-181: build() docstring still references default_profile arg; document validate_profiles and intent.

The signature adds validate_profiles but the docstring mentions a non-existent argument. Please align docs and clarify what gets validated at build.

Doc fix:

 def build(self, validate_profiles: bool = True) -> AgentConfig:
     """
     Build the mobile-use AgentConfig object.
 
-    Args:
-        default_profile: Name of the default agent profile to use
+    Args:
+        validate_profiles: When True (default), validate providers for profiles created/added during build
+        (e.g., inferred default). Existing profiles added earlier are not revalidated unless you choose to
+        validate them below.
 
     Returns:
         A configured AgentConfig object

Optional: if you intend validate_profiles=True to validate all configured profiles at build time, add:

@@
-        else:
+        else:
             available_profiles = ", ".join(self._agent_profiles.keys())
             raise ValueError(
                 f"You must call with_default_profile() to select one among: {available_profiles}"
             )
 
-        return AgentConfig(
+        # Optional: validate all existing profiles when requested
+        if validate_profiles:
+            for p in self._agent_profiles.values():
+                p.llm_config.validate_providers()
+
+        return AgentConfig(

If you prefer not to revalidate, consider renaming the arg to validate_default_profile for clarity.


192-203: Default-profile path: behavior when validate_profiles=False may mask missing credentials.

With validate_profiles=False, get_default_minitap_llm_config(validate=False) returns a minitap config even without MINITAP_API_KEY, producing a default profile that will likely fail later at runtime.

  • This matches the PR goal (disable validation), but consider logging a warning when returning a minitap config without credentials to aid debugging.
  • Alternatively, prefer get_default_llm_config() unless an explicit “prefer_minitap” flag is set.

Would you like a follow-up patch to emit a warning when validate_profiles=False and MINITAP_API_KEY is unset?


212-220: Return-time immutability: copy agent_profiles to avoid external mutation post-build.

Builder currently returns internal dict; subsequent external mutation can affect a built AgentConfig.

Minimal change:

-        return AgentConfig(
-            agent_profiles=self._agent_profiles,
+        return AgentConfig(
+            agent_profiles=copy.deepcopy(self._agent_profiles),
             task_request_defaults=self._task_request_defaults or TaskRequestCommon(),
             default_profile=default_profile,
             device_id=self._device_id,
             device_platform=self._device_platform,
             servers=self._servers,
             graph_config_callbacks=self._graph_config_callbacks,
         )
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 17193b8 and fe9b671.

📒 Files selected for processing (1)
  • minitap/mobile_use/sdk/builders/agent_config_builder.py (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
minitap/mobile_use/sdk/builders/agent_config_builder.py (3)
minitap/mobile_use/sdk/types/task.py (1)
  • AgentProfile (20-56)
minitap/mobile_use/config.py (3)
  • validate_providers (165-172)
  • get_default_minitap_llm_config (243-292)
  • get_default_llm_config (193-240)
minitap/mobile_use/sdk/types/agent.py (1)
  • AgentConfig (57-78)

@KYN4 KYN4 merged commit 346eda6 into main Oct 24, 2025
9 checks passed
@KYN4 KYN4 deleted the disable-llm-config-validation branch October 24, 2025 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants