Skip to content

Route workflow commands through core daemon - #310

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

Route workflow commands through core daemon#310
TraderSamwise merged 2 commits into
masterfrom
chore/core-sidecar-next-35

Conversation

@TraderSamwise

@TraderSamwise TraderSamwise commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • route task, handoff, and review installed-shim commands through daemon text routes backed by project-service APIs
  • add daemon text renderers and route contract entries for workflow commands
  • keep stale/invalid fallback behavior while adding project/json parity to the Node fallback
  • update command ownership inventory to mark workflow commands CUT

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 support for workflow commands covering tasks, handoffs, and reviews, including list/show, assign, accept, complete, approve, and request-changes actions.
    • Added project selection support for these commands so they can target a specific project path.
  • Bug Fixes

    • Improved routing so workflow commands are served consistently through the installed path and daemon-backed fast path.
    • Added validation and clearer error handling for invalid command arguments.

@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 8:35pm

@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: 46 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: 990307a8-48ca-474d-aefa-a77cd732acf8

📥 Commits

Reviewing files that changed from the base of the PR and between 81fcb3b and 4312ce5.

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

Walkthrough

This PR adds workflow commands (task, handoff, review) as first-class routed features. It introduces new CORE_API_ROUTES text endpoints, daemon route handlers proxying to the project service, rendering functions for text output, installed shim fast-path support, and CLI --project/--json options across handoff, task, and review subcommands. Documentation classification is updated accordingly.

Changes

Workflow commands cohort

