Skip to content

fix: get new actors working on docker compose #2623

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

Open
wants to merge 1 commit into
base: 06-19-fix_figure_out_actor_log_shipping
Choose a base branch
from

Conversation

MasterPtato
Copy link
Contributor

Changes

Copy link
Contributor Author

MasterPtato commented Jun 20, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add the label merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link

cloudflare-workers-and-pages bot commented Jun 20, 2025

Deploying rivet with  Cloudflare Pages  Cloudflare Pages

Latest commit: b935bff
Status:🚫  Build failed.

View logs

@MasterPtato MasterPtato force-pushed the 06-20-fix_get_new_actors_working_on_docker_compose branch from a07e898 to 5a69df2 Compare June 20, 2025 19:09
@MasterPtato MasterPtato force-pushed the 06-19-fix_figure_out_actor_log_shipping branch from d29889c to 6f7e9a1 Compare June 20, 2025 19:09
@MasterPtato MasterPtato force-pushed the 06-20-fix_get_new_actors_working_on_docker_compose branch from 5a69df2 to e8d4467 Compare June 20, 2025 19:52
@MasterPtato MasterPtato force-pushed the 06-19-fix_figure_out_actor_log_shipping branch from 72f5c2b to d939ad7 Compare June 20, 2025 19:54
@MasterPtato MasterPtato force-pushed the 06-20-fix_get_new_actors_working_on_docker_compose branch from e8d4467 to 15cd02e Compare June 20, 2025 19:54
@NathanFlurry NathanFlurry force-pushed the 06-19-fix_figure_out_actor_log_shipping branch from d939ad7 to 8d2bd86 Compare June 20, 2025 19:57
@NathanFlurry NathanFlurry force-pushed the 06-20-fix_get_new_actors_working_on_docker_compose branch from 15cd02e to 414cc8c Compare June 20, 2025 19:57
@NathanFlurry NathanFlurry force-pushed the 06-19-fix_figure_out_actor_log_shipping branch from 8d2bd86 to 6d91cde Compare June 20, 2025 20:34
@MasterPtato MasterPtato force-pushed the 06-19-fix_figure_out_actor_log_shipping branch from f2a9b74 to b3a2cd3 Compare July 2, 2025 19:46
@MasterPtato MasterPtato force-pushed the 06-20-fix_get_new_actors_working_on_docker_compose branch from 325b3f9 to 6c47920 Compare July 2, 2025 19:46
Copy link

claude bot commented Jul 2, 2025

Claude finished @MasterPtato's task —— View job


PR Review: Fix new actors working on docker compose

Reviewing this PR for code quality, potential bugs, performance, security, and test coverage.

Todo List:

  • Read repository guidelines (CLAUDE.md)
  • Analyze core Rust changes in packages/edge/
  • Review database migrations
  • Check Docker and configuration changes
  • Examine test modifications
  • Provide comprehensive feedback on code quality
  • Identify potential bugs and issues
  • Assess performance considerations
  • Review security implications
  • Evaluate test coverage

Review Summary

This PR implements significant changes to support "new actors" with enhanced ID management and Docker Compose compatibility. Overall the changes are well-structured, but there are several issues that need attention.

🐛 Critical Issues

  1. Build Error in container-runner (packages/edge/infra/client/container-runner/src/main.rs:61)

    let exit_code = match container::run(
        msg_tx.clone(),
        &actor_path,  // ❌ `actor_path` is undefined
        &container_id,
        root_user_enabled,
    )

    Should likely be runner_path instead of actor_path.

  2. Tokio async block issue (Already identified by graphite-app at packages/edge/infra/client/manager/src/main.rs:193)

    async { metrics_task.await.map_err(Into::<anyhow::Error>::into)? },  // ❌ Incorrect ? usage

    Should be:

    async { metrics_task.await.map_err(Into::<anyhow::Error>::into) },

⚠️ Potential Issues

  1. Database Migration Concerns

    • add_runner_id.up.sql adds a column but no down migration provided for reversibility
    • No indices defined for the new runner_id column which could impact query performance
  2. Memory Management in Runtime (packages/edge/services/pegboard/src/workflows/actor2/runtime.rs)

    • Complex FDB transaction logic with multiple memory calculations could benefit from better error handling for edge cases
    • Large transaction bodies (500+ lines) might hit FDB transaction limits under high contention
  3. Resource Allocation Logic

    • Bin-packing algorithm in allocate_actor could lead to memory fragmentation over time
    • No apparent cleanup for stale allocation records

🔒 Security Considerations

  1. Unsafe Code (packages/common/util/id/src/lib.rs:204)

    let s = unsafe { String::from_utf8_unchecked(buf.to_vec()) };

    While documented as safe (ASCII), consider using safe conversion for defense in depth.

  2. Environment Variable Handling

    • Container runner accepts ROOT_USER_ENABLED and VECTOR_SOCKET_ADDR - ensure these are properly validated in production environments

Performance Considerations

  1. Efficient Improvements

    • New ID system with V1 format (30-char base36) is more efficient than UUIDs for certain use cases
    • FDB snapshot reads reduce transaction conflicts in allocation logic
  2. Areas for Optimization

    • ClickHouse actor_runners table could benefit from better partitioning strategy
    • Vector message serialization in log_shipper happens per message - consider batching

🧪 Test Coverage

  1. Positive Changes

    • TypeScript test includes both HTTP and UDP protocol testing
    • Test covers actor lifecycle (create → ready → destroy)
  2. Missing Coverage

    • No integration tests for new actor allocation algorithm
    • FDB transaction rollback scenarios not covered
    • Error handling paths in log shipping not tested

📋 Code Quality

Good Practices:

  • Comprehensive error handling with proper context
  • Well-structured workflow pattern with state management
  • Clear separation of concerns (allocation, runtime, destruction)

