Skip to content

feat(consciousness): async tool execution (BRO-459)#53

Merged
broomva merged 1 commit into
mainfrom
feature/bro-459-async-tool-execution
Apr 5, 2026
Merged

feat(consciousness): async tool execution (BRO-459)#53
broomva merged 1 commit into
mainfrom
feature/bro-459-async-tool-execution

Conversation

@broomva
Copy link
Copy Markdown
Owner

@broomva broomva commented Apr 5, 2026

Summary

  • Move agent tick loop from blocking the consciousness event loop to a spawned tokio task, keeping the actor responsive during LLM calls + tool execution
  • Add CycleCompleted, ToolResult, ToolFailed event variants and WaitingForTools mode for future per-tool async
  • Use WeakSender for the self-referencing channel to preserve channel-close shutdown semantics
  • Sequential queue drain via CycleCompleted -> drain_queue_after_run chain (one cycle at a time)

Changes

  • crates/arcand/src/consciousness.rs: New spawn_agent_cycle + run_agent_cycle_inner methods, updated event loop and handle_user_message
  • crates/arcand/tests/consciousness_test.rs: 2 new integration tests (non_blocking_cycle_completes, cycle_completed_drains_queue)

Test plan

  • cargo fmt --check passes
  • cargo clippy -p arcand passes (zero warnings)
  • cargo test -p arcand --test consciousness_test — 9/9 tests pass (7 existing + 2 new)
  • cargo test --workspace — full workspace passes (zero failures)
  • Manual verification with real LLM provider (send concurrent messages, verify non-blocking behavior)

🤖 Generated with Claude Code

@linear
Copy link
Copy Markdown

linear Bot commented Apr 5, 2026

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 5, 2026

Warning

Rate limit exceeded

@broomva has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 18 minutes and 53 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 18 minutes and 53 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 834e2e16-7918-41b2-94a0-95dfad55894d

📥 Commits

Reviewing files that changed from the base of the PR and between 2e54e27 and e847063.

📒 Files selected for processing (2)
  • crates/arcand/src/consciousness.rs
  • crates/arcand/tests/consciousness_test.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/bro-459-async-tool-execution

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

…le (BRO-459)

Move the agent tick loop from blocking the consciousness event loop to a
spawned tokio task. The actor stays responsive to new messages, status
queries, and timer ticks while the LLM call + tool execution runs
concurrently. Key changes:

- Add ToolResult, ToolFailed, CycleCompleted event variants
- Add WaitingForTools mode (for future per-tool async)
- Add self_tx (WeakSender) so spawned tasks send CycleCompleted back
- Extract run_agent_cycle_inner as a static method for spawned tasks
- drain_queue_after_run now spawns one cycle at a time (sequential via
  CycleCompleted -> drain chain)
- WeakSender ensures channel-close detection still works when all
  external handles are dropped
- 2 new integration tests: non_blocking_cycle_completes,
  cycle_completed_drains_queue

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@broomva broomva force-pushed the feature/bro-459-async-tool-execution branch from fa3cf3b to e847063 Compare April 5, 2026 02:25
@broomva broomva merged commit ea3906e into main Apr 5, 2026
10 checks passed
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