Skip to content

Conversation

@piiq
Copy link
Owner

@piiq piiq commented Jul 7, 2025

This pull request introduces several updates to enhance the Allocator Bot's functionality, improve its deployment process, and streamline its codebase. Key changes include the addition of Docker support, updates to environment configuration, new GitHub Actions workflows, and significant refactoring of the bot's agent logic.

Deployment and Configuration Enhancements:

  • Added a Dockerfile for multi-stage builds, enabling easy deployment of the Allocator Bot as a Docker container. The runtime stage uses a non-root user for security, and the default port is exposed as 4299.
  • Updated .env.example to include new configuration options such as S3 storage settings and renamed API_KEYS_FILE_PATH to APP_API_KEY for clarity.
  • Added .dockerignore to exclude unnecessary files from Docker builds, improving build performance.

GitHub Actions Workflows:

  • Introduced a docker-publish.yml workflow to build and publish Docker images to GitHub Container Registry on pushes to the main branch.
  • Added a lint_and_test.yml workflow to automate linting and testing on pushes and pull requests to the main branch.

Codebase Refactoring:

  • Refactored allocator_bot/agent.py to replace OpenAI models with OpenRouter models, add retry logic, and improve the structure of LLM interactions. Introduced new helper methods such as make_llm and updated the execution_loop to yield reasoning steps and tables for better SSE responses. [1] [2]
  • Added logging to allocator_bot/__main__.py and implemented a get_app function that loads environment variables and initializes the FastAPI app.

Documentation Updates:

  • Enhanced README.md with Docker setup instructions, environment variable descriptions, and updated usage details for integration with OpenBB Workspace. [1] [2] [3]

Miscellaneous:

  • Added .markdownlint.json to configure markdown linting rules, disabling MD033 and MD013.
  • Updated .cursorrules, CLAUDE.md, and GEMINI.md to include references to llms.md.

@piiq piiq marked this pull request as ready for review July 7, 2025 18:36
@piiq piiq requested a review from Copilot July 7, 2025 18:36
Copy link

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 migrates storage to optional S3-backed workflows, converts key utilities and portfolio functions to async, refactors configuration and API security, and updates packaging and deployment artifacts.

  • Introduce CloudObjectStorage with S3 support alongside LocalFileStorage and comprehensive tests.
  • Convert utils, portfolio fetch/optimize/prepare functions to async and switch to openbb_fmp for data fetching.
  • Refactor FastAPI app to use OAuth2 security with Pydantic AppConfig, update endpoint definitions, widget metadata, packaging (pyproject.toml), Dockerfile, and add Kubernetes manifests.

Reviewed Changes

Copilot reviewed 36 out of 40 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
allocator_bot/storage.py Add CloudObjectStorage, S3 logic, update tests
tests/test_storage.py New tests for S3 and local storage flows
allocator_bot/utils.py Async-ify helpers (validate_api_key, sanitize_message, generate_id)
tests/test_utils.py Update coverage for async utils
allocator_bot/portfolio.py Async portfolio functions, switch to FMPEquityHistoricalFetcher
tests/test_portfolio.py New async tests for portfolio logic
allocator_bot/api.py OAuth2 security, Pydantic config, endpoint/widget metadata refactor
pyproject.toml Migrate to [project] format, update dependencies
Dockerfile Multi-stage Docker build
k8s/*.yaml Add Kubernetes deployment, service, configmap, secret, namespace
Comments suppressed due to low confidence (2)

allocator_bot/utils.py:30

  • [nitpick] The docstring still says "total length of 4 characters" but the suffix length is now configurable. Please update the docstring to reflect that the total ID length = timestamp part length (2) + the length parameter.
async def generate_id(length: int = 2) -> str:

allocator_bot/storage.py:108

  • [nitpick] The parameter allocation_id in save_task refers to a task identifier, not an allocation. Consider renaming it to task_id for clarity.
async def save_task(allocation_id: str, task_data: dict) -> str:

@piiq piiq changed the title Feature/migrate to s3 storage Version 0.2.0 with S3, docker, bells and whistles Jul 7, 2025
@piiq piiq merged commit f1bd378 into main Jul 7, 2025
1 check passed
@piiq piiq deleted the feature/migrate-to-s3-storage branch July 7, 2025 18:46
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