Areas for Improvement:

  • Some functions are quite large (e.g., allocate_actor at 200+ lines)
  • Magic numbers could be better documented (e.g., ACTOR_START_THRESHOLD_MS)
  • Missing documentation for complex allocation algorithm

🐳 Docker & Configuration

  • Docker builds correctly include all new binaries
  • Configuration changes are minimal and focused
  • Multi-stage build properly optimized

Recommendations

  1. Fix the critical build error in container-runner/main.rs
  2. Address the tokio async block issue as suggested by graphite-app
  3. Add database migration rollback for the runner_id column
  4. Consider adding integration tests for the new allocation logic
  5. Document the allocation algorithm for future maintainers

The overall approach is sound and the implementation follows good patterns. Once the critical issues are addressed, this should be ready for merge.

Copy link

claude bot commented Jul 2, 2025

Claude finished @MasterPtato's task —— View job


PR Review: Fix new actors working on docker compose

Reviewing this PR for code quality, potential bugs, performance, security, and test coverage.

Todo List:

  • Read repository guidelines (CLAUDE.md)
  • Analyze core Rust changes in packages/edge/
  • Review database migrations
  • Check Docker and configuration changes
  • Examine test modifications
  • Provide comprehensive feedback on code quality
  • Identify potential bugs and issues
  • Assess performance considerations
  • Review security implications
  • Evaluate test coverage

Review Summary

This PR implements significant changes to support "new actors" with enhanced ID management and Docker Compose compatibility. Overall the changes are well-structured, but there are several issues that need attention.

🐛 Critical Issues

  1. Build Error in container-runner (packages/edge/infra/client/container-runner/src/main.rs:61)

    let exit_code = match container::run(
        msg_tx.clone(),
        &actor_path,  // ❌ `actor_path` is undefined
        &container_id,
        root_user_enabled,
    )

    Should likely be runner_path instead of actor_path.

  2. Tokio async block issue (Already identified by graphite-app at packages/edge/infra/client/manager/src/main.rs:193)

    async { metrics_task.await.map_err(Into::<anyhow::Error>::into)? },  // ❌ Incorrect ? usage

    Should be:

    async { metrics_task.await.map_err(Into::<anyhow::Error>::into) },

⚠️ Potential Issues

  1. Database Migration Concerns

    • add_runner_id.up.sql adds a column but no down migration provided for reversibility
    • No indices defined for the new runner_id column which could impact query performance
  2. Memory Management in Runtime (packages/edge/services/pegboard/src/workflows/actor2/runtime.rs)

    • Complex FDB transaction logic with multiple memory calculations could benefit from better error handling for edge cases
    • Large transaction bodies (500+ lines) might hit FDB transaction limits under high contention
  3. Resource Allocation Logic

    • Bin-packing algorithm in allocate_actor could lead to memory fragmentation over time
    • No apparent cleanup for stale allocation records

🔒 Security Considerations

  1. Unsafe Code (packages/common/util/id/src/lib.rs:204)

    let s = unsafe { String::from_utf8_unchecked(buf.to_vec()) };

    While documented as safe (ASCII), consider using safe conversion for defense in depth.

  2. Environment Variable Handling

    • Container runner accepts ROOT_USER_ENABLED and VECTOR_SOCKET_ADDR - ensure these are properly validated in production environments

Performance Considerations

  1. Efficient Improvements

    • New ID system with V1 format (30-char base36) is more efficient than UUIDs for certain use cases
    • FDB snapshot reads reduce transaction conflicts in allocation logic
  2. Areas for Optimization

    • ClickHouse actor_runners table could benefit from better partitioning strategy
    • Vector message serialization in log_shipper happens per message - consider batching

🧪 Test Coverage

  1. Positive Changes

    • TypeScript test includes both HTTP and UDP protocol testing
    • Test covers actor lifecycle (create → ready → destroy)
  2. Missing Coverage

    • No integration tests for new actor allocation algorithm
    • FDB transaction rollback scenarios not covered
    • Error handling paths in log shipping not tested

📋 Code Quality

Good Practices:

  • Comprehensive error handling with proper context
  • Well-structured workflow pattern with state management
  • Clear separation of concerns (allocation, runtime, destruction)

Areas for Improvement:

  • Some functions are quite large (e.g., allocate_actor at 200+ lines)
  • Magic numbers could be better documented (e.g., ACTOR_START_THRESHOLD_MS)
  • Missing documentation for complex allocation algorithm

🐳 Docker & Configuration

  • Docker builds correctly include all new binaries
  • Configuration changes are minimal and focused
  • Multi-stage build properly optimized

Recommendations

  1. Fix the critical build error in container-runner/main.rs
  2. Address the tokio async block issue as suggested by graphite-app
  3. Add database migration rollback for the runner_id column
  4. Consider adding integration tests for the new allocation logic
  5. Document the allocation algorithm for future maintainers

The overall approach is sound and the implementation follows good patterns. Once the critical issues are addressed, this should be ready for merge.

Copy link

claude bot commented Jul 3, 2025

Claude finished @MasterPtato's task —— View job


PR Review: Fix new actors working on docker compose

Reviewing this PR for code quality, potential bugs, performance, security, and test coverage.

Todo List:

  • Read repository guidelines (CLAUDE.md)
  • Analyze core Rust changes in packages/edge/
  • Review database migrations
  • Check Docker and configuration changes
  • Examine test modifications
  • Provide comprehensive feedback on code quality
  • Identify potential bugs and issues
  • Assess performance considerations
  • Review security implications
  • Evaluate test coverage

Review Summary

This PR implements significant changes to support "new actors" with enhanced ID management and Docker Compose compatibility. Overall the changes are well-structured, but there are several issues that need attention.

