@virtual_builtin
Feature: Virtual built-in actors resolved on-demand from provider registry
  As an agent user
  I want built-in actors to appear immediately after init (when providers are configured)
  So that I can run actors without prior write operations

  Background:
    Given a virtual actor registry with configured providers:
      | type      | name      | model            |
      | openai    | openai    | gpt-4o           |
      | anthropic | anthropic | claude-3-opus    |

  Scenario: Actor list shows built-in actors immediately after init
    When I list virtual actors
    Then the virtual actor list should contain "openai/gpt-4o"
    And the virtual actor list should contain "anthropic/claude-3-opus"
    And the virtual actor list should show built-in flag for "openai/gpt-4o"
    And no database writes should have occurred

  Scenario: Actor show works for virtual built-in without prior materialization
    When I show virtual actor "openai/gpt-4o"
    Then the virtual actor result should have name "openai/gpt-4o"
    And the virtual actor result should be marked as built-in
    And no database writes should have occurred

  Scenario: Actor remove rejects virtual built-in with clear error
    When I try to remove virtual actor "openai/gpt-4o"
    Then a virtual actor ValidationError should be raised
    And the virtual builtin error message should mention "built-in"

  Scenario: Actor set-default persists name for virtual built-in without DB row
    When I set default virtual actor to "openai/gpt-4o"
    Then the virtual actor default name should be stored as "openai/gpt-4o"
    And no actor row should be created in the database

  Scenario: Actor get-default resolves virtual built-in from stored preference
    Given the default actor preference is set to "openai/gpt-4o"
    When I get the default virtual actor
    Then the virtual actor result should have name "openai/gpt-4o"
    And the virtual actor result should be marked as built-in
    And the virtual actor result should be marked as default

  Scenario: Actor list shows no DB writes occur
    When I list virtual actors
    Then the virtual actor service upsert_actor should not have been called
    And the virtual actor service set_default_actor should not have been called

  Scenario: Actor list with no configured providers returns empty
    Given a virtual actor registry with no configured providers
    When I list virtual actors via no-provider registry
    Then the virtual no-provider actor list should be empty

  Scenario: Custom actor takes precedence over virtual built-in with same name
    Given a custom DB actor named "openai/gpt-4o" exists
    When I list virtual actors
    Then the virtual actor list should contain "openai/gpt-4o"
    And the "openai/gpt-4o" actor in list should not be built-in
