Presently there is no validation of the value passed to the agent binary with -t/--task_stream.
This value is passed directly to the database, which can result in strange and unexpected behaviour. Notably, the agent will start up, show no errors and receive no work.
Steps to Reproduce
- Start the boundless stack per the quickstart guide (
just bento up)
- Run another agent with
-t notatype
docker run \
--name "test_agent" \
--network "bento_default"
-e DATABASE_URL="postgresql://worker:password@postgres:5432/taskdb" \
-e REDIS_URL="redis://redis:6379" \
-e S3_URL="http://minio:9000" \
-e S3_BUCKET="workflow" \
-e S3_ACCESS_KEY="admin" \
-e S3_SECRET_KEY="password" \
-e RUST_LOG="info" \
-e RUST_BACKTRACE="1" \
--entrypoint /app/agent \
risczero/risc0-bento-agent:2.3.0@sha256:5b029fb8074b3273b45e6e8fb4d6dbd86000a216688d8f1429eb893686cc1ff8 \
-t notatype
Which will result in this:
2025-08-29T16:23:14.370328Z INFO sqlx::postgres::notice: relation "_sqlx_migrations" already exists, skipping
2025-08-29T16:23:14.371437Z INFO agent: Successful agent startup! Worker type: notatype
Relevant Code
Agent is instantiated with args:
|
let agent = Agent::new(args) |
|
.await |
|
.context("Failed to initialize Agent")?; |
|
|
|
sqlx::migrate!("../taskdb/migrations") |
|
.run(&agent.db_pool) |
|
.await |
|
.context("Failed to run migrations")?; |
|
|
|
tracing::info!("Successful agent startup! Worker type: {task_stream}"); |
|
|
|
// Poll until agent is signaled to exit: |
|
agent.poll_work().await.context("Exiting agent polling") |
task_stream is passed directly to DB:
|
let task = taskdb::request_work(&self.db_pool, &self.args.task_stream) |
Proposed Fix
Implement an enum for the different agent types and let clap parse the input.
use clap::{Parser, ValueEnum};
#[derive(Debug, Clone, ValueEnum)]
#[clap(rename_all = "kebab-case")]
enum TaskStreamType {
Prove,
Snark,
Aux,
Exec,
}
#[derive(Parser, Debug, Clone)]
#[command(author, version, about, long_about = None)]
pub struct Args {
...
#[arg(value_parser = clap::value_parser!(TaskStreamType))]
task_stream: TaskStreamType,
...
}
⭐ If someone can validate this fix I would be happy to open a PR. ⭐
Presently there is no validation of the value passed to the agent binary with
-t/--task_stream.This value is passed directly to the database, which can result in strange and unexpected behaviour. Notably, the agent will start up, show no errors and receive no work.
Steps to Reproduce
just bento up)-t notatypeWhich will result in this:
Relevant Code
Agent is instantiated with args:
boundless/bento/crates/workflow/src/bin/agent.rs
Lines 19 to 31 in 5e7ac7d
task_streamis passed directly to DB:boundless/bento/crates/workflow/src/lib.rs
Line 238 in 5e7ac7d
Proposed Fix
Implement an enum for the different agent types and let clap parse the input.
⭐ If someone can validate this fix I would be happy to open a PR. ⭐