🐛 Critical Issues

  1. Build Error in container-runner (packages/edge/infra/client/container-runner/src/main.rs:61)

    let exit_code = match container::run(
        msg_tx.clone(),
        &actor_path,  // ❌ `actor_path` is undefined
        &container_id,
        root_user_enabled,
    )

    Should likely be runner_path instead of actor_path.

  2. Tokio async block issue (Already identified by graphite-app at packages/edge/infra/client/manager/src/main.rs:193)

    async { metrics_task.await.map_err(Into::<anyhow::Error>::into)? },  // ❌ Incorrect ? usage

    Should be:

    async { metrics_task.await.map_err(Into::<anyhow::Error>::into) },

⚠️ Potential Issues

  1. Database Migration Concerns

    • add_runner_id.up.sql adds a column but no down migration provided for reversibility
    • No indices defined for the new runner_id column which could impact query performance
  2. Memory Management in Runtime (packages/edge/services/pegboard/src/workflows/actor2/runtime.rs)

    • Complex FDB transaction logic with multiple memory calculations could benefit from better error handling for edge cases
    • Large transaction bodies (500+ lines) might hit FDB transaction limits under high contention
  3. Resource Allocation Logic

    • Bin-packing algorithm in allocate_actor could lead to memory fragmentation over time
    • No apparent cleanup for stale allocation records

🔒 Security Considerations

  1. Unsafe Code (packages/common/util/id/src/lib.rs:204)

    let s = unsafe { String::from_utf8_unchecked(buf.to_vec()) };

    While documented as safe (ASCII), consider using safe conversion for defense in depth.

  2. Environment Variable Handling

    • Container runner accepts ROOT_USER_ENABLED and VECTOR_SOCKET_ADDR - ensure these are properly validated in production environments

Performance Considerations

  1. Efficient Improvements

    • New ID system with V1 format (30-char base36) is more efficient than UUIDs for certain use cases
    • FDB snapshot reads reduce transaction conflicts in allocation logic
  2. Areas for Optimization

    • ClickHouse actor_runners table could benefit from better partitioning strategy
    • Vector message serialization in log_shipper happens per message - consider batching

🧪 Test Coverage

  1. Positive Changes

    • TypeScript test includes both HTTP and UDP protocol testing
    • Test covers actor lifecycle (create → ready → destroy)
  2. Missing Coverage

    • No integration tests for new actor allocation algorithm
    • FDB transaction rollback scenarios not covered
    • Error handling paths in log shipping not tested

📋 Code Quality

Good Practices:

  • Comprehensive error handling with proper context
  • Well-structured workflow pattern with state management
  • Clear separation of concerns (allocation, runtime, destruction)

Areas for Improvement:

  • Some functions are quite large (e.g., allocate_actor at 200+ lines)
  • Magic numbers could be better documented (e.g., ACTOR_START_THRESHOLD_MS)
  • Missing documentation for complex allocation algorithm

🐳 Docker & Configuration

  • Docker builds correctly include all new binaries
  • Configuration changes are minimal and focused
  • Multi-stage build properly optimized

Recommendations

  1. Fix the critical build error in container-runner/main.rs
  2. Address the tokio async block issue as suggested by graphite-app
  3. Add database migration rollback for the runner_id column
  4. Consider adding integration tests for the new allocation logic
  5. Document the allocation algorithm for future maintainers

The overall approach is sound and the implementation follows good patterns. Once the critical issues are addressed, this should be ready for merge.

Copy link

claude bot commented Jul 3, 2025

Claude finished @MasterPtato's task —— View job


PR Review: Fix new actors working on docker compose

Reviewing this PR for code quality, potential bugs, performance, security, and test coverage.

Todo List:

  • Read repository guidelines (CLAUDE.md)
  • Analyze core Rust changes in packages/edge/
  • Review database migrations
  • Check Docker and configuration changes
  • Examine test modifications
  • Provide comprehensive feedback on code quality
  • Identify potential bugs and issues
  • Assess performance considerations
  • Review security implications
  • Evaluate test coverage

Review Summary

This PR implements significant changes to support "new actors" with enhanced ID management and Docker Compose compatibility. Overall the changes are well-structured, but there are several issues that need attention.

🐛 Critical Issues

  1. Build Error in container-runner (packages/edge/infra/client/container-runner/src/main.rs:61)

    let exit_code = match container::run(
        msg_tx.clone(),
        &actor_path,  // ❌ `actor_path` is undefined
        &container_id,
        root_user_enabled,
    )

    Should likely be runner_path instead of actor_path.

  2. Tokio async block issue (Already identified by graphite-app at packages/edge/infra/client/manager/src/main.rs:193)

    async { metrics_task.await.map_err(Into::<anyhow::Error>::into)? },  // ❌ Incorrect ? usage

    Should be:

    async { metrics_task.await.map_err(Into::<anyhow::Error>::into) },

⚠️ Potential Issues

  1. Database Migration Concerns

    • add_runner_id.up.sql adds a column but no down migration provided for reversibility
    • No indices defined for the new runner_id column which could impact query performance
  2. Memory Management in Runtime (packages/edge/services/pegboard/src/workflows/actor2/runtime.rs)

    • Complex FDB transaction logic with multiple memory calculations could benefit from better error handling for edge cases
    • Large transaction bodies (500+ lines) might hit FDB transaction limits under high contention
  3. Resource Allocation Logic

    • Bin-packing algorithm in allocate_actor could lead to memory fragmentation over time
    • No apparent cleanup for stale allocation records

🔒 Security Considerations

  1. Unsafe Code (packages/common/util/id/src/lib.rs:204)

    let s = unsafe { String::from_utf8_unchecked(buf.to_vec()) };

    While documented as safe (ASCII), consider using safe conversion for defense in depth.

  2. Environment Variable Handling

    • Container runner accepts ROOT_USER_ENABLED and VECTOR_SOCKET_ADDR - ensure these are properly validated in production environments

