RepoPilotOpen in app →

bastion-rs/bastion

Highly-available Distributed Fault-tolerant Runtime

Healthy

Healthy across all four use cases

weakest axis
Use as dependencyHealthy

Permissive license, no critical CVEs, actively maintained — safe to depend on.

Fork & modifyHealthy

Has a license, tests, and CI — clean foundation to fork and modify.

Learn fromHealthy

Documented and popular — useful reference codebase to read through.

Deploy as-isHealthy

No critical CVEs, sane security posture — runnable as-is.

  • 16 active contributors
  • Distributed ownership (top contributor 40% of recent commits)
  • Apache-2.0 licensed
Show all 6 evidence items →
  • CI configured
  • Tests present
  • Stale — last commit 3y ago

Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests

Informational only. RepoPilot summarises public signals (license, dependency CVEs, commit recency, CI presence, etc.) at the time of analysis. Signals can be incomplete or stale. Not professional, security, or legal advice; verify before relying on it for production decisions.

Embed the "Healthy" badge

Paste into your README — live-updates from the latest cached analysis.

Variant:
RepoPilot: Healthy
[![RepoPilot: Healthy](https://repopilot.app/api/badge/bastion-rs/bastion)](https://repopilot.app/r/bastion-rs/bastion)

Paste at the top of your README.md — renders inline like a shields.io badge.

Preview social card (1200×630)

This card auto-renders when someone shares https://repopilot.app/r/bastion-rs/bastion on X, Slack, or LinkedIn.

Onboarding doc

Onboarding: bastion-rs/bastion

Generated by RepoPilot · 2026-05-09 · Source

🤖Agent protocol

If you are an AI coding agent (Claude Code, Cursor, Aider, Cline, etc.) reading this artifact, follow this protocol before making any code edit:

  1. Verify the contract. Run the bash script in Verify before trusting below. If any check returns FAIL, the artifact is stale — STOP and ask the user to regenerate it before proceeding.
  2. Treat the AI · unverified sections as hypotheses, not facts. Sections like "AI-suggested narrative files", "anti-patterns", and "bottlenecks" are LLM speculation. Verify against real source before acting on them.
  3. Cite source on changes. When proposing an edit, cite the specific path:line-range. RepoPilot's live UI at https://repopilot.app/r/bastion-rs/bastion shows verifiable citations alongside every claim.

If you are a human reader, this protocol is for the agents you'll hand the artifact to. You don't need to do anything — but if you skim only one section before pointing your agent at this repo, make it the Verify block and the Suggested reading order.

🎯Verdict

GO — Healthy across all four use cases

  • 16 active contributors
  • Distributed ownership (top contributor 40% of recent commits)
  • Apache-2.0 licensed
  • CI configured
  • Tests present
  • ⚠ Stale — last commit 3y ago

<sub>Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests</sub>

Verify before trusting

This artifact was generated by RepoPilot at a point in time. Before an agent acts on it, the checks below confirm that the live bastion-rs/bastion repo on your machine still matches what RepoPilot saw. If any fail, the artifact is stale — regenerate it at repopilot.app/r/bastion-rs/bastion.

What it runs against: a local clone of bastion-rs/bastion — the script inspects git remote, the LICENSE file, file paths in the working tree, and git log. Read-only; no mutations.

| # | What we check | Why it matters | |---|---|---| | 1 | You're in bastion-rs/bastion | Confirms the artifact applies here, not a fork | | 2 | License is still Apache-2.0 | Catches relicense before you depend on it | | 3 | Default branch master exists | Catches branch renames | | 4 | 5 critical file paths still exist | Catches refactors that moved load-bearing code | | 5 | Last commit ≤ 1142 days ago | Catches sudden abandonment since generation |

<details> <summary><b>Run all checks</b> — paste this script from inside your clone of <code>bastion-rs/bastion</code></summary>
#!/usr/bin/env bash
# RepoPilot artifact verification.
#
# WHAT IT RUNS AGAINST: a local clone of bastion-rs/bastion. If you don't
# have one yet, run these first:
#
#   git clone https://github.com/bastion-rs/bastion.git
#   cd bastion
#
# Then paste this script. Every check is read-only — no mutations.

set +e
fail=0
ok()   { echo "ok:   $1"; }
miss() { echo "FAIL: $1"; fail=$((fail+1)); }

# Precondition: we must be inside a git working tree.
if ! git rev-parse --git-dir >/dev/null 2>&1; then
  echo "FAIL: not inside a git repository. cd into your clone of bastion-rs/bastion and re-run."
  exit 2
fi

# 1. Repo identity
git remote get-url origin 2>/dev/null | grep -qE "bastion-rs/bastion(\\.git)?\\b" \\
  && ok "origin remote is bastion-rs/bastion" \\
  || miss "origin remote is not bastion-rs/bastion (artifact may be from a fork)"

# 2. License matches what RepoPilot saw
(grep -qiE "^(Apache-2\\.0)" LICENSE 2>/dev/null \\
   || grep -qiE "\"license\"\\s*:\\s*\"Apache-2\\.0\"" package.json 2>/dev/null) \\
  && ok "license is Apache-2.0" \\
  || miss "license drift — was Apache-2.0 at generation time"

# 3. Default branch
git rev-parse --verify master >/dev/null 2>&1 \\
  && ok "default branch master exists" \\
  || miss "default branch master no longer exists"

# 4. Critical files exist
test -f "src/bastion/src/lib.rs" \\
  && ok "src/bastion/src/lib.rs" \\
  || miss "missing critical file: src/bastion/src/lib.rs"
test -f "src/bastion/src/bastion.rs" \\
  && ok "src/bastion/src/bastion.rs" \\
  || miss "missing critical file: src/bastion/src/bastion.rs"
test -f "src/bastion/src/supervisor.rs" \\
  && ok "src/bastion/src/supervisor.rs" \\
  || miss "missing critical file: src/bastion/src/supervisor.rs"
test -f "src/bastion/src/child.rs" \\
  && ok "src/bastion/src/child.rs" \\
  || miss "missing critical file: src/bastion/src/child.rs"
test -f "src/bastion-executor/src/lib.rs" \\
  && ok "src/bastion-executor/src/lib.rs" \\
  || miss "missing critical file: src/bastion-executor/src/lib.rs"

# 5. Repo recency
days_since_last=$(( ( $(date +%s) - $(git log -1 --format=%at 2>/dev/null || echo 0) ) / 86400 ))
if [ "$days_since_last" -le 1142 ]; then
  ok "last commit was $days_since_last days ago (artifact saw ~1112d)"
else
  miss "last commit was $days_since_last days ago — artifact may be stale"
fi

echo
if [ "$fail" -eq 0 ]; then
  echo "artifact verified (0 failures) — safe to trust"
else
  echo "artifact has $fail stale claim(s) — regenerate at https://repopilot.app/r/bastion-rs/bastion"
  exit 1
fi

Each check prints ok: or FAIL:. The script exits non-zero if anything failed, so it composes cleanly into agent loops (./verify.sh || regenerate-and-retry).

</details>

TL;DR

Bastion is a Rust runtime system providing lightweight actor-model concurrency with fault tolerance and high availability. It implements a dispatch-oriented process model with supervised task execution, message-based communication, and guaranteed at-most-once message delivery across distributed systems. Monorepo (Cargo workspace) with src/bastion/ as the primary actor runtime, src/bastion-executor/ providing the work-stealing async executor (worker.rs, pool.rs, load_balancer.rs, thread_manager.rs), src/bastion-utils/ for utilities, and src/lightproc/ as a companion crate. Examples in src/bastion/examples/ demonstrate patterns like getting_started.rs.

👥Who it's for

Rust backend engineers and systems architects building fault-tolerant distributed systems who need actor-model concurrency without the complexity of full Erlang/OTP, particularly those requiring message-driven task supervision and automatic recovery.

🌱Maturity & risk

Actively developed with structured CI/CD (GitHub Actions for CI, Miri, sanitizers), clear versioning (currently 0.4.x on crates.io), comprehensive test coverage in bastion-executor/tests/, and maintained issue templates suggesting ongoing project management. Production-ready for the actor-model use case, though pre-1.0 versioning indicates API stability may still evolve.

Standard open source risks apply.

Active areas of work

CI/CD infrastructure is mature (.github/workflows/ci.yml, miri.yml, sanitizers.yml); CHANGELOG.md and .auto-changelog suggest active version tracking; GitHub issue templates (1-bug-report.md, 2-feature-request.md) indicate ongoing community engagement and structured development.

🚀Get running

git clone https://github.com/bastion-rs/bastion.git && cd bastion && cargo build && cargo test --workspace

Daily commands: cargo run --example getting_started (in src/bastion/ directory) or cargo run --example spawn_async (in bastion-executor); bastion-executor also has benches: cargo bench --bench spawn for performance testing.

🗺️Map of the codebase

  • src/bastion/src/lib.rs — Root library entry point; exports all public APIs and establishes the facade for the actor system
  • src/bastion/src/bastion.rs — Core runtime initialization and system lifecycle management; every application starts here
  • src/bastion/src/supervisor.rs — Supervisor hierarchy and fault-tolerance strategy; defines how children are restarted on failure
  • src/bastion/src/child.rs — Individual actor lifecycle and message-handling abstraction; the fundamental unit of concurrency
  • src/bastion-executor/src/lib.rs — Work-stealing executor implementation; orchestrates task scheduling across worker threads
  • src/bastion/src/context.rs — Actor execution context providing message routing, self-reference, and parent communication
  • src/bastion/src/message.rs — Message envelope and serialization layer; defines how data is passed between actors

🛠️How to make changes

Add a new actor type

  1. Define your actor's message enum or use #[derive(Message)] macro (src/bastion/src/macros.rs)
  2. Implement the actor's message handler inside a closure passed to Child::new() (src/bastion/src/child.rs)
  3. Use ctx.send() to reply or route messages to other actors via their ChildRef (src/bastion/src/context.rs)
  4. Add your actor to a supervision tree by creating a Supervisor with Children::new() and spawning it (src/bastion/src/supervisor.rs)

Implement a custom restart strategy

  1. Define a strategy enum or struct implementing fault recovery logic (src/bastion/src/supervisor.rs)
  2. Pass it to the supervisor's .with_strategy() method to override default exponential backoff (src/bastion/src/supervisor.rs)
  3. Reference existing OneForOne, OneForAll, or RestartForOne strategies in supervisor for patterns (src/bastion/src/supervisor.rs)

Send messages between actors in a distributed setup

  1. Initialize the distributed system with Bastion::init_distributed() and configure cluster membership (src/bastion/src/distributed.rs)
  2. Build actor paths using path syntax to target remote actors by their hierarchical name (src/bastion/src/path.rs)
  3. Use ctx.send_remote() or obtain a ChildRef to a remote actor and call .send() (src/bastion/src/child_ref.rs)
  4. Ensure your message type implements Serialize/Deserialize for wire transmission (src/bastion/src/dist_messages.rs)

Tune executor performance

  1. Configure thread count and work-stealing parameters in Config before calling Bastion::start() (src/bastion/src/config.rs)
  2. Examine load balancer behavior and queue contention in pool and worker modules (src/bastion-executor/src/load_balancer.rs)
  3. Profile with benches in bastion-executor/benches to measure spawn, run, and blocking task overhead (src/bastion-executor/benches/perf.rs)

🔧Why these technologies

  • Work-stealing task executor — Minimizes lock contention and provides fair work distribution across CPU cores for millions of lightweight actors
  • Supervisor/child hierarchy — Implements the 'let it crash' philosophy; faults are localized and recovered without affecting the entire system
  • Message passing over shared memory — Enforces isolation between actors; avoids data races and simplifies reasoning about concurrent behavior
  • Async Rust with Tokio integration — Allows non-blocking I/O and native integration with the broader Rust async ecosystem
  • Distributed actor model with serialization — Enables cluster deployment and location-transparent actor communication via network sockets

⚖️Trade-offs already made

  • Panic-as-restart recovery model

    • Why: Simplifies fault recovery by treating panics as a normal control flow in actor systems
    • Consequence: Actors must be stateless or implement recovery logic; unhandled panics restart the actor, losing in-flight messages
  • Message serialization overhead for distribution

    • Why: Allows actors to live on different nodes without code duplication
    • Consequence: Local messaging is zero-copy but distributed messaging incurs serialization latency (microseconds to milliseconds)
  • Single Bastion instance per process

    • Why: undefined
    • Consequence: undefined

🪤Traps & gotchas

Workspace uses panic=unwind in both release and dev profiles (Cargo.toml) rather than abort—verify this doesn't conflict with your deployment environment. bastion-executor benchmarks (benches/spawn.rs, benches/perf.rs) may require specific CPU isolation or quiet system to get reproducible numbers. No visible .env or config files—runtime is configured programmatically. Tests import from src/bastion-executor/tests/lib.rs which suggests shared test utilities that new tests must reference.

🏗️Architecture

💡Concepts to learn

  • Work-Stealing Scheduler — Core load balancing strategy in src/bastion-executor/src/load_balancer.rs and worker.rs—determines how tasks are distributed across threads and prevents thread starvation
  • Actor Model — Bastion's programming model for concurrent, isolated units (actors) communicating via message passing rather than shared memory, implemented throughout src/bastion/src/
  • Supervisor Trees — Fault tolerance pattern inherited from Erlang/OTP where parent actors supervise children and restart them on failure—core to Bastion's high-availability guarantee
  • Lightweight Processes / Green Threads — Bastion implements actor tasks as lightweight abstractions over OS threads managed by the executor, enabling thousands of concurrent tasks without OS thread overhead
  • At-Most-Once Delivery Semantics — Bastion's message delivery guarantee (stated in README) ensures each message is processed by exactly one actor or dropped—critical for distributed system correctness
  • Thread Affinity / CPU Placement — src/bastion-executor/src/placement.rs enables pinning worker threads to specific CPU cores, improving cache locality and predictable latency in latency-sensitive workloads
  • Blocking Task Isolation — src/bastion-executor/src/blocking.rs provides separate handling for blocking I/O to prevent starving async tasks—critical pattern for mixed async/blocking workloads
  • tokio-rs/tokio — Alternative async runtime for Rust; Bastion uses a work-stealing executor while Tokio uses a scheduler-based approach—understanding both is key for runtime choice
  • erlang/otp — Original inspiration for actor model and supervisor tree fault tolerance patterns that Bastion implements
  • paritytech/substrate — Production blockchain runtime using actor-like patterns and fault tolerance principles similar to Bastion's concurrency model
  • rayon-rs/rayon — Alternative work-stealing scheduler for Rust parallelism; comparison point for Bastion's task distribution strategy
  • async-rs/async-std — Companion async runtime ecosystem; users often evaluate async-std vs. Tokio vs. Bastion for their use case

🪄PR ideas

To work on one of these in Claude Code or Cursor, paste: Implement the "<title>" PR idea from CLAUDE.md, working through the checklist as the task list.

Add comprehensive benchmarking suite for bastion-executor load balancer

The bastion-executor has a load_balancer.rs module but no dedicated benchmarks exist in src/bastion-executor/benches/ to measure its performance characteristics. Given this is a fault-tolerant runtime, benchmarking load distribution under various conditions (uneven task distribution, queue saturation, worker contention) would provide valuable performance insights and prevent regressions.

  • [ ] Create src/bastion-executor/benches/load_balancer.rs with benchmarks for queue distribution patterns
  • [ ] Add benchmarks measuring steal operations across workers under different loads
  • [ ] Benchmark performance with varying numbers of workers and task queue depths
  • [ ] Document benchmark results in src/bastion-executor/README.md with performance expectations

Add integration tests for multi-level supervision trees in src/bastion/tests/

The examples folder shows supervisors and distributors being used (examples/distributor.rs), but the test coverage in src/bastion appears minimal. Integration tests validating complex supervision hierarchies, fault propagation through nested supervisors, and recovery behavior would strengthen confidence in the core fault-tolerance claims.

  • [ ] Create src/bastion/tests/supervision_hierarchy.rs testing nested supervisor relationships
  • [ ] Add tests for fault propagation and restart behavior across supervisor levels
  • [ ] Add tests validating message delivery guarantees during supervisor restarts
  • [ ] Reference any passing/failing scenarios in test documentation

Document and test blocking thread pool configuration via src/bastion-executor/src/blocking.rs

The blocking.rs module exists and has a test script (src/bastion-executor/scripts/test_blocking_thread_pool.sh), but there are no unit or integration tests in src/bastion-executor/tests/ specifically validating blocking task execution, thread pool sizing, and blocking-vs-async task separation. This is critical for users relying on blocking I/O.

  • [ ] Add src/bastion-executor/tests/blocking_behavior.rs with tests for blocking task isolation
  • [ ] Add tests validating thread pool sizing limits and overflow behavior
  • [ ] Add tests confirming blocking tasks don't starve async task execution
  • [ ] Update src/bastion-executor/README.md with blocking API usage examples and guarantees

🌿Good first issues

  • Add integration test for supervisor tree recovery in src/bastion-executor/tests/ verifying fault tolerance when worker threads panic—no such test visible in the current test files
  • Document load balancer strategy selection in README and add example in src/bastion/examples/ showing how to configure placement.rs strategies for NUMA or heterogeneous workloads
  • Expand bastion-executor/benches/stats.rs to collect and report latency percentiles (p50, p95, p99) for task scheduling, currently only throughput is measured

Top contributors

Click to expand

📝Recent commits

Click to expand
  • 48d4c73 — start iteration 0.4.6-alpha.0 (o0Ignition0o)
  • 2703b52 — prepare for bastion publish (o0Ignition0o)
  • cd14080 — bastion-executor: prepare for release 0.4.2 (o0Ignition0o)
  • 01eeb58 — Update dependencies (#337) (Keruspe)
  • beff46a — unregister from distributors and dispatchers when a child panics (#336) (o0Ignition0o)
  • 44508cd — Don't remove a distributor from the global dispatcher if it has clients (#330) (cjfuller)
  • 7fb016c — Example: add dependencies to distributor (#329) (cbonaudo)
  • 0556377 — update hello world with message handler (#328) (oScape)
  • f1697b3 — bump dependencies (#324) (o0Ignition0o)
  • 24f5522 — remove clippy inline lints, that's too much noise for now (#326) (o0Ignition0o)

🔒Security observations

Bastion-rs demonstrates reasonable security maturity with an established vulnerability reporting process and dual licensing (Apache/MIT). The codebase follows Rust best practices with use of sanitizers and miri testing. However, improvements are needed in: (1) security configuration hardening (panic behavior in release builds), (2) expanding security documentation and threat model communication, (3) formalizing the security response team structure, and (4) implementing comprehensive security scanning in CI/CD pipelines. No hardcoded secrets, SQL injection vectors, or infrastructure misconfigurations were detected in the visible file structure. The project would benefit from formal security audits given its use case as a distributed, fault-tolerant runtime in potentially critical systems.

  • Medium · Broad Panic Configuration in Release Profile — Cargo.toml - [profile.release], [profile.dev], [profile.bench]. The Cargo.toml configuration sets 'panic = "unwind"' across all profiles (dev, release, bench). Using unwind mode can increase binary size and may expose more stack information in panic scenarios. For production releases, abort mode is generally recommended for security and performance. Fix: Consider using 'panic = "abort"' in the release profile to reduce binary size and minimize information disclosure through unwinding. Keep 'unwind' only in dev/bench profiles if needed for debugging.
  • Low · Missing Security Headers Documentation — SECURITY.md and overall documentation. While a SECURITY.md file exists with vulnerability reporting guidelines, there is no documented security architecture, threat model, or security best practices for users of the library. The codebase lacks security-focused documentation beyond vulnerability reporting procedures. Fix: Expand SECURITY.md to include: security architecture overview, known limitations, security guarantees, cryptographic practices (if applicable), and guidance on secure usage patterns for distributed systems.
  • Low · Incomplete Security Point of Contact Information — SECURITY.md - Security Point of Contact section. The SECURITY.md relies on email and GitHub handles as contact methods. The email (team@bastion.rs) and single point of contact (@vertexclique) create potential bottlenecks and single points of failure for security issue reporting. Fix: Establish a security team rather than individual contacts, implement a PGP key for encrypted vulnerability reports, and consider using HackerOne or similar platforms for coordinated disclosure.
  • Low · No Visible Dependency Version Pinning Strategy — Cargo.toml workspace configuration. The workspace Cargo.toml does not show explicit version constraints for member dependencies. Without examining individual Cargo.toml files, it's unclear if transitive dependencies are properly vetted and version-locked. Fix: Review and lock versions of all critical transitive dependencies. Consider using Cargo.lock in the repository and implementing dependency scanning tools (cargo-deny, cargo-audit) in CI/CD pipeline.
  • Low · Insufficient CI/CD Security Scanning — .github/workflows/. The GitHub Actions workflows visible in the file structure (ci.yml, miri.yml, sanitizers.yml) don't explicitly indicate comprehensive security scanning (SAST, dependency scanning, etc). Fix: Add automated security checks to CI/CD: cargo-audit for dependency vulnerabilities, clippy with security lints, dependency scanning, and consider SAST tools. Implement branch protection rules requiring security checks to pass.

LLM-derived; treat as a starting point, not a security audit.


Generated by RepoPilot. Verdict based on maintenance signals — see the live page for receipts. Re-run on a new commit to refresh.

Healthy signals · bastion-rs/bastion — RepoPilot