feat(agent): add code-specialized bootstrap entrypoint#174
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe pull request introduces specialized Agent initialization pathways to support profile-based configuration. New methods Changes
Sequence DiagramsequenceDiagram
participant Caller
participant Agent
participant Bootstrap as BootstrapContext
participant Config
Caller->>Agent: code_from_config(config)
activate Agent
Agent->>Bootstrap: from_config_with_profile(config, "code")
activate Bootstrap
Bootstrap->>Bootstrap: clone config, override profile
Bootstrap->>Bootstrap: from_effective_config
Bootstrap-->>Agent: BootstrapContext
deactivate Bootstrap
Agent->>Agent: from_bootstrap_with_provider(config, bootstrap, provider)
Agent-->>Caller: Agent (code profile)
deactivate Agent
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✅ Contributor ReportUser: @yacosta738
Contributor Report evaluates based on public GitHub activity. Analysis period: 2025-03-08 to 2026-03-08 |
|
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
clients/agent-runtime/src/agent/agent.rs (1)
254-275: 🧹 Nitpick | 🔵 TrivialMinor:
model_nameis computed twice.
from_bootstrapderivesmodel_nameat lines 255-259, thenfrom_bootstrap_with_providerderives it again at lines 271-275. Since both read from the sameconfig, consider passingmodel_nameas a parameter to avoid redundant extraction.♻️ Suggested refactor
- fn from_bootstrap(config: &Config, bootstrap: bootstrap::BootstrapContext) -> Result<Self> { - let model_name = config - .default_model - .as_deref() - .unwrap_or("anthropic/claude-sonnet-4-20250514") - .to_string(); - - let provider: Box<dyn Provider> = bootstrap::create_routed_provider(config, &model_name)?; - - Self::from_bootstrap_with_provider(config, bootstrap, provider) + fn from_bootstrap(config: &Config, bootstrap: bootstrap::BootstrapContext) -> Result<Self> { + let model_name = config + .default_model + .as_deref() + .unwrap_or("anthropic/claude-sonnet-4-20250514"); + + let provider: Box<dyn Provider> = bootstrap::create_routed_provider(config, model_name)?; + + Self::from_bootstrap_with_provider(config, bootstrap, provider, model_name.to_string()) } fn from_bootstrap_with_provider( config: &Config, bootstrap: bootstrap::BootstrapContext, provider: Box<dyn Provider>, + model_name: String, ) -> Result<Self> { - let model_name = config - .default_model - .as_deref() - .unwrap_or("anthropic/claude-sonnet-4-20250514") - .to_string(); - let dispatcher_choice = config.agent.tool_dispatcher.as_str();🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@clients/agent-runtime/src/agent/agent.rs` around lines 254 - 275, Compute model_name once in from_bootstrap and pass it into from_bootstrap_with_provider instead of recomputing it; update the signature of from_bootstrap_with_provider to accept model_name: String (or &str) and remove the duplicate extraction inside from_bootstrap_with_provider (references: from_bootstrap and from_bootstrap_with_provider, variable model_name and call to bootstrap::create_routed_provider) so the function uses the passed-in model_name when creating/using the provider.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@clients/agent-runtime/src/agent/agent.rs`:
- Around line 254-275: Compute model_name once in from_bootstrap and pass it
into from_bootstrap_with_provider instead of recomputing it; update the
signature of from_bootstrap_with_provider to accept model_name: String (or &str)
and remove the duplicate extraction inside from_bootstrap_with_provider
(references: from_bootstrap and from_bootstrap_with_provider, variable
model_name and call to bootstrap::create_routed_provider) so the function uses
the passed-in model_name when creating/using the provider.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: d66b7b41-2a19-4d28-a004-6b1a318ba2c9
📒 Files selected for processing (4)
clients/agent-runtime/src/agent/agent.rsclients/agent-runtime/src/bootstrap/mod.rsclients/web/apps/docs/src/content/docs/en/clients/agent-runtime/architecture.mdclients/web/apps/docs/src/content/docs/es/clients/agent-runtime/architecture.md
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: pr-checks
- GitHub Check: sonar
- GitHub Check: Cloudflare Pages
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{md,mdx}
⚙️ CodeRabbit configuration file
**/*.{md,mdx}: Verify technical accuracy and that docs stay aligned with code changes.
For user-facing docs, check EN/ES parity or explicitly note pending translation gaps.
Files:
clients/web/apps/docs/src/content/docs/en/clients/agent-runtime/architecture.mdclients/web/apps/docs/src/content/docs/es/clients/agent-runtime/architecture.md
**/*
⚙️ CodeRabbit configuration file
**/*: Security first, performance second.
Validate input boundaries, auth/authz implications, and secret management.
Look for behavioral regressions, missing tests, and contract breaks across modules.
Files:
clients/web/apps/docs/src/content/docs/en/clients/agent-runtime/architecture.mdclients/agent-runtime/src/bootstrap/mod.rsclients/web/apps/docs/src/content/docs/es/clients/agent-runtime/architecture.mdclients/agent-runtime/src/agent/agent.rs
clients/agent-runtime/src/**/*.rs
📄 CodeRabbit inference engine (clients/agent-runtime/AGENTS.md)
clients/agent-runtime/src/**/*.rs: Never log secrets, tokens, raw credentials, or sensitive payloads in any logging statements
Avoid unnecessary allocations, clones, and blocking operations to maintain performance and efficiency
Files:
clients/agent-runtime/src/bootstrap/mod.rsclients/agent-runtime/src/agent/agent.rs
clients/agent-runtime/**/*.rs
📄 CodeRabbit inference engine (clients/agent-runtime/AGENTS.md)
Run
cargo fmt --all -- --check,cargo clippy --all-targets -- -D warnings, andcargo testfor code validation, or document which checks were skipped and why
Files:
clients/agent-runtime/src/bootstrap/mod.rsclients/agent-runtime/src/agent/agent.rs
**/*.rs
⚙️ CodeRabbit configuration file
**/*.rs: Focus on Rust idioms, memory safety, and ownership/borrowing correctness.
Flag unnecessary clones, unchecked panics in production paths, and weak error context.
Prioritize unsafe blocks, FFI boundaries, concurrency races, and secret handling.
Files:
clients/agent-runtime/src/bootstrap/mod.rsclients/agent-runtime/src/agent/agent.rs
🧠 Learnings (8)
📓 Common learnings
Learnt from: CR
Repo: dallay/corvus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-17T07:28:38.934Z
Learning: Applies to .agents/AGENTS.md : Document agent configurations and capabilities in AGENTS.md
📚 Learning: 2026-02-17T07:28:38.934Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-17T07:28:38.934Z
Learning: Applies to .agents/AGENTS.md : Document agent configurations and capabilities in AGENTS.md
Applied to files:
clients/web/apps/docs/src/content/docs/en/clients/agent-runtime/architecture.mdclients/web/apps/docs/src/content/docs/es/clients/agent-runtime/architecture.md
📚 Learning: 2026-02-17T07:28:38.934Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-17T07:28:38.934Z
Learning: Applies to .agents/AGENTS.md : Include version information and compatibility details for agents
Applied to files:
clients/web/apps/docs/src/content/docs/en/clients/agent-runtime/architecture.md
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/main.rs : Preserve CLI contract unless change is intentional and documented; prefer explicit errors over silent fallback for unsupported critical paths
Applied to files:
clients/web/apps/docs/src/content/docs/en/clients/agent-runtime/architecture.mdclients/agent-runtime/src/bootstrap/mod.rsclients/agent-runtime/src/agent/agent.rs
📚 Learning: 2026-02-17T07:28:38.934Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-17T07:28:38.934Z
Learning: Applies to .agents/AGENTS.md : Maintain comprehensive agent metadata including name, description, purpose, and capabilities
Applied to files:
clients/web/apps/docs/src/content/docs/en/clients/agent-runtime/architecture.md
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/main.rs : Keep startup path lean and avoid heavy initialization in command parsing flow
Applied to files:
clients/web/apps/docs/src/content/docs/en/clients/agent-runtime/architecture.mdclients/agent-runtime/src/bootstrap/mod.rsclients/agent-runtime/src/agent/agent.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/providers/**/*.rs : Implement `Provider` trait in `src/providers/` and register in `src/providers/mod.rs` factory when adding a new provider
Applied to files:
clients/web/apps/docs/src/content/docs/en/clients/agent-runtime/architecture.mdclients/agent-runtime/src/agent/agent.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/**/Cargo.toml : Preserve release-size profile assumptions in `Cargo.toml` and avoid adding heavy dependencies unless clearly justified
Applied to files:
clients/agent-runtime/src/bootstrap/mod.rsclients/agent-runtime/src/agent/agent.rs
🪛 LanguageTool
clients/web/apps/docs/src/content/docs/es/clients/agent-runtime/architecture.md
[grammar] ~138-~138: Elimina la palabra o signo.
Context: ... especializado en código sin duplicar el bootstrap. La ruta canónica es `Agent::c...
(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_SPACE)
[grammar] ~139-~139: Elimina la palabra o signo.
Context: ...g(&config)`, que reutiliza el ensamblaje compartido del bootstrap y fuerza el per...
(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_SPACE)
[grammar] ~140-~140: Elimina la palabra o signo.
Context: ...dades code solo para esa instancia del agente. Los consumidores de más bajo niv...
(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_SPACE)
[grammar] ~141-~141: Elimina la palabra o signo.
Context: ...ceder directamente a los componentes del bootstrap pueden usar `BootstrapContext:...
(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_SPACE)
[grammar] ~144-~144: Cambia la forma del adjetivo.
Context: ...ofile(&config, "code")`. Esto mantiene alineados la selección de proveedor, la memoria, ...
(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_ADJECTIVE_FORM)
[grammar] ~144-~144: Elimina la palabra o signo.
Context: ...oria, la observabilidad y el filtrado de herramientas con la ruta principal del r...
(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_SPACE)
[grammar] ~145-~145: Elimina la palabra o signo.
Context: ...mientras permite agregar futuros agentes especializados como entrypoints delgados...
(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_SPACE)
[grammar] ~146-~146: Elimina la palabra o signo.
Context: ...les en lugar de árboles de configuración separados. ### Proveedores El módulo `...
(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_SPACE)
🔇 Additional comments (5)
clients/web/apps/docs/src/content/docs/en/clients/agent-runtime/architecture.md (1)
132-142: LGTM!The new "Internal Specialized Agent Paths" section accurately documents the added
Agent::code_from_configandBootstrapContext::from_config_with_profileAPIs. The description correctly explains the profile-based bootstrap reuse pattern and aligns with the implementation inagent.rsandbootstrap/mod.rs.clients/web/apps/docs/src/content/docs/es/clients/agent-runtime/architecture.md (1)
136-147: LGTM!The Spanish translation maintains semantic parity with the English documentation. The static analysis grammar warnings are false positives triggered by code identifiers within backticks (e.g.,
bootstrap,code).clients/agent-runtime/src/bootstrap/mod.rs (1)
164-176: LGTM!The refactored bootstrap initialization cleanly separates profile override logic from effective config processing. The
config.clone()on line 169 is acceptable since this runs only once during agent initialization, not on hot request paths.clients/agent-runtime/src/agent/agent.rs (2)
230-238: LGTM!Clean public API additions for profile-based agent construction.
code_from_configis a convenient thin wrapper that hardcodes the "code" profile.
1341-1366: LGTM!Solid test coverage for the code-profile bootstrap path. Correctly verifies tool filtering (
shellandgit_operationspresent,scheduleabsent) and exercises thefrom_bootstrap_with_providerconstructor with a mock provider.



This pull request introduces a new, profile-based mechanism for instantiating specialized agents—specifically, a "code" profile—without duplicating bootstrap logic. It refactors the agent and bootstrap initialization flow to support this, adds new entrypoints for profile-based agent creation, and updates documentation and tests to reflect these changes.
Agent Initialization and Profile Support
Added new methods to the
Agentstruct:from_config_with_profileandcode_from_config, allowing creation of agents with a specific capability profile (e.g., "code"), reusing existing bootstrap logic. Also refactored agent construction to use a newfrom_bootstrap_with_providerhelper for improved composability. [1] [2] [3]Updated
BootstrapContextwithfrom_config_with_profileandfrom_effective_configmethods, enabling profile-specific context initialization without duplicating configuration logic.Testing
Documentation