Performance Considerations

  1. Efficient Improvements

    • New ID system with V1 format (30-char base36) is more efficient than UUIDs for certain use cases
    • FDB snapshot reads reduce transaction conflicts in allocation logic
  2. Areas for Optimization

    • ClickHouse actor_runners table could benefit from better partitioning strategy
    • Vector message serialization in log_shipper happens per message - consider batching

🧪 Test Coverage

  1. Positive Changes

    • TypeScript test includes both HTTP and UDP protocol testing
    • Test covers actor lifecycle (create → ready → destroy)
  2. Missing Coverage

    • No integration tests for new actor allocation algorithm
    • FDB transaction rollback scenarios not covered
    • Error handling paths in log shipping not tested

📋 Code Quality

Good Practices:

  • Comprehensive error handling with proper context
  • Well-structured workflow pattern with state management
  • Clear separation of concerns (allocation, runtime, destruction)

Areas for Improvement:

  • Some functions are quite large (e.g., allocate_actor at 200+ lines)
  • Magic numbers could be better documented (e.g., ACTOR_START_THRESHOLD_MS)
  • Missing documentation for complex allocation algorithm

🐳 Docker & Configuration

  • Docker builds correctly include all new binaries
  • Configuration changes are minimal and focused
  • Multi-stage build properly optimized

Recommendations

  1. Fix the critical build error in container-runner/main.rs
  2. Address the tokio async block issue as suggested by graphite-app
  3. Add database migration rollback for the runner_id column
  4. Consider adding integration tests for the new allocation logic
  5. Document the allocation algorithm for future maintainers

The overall approach is sound and the implementation follows good patterns. Once the critical issues are addressed, this should be ready for merge.


@MasterPtato MasterPtato force-pushed the 06-20-fix_get_new_actors_working_on_docker_compose branch from 67ae3b8 to bec61ff Compare July 4, 2025 01:27
@MasterPtato MasterPtato force-pushed the 06-19-fix_figure_out_actor_log_shipping branch from 400fb28 to 70eeac4 Compare July 4, 2025 01:27
Copy link

coderabbitai bot commented Jul 4, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in 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.

Copy link

claude bot commented Jul 4, 2025

Claude finished @MasterPtato's task —— View job


PR Review: Fix new actors working on docker compose

Reviewing this PR for code quality, potential bugs, performance, security, and test coverage.

Todo List:

  • Read repository guidelines (CLAUDE.md)
  • Analyze core Rust changes in packages/edge/
  • Review database migrations
  • Check Docker and configuration changes
  • Examine test modifications
  • Provide comprehensive feedback on code quality
  • Identify potential bugs and issues
  • Assess performance considerations
  • Review security implications
  • Evaluate test coverage

Review Summary

This PR implements significant changes to support "new actors" with enhanced ID management and Docker Compose compatibility. Overall the changes are well-structured, but there are several issues that need attention.

🐛 Critical Issues

  1. Build Error in container-runner (packages/edge/infra/client/container-runner/src/main.rs:61)

    let exit_code = match container::run(
        msg_tx.clone(),
        &actor_path,  // ❌ `actor_path` is undefined
        &container_id,
        root_user_enabled,
    )

    Should likely be runner_path instead of actor_path.

  2. Tokio async block issue (Already identified by graphite-app at packages/edge/infra/client/manager/src/main.rs:193)

    async { metrics_task.await.map_err(Into::<anyhow::Error>::into)? },  // ❌ Incorrect ? usage

    Should be:

    async { metrics_task.await.map_err(Into::<anyhow::Error>::into) },

⚠️ Potential Issues

  1. Database Migration Concerns

    • add_runner_id.up.sql adds a column but no down migration provided for reversibility
    • No indices defined for the new runner_id column which could impact query performance
  2. Memory Management in Runtime (packages/edge/services/pegboard/src/workflows/actor2/runtime.rs)

    • Complex FDB transaction logic with multiple memory calculations could benefit from better error handling for edge cases
    • Large transaction bodies (500+ lines) might hit FDB transaction limits under high contention
  3. Resource Allocation Logic

    • Bin-packing algorithm in allocate_actor could lead to memory fragmentation over time
    • No apparent cleanup for stale allocation records

🔒 Security Considerations

  1. Unsafe Code (packages/common/util/id/src/lib.rs:204)

    let s = unsafe { String::from_utf8_unchecked(buf.to_vec()) };

    While documented as safe (ASCII), consider using safe conversion for defense in depth.

  2. Environment Variable Handling

    • Container runner accepts ROOT_USER_ENABLED and VECTOR_SOCKET_ADDR - ensure these are properly validated in production environments

Performance Considerations

  1. Efficient Improvements

    • New ID system with V1 format (30-char base36) is more efficient than UUIDs for certain use cases
    • FDB snapshot reads reduce transaction conflicts in allocation logic
  2. Areas for Optimization

    • ClickHouse actor_runners table could benefit from better partitioning strategy
    • Vector message serialization in log_shipper happens per message - consider batching

🧪 Test Coverage

  1. Positive Changes

    • TypeScript test includes both HTTP and UDP protocol testing
    • Test covers actor lifecycle (create → ready → destroy)
  2. Missing Coverage

    • No integration tests for new actor allocation algorithm
    • FDB transaction rollback scenarios not covered
    • Error handling paths in log shipping not tested

📋 Code Quality

Good Practices:

  • Comprehensive error handling with proper context
  • Well-structured workflow pattern with state management
  • Clear separation of concerns (allocation, runtime, destruction)

Areas for Improvement:

  • Some functions are quite large (e.g., allocate_actor at 200+ lines)
  • Magic numbers could be better documented (e.g., ACTOR_START_THRESHOLD_MS)
  • Missing documentation for complex allocation algorithm