Layer / File(s) Summary
Route contract and text rendering
src/core-command-contract.ts, src/core-text.ts
Adds CORE_API_ROUTES entries for handoff/task/review text endpoints and new payload types/render functions for handoff, task list/show/mutation, and review request-changes output.
Daemon route handlers
src/daemon.ts, src/daemon.test.ts
Adds handlers proxying handoff send/mutation, task list/show/assign/mutation, and review request-changes to the project service, extends LOCAL_CLI_TEXT_ROUTES and routeRequest dispatch, and adds daemon tests covering these routes.
Installed shim fast-path commands
scripts/installed-aimux-shim.sh, src/installed-shim.test.ts, src/core-command-ownership.test.ts, docs/command-ownership-inventory.md
Adds shell functions for handoff, task, and review subcommands with routing/dispatch, expands the curl fast-path matcher, adds fast-path tests, updates ownership test inventory, and reclassifies these commands from LEGACY to CUT in documentation.
CLI --project support and command wiring
src/main.ts
Extends postProjectServiceJson/getProjectServiceJson with a projectRoot option and adds --project/--json flags to message send, handoff, task, and review commands, resolving project root via prepareProjectContext.

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

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant Shim as Installed Shim
  participant Daemon
  participant ProjectService

  CLI->>Shim: aimux task/handoff/review <args>
  Shim->>Daemon: GET/POST /core/{handoff|task|review}/*-text
  Daemon->>ProjectService: requestJson (send/accept/complete/list/show/assign/action)
  ProjectService-->>Daemon: task/thread/message data
  Daemon-->>Shim: rendered text lines
  Shim-->>CLI: stdout output
Loading

Possibly related PRs

  • TraderSamwise/aimux#271: Both PRs extend the routeRequest dispatch layer in src/daemon.ts to add new CORE API endpoint handling.
🚥 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 accurately summarizes the main change: routing workflow commands through the core 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-35

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: 1

🧹 Nitpick comments (4)
src/daemon.ts (1)

960-1181: 🧹 Nitpick | 🔵 Trivial

New route handlers look correct; verify end-to-end via built daemon.

Handler logic, validation, and dispatch wiring for handoff/task/review routes are consistent with the route contract and covered by daemon.test.ts. As per coding guidelines, for this kind of daemon runtime/CLI behavior, build and install the local release asset and run aimux restart to confirm the daemon actually picks up these new routes end-to-end, rather than relying on source-level test mocks alone.

🤖 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/daemon.ts` around lines 960 - 1181, The new route handlers in daemon.ts
look fine, but this change needs end-to-end verification against the built
daemon rather than only source-level tests. Build and install the local release
asset, then use aimux restart and exercise the new handoff/task/review routes to
confirm the runtime actually picks up the updated handler methods such as
handoffSendTextRoute, handoffMutationTextRoute, taskAssignTextRoute,
taskMutationTextRoute, reviewRequestChangesTextRoute, and taskMutationResponse.

Source: Coding guidelines

scripts/installed-aimux-shim.sh (2)

1030-1058: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

aimux_parse_thread_action_args and aimux_parse_task_action_args are near-duplicates.

Both functions parse identical --project/--from/--body/--json options and differ only in the id variable name (AIMUX_PARSED_THREAD vs AIMUX_PARSED_TASK). Consider unifying into a single helper that takes the output variable name (or id kind) as a parameter to avoid maintaining two copies of the same parsing logic.

♻️ Sketch of a shared helper
-aimux_parse_thread_action_args() {
-  ...
-  AIMUX_PARSED_THREAD="$thread_id"
-  ...
-}
-
-aimux_parse_task_action_args() {
-  ...
-  AIMUX_PARSED_TASK="$task_id"
-  ...
-}
+aimux_parse_id_action_args() {
+  id_var_name="$1"
+  shift
+  [ "$#" -gt 0 ] || return 1
+  the_id="$1"
+  case "$the_id" in -*) return 1 ;; esac
+  shift
+  ...
+  eval "$id_var_name=\$the_id"
+}

Also applies to: 1177-1205

🤖 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 `@scripts/installed-aimux-shim.sh` around lines 1030 - 1058, The parsing logic
in aimux_parse_thread_action_args and aimux_parse_task_action_args is
duplicated, differing only in the output id field they set. Refactor the shared
option parsing for --project, --from, --body, and --json into one helper that
accepts the id kind or destination variable name, then have both
aimux_parse_thread_action_args and aimux_parse_task_action_args call it and
assign the appropriate AIMUX_PARSED_* variable.

959-1028: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicate option-parsing scaffolding vs. aimux_try_message.

The send branch here re-implements almost the entire option table (--project, --from, --to, --assignee, --tool, --worktree, --title, --json) already present in aimux_try_message (lines 902-957). Consider extracting a shared option-parsing helper (e.g., aimux_parse_dispatch_args) that both aimux_try_message and aimux_try_handoff can call, reducing the risk of the two diverging silently as new flags are added.

🤖 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 `@scripts/installed-aimux-shim.sh` around lines 959 - 1028, The send branch in
aimux_try_handoff duplicates the same option parsing already implemented in
aimux_try_message, so refactor the shared flag handling into a common helper and
have both functions call it. Extract the parsing for
project/from/to/assignee/tool/worktree/title/json into a reusable function such
as aimux_parse_dispatch_args, then use its parsed outputs in aimux_try_handoff
and aimux_try_message to keep behavior consistent as flags evolve.
src/main.ts (1)

2225-2559: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Repeated action-handler boilerplate across handoff/task/review mutation commands.

The handoff accept, handoff complete, task accept/block/complete/reopen, and review approve/request-changes handlers all follow the identical shape: parse {project, from, body, json}, call prepareProjectContext, POST to a project-service endpoint, then optionally echo JSON. Consider factoring a small helper, e.g. runIdActionCommand(path, idField, opts), to reduce the ~9x duplicated wiring and make future endpoint additions less error-prone.

🤖 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/main.ts` around lines 2225 - 2559, The handoff/task/review mutation
command handlers repeat the same option parsing, project context setup, service
POST, and JSON/output branching logic. Factor this shared flow out of the
existing command actions into a small reusable helper (for example a function
used by the `handoff`, `task`, and `review` command builders) and have `accept`,
`complete`, `block`, `reopen`, `approve`, and `request-changes` call it with
their endpoint and id field details. Keep the command-specific names and
response printing, but centralize the common wiring to reduce duplication and
make future commands easier to add.
🤖 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 `@scripts/installed-aimux-shim.sh`:
- Around line 1135-1136: The `--diff` space-form parsing in the argument switch
is rejecting valid diff text that starts with dashes, causing it to miss the
shim fast path. Update the `--diff)` handling to treat the next argument as raw
diff content instead of passing it through `aimux_require_arg_value`, while
keeping `--diff=*` unchanged; use the `--diff` case in the same dispatch block
to apply the exception only for the space-separated form.

---

Nitpick comments:
In `@scripts/installed-aimux-shim.sh`:
- Around line 1030-1058: The parsing logic in aimux_parse_thread_action_args and
aimux_parse_task_action_args is duplicated, differing only in the output id
field they set. Refactor the shared option parsing for --project, --from,
--body, and --json into one helper that accepts the id kind or destination
variable name, then have both aimux_parse_thread_action_args and
aimux_parse_task_action_args call it and assign the appropriate AIMUX_PARSED_*
variable.
- Around line 959-1028: The send branch in aimux_try_handoff duplicates the same
option parsing already implemented in aimux_try_message, so refactor the shared
flag handling into a common helper and have both functions call it. Extract the
parsing for project/from/to/assignee/tool/worktree/title/json into a reusable
function such as aimux_parse_dispatch_args, then use its parsed outputs in
aimux_try_handoff and aimux_try_message to keep behavior consistent as flags
evolve.

In `@src/daemon.ts`:
- Around line 960-1181: The new route handlers in daemon.ts look fine, but this
change needs end-to-end verification against the built daemon rather than only
source-level tests. Build and install the local release asset, then use aimux
restart and exercise the new handoff/task/review routes to confirm the runtime
actually picks up the updated handler methods such as handoffSendTextRoute,
handoffMutationTextRoute, taskAssignTextRoute, taskMutationTextRoute,
reviewRequestChangesTextRoute, and taskMutationResponse.

In `@src/main.ts`:
- Around line 2225-2559: The handoff/task/review mutation command handlers
repeat the same option parsing, project context setup, service POST, and
JSON/output branching logic. Factor this shared flow out of the existing command
actions into a small reusable helper (for example a function used by the
`handoff`, `task`, and `review` command builders) and have `accept`, `complete`,
`block`, `reopen`, `approve`, and `request-changes` call it with their endpoint
and id field details. Keep the command-specific names and response printing, but
centralize the common wiring to reduce duplication and make future commands
easier to add.
🪄 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: c8d9a7a2-9224-4801-a61d-c83395204a44

📥 Commits

Reviewing files that changed from the base of the PR and between 45de728 and 81fcb3b.

📒 Files selected for processing (9)
  • 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
  • src/main.ts

Comment thread scripts/installed-aimux-shim.sh Outdated
@TraderSamwise
TraderSamwise merged commit e67519f 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