Skip to content

feat(agent-workflows): Cursor Cloud Agents parallel workflow (#1480)#1759

Merged
senamakel merged 3 commits into
tinyhumansai:mainfrom
CodeGhost21:agent-workflows-cursor-cloud-1480
May 15, 2026
Merged

feat(agent-workflows): Cursor Cloud Agents parallel workflow (#1480)#1759
senamakel merged 3 commits into
tinyhumansai:mainfrom
CodeGhost21:agent-workflows-cursor-cloud-1480

Conversation

@CodeGhost21
Copy link
Copy Markdown
Contributor

@CodeGhost21 CodeGhost21 commented May 14, 2026

Summary

  • Adds a documented multi-agent workflow plus zero-dep operator tooling for running up to 25 Cursor Cloud Agents in parallel against OpenHuman.
  • pnpm agent-batch <validate|overlap|launch|status> enforces schema, proves ownership disjointness, generates per-agent launch comments, and rewrites a single tracking comment with a PR/CI status table.
  • Reuses existing quality gates (format:check, typecheck, lint, focused tests, ≥80% diff coverage) — does not re-implement them.

Problem

OpenHuman has no documented or automated workflow for running ~15–20 Cursor Cloud Agents in parallel. Without one, batches collide on branches/files, drop quality gates, or run with overscoped credentials. Issue #1480 asks for a documented, observable, secret-safe pilot that can scale to 15–20 concurrent agents.

Solution

A JSON batch spec is the single source of truth:

  • scripts/agent-batch/validate.mjs — schema, kebab-case ids, cursor/<id>-<issue>-<slug> branches, prefix-only ownership (no globs), 25-agent hard cap.
  • scripts/agent-batch/overlap.mjs — mechanical pairwise prefix-containment check across owned_paths, with an explicit allowed_shared_paths escape hatch for unavoidably-shared files (e.g. the coverage matrix).
  • scripts/agent-batch/launch.mjs — emits a per-agent comment that names owned paths, required reading, validation commands, and PR rules so every agent inherits the same constraints.
  • scripts/agent-batch/status.mjs — one gh pr list --label batch:<id> call per batch; rewrites a single tracking comment via a <!-- batch:<id> --> marker so the issue thread does not fill with stale tables.

The workflow doc (docs/agent-workflows/cursor-cloud-agents.md) covers setup, batch input format, branch/PR conventions, ownership boundaries, quality gates (linking to the existing coverage.yml and pr-quality.yml), secrets posture, progress visibility, and pilot-then-scale (N=3 → N=5 → N=15–20).

Submission Checklist

  • Tests added or updated (happy path + at least one failure / edge case) per Testing Strategy — 25 node:test cases under scripts/agent-batch/__tests__/ covering schema, overlap (disjoint + collision), branch regex (positive + negative), argv parsing, and end-to-end CLI behaviour via a fixture.
  • Diff coverage ≥ 80% — N/A: all changed lines are under docs/agent-workflows/ and scripts/agent-batch/, both outside the Vitest (app/coverage/lcov.info) and cargo-llvm-cov roots; diff-cover excludes unmeasured files automatically per .github/workflows/coverage.yml. The new scripts are themselves covered by the included node:test suite (pnpm agent-batch:test).
  • Coverage matrix updated — N/A: operator tooling + docs; no app/core feature surface added.
  • All affected feature IDs from the matrix are listed in the PR description under ## Related — N/A: no matrix rows touched.
  • No new external network dependencies introduced (mock backend used per Testing Strategy) — scripts are Node 20+ stdlib only; status.mjs shells to gh (already a dev prereq).
  • Manual smoke checklist updated if this touches release-cut surfaces (docs/RELEASE-MANUAL-SMOKE.md) — N/A: no release-cut surface touched.
  • Linked issue closed via Closes #NNN in the ## Related section.

Impact

  • Operator tooling and documentation only — no runtime, frontend, or core behavior changes.
  • No new dependencies; node --test + node:child_process only.
  • package.json adds agent-batch and agent-batch:test npm scripts.
  • New executable scripts under scripts/agent-batch/ (chmod +x on the CLI entrypoints).

Related


AI Authored PR Metadata (required for Codex/Linear PRs)

Linear Issue

Commit & Branch

  • Branch: agent-workflows-cursor-cloud-1480
  • Commit SHA: 9d403ff3e4a3673ea3752401ee059ad0d1f4fba5

Validation Run

  • pnpm --filter openhuman-app format:check — clean (Prettier --write applied during authoring, re-checked clean).
  • pnpm typecheck — clean (no .ts files touched).
  • Focused tests: pnpm agent-batch:test — 25/25 pass, ~271 ms.
  • Rust fmt/check (if changed): N/A — no Rust touched. (Pre-push hook ran the repo-wide pnpm rust:check successfully on this branch.)
  • Tauri fmt/check (if changed): N/A — no Tauri shell code touched.

Validation Blocked

  • command: N/A
  • error: N/A
  • impact: N/A

Behavior Changes

  • Intended behavior change: adds operator tooling (pnpm agent-batch …) and a documented multi-agent workflow. No runtime behavior changes.
  • User-visible effect: none for end users. Operators gain four pnpm agent-batch verbs and docs/agent-workflows/cursor-cloud-agents.md.

Parity Contract

  • Legacy behavior preserved: N/A — no prior workflow to preserve.
  • Guard/fallback/dispatch parity checks: N/A.

Duplicate / Superseded PR Handling

  • Duplicate PR(s): none opened.
  • Canonical PR: this PR.
  • Resolution: N/A.

Summary by CodeRabbit

  • New Features

    • Added an agent-batch workflow with CLI commands to validate, detect overlaps, launch prompts, and render/post progress for parallel Cursor Cloud Agents.
  • Documentation

    • New operator playbook covering the batch spec contract, ownership rules, PR quality gates, staged rollout, and a quickstart; includes a pilot example spec.
  • Tests

    • Added unit and integration tests covering spec validation, overlap detection, CLI behavior, and status rendering.
  • Chores

    • Added npm scripts to run the agent-batch CLI and its tests.

Review Change Stack

…ansai#1480)

Adds a documented multi-agent workflow plus zero-dep operator tooling for
running up to 25 Cursor Cloud Agents in parallel against OpenHuman:

- docs/agent-workflows/cursor-cloud-agents.md — workflow doc covering
  batch spec, branch/PR conventions, ownership boundaries, quality
  gates, secrets posture, progress visibility, and pilot-then-scale.
- scripts/agent-batch/ — Node 20+ stdlib only:
    validate.mjs   schema + naming + prefix-only ownership rules
    overlap.mjs    mechanical disjointness proof across owned_paths
    launch.mjs     per-agent launch comment with required reading
                   and validation commands
    status.mjs     one gh-pr-list call + single tracking comment
                   updated in place via <!-- batch:<id> --> marker
- docs/agent-workflows/pilot-batch-example.json — canonical 3-agent
  spec used by the doc walkthrough and the test fixtures.
- node:test suite (25 cases) covering schema, overlap, branch regex,
  argv parsing, and end-to-end CLI behaviour from a fixture.
- package.json — pnpm agent-batch / agent-batch:test entrypoints.

Quality gates are reused, not re-implemented: agents run the same
format:check / typecheck / lint / focused tests / >=80% diff coverage
as any other PR per .github/workflows/{coverage,pr-quality}.yml.
@CodeGhost21 CodeGhost21 requested a review from a team May 14, 2026 19:29
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e2e13c85-a290-4e33-b9fe-8a004e9fde42

📥 Commits

Reviewing files that changed from the base of the PR and between 3412ce5 and abd1ad9.

📒 Files selected for processing (1)
  • scripts/agent-batch/status.mjs
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/agent-batch/status.mjs

📝 Walkthrough

Walkthrough

Adds a batch-spec-driven Cursor Cloud Agents workflow: a JSON batch contract and operator playbook, a validation/overlap library, CLI verbs (validate/overlap/launch/status) with tests, package scripts, a 3-agent pilot example, and status posting via the gh CLI for tracking progress.

Changes

Cursor Cloud Agents Parallel Workflow

Layer / File(s) Summary
Spec contract and operator documentation
docs/agent-workflows/cursor-cloud-agents.md, docs/agent-workflows/pilot-batch-example.json
Defines the batch-spec JSON shape, ownership prefix rules, branch/PR naming and template expectations, quality gates, secrets posture, staged rollout and operator quickstart; includes a 3-agent pilot example pilot-batch-example.json.
Core validation library and unit tests
scripts/agent-batch/lib.mjs, scripts/agent-batch/__tests__/lib.test.mjs
Adds BRANCH_RE, SpecError, loadSpec, validateSpec, findOverlaps, and parseArgs. Implements schema/policy validation, owned-path restrictions, uniqueness and branch-segment rules, and pure overlap detection. Unit tests cover validation failures, overlap cases, branch regex, and CLI arg parsing.
CLI dispatcher and package wiring
scripts/agent-batch/cli.mjs, package.json
Adds a top-level agent-batch dispatcher that forwards verbs to sibling scripts and two npm scripts: agent-batch and agent-batch:test.
Validate CLI and integration tests
scripts/agent-batch/validate.mjs, scripts/agent-batch/__tests__/cli.test.mjs
validate.mjs loads and validates a spec, prints one-line success on OK, and exits with distinct codes for SpecError vs unexpected errors. Integration tests include success and malformed-branch failure cases.
Overlap CLI and integration tests
scripts/agent-batch/overlap.mjs, scripts/agent-batch/__tests__/cli.test.mjs
overlap.mjs reports ownership/path-prefix collisions (reason "exact" or "prefix") or prints an [agent-batch] ok message when disjoint. Integration tests cover disjoint and colliding specs and expected stderr diagnostics.
Launch CLI (comment renderer)
scripts/agent-batch/launch.mjs
launch.mjs validates spec and overlaps, filters by --agent if provided, and prints a per-agent Cursor prompt comment (owned/shared paths and fixed checklist). Currently print-only (no posting).
Status CLI, GitHub integration and tests
scripts/agent-batch/status.mjs, scripts/agent-batch/__tests__/cli.test.mjs
status.mjs renders a GitHub-flavored markdown table from a fixture or gh pr list filtered by batch:<batch_id>, computes a worst-status CI rollup per PR, and can post/patch a single tracking comment via gh API. Includes fixture-driven rendering tests and robust gh error handling.
sequenceDiagram
  participant Operator as Operator
  participant StatusCLI as StatusCLI
  participant GitHubCLI as GitHubCLI
  participant TrackingIssue as TrackingIssue

  Operator->>StatusCLI: pnpm agent-batch status spec.json --post
  Note right of StatusCLI: loadSpec + validateSpec
  alt fixture provided
    StatusCLI->>StatusCLI: use fixture PR data
  else no fixture
    StatusCLI->>GitHubCLI: gh pr list --label batch:<batch_id>
    GitHubCLI-->>StatusCLI: PR list JSON
  end
  StatusCLI->>StatusCLI: render markdown table
  StatusCLI->>GitHubCLI: gh api list comments on tracking issue (marker)
  GitHubCLI-->>StatusCLI: existing comment id? / none
  alt existing comment
    StatusCLI->>GitHubCLI: gh api PATCH /comments/:id (updated table)
  else
    StatusCLI->>GitHubCLI: gh api POST /issues/:issue_number/comments (new comment)
  end
  GitHubCLI-->>TrackingIssue: comment posted or updated
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

  • #1741 — Adds the agent-batch CLI, lib, overlap/validate/status/launch scripts and pilot JSON; aligns with the parallel Cursor Cloud Agents workflow objective.

Suggested reviewers

  • senamakel

Poem

🐰 From my burrow I pen a little plan,
Paths claimed and named so every agent can,
Launch comments printed, one table to see,
Pilot three → scale to a busy tree.
Hop — the batch takes flight!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 15.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately and concisely summarizes the main change: adding a Cursor Cloud Agents parallel workflow with associated tooling and documentation.
Linked Issues check ✅ Passed All code-level objectives from issue #1480 are met: documented workflow with setup/conventions, parallel execution support with ownership boundaries, quality gates integration, safe secrets posture, progress visibility via status script, and pilot batch configuration.
Out of Scope Changes check ✅ Passed All changes are directly in scope: documentation (cursor-cloud-agents.md), batch spec/tooling (lib.mjs, validate.mjs, overlap.mjs, launch.mjs, status.mjs, cli.mjs), tests, and package.json scripts. No runtime/frontend/core code or external dependencies added.

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

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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

- Drop "(AC #N)" suffixes from section headings so anchors stay simple
  kebab-case (the body still names the AC for each section). Restores
  the #secrets-posture cross-link.
- Replace placeholder "[#1234](…)" link syntax in the progress-table
  example with code spans — lychee was resolving "…" as a relative
  file path and erroring.
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (1)
scripts/agent-batch/launch.mjs (1)

1-108: ⚡ Quick win

Add integration tests for launch.mjs.

While validate.mjs, overlap.mjs, and status.mjs have integration test coverage in cli.test.mjs, launch.mjs is untested. Adding tests that verify the rendered output format, --agent filtering, and overlap-blocking behavior would improve confidence in this CLI's correctness.

🤖 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/agent-batch/launch.mjs` around lines 1 - 108, Add integration tests
for scripts/agent-batch/launch.mjs: write tests in the existing cli.test.mjs
that invoke the CLI entrypoint (main via running node launch.mjs or importing
and calling main with mocked process.argv) to assert (1) the rendered output
from renderComment contains the expected sections and values for a sample spec,
(2) the --agent flag filters to a single agent (use parseArgs/flags simulation
or pass args) and prints only that agent, and (3) findOverlaps blocking behavior
returns a non-zero exit and error message when overlaps exist (mock
loadSpec/validateSpec/findOverlaps to supply a colliding spec). Use the same
test harness style as validate.mjs/overlap.mjs/status.mjs tests in cli.test.mjs
so the new tests integrate with existing fixtures and assertions.
🤖 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/agent-workflows/cursor-cloud-agents.md`:
- Line 29: Update the broken fragment link in cursor-cloud-agents.md: replace
the link target `#secrets-posture` used in the batch description with the
correct GitHub anchor `#secrets-posture-ac-5` (or alternatively rename the
heading "## Secrets posture (AC `#5`)" to "## Secrets posture" so the existing
anchor works); locate the reference to `#secrets-posture` in the batch example
and change it to `#secrets-posture-ac-5` to match the generated anchor for the
heading.
- Around line 117-118: Replace the placeholder markdown links using the ellipsis
link text (e.g., `[`#1234`](…)` and `[`#1235`](…)`) which the link-checker attempts
to validate; instead, change those to non-clickable code-formatted text (e.g.,
``[`#1234`]``) or real example URLs (e.g., `https://example.com/...`) so the table
rows like `a01   | `#1234` | cursor/a01-1234-… | [`#1234`](…) | ✓ green` no longer
contain `(...)` link targets that break the link-checker; update both
occurrences (`[`#1234`](…)`, `[`#1235`](…)`) consistently in the table.

In `@scripts/agent-batch/status.mjs`:
- Around line 156-169: The PATCH call is passing the whole comment via a
command-line arg which can hit OS arg-length limits; modify the spawnSync
invocation that builds the gh api PATCH for
repos/${spec.base_repo}/issues/comments/${id} (the spawnSync call using "PATCH"
and `body=${body}`) to mirror the POST pattern: replace `-f body=${body}` with
`--body-file -` in the args and provide the comment text via spawnSync's input
(stdin) option (keeping encoding:"utf8"); keep the same error check on r.status
and include stderr in the thrown Error as before.
- Around line 117-133: The jq filter currently emits wrapped arrays per page
causing concatenated array fragments that break JSON.parse; update the gh
spawnSync call to emit newline-separated objects by changing the jq expression
to output objects (e.g., remove the outer [...] so it uses '.[] | select(...) |
{id, html_url}'), then replace the single JSON.parse(list.stdout || "[]") logic
with parsing newline-delimited JSON from list.stdout (split on newlines, filter
out empty lines, and JSON.parse each line) to produce the existing array; refer
to the spawnSync invocation, the list variable, COMMENT_MARKER(spec.batch_id),
and the existing constant to locate where to change the jq filter and parsing.

---

Nitpick comments:
In `@scripts/agent-batch/launch.mjs`:
- Around line 1-108: Add integration tests for scripts/agent-batch/launch.mjs:
write tests in the existing cli.test.mjs that invoke the CLI entrypoint (main
via running node launch.mjs or importing and calling main with mocked
process.argv) to assert (1) the rendered output from renderComment contains the
expected sections and values for a sample spec, (2) the --agent flag filters to
a single agent (use parseArgs/flags simulation or pass args) and prints only
that agent, and (3) findOverlaps blocking behavior returns a non-zero exit and
error message when overlaps exist (mock loadSpec/validateSpec/findOverlaps to
supply a colliding spec). Use the same test harness style as
validate.mjs/overlap.mjs/status.mjs tests in cli.test.mjs so the new tests
integrate with existing fixtures and assertions.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c9d91abb-168c-46a3-b5c0-74db7f126a49

📥 Commits

Reviewing files that changed from the base of the PR and between 08b8813 and 9d403ff.

📒 Files selected for processing (11)
  • docs/agent-workflows/cursor-cloud-agents.md
  • docs/agent-workflows/pilot-batch-example.json
  • package.json
  • scripts/agent-batch/__tests__/cli.test.mjs
  • scripts/agent-batch/__tests__/lib.test.mjs
  • scripts/agent-batch/cli.mjs
  • scripts/agent-batch/launch.mjs
  • scripts/agent-batch/lib.mjs
  • scripts/agent-batch/overlap.mjs
  • scripts/agent-batch/status.mjs
  • scripts/agent-batch/validate.mjs

Comment thread docs/agent-workflows/cursor-cloud-agents.md
Comment thread docs/agent-workflows/cursor-cloud-agents.md Outdated
Comment thread scripts/agent-batch/status.mjs Outdated
Comment thread scripts/agent-batch/status.mjs
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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/agent-workflows/cursor-cloud-agents.md`:
- Line 58: The table row for `tracking_issue` includes an unclear "AC `#6`"
reference; update that row (the `tracking_issue` entry) to either remove "AC `#6`"
or replace it with a short inline explanation such as "Acceptance Criteria 6
(see issue `#1480` for details)" so readers without issue context understand the
meaning; ensure the change preserves the existing description "One upstream
issue per batch; that issue's comment thread is the dashboard" while making the
AC reference explicit or omitted.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c613661b-fdfd-4541-8da9-44a1cfb22e31

📥 Commits

Reviewing files that changed from the base of the PR and between 9d403ff and 3412ce5.

📒 Files selected for processing (1)
  • docs/agent-workflows/cursor-cloud-agents.md

| `batch_id` | yes | Stable identifier — appears in PR bodies and the tracking comment. |
| `base_repo` | yes | Always `tinyhumansai/openhuman` unless explicitly delegated. |
| `base_branch` | yes | `main`. |
| `tracking_issue` | yes | One upstream issue per batch; that issue's comment thread is the dashboard (AC #6). |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Clarify the "AC #6" reference.

The reference to "AC #6" assumes readers have context from issue #1480. Consider either removing the AC reference or briefly explaining it inline.

📝 Suggested fix
-| `tracking_issue`                | yes      | One upstream issue per batch; that issue's comment thread is the dashboard (AC `#6`).                                                                                               |
+| `tracking_issue`                | yes      | One upstream issue per batch; that issue's comment thread is the dashboard.                                                                                               |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| `tracking_issue` | yes | One upstream issue per batch; that issue's comment thread is the dashboard (AC #6). |
| `tracking_issue` | yes | One upstream issue per batch; that issue's comment thread is the dashboard. |
🤖 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 `@docs/agent-workflows/cursor-cloud-agents.md` at line 58, The table row for
`tracking_issue` includes an unclear "AC `#6`" reference; update that row (the
`tracking_issue` entry) to either remove "AC `#6`" or replace it with a short
inline explanation such as "Acceptance Criteria 6 (see issue `#1480` for details)"
so readers without issue context understand the meaning; ensure the change
preserves the existing description "One upstream issue per batch; that issue's
comment thread is the dashboard" while making the AC reference explicit or
omitted.

- Parse `gh api --paginate` output as NDJSON: the jq filter ran per page,
  so wrapping in `[...]` produced concatenated array fragments that broke
  JSON.parse. Drop the outer array and split/parse line-by-line.
- Send the PATCH comment body via stdin (`-F body=@-`) instead of
  `-f body=${body}`, so long markdown tables don't risk ARG_MAX.
@senamakel senamakel merged commit b2d45a9 into tinyhumansai:main May 15, 2026
23 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.

Build a parallel Cursor Cloud Agents workflow

2 participants