🐳 Docker & Configuration

  • Docker builds correctly include all new binaries
  • Configuration changes are minimal and focused
  • Multi-stage build properly optimized

Recommendations

  1. Fix the critical build error in container-runner/main.rs
  2. Address the tokio async block issue as suggested by graphite-app
  3. Add database migration rollback for the runner_id column
  4. Consider adding integration tests for the new allocation logic
  5. Document the allocation algorithm for future maintainers

The overall approach is sound and the implementation follows good patterns. Once the critical issues are addressed, this should be ready for merge.


Copy link

claude bot commented Jul 4, 2025

Claude finished @MasterPtato's task —— View job


PR Review: Fix new actors working on docker compose

Reviewing this PR for code quality, potential bugs, performance, security, and test coverage.

Todo List:

  • Read repository guidelines (CLAUDE.md)
  • Analyze core Rust changes in packages/edge/
  • Review database migrations
  • Check Docker and configuration changes
  • Examine test modifications
  • Provide comprehensive feedback on code quality
  • Identify potential bugs and issues
  • Assess performance considerations
  • Review security implications
  • Evaluate test coverage

Review Summary

This PR implements significant changes to support "new actors" with enhanced ID management and Docker Compose compatibility. Overall the changes are well-structured, but there are several issues that need attention.

🐛 Critical Issues

  1. Build Error in container-runner (packages/edge/infra/client/container-runner/src/main.rs:61)

    let exit_code = match container::run(
        msg_tx.clone(),
        &actor_path,  // ❌ `actor_path` is undefined
        &container_id,
        root_user_enabled,
    )

    Should likely be runner_path instead of actor_path.

  2. Tokio async block issue (Already identified by graphite-app at packages/edge/infra/client/manager/src/main.rs:193)

    async { metrics_task.await.map_err(Into::<anyhow::Error>::into)? },  // ❌ Incorrect ? usage

    Should be:

    async { metrics_task.await.map_err(Into::<anyhow::Error>::into) },

⚠️ Potential Issues

  1. Database Migration Concerns

    • add_runner_id.up.sql adds a column but no down migration provided for reversibility
    • No indices defined for the new runner_id column which could impact query performance
  2. Memory Management in Runtime (packages/edge/services/pegboard/src/workflows/actor2/runtime.rs)

    • Complex FDB transaction logic with multiple memory calculations could benefit from better error handling for edge cases
    • Large transaction bodies (500+ lines) might hit FDB transaction limits under high contention
  3. Resource Allocation Logic

    • Bin-packing algorithm in allocate_actor could lead to memory fragmentation over time
    • No apparent cleanup for stale allocation records

🔒 Security Considerations

  1. Unsafe Code (packages/common/util/id/src/lib.rs:204)

    let s = unsafe { String::from_utf8_unchecked(buf.to_vec()) };

    While documented as safe (ASCII), consider using safe conversion for defense in depth.

  2. Environment Variable Handling

    • Container runner accepts ROOT_USER_ENABLED and VECTOR_SOCKET_ADDR - ensure these are properly validated in production environments

Performance Considerations

  1. Efficient Improvements

    • New ID system with V1 format (30-char base36) is more efficient than UUIDs for certain use cases
    • FDB snapshot reads reduce transaction conflicts in allocation logic
  2. Areas for Optimization

    • ClickHouse actor_runners table could benefit from better partitioning strategy
    • Vector message serialization in log_shipper happens per message - consider batching

🧪 Test Coverage

  1. Positive Changes

    • TypeScript test includes both HTTP and UDP protocol testing
    • Test covers actor lifecycle (create → ready → destroy)
  2. Missing Coverage

    • No integration tests for new actor allocation algorithm
    • FDB transaction rollback scenarios not covered
    • Error handling paths in log shipping not tested

📋 Code Quality

Good Practices:

  • Comprehensive error handling with proper context
  • Well-structured workflow pattern with state management
  • Clear separation of concerns (allocation, runtime, destruction)

Areas for Improvement:

  • Some functions are quite large (e.g., allocate_actor at 200+ lines)
  • Magic numbers could be better documented (e.g., ACTOR_START_THRESHOLD_MS)
  • Missing documentation for complex allocation algorithm

🐳 Docker & Configuration

  • Docker builds correctly include all new binaries
  • Configuration changes are minimal and focused
  • Multi-stage build properly optimized

Recommendations

  1. Fix the critical build error in container-runner/main.rs
  2. Address the tokio async block issue as suggested by graphite-app
  3. Add database migration rollback for the runner_id column
  4. Consider adding integration tests for the new allocation logic
  5. Document the allocation algorithm for future maintainers

The overall approach is sound and the implementation follows good patterns. Once the critical issues are addressed, this should be ready for merge.


@MasterPtato MasterPtato force-pushed the 06-20-fix_get_new_actors_working_on_docker_compose branch from bec61ff to 8f43d76 Compare July 11, 2025 22:23
@MasterPtato MasterPtato force-pushed the 06-19-fix_figure_out_actor_log_shipping branch from 70eeac4 to 6a03830 Compare July 11, 2025 22:23
Copy link

claude bot commented Jul 11, 2025

Claude finished @MasterPtato's task —— View job


PR Review: Fix new actors working on docker compose

Reviewing this PR for code quality, potential bugs, performance, security, and test coverage.

Todo List:

  • Read repository guidelines (CLAUDE.md)
  • Analyze core Rust changes in packages/edge/
  • Review database migrations
  • Check Docker and configuration changes
  • Examine test modifications
  • Provide comprehensive feedback on code quality
  • Identify potential bugs and issues
  • Assess performance considerations
  • Review security implications
  • Evaluate test coverage

Review Summary

This PR implements significant changes to support "new actors" with enhanced ID management and Docker Compose compatibility. Overall the changes are well-structured, but there are several issues that need attention.

