Skip to content

Route thread commands through daemon - #309

Merged
TraderSamwise merged 2 commits into
masterfrom
chore/core-sidecar-next-34
Jul 4, 2026
Merged

Route thread commands through daemon#309
TraderSamwise merged 2 commits into
masterfrom
chore/core-sidecar-next-34

Conversation

@TraderSamwise

@TraderSamwise TraderSamwise commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • add daemon-owned text routes for threads/thread/message CLI workflows
  • route installed shim fast paths through the daemon to project-service thread APIs
  • update command ownership inventory and coverage for no-Node healthy paths plus stale-daemon fallback

Verification

  • yarn typecheck
  • yarn lint
  • yarn build
  • yarn vitest run src/daemon.test.ts src/installed-shim.test.ts src/core-command-ownership.test.ts
  • yarn vitest run

Summary by CodeRabbit

  • New Features

    • Added command support for thread browsing, thread actions, and message sending through the installed CLI.
    • Thread results now show richer details such as status, unread/waiting counts, participants, and latest message info.
  • Bug Fixes

    • Thread and message commands now follow the normal daemon-backed path when available, improving consistency and reliability.
    • Added fallback behavior so commands still work when the daemon is not up to date.
  • Documentation

    • Updated command ownership tracking for the new thread and message commands.

@vercel

vercel Bot commented Jul 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app Ready Ready Preview, Comment Jul 4, 2026 7:40pm

@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 38 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 53e3ae83-7820-415e-88c0-fe52f36d6f14

📥 Commits

Reviewing files that changed from the base of the PR and between 86b7704 and 18844ec.

📒 Files selected for processing (4)
  • scripts/installed-aimux-shim.sh
  • src/daemon.test.ts
  • src/daemon.ts
  • src/installed-shim.test.ts
📝 Walkthrough

Walkthrough

This PR adds thread and message management commands routed through daemon text endpoints to project-service APIs. It extends CORE_API_ROUTES with thread/message path constants, adds rendering helpers in core-text.ts, implements new shim CLI commands (threads, thread, message), adds corresponding daemon route handlers with validation, and updates dispatch wiring and tests. Documentation reclassifies these commands from LEGACY to CUT.

Changes

Thread/message text routes

Layer / File(s) Summary
Route contracts and render types
src/core-command-contract.ts, src/core-text.ts
Adds messageSendText and thread*Text/threadsListText route constants, plus new payload interfaces and renderCore*Lines functions for thread/message text output.
Installed shim commands
scripts/installed-aimux-shim.sh
Adds aimux_try_threads, aimux_try_thread, aimux_try_message helpers with per-subcommand argument parsing/validation, and extends top-level dispatch for threads, thread, message commands.
Daemon route handlers and dispatch
src/daemon.ts
Adds imports for new render/payload types, expands LOCAL_CLI_TEXT_ROUTES, adds isRouteResponse, requiredProjectServiceObject, csvParam helpers, implements thread/message private handlers proxying to project service, and wires them into routeRequest().
Tests and ownership doc
src/daemon.test.ts, src/installed-shim.test.ts, src/core-command-ownership.test.ts, docs/command-ownership-inventory.md
Adds integration tests for daemon thread/message routing and shim fast-path/fallback behavior, extends ownership inventory test entries, and reclassifies aimux thread/aimux message from LEGACY to CUT.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Shim as installed-aimux-shim.sh
  participant Daemon as daemon.ts
  participant ProjectService as Project Service API
  participant Render as core-text.ts

  Shim->>Daemon: GET/POST /core/thread(s)/*-text or /core/message/send-text
  Daemon->>Daemon: validate input (requiredProjectServiceObject, csvParam)
  Daemon->>ProjectService: getProjectServiceJson/postProjectServiceJson
  ProjectService-->>Daemon: thread/message JSON response
  Daemon->>Render: renderCoreThread*/MessageSendLines(payload)
  Render-->>Daemon: formatted text lines
  Daemon-->>Shim: CLI text/json response
Loading

Possibly related PRs

  • TraderSamwise/aimux#298: Both PRs modify the same scripts/installed-aimux-shim.sh dispatch logic, adding new CLI subcommand handling.
  • TraderSamwise/aimux#302: Both PRs extend CORE_API_ROUTES and daemon/shim dispatch with new /core/*-text fast-path routes.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: routing thread-related commands through the daemon.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/core-sidecar-next-34

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 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 `@docs/command-ownership-inventory.md`:
- Line 61: The `aimux thread ...` and `aimux message ...` row is classified as
`CUT` before the family has text/JSON parity, which conflicts with the
document’s own enforcement rule. Update the inventory entry to keep these
commands in `SIDEcar`/`LEGACY` until the related shim commands such as `thread
open/send/mark-seen/status` and `message send` support `--json`, or otherwise
close the JSON gap first before reclassifying this family in the table.

In `@scripts/installed-aimux-shim.sh`:
- Around line 750-925: The new subcommand parsers in aimux_try_message and the
thread command branches (open, send, mark-seen, status) bypass the same input
validation used by aimux_parse_project_json_args and
aimux_parse_project_json_args_with_session. Add the missing guards for every
parsed option so each flag rejects values that start with "-" and rejects empty
"--flag=" values, matching the shared helpers’ behavior. Apply this consistently
to the per-flag case handling for project_root, title, from, participants, to,
assignee, tool, worktree, kind, status, owner, and waiting_on so invalid input
falls back cleanly instead of being forwarded to aimux_post_query_text_route.
- Around line 750-925: The threaded and message mutation fast paths are missing
`--json` support, so they do not preserve the same JSON/text behavior as the
other CUT mutation commands. Update the argument parsing in `aimux_try_thread`
and `aimux_try_message` for `open`, `send`, `mark-seen`, `status`, and `message
send` to recognize `--json` and carry that flag through to
`aimux_post_query_text_route` by appending `?json=1` when set, matching the
existing pattern used by the other mutation paths.

In `@src/daemon.ts`:
- Around line 784-807: The participants guard in threadOpenTextRoute only checks
for a falsy value, so an empty array from csvParam still slips through. Update
the validation in threadOpenTextRoute to reject both missing and empty
participants, matching the pattern used in messageSendTextRoute by checking for
no value or zero length before calling postProjectServiceJson.
🪄 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

Run ID: c204f9c5-2939-452d-bb15-3737dcbf59c8

📥 Commits

Reviewing files that changed from the base of the PR and between 818c17d and 86b7704.

📒 Files selected for processing (8)
  • docs/command-ownership-inventory.md
  • scripts/installed-aimux-shim.sh
  • src/core-command-contract.ts
  • src/core-command-ownership.test.ts
  • src/core-text.ts
  • src/daemon.test.ts
  • src/daemon.ts
  • src/installed-shim.test.ts

Comment thread docs/command-ownership-inventory.md
Comment thread scripts/installed-aimux-shim.sh
Comment thread src/daemon.ts
@TraderSamwise
TraderSamwise merged commit 45de728 into master Jul 4, 2026
3 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