Skip to content

Some corner cases fixed#83

Merged
sawradip merged 3 commits into
mainfrom
sawra/util_fix
Nov 12, 2025
Merged

Some corner cases fixed#83
sawradip merged 3 commits into
mainfrom
sawra/util_fix

Conversation

@sawradip
Copy link
Copy Markdown
Contributor

@sawradip sawradip commented Nov 12, 2025

Summary by CodeRabbit

  • New Features

    • Deployment now displays Agent URL (dashboard) for easier access
    • Added --minimal and --existing initialization options for flexible project setup
  • Bug Fixes

    • Added validation to ensure required agent configuration exists before deployment or local server startup

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Nov 12, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The pull request refactors CLI initialization to support existing codebase and minimal project pathways, replacing GitHub and blank options. It adds dashboard URL support to deployment results, makes agent_architecture optional in RunAgentConfig schema, and introduces validation guards for projects without configured entrypoints across multiple components.

Changes

Cohort / File(s) Summary
CLI Initialization Refactoring
runagent/cli/commands/init.py
Replaced --blank and --from-github flags with --minimal and --existing options. Updated function signature and logic to route non-interactive initialization through new pathways. Added path validation for existing codebases, interactive prompting, and RunAgentConfig creation with TemplateSource. Integrated database registration for initialized agents. Updated imports to include AGENT_CONFIG_FILE_NAME, TEMPLATE_REPO_URL, RunAgentConfig, and TemplateSource.
Schema Changes
runagent/utils/schema.py
Made template_source required and agent_architecture optional with default None. Added new fields agent_id: str and auth_settings. Enhanced to_dict() serialization to use model_dump(exclude_none=False, exclude_unset=False) with nested field conversion and post-processing. Added new model_dump_json() method.
Validation and Entrypoint Handling
runagent/utils/agent.py, runagent/sdk/rest_client.py, runagent/sdk/server/local_server.py
Added early-return guards when agent has no entrypoints configured. validate_agent() bypasses framework-specific validation and returns success state for no-entrypoint cases. _validate_entrypoint_files() returns empty list early. LocalServer.__init__() raises ValueError if entrypoints missing.
Deployment Result Handling
runagent/cli/commands/deploy.py
Extracts agent_id and dashboard_url from deployment results. Constructs default dashboard URL from agent_id if not provided. Updates output messages to display Agent ID and Agent URL instead of raw endpoint data.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI as CLI (init)
    participant Config as RunAgentConfig
    participant DB as DBService
    
    User->>CLI: init --existing /path/to/project
    CLI->>CLI: Validate path exists & is directory
    CLI->>CLI: Check no RunAgent config exists
    Note over CLI: Create new config with template_source
    CLI->>Config: RunAgentConfig(path, template_source, agent_id)
    Config->>Config: Serialize to JSON & write to AGENT_CONFIG_FILE_NAME
    CLI->>DB: DBService.add_agent(agent_id, status="initialized")
    Note over CLI: No entrypoints configured<br/>(requires manual setup)
    CLI->>User: Success: Agent initialized
Loading
sequenceDiagram
    participant Agent as RunAgent
    participant Deployer as rest_client
    participant Result as Deployment Result
    participant Output as CLI Display
    
    Agent->>Deployer: Deploy agent
    Deployer->>Result: Receive result with agent_id & dashboard_url
    alt dashboard_url provided
        Deployer->>Deployer: Use provided dashboard_url
    else dashboard_url missing
        Deployer->>Deployer: Construct URL from agent_id
    end
    Deployer->>Output: Extract & display Agent ID & Dashboard URL
    Note over Output: Old: endpoint data<br/>New: dashboard_url + agent_id
    Output->>Agent: User views agent dashboard
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45–60 minutes

  • runagent/utils/schema.py: Schema changes affecting template_source requirement, agent_architecture optionality, and new fields agent_id and auth_settings. Enhanced serialization logic with model_dump() and post-processing requires careful verification of edge cases (None values, nested conversion, empty structures).
  • runagent/cli/commands/init.py: Major refactoring introducing new control flow paths for --existing and --minimal with path validation, config generation, and database integration. Verify all branching scenarios and database registration logic.
  • Validation guard implementations across multiple files (agent.py, rest_client.py, local_server.py): Ensure early returns and error handling don't mask legitimate configuration issues; verify error messages and fail-fast behavior.
  • Integration points: Validate that schema changes propagate correctly through CLI, deployment, and validation layers; confirm backward compatibility implications for existing configurations.

Poem

🐰 A rabbit hops through schemas new,
Where templates bloom and agents spring true—
Existing codebases now find their way,
No entrypoints? No delay!
Dashboard URLs shine so bright,
Our init flow's taken flight! 🚀

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sawra/util_fix

📜 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 56ee39e and c6e80df.

📒 Files selected for processing (6)
  • runagent/cli/commands/deploy.py (1 hunks)
  • runagent/cli/commands/init.py (12 hunks)
  • runagent/sdk/rest_client.py (3 hunks)
  • runagent/sdk/server/local_server.py (1 hunks)
  • runagent/utils/agent.py (1 hunks)
  • runagent/utils/schema.py (3 hunks)

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.

@sawradip sawradip merged commit 419266a into main Nov 12, 2025
1 of 2 checks passed
This was referenced Nov 14, 2025
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.

1 participant