🐛 Critical Issues

  1. Build Error in container-runner (packages/edge/infra/client/container-runner/src/main.rs:61)

    let exit_code = match container::run(
        msg_tx.clone(),
        &actor_path,  // ❌ `actor_path` is undefined
        &container_id,
        root_user_enabled,
    )

    Should likely be runner_path instead of actor_path.

  2. Tokio async block issue (Already identified by graphite-app at packages/edge/infra/client/manager/src/main.rs:193)

    async { metrics_task.await.map_err(Into::<anyhow::Error>::into)? },  // ❌ Incorrect ? usage

    Should be:

    async { metrics_task.await.map_err(Into::<anyhow::Error>::into) },

⚠️ Potential Issues

  1. Database Migration Concerns

    • add_runner_id.up.sql adds a column but no down migration provided for reversibility
    • No indices defined for the new runner_id column which could impact query performance
  2. Memory Management in Runtime (packages/edge/services/pegboard/src/workflows/actor2/runtime.rs)

    • Complex FDB transaction logic with multiple memory calculations could benefit from better error handling for edge cases
    • Large transaction bodies (500+ lines) might hit FDB transaction limits under high contention
  3. Resource Allocation Logic

    • Bin-packing algorithm in allocate_actor could lead to memory fragmentation over time
    • No apparent cleanup for stale allocation records

🔒 Security Considerations

  1. Unsafe Code (packages/common/util/id/src/lib.rs:204)

    let s = unsafe { String::from_utf8_unchecked(buf.to_vec()) };

    While documented as safe (ASCII), consider using safe conversion for defense in depth.

  2. Environment Variable Handling

    • Container runner accepts ROOT_USER_ENABLED and VECTOR_SOCKET_ADDR - ensure these are properly validated in production environments

Performance Considerations

  1. Efficient Improvements

    • New ID system with V1 format (30-char base36) is more efficient than UUIDs for certain use cases
    • FDB snapshot reads reduce transaction conflicts in allocation logic
  2. Areas for Optimization

    • ClickHouse actor_runners table could benefit from better partitioning strategy
    • Vector message serialization in log_shipper happens per message - consider batching

🧪 Test Coverage

  1. Positive Changes

    • TypeScript test includes both HTTP and UDP protocol testing
    • Test covers actor lifecycle (create → ready → destroy)
  2. Missing Coverage

    • No integration tests for new actor allocation algorithm
    • FDB transaction rollback scenarios not covered
    • Error handling paths in log shipping not tested

📋 Code Quality

Good Practices:

  • Comprehensive error handling with proper context
  • Well-structured workflow pattern with state management
  • Clear separation of concerns (allocation, runtime, destruction)

Areas for Improvement:

  • Some functions are quite large (e.g., allocate_actor at 200+ lines)
  • Magic numbers could be better documented (e.g., ACTOR_START_THRESHOLD_MS)
  • Missing documentation for complex allocation algorithm

🐳 Docker & Configuration

  • Docker builds correctly include all new binaries
  • Configuration changes are minimal and focused
  • Multi-stage build properly optimized

Recommendations

  1. Fix the critical build error in container-runner/main.rs
  2. Address the tokio async block issue as suggested by graphite-app
  3. Add database migration rollback for the runner_id column
  4. Consider adding integration tests for the new allocation logic
  5. Document the allocation algorithm for future maintainers

The overall approach is sound and the implementation follows good patterns. Once the critical issues are addressed, this should be ready for merge.


View job

Copy link

claude bot commented Jul 11, 2025

Claude finished @MasterPtato's task —— View job


PR Review: Fix new actors working on docker compose

Reviewing this PR for code quality, potential bugs, performance, security, and test coverage.

Todo List:

  • Read repository guidelines (CLAUDE.md)
  • Analyze core Rust changes in packages/edge/
  • Review database migrations
  • Check Docker and configuration changes
  • Examine test modifications
  • Provide comprehensive feedback on code quality
  • Identify potential bugs and issues
  • Assess performance considerations
  • Review security implications
  • Evaluate test coverage

Review Summary

This PR implements significant changes to support "new actors" with enhanced ID management and Docker Compose compatibility. Overall the changes are well-structured, but there are several issues that need attention.

🐛 Critical Issues

  1. Build Error in container-runner (packages/edge/infra/client/container-runner/src/main.rs:65)

    let exit_code = match container::run(
        msg_tx.clone(),
        &actor_path,  // ❌ `actor_path` is undefined
        &container_id,
        root_user_enabled,
    )

    Should likely be runner_path instead of actor_path.

  2. Tokio async block issue (Already identified by graphite-app at packages/edge/infra/client/manager/src/main.rs:193)

    async { metrics_task.await.map_err(Into::<anyhow::Error>::into)? },  // ❌ Incorrect ? usage

    Should be:

    async { metrics_task.await.map_err(Into::<anyhow::Error>::into) },

⚠️ Potential Issues

  1. Database Migration Concerns

    • add_runner_id.up.sql adds a column but no down migration provided for reversibility
    • No indices defined for the new runner_id column which could impact query performance
  2. Memory Management in Runtime (packages/edge/services/pegboard/src/workflows/actor2/runtime.rs)

    • Complex FDB transaction logic with multiple memory calculations could benefit from better error handling for edge cases
    • Large transaction bodies (500+ lines) might hit FDB transaction limits under high contention
  3. Resource Allocation Logic

    • Bin-packing algorithm in allocate_actor could lead to memory fragmentation over time
    • No apparent cleanup for stale allocation records

🔒 Security Considerations

  1. Unsafe Code (packages/common/util/id/src/lib.rs:204)

    let s = unsafe { String::from_utf8_unchecked(buf.to_vec()) };

    While documented as safe (ASCII), consider using safe conversion for defense in depth.

  2. Environment Variable Handling

    • Container runner accepts ROOT_USER_ENABLED and VECTOR_SOCKET_ADDR - ensure these are properly validated in production environments

