Repository navigation
feat(session): publish subagent runtime messages - #98
Conversation
Product-side session management needs a narrow subagent_message publishing contract so the existing pipeline prompt wiring can consume messages without expanding agentkit or HTTP scope. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR adds ChangesSubagent Message Publishing
Sequence DiagramsequenceDiagram
participant Caller
participant SessionManager
participant RuntimeMessageBus
participant Pipeline
participant LLM
Caller->>SessionManager: publish_subagent_message(session_id, text)
SessionManager->>SessionManager: validate text, generate/validate message_id
SessionManager->>RuntimeMessageBus: publish(SUBAGENT_MESSAGE, {text, metadata})
RuntimeMessageBus-->>SessionManager: confirmation
SessionManager->>SessionManager: update session.last_activity, persist
SessionManager-->>Caller: return True
Pipeline->>RuntimeMessageBus: consume pending runtime messages
RuntimeMessageBus-->>Pipeline: [SUBAGENT_MESSAGE payload]
Pipeline->>Pipeline: compose system prompt with subagent message
Pipeline->>LLM: execute with updated prompt
LLM-->>Pipeline: response
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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. Review rate limit: 0/1 reviews remaining, refill in 4 minutes and 34 seconds.Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@coding-agent/src/coding_agent/ui/session_manager.py`:
- Around line 1629-1667: publish_subagent_message currently reads the live
Session, publishes to the runtime bus, and persists the session without holding
self._lock, allowing a concurrent remove_session_async()/close_session() to
delete the session and be overwritten; fix by serializing the entire
read-publish-persist path with the session lock: acquire the per-session lock
(self._lock) before calling get_session_async(), keep it held while calling
session.runtime_message_bus.publish(...), updating session.last_activity, and
calling _persist_session_async(session), and only release the lock after persist
(ensure the lock is held across the try/except that handles
DuplicateRuntimeMessageError so you don't resurrect a removed session).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 8bd86900-608d-4976-a39e-be5af1682cf0
📒 Files selected for processing (2)
coding-agent/src/coding_agent/ui/session_manager.pycoding-agent/tests/ui/test_session_manager_public_api.py
Hold the session lock across subagent message publish and persistence so a concurrent remove cannot restore deleted state. Add a regression test that proves removal waits until publish finishes and leaves the session deleted.
Summary
SessionManager.publish_subagent_message(...)contract that publishessubagent_messageruntime messages on the session bustextplus optional metadata), support caller-provided message ids, and make duplicate ids idempotent successVerification
uv run pytest tests/ui/test_session_manager_public_api.py -k "publish_subagent_message or submit_approval_rejects_stale_pending_projection_without_store_request" -quv run pytest tests/ui/test_session_manager_public_api.py -quv run pytest tests/agentkit/runtime/test_pipeline.py -k "runtime_context_grounding or runtime_message_consumed_after_build_context_reaches_prompt or prompt_runtime_message_after_run_model_is_kept_for_next_turn or runtime_approval_decision_is_left_for_product_consumer" -quv run pytest tests/agentkit/runtime/test_pipeline.py -quv run pytest tests/coding_agent/test_approval_runtime_messages.py -quv run basedpyright src/coding_agent/ui/session_manager.py tests/ui/test_session_manager_public_api.py --level errorpython3 -m py_compile src/coding_agent/ui/session_manager.pyuv run python -m coding_agent --helpSummary by CodeRabbit
Release Notes