Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solving the cli start --character parameter doesn't work, and fixed plugin-solana issue. #4016

Closed
wants to merge 4 commits into from

Conversation

tercel
Copy link
Contributor

@tercel tercel commented Mar 20, 2025

Solving the cli start --character parameter doesn't work
Refactored SOL address handling in plugin-solana actions to use environment variables since no settings exported.
Updated task service to ensure runtime adapter readiness before execution if no plugin-sql.

Summary by CodeRabbit

  • New Features
    • Agents now conditionally initialize based on provided character options.
  • Refactor
    • Improved error logging and handling across multiple operations.
    • Updated configuration for token addresses to use environment variables.
    • Enhanced validations in transfer processing.
  • Style
    • Standardized formatting and string delimiters in configuration and test files.
  • Tests
    • Refined test formatting and removed obsolete test cases.

…d error logging for plugin loading failures and file loading issues. Enhanced character loading with better path resolution. Updated task service to ensure runtime adapter readiness before execution. Refactored SOL address handling in plugin actions to use environment variables.
Copy link
Contributor

coderabbitai bot commented Mar 20, 2025

Walkthrough

This pull request updates error handling and control flow across several packages. In the CLI, the startAgents function now accepts a Character type and conditionally initializes a new agent while adding error logging in startAgent. The server loader now logs errors instead of throwing and expands its file search paths. In the core services, TaskService now verifies the presence of a runtime and its adapter, logging warnings when necessary. Additionally, token actions in the Solana plugin now reference environment variables instead of settings, and various test files have been reformatted. An environment test suite has been removed.

Changes

File(s) Change Summary
packages/cli/src/commands/start.ts Enhanced error logging in startAgent; updated startAgents parameter type to accept Character; added conditional logic to initialize new agent if options.character is provided.
packages/cli/src/server/loader.ts Modified tryLoadFile to log errors and return null instead of throwing; added a new file path in loadCharacterTryPath for character file discovery.
packages/core/src/services/task.ts
packages/core/src/types.ts
Added runtime parameter check and error throwing in TaskService.start;
Inserted adapter availability check in checkTasks with warning logging;
Extended IDatabaseAdapter interface with an optional adapter property.
packages/plugin-solana/src/actions/swap.ts
packages/plugin-solana/src/actions/transfer.ts
Updated token address references from settings.SOL_ADDRESS to process.env.SOL_ADDRESS in swap actions; improved validation logic and added debug logging in transfer actions.
packages/plugin-storage-s3/__tests__/awsS3.test.ts
packages/plugin-storage-s3/__tests__/plugin.test.ts
packages/plugin-storage-s3/__tests__/types.test.ts
packages/plugin-storage-s3/package.json
packages/plugin-storage-s3/vitest.config.ts
Reformatted code by switching double quotes to single quotes and adjusting indentation; removed trailing space in the test script.
packages/core/__tests__/environment.test.ts Removed the entire test suite for validateCharacterConfig.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI as CLI Command
    participant SA as startAgents
    participant SAT as startAgent
    participant Logger

    User->>CLI: Initiate start command
    CLI->>SA: Call startAgents(options)
    alt options.character provided
      SA->>SAT: Call startAgent(options.character)
      SAT-->>Logger: Log error if plugin fails to load
      SA->>SA: Initialize new agent (empty plugins, no init)
    else Default character used
      SA->>SAT: Call startAgent(defaultCharacter)
    end
Loading
sequenceDiagram
    participant Caller
    participant TS as TaskService
    participant Logger

    Caller->>TS: Call start(runtime)
    alt runtime missing
        TS-->>Caller: Throw error "Runtime is required"
    else runtime provided
        TS->>TS: Execute checkTasks()
        alt adapter missing
            TS-->>Logger: Log warning "runtime adapter not ready"
            TS-->>TS: Return early from task checks
        else adapter present
            TS->>TS: Continue task processing
        end
    end
Loading

Possibly related PRs

Suggested labels

Needs Testing, Plugin_new, V2

Suggested reviewers

  • wtfsayo

Poem

In lines of code the changes flow,
Errors caught where issues grow,
Agents start with a careful beat,
Tasks and logs now extra neat!
Code dances free with a new glow 🚀

Cheers to fixes crisp and bright!


📜 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 8ee2748 and 8336c0a.

📒 Files selected for processing (1)
  • packages/core/__tests__/environment.test.ts (0 hunks)
💤 Files with no reviewable changes (1)
  • packages/core/tests/environment.test.ts

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@tercel
Copy link
Contributor Author

tercel commented Mar 20, 2025

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented Mar 20, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@tercel
Copy link
Contributor Author

tercel commented Mar 20, 2025

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented Mar 20, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@tercel
Copy link
Contributor Author

tercel commented Mar 21, 2025

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented Mar 21, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@tercel
Copy link
Contributor Author

tercel commented Mar 21, 2025

Please review this manually. Thanks.

Copy link
Contributor

coderabbitai bot commented Mar 24, 2025

Tip

For best results, initiate chat on the files or code changes.

@wtfsayo I'll trigger a full review and summary regeneration for this PR right away. This will ensure all changes are thoroughly examined regardless of previous review status. The review will analyze the code changes across all modified files, and a new comprehensive summary will be generated to highlight the key modifications and their implications.

✅ Actions performed

Full review and summary regeneration triggered.

Note: This will review all files in the PR from scratch and regenerate the summary, regardless of previous review status.

@wtfsayo
Copy link
Member

wtfsayo commented Mar 26, 2025

fixed in; #4083

@wtfsayo wtfsayo closed this Mar 26, 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.

2 participants