Performance Considerations

  1. Efficient Improvements

    • New ID system with V1 format (30-char base36) is more efficient than UUIDs for certain use cases
    • FDB snapshot reads reduce transaction conflicts in allocation logic
  2. Areas for Optimization

    • ClickHouse actor_runners table could benefit from better partitioning strategy
    • Vector message serialization in log_shipper happens per message - consider batching

🧪 Test Coverage

  1. Positive Changes

    • TypeScript test includes both HTTP and UDP protocol testing
    • Test covers actor lifecycle (create → ready → destroy)
  2. Missing Coverage

    • No integration tests for new actor allocation algorithm
    • FDB transaction rollback scenarios not covered
    • Error handling paths in log shipping not tested

📋 Code Quality

Good Practices:

  • Comprehensive error handling with proper context
  • Well-structured workflow pattern with state management
  • Clear separation of concerns (allocation, runtime, destruction)

Areas for Improvement:

  • Some functions are quite large (e.g., allocate_actor at 200+ lines)
  • Magic numbers could be better documented (e.g., ACTOR_START_THRESHOLD_MS)
  • Missing documentation for complex allocation algorithm

🐳 Docker & Configuration

  • Docker builds correctly include all new binaries
  • Configuration changes are minimal and focused
  • Multi-stage build properly optimized

Recommendations

  1. Fix the critical build error in container-runner/main.rs
  2. Address the tokio async block issue as suggested by graphite-app
  3. Add database migration rollback for the runner_id column
  4. Consider adding integration tests for the new allocation logic
  5. Document the allocation algorithm for future maintainers

The overall approach is sound and the implementation follows good patterns. Once the critical issues are addressed, this should be ready for merge.


@MasterPtato MasterPtato force-pushed the 06-19-fix_figure_out_actor_log_shipping branch from 6a03830 to caba229 Compare July 12, 2025 00:40
@MasterPtato MasterPtato force-pushed the 06-20-fix_get_new_actors_working_on_docker_compose branch from 8f43d76 to b935bff Compare July 12, 2025 00:40
Copy link

claude bot commented Jul 12, 2025

Claude finished @MasterPtato's task —— View job


PR Review: Fix new actors working on docker compose

Reviewing this PR for code quality, potential bugs, performance, security, and test coverage.

Todo List:

  • Read repository guidelines (CLAUDE.md)
  • Analyze core Rust changes in packages/edge/
  • Review database migrations
  • Check Docker and configuration changes
  • Examine test modifications
  • Provide comprehensive feedback on code quality
  • Identify potential bugs and issues
  • Assess performance considerations
  • Review security implications
  • Evaluate test coverage

Review Summary

This PR implements significant changes to support "new actors" with enhanced ID management and Docker Compose compatibility. Overall the changes are well-structured, but there are several issues that need attention.

🐛 Critical Issues

  1. Build Error in container-runner (packages/edge/infra/client/container-runner/src/main.rs:65)

    let exit_code = match container::run(
        msg_tx.clone(),
        &actor_path,  // ❌ `actor_path` is undefined
        &container_id,
        root_user_enabled,
    )

    Should likely be runner_path instead of actor_path.

  2. Tokio async block issue (Already identified by graphite-app at packages/edge/infra/client/manager/src/main.rs:193)

    async { metrics_task.await.map_err(Into::<anyhow::Error>::into)? },  // ❌ Incorrect ? usage

    Should be:

    async { metrics_task.await.map_err(Into::<anyhow::Error>::into) },

⚠️ Potential Issues

  1. Database Migration Concerns

    • add_runner_id.up.sql adds a column but no down migration provided for reversibility
    • No indices defined for the new runner_id column which could impact query performance
  2. Memory Management in Runtime (packages/edge/services/pegboard/src/workflows/actor2/runtime.rs)

    • Complex FDB transaction logic with multiple memory calculations could benefit from better error handling for edge cases
    • Large transaction bodies (500+ lines) might hit FDB transaction limits under high contention
  3. Resource Allocation Logic

    • Bin-packing algorithm in allocate_actor could lead to memory fragmentation over time
    • No apparent cleanup for stale allocation records

🔒 Security Considerations

  1. Unsafe Code (packages/common/util/id/src/lib.rs:204)

    let s = unsafe { String::from_utf8_unchecked(buf.to_vec()) };

    While documented as safe (ASCII), consider using safe conversion for defense in depth.

  2. Environment Variable Handling

    • Container runner accepts ROOT_USER_ENABLED and VECTOR_SOCKET_ADDR - ensure these are properly validated in production environments

Performance Considerations

  1. Efficient Improvements

    • New ID system with V1 format (30-char base36) is more efficient than UUIDs for certain use cases
    • FDB snapshot reads reduce transaction conflicts in allocation logic
  2. Areas for Optimization

    • ClickHouse actor_runners table could benefit from better partitioning strategy
    • Vector message serialization in log_shipper happens per message - consider batching

🧪 Test Coverage

  1. Positive Changes

    • TypeScript test includes both HTTP and UDP protocol testing
    • Test covers actor lifecycle (create → ready → destroy)
  2. Missing Coverage

    • No integration tests for new actor allocation algorithm
    • FDB transaction rollback scenarios not covered
    • Error handling paths in log shipping not tested

📋 Code Quality

Good Practices:

  • Comprehensive error handling with proper context
  • Well-structured workflow pattern with state management
  • Clear separation of concerns (allocation, runtime, destruction)

Areas for Improvement:

  • Some functions are quite large (e.g., allocate_actor at 200+ lines)
  • Magic numbers could be better documented (e.g., ACTOR_START_THRESHOLD_MS)
  • Missing documentation for complex allocation algorithm

🐳 Docker & Configuration

  • Docker builds correctly include all new binaries
  • Configuration changes are minimal and focused
  • Multi-stage build properly optimized

