Fix Command Router HTTP API count-only queries and parameter sync#1188
Conversation
|
Warning Review limit reached
Next review available in: 33 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
WalkthroughHTTP command routing now synchronizes per-peer parameters and returns structured polling results. COUNT responses support count-only execution totals, while HTTP handlers and tests consume the richer result contract across streaming, get/set, error, and parameter synchronization paths. ChangesHTTP router result flow
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant CommandRouterHttpAPI
participant BusCommandRouterProxyStreamPoller
participant BusCommandRouterProxy
participant RemotePeer
CommandRouterHttpAPI->>BusCommandRouterProxyStreamPoller: execute command and poll stream
BusCommandRouterProxyStreamPoller->>RemotePeer: dispatch router command
RemotePeer-->>BusCommandRouterProxy: answers or COUNT response
BusCommandRouterProxyStreamPoller-->>CommandRouterHttpAPI: PollStreamResult
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/agents/command_router/BusCommandRouterProcessor.cc (1)
39-48: 🩺 Stability & Availability | 🔴 Critical | ⚡ Quick winCopy peer parameters while holding the mutex
parameters_for_peer()returns aProperties&after releasingrouter_parameters_mutex, but bothdispatch_http_command()andrun_command()copy from that reference later.handle_set()writes back to the samerouter_parameters_by_peerentry under the same mutex, so overlapping requests for one peer can race on thePropertiescopy. ReturnPropertiesby value from the locked section (or add a locked copy helper) and add a concurrent set/query test.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/agents/command_router/BusCommandRouterProcessor.cc` around lines 39 - 48, Change BusCommandRouterProcessor::parameters_for_peer() to copy the peer parameters while router_parameters_mutex is held and return Properties by value, then update dispatch_http_command() and run_command() callers to use the value. Add a concurrent test covering overlapping handle_set() and query/dispatch operations for the same peer.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/agents/command_router/BusCommandRouterProxy.cc`:
- Around line 65-74: Update BusCommandRouterProxy::count_answer to parse and
validate the COUNT argument before calling set_count: reject negative or
otherwise invalid values through the existing error mechanism, then convert only
validated non-negative input to the unsigned count type. Add coverage for
negative and invalid COUNT arguments.
---
Outside diff comments:
In `@src/agents/command_router/BusCommandRouterProcessor.cc`:
- Around line 39-48: Change BusCommandRouterProcessor::parameters_for_peer() to
copy the peer parameters while router_parameters_mutex is held and return
Properties by value, then update dispatch_http_command() and run_command()
callers to use the value. Add a concurrent test covering overlapping
handle_set() and query/dispatch operations for the same peer.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: dd2dca6e-0945-4c2e-a8d5-b98f0f7908fb
📒 Files selected for processing (8)
src/agents/command_router/BusCommandRouterProcessor.ccsrc/agents/command_router/BusCommandRouterProxy.ccsrc/agents/command_router/BusCommandRouterProxy.hsrc/agents/command_router/http_api/BusCommandRouterProxyStreamPoller.ccsrc/agents/command_router/http_api/BusCommandRouterProxyStreamPoller.hsrc/agents/command_router/http_api/CommandRouterHttpAPI.ccsrc/agents/command_router/http_api/CommandRouterHttpAPI.hsrc/tests/cpp/command_router_http_api_test.cc
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/agents/command_router/http_api/BusCommandRouterProxyStreamPoller.cc (1)
12-14: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCover both metta-output branches with focused tests.
The supplied regression test covers only
populate_metta_mapping == falsewith an empty mapping. Add cases forpopulate_metta_mapping == trueand forpopulate_metta_mapping == falsewith a populatedmetta_expressionmap, asserting that the serialized answer contains the MeTTa value.As per coding guidelines, test updates are required when production code changes. As per path instructions, behavior changes should have matching
*_test.cccoverage.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/agents/command_router/http_api/BusCommandRouterProxyStreamPoller.cc` around lines 12 - 14, Add focused tests for should_use_metta_output covering both remaining branches: populate_metta_mapping == true and populate_metta_mapping == false with a populated answer.metta_expression map. In each case, assert that the serialized answer includes the expected MeTTa value, using the existing regression test setup and corresponding *_test.cc conventions.Sources: Coding guidelines, Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/agents/command_router/http_api/BusCommandRouterProxyStreamPoller.cc`:
- Around line 12-14: Add focused tests for should_use_metta_output covering both
remaining branches: populate_metta_mapping == true and populate_metta_mapping ==
false with a populated answer.metta_expression map. In each case, assert that
the serialized answer includes the expected MeTTa value, using the existing
regression test setup and corresponding *_test.cc conventions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: b4dd3923-ee4e-4ecb-ba69-9f13c19c0249
📒 Files selected for processing (2)
src/agents/command_router/http_api/BusCommandRouterProxyStreamPoller.ccsrc/tests/cpp/command_router_http_api_test.cc
🚧 Files skipped from review as they are similar to previous changes (1)
- src/tests/cpp/command_router_http_api_test.cc
No description provided.