Skip to content

feat(consciousness): Spaces integration as external stimulus (BRO-458)#51

Merged
broomva merged 1 commit intomainfrom
feature/bro-458-spaces-consciousness
Apr 5, 2026
Merged

feat(consciousness): Spaces integration as external stimulus (BRO-458)#51
broomva merged 1 commit intomainfrom
feature/bro-458-spaces-consciousness

Conversation

@broomva
Copy link
Copy Markdown
Owner

@broomva broomva commented Apr 5, 2026

Summary

  • Add SpacesMessage variant to ConsciousnessEvent enum, enabling the consciousness actor to receive distributed messages from the Spaces networking layer as external stimuli
  • When idle or sleeping, incoming Spaces messages are re-injected as UserMessage events to trigger deliberation cycles; own messages are filtered to prevent feedback loops
  • Add spaces_enabled / spaces_poll_interval config fields and a guarded polling timer branch in the tokio::select! event loop (stub for future SpacetimeDB SDK integration via spawn_blocking)
  • Add 2 integration tests: spaces_message_handled_when_idle and own_spaces_messages_ignored

Changes

File What
crates/arcand/src/consciousness.rs SpacesMessage event variant, config fields, polling branch, handle_spaces_message method
crates/arcand/tests/consciousness_test.rs 2 new tests for Spaces message handling

Test plan

  • cargo check -p arcand passes
  • cargo clippy -p arcand clean (no warnings)
  • cargo test -p arcand -- all 70 tests pass (51 unit + 10 canonical API + 9 consciousness)
  • Future: wire actual SpacetimeDB polling via SpacesPort::read_messages + spawn_blocking

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added Spaces messaging capability with configurable polling intervals
    • Messages handled intelligently based on session state (idle receives messages, active logs context, shutdown ignores)
    • Automatic filtering prevents self-generated message processing
  • Tests

    • New integration tests verify Spaces message handling and state-based behavior

Add SpacesMessage variant to ConsciousnessEvent enum, allowing the
consciousness actor to receive distributed messages from the Spaces
networking layer. When idle/sleeping, incoming Spaces messages trigger
a deliberation cycle. Own messages are filtered to prevent feedback
loops. Includes spaces_enabled config flag and polling timer stub for
future SpacetimeDB SDK integration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@linear
Copy link
Copy Markdown

linear bot commented Apr 5, 2026

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 5, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Added Spaces-related configuration and message handling to the consciousness actor. New config fields control polling behavior, a SpacesMessage event variant was introduced, and an event handler processes messages based on session mode, filtering self-originated messages.

Changes

Cohort / File(s) Summary
Spaces Integration
crates/arcand/src/consciousness.rs
Added spaces_enabled and spaces_poll_interval config fields. Extended ConsciousnessEvent with SpacesMessage variant. Integrated polling interval into event loop with conditional tick dispatch. Implemented handle_spaces_message handler that filters self-messages, logs previews, and routes to re-injection (Idle/Sleeping), context logging (Active), or ignoring (ShuttingDown).
Spaces Tests
crates/arcand/tests/consciousness_test.rs
Added two integration tests: spaces_message_handled_when_idle validates message processing during Idle mode with status verification, and own_spaces_messages_ignored confirms self-originated messages don't trigger processing.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🐰 A rabbit hops through spaces wide,
Where consciousness and messages collide,
New channels flow, but self-talks fade,
As modes dance between sleep and trade,
Poll tick, tick—awareness stays awake!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(consciousness): Spaces integration as external stimulus (BRO-458)' directly and clearly summarizes the main change: adding Spaces message integration to the consciousness actor as external stimulus.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/bro-458-spaces-consciousness

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.

@broomva broomva merged commit 8590b39 into main Apr 5, 2026
9 of 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