Recommendations

  1. Fix the critical build error in container-runner/main.rs
  2. Address the tokio async block issue as suggested by graphite-app
  3. Add database migration rollback for the runner_id column
  4. Consider adding integration tests for the new allocation logic
  5. Document the allocation algorithm for future maintainers

The overall approach is sound and the implementation follows good patterns. Once the critical issues are addressed, this should be ready for merge.


@@ -190,7 +190,7 @@ async fn run(init: Init, first: bool) -> Result<()> {
let ctx = Ctx::new(init.config, init.system, init.pool, tx);

tokio::try_join!(
async { metrics_task.await.map_err(Into::<anyhow::Error>::into) },
async { metrics_task.await.map_err(Into::<anyhow::Error>::into)? },
Copy link
Contributor

Choose a reason for hiding this comment

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

The error handling here is incomplete. When awaiting a JoinHandle, you get a Result<T, JoinError> where T is the task's result (which is already an anyhow::Error). The current ? only handles the JoinError but not the inner error.

Consider either:

async { 
    // Handle both the JoinError and the inner anyhow::Error
    metrics_task.await.map_err(Into::<anyhow::Error>::into)?? 
}

Or a more explicit approach:

async {
    let result = metrics_task.await.map_err(Into::<anyhow::Error>::into)?;
    result
}

This ensures both the task completion error and any error returned by the metrics task itself are properly propagated.

Suggested change
async { metrics_task.await.map_err(Into::<anyhow::Error>::into)? },
async { metrics_task.await.map_err(Into::<anyhow::Error>::into)?? },

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

Copy link

claude bot commented Jul 12, 2025

Claude finished @MasterPtato's task —— View job


PR Review: Fix new actors working on docker compose

Reviewing this PR for code quality, potential bugs, performance, security, and test coverage.

Todo List:

  • Read repository guidelines (CLAUDE.md)
  • Analyze core Rust changes in packages/edge/
  • Review database migrations
  • Check Docker and configuration changes
  • Examine test modifications
  • Provide comprehensive feedback on code quality
  • Identify potential bugs and issues
  • Assess performance considerations
  • Review security implications
  • Evaluate test coverage

Review Summary

This PR implements significant changes to support "new actors" with enhanced ID management and Docker Compose compatibility. Overall the changes are well-structured, but there are several issues that need attention.

🐛 Critical Issues

  1. Build Error in container-runner (packages/edge/infra/client/container-runner/src/main.rs:65)

    let exit_code = match container::run(
        msg_tx.clone(),
        &actor_path,  // ❌ `actor_path` is undefined
        &container_id,
        root_user_enabled,
    )

    Should likely be runner_path instead of actor_path.

  2. Tokio async block issue (Already identified by graphite-app at packages/edge/infra/client/manager/src/main.rs:193)

    async { metrics_task.await.map_err(Into::<anyhow::Error>::into)? },  // ❌ Incorrect ? usage

    Should be:

    async { metrics_task.await.map_err(Into::<anyhow::Error>::into) },

⚠️ Potential Issues

  1. Database Migration Concerns

    • add_runner_id.up.sql adds a column but no down migration provided for reversibility
    • No indices defined for the new runner_id column which could impact query performance
  2. Memory Management in Runtime (packages/edge/services/pegboard/src/workflows/actor2/runtime.rs)

    • Complex FDB transaction logic with multiple memory calculations could benefit from better error handling for edge cases
    • Large transaction bodies (500+ lines) might hit FDB transaction limits under high contention
  3. Resource Allocation Logic

    • Bin-packing algorithm in allocate_actor could lead to memory fragmentation over time
    • No apparent cleanup for stale allocation records

🔒 Security Considerations

  1. Unsafe Code (packages/common/util/id/src/lib.rs:204)

    let s = unsafe { String::from_utf8_unchecked(buf.to_vec()) };

    While documented as safe (ASCII), consider using safe conversion for defense in depth.

  2. Environment Variable Handling

    • Container runner accepts ROOT_USER_ENABLED and VECTOR_SOCKET_ADDR - ensure these are properly validated in production environments

Performance Considerations

  1. Efficient Improvements

    • New ID system with V1 format (30-char base36) is more efficient than UUIDs for certain use cases
    • FDB snapshot reads reduce transaction conflicts in allocation logic
  2. Areas for Optimization

    • ClickHouse actor_runners table could benefit from better partitioning strategy
    • Vector message serialization in log_shipper happens per message - consider batching

🧪 Test Coverage

  1. Positive Changes

    • TypeScript test includes both HTTP and UDP protocol testing
    • Test covers actor lifecycle (create → ready → destroy)
  2. Missing Coverage

    • No integration tests for new actor allocation algorithm
    • FDB transaction rollback scenarios not covered
    • Error handling paths in log shipping not tested

📋 Code Quality

Good Practices:

  • Comprehensive error handling with proper context
  • Well-structured workflow pattern with state management
  • Clear separation of concerns (allocation, runtime, destruction)

Areas for Improvement:

  • Some functions are quite large (e.g., allocate_actor at 200+ lines)
  • Magic numbers could be better documented (e.g., ACTOR_START_THRESHOLD_MS)
  • Missing documentation for complex allocation algorithm

🐳 Docker & Configuration

  • Docker builds correctly include all new binaries
  • Configuration changes are minimal and focused
  • Multi-stage build properly optimized

Recommendations

  1. Fix the critical build error in container-runner/main.rs
  2. Address the tokio async block issue as suggested by graphite-app
  3. Add database migration rollback for the runner_id column
  4. Consider adding integration tests for the new allocation logic
  5. Document the allocation algorithm for future maintainers

The overall approach is sound and the implementation follows good patterns. Once the critical issues are addressed, this should be ready for merge.


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