Repository navigation
Feat multi agent collabofeat(orchestration): migrate multi-agent collaboration to current runtimeration v2 - #16515
user141514 wants to merge 1 commit into
Conversation
|
Important Review skippedWe couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting You can disable this status message by setting the Use the checkbox below for a quick retry:
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe change adds collaboration topology, routing, admission, payload, mailbox, publication, checkpoint, and acknowledgment support. It exposes four collaboration RPC methods and matching CLI commands. Waiting checkpoints use long-poll transport and centralized timeout resolution. Worker dispatches receive collaboration protocol instructions, and successful completion can be rejected when required publications are missing. Runtime automation validation, worktree scan invalidation, CLI selection, and terminal cleanup handling are also updated. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Title checkExplanation The title identifies the main change: migrating multi-agent collaboration to the current runtime v2 architecture. However, it contains corrupted and duplicated text such as "collabofeat(orchestration)" and "runtimeration," which reduces clarity. Full details: Description checkExplanation The description explains the collaboration migration, runtime behavior, validation, and scope. It does not follow the required template and omits the ELI5, Why, Linked Issue, Visual Proof, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist sections. Resolution Rewrite the description using the repository template. Add an ELI5 section, explain why the approach was selected, provide a real linked issue after "Fixes #", add visual or behavior proof as required, complete the AI Disclosure and Review sections, complete the Agent skill upstream boundary checkbox, address the Notes items, and complete the Checklist with test and validation status. Full details: Docstring CoverageExplanation Docstring coverage is 8.99% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 89 functions across 56 files. (1 skipped: 1 too large.) Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
src/cli/handlers/orchestration/collaboration-handlers.ts (1)
99-118: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRename
COLLABORATION_TOPICS_MAXfor the admission bound or add a separate constant.
admission.acceptedTypesholds semantic types, not topics. The shared constant makes the limit and the error text hard to map to the validated field.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f660c7c1-84f4-414a-9486-301795ce19bf
📥 Commits
Reviewing files that changed from the base of the PR and between cac5388 and 97f19892e1535715804fa82b8c49374c88807174.
⛔ Files ignored due to path filters (1)
src/main/runtime/orchestration/__snapshots__/preamble.test.ts.snapis excluded by!**/*.snap
📒 Files selected for processing (57)
src/cli/handler-group-manifest.tssrc/cli/handlers/orchestration.tssrc/cli/handlers/orchestration/collaboration-handlers.test.tssrc/cli/handlers/orchestration/collaboration-handlers.tssrc/cli/runtime/client-timeout-policy.test.tssrc/cli/runtime/client.tssrc/cli/runtime/runtime-request-timeout.tssrc/cli/specs/orchestration-collaboration-specs.test.tssrc/cli/specs/orchestration-collaboration-specs.tssrc/cli/specs/orchestration.tssrc/main/runtime/collaboration/collaboration-admission.test.tssrc/main/runtime/collaboration/collaboration-admission.tssrc/main/runtime/collaboration/collaboration-checkpoint-store.test.tssrc/main/runtime/collaboration/collaboration-checkpoint-store.tssrc/main/runtime/collaboration/collaboration-dispatch-authority.test.tssrc/main/runtime/collaboration/collaboration-dispatch-authority.tssrc/main/runtime/collaboration/collaboration-message-payload.test.tssrc/main/runtime/collaboration/collaboration-message-payload.tssrc/main/runtime/collaboration/collaboration-publication-facts.test.tssrc/main/runtime/collaboration/collaboration-publication-facts.tssrc/main/runtime/collaboration/collaboration-publish-store.test.tssrc/main/runtime/collaboration/collaboration-publish-store.tssrc/main/runtime/collaboration/collaboration-routing.test.tssrc/main/runtime/collaboration/collaboration-routing.tssrc/main/runtime/collaboration/collaboration-runtime-registry.test.tssrc/main/runtime/collaboration/collaboration-runtime-registry.tssrc/main/runtime/collaboration/collaboration-task-mailbox.test.tssrc/main/runtime/collaboration/collaboration-task-mailbox.tssrc/main/runtime/collaboration/collaboration-topology.test.tssrc/main/runtime/collaboration/collaboration-topology.tssrc/main/runtime/collaboration/collaboration-worker-completion.tssrc/main/runtime/collaboration/collaboration-worker-protocol.test.tssrc/main/runtime/collaboration/collaboration-worker-protocol.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/orchestration/lifecycle-reconciliation.tssrc/main/runtime/orchestration/preamble.test.tssrc/main/runtime/orchestration/preamble.tssrc/main/runtime/rpc/methods/collaboration-ack.test.tssrc/main/runtime/rpc/methods/collaboration-ack.tssrc/main/runtime/rpc/methods/collaboration-checkpoint.test.tssrc/main/runtime/rpc/methods/collaboration-checkpoint.tssrc/main/runtime/rpc/methods/collaboration-configure.test.tssrc/main/runtime/rpc/methods/collaboration-configure.tssrc/main/runtime/rpc/methods/collaboration-manifest.test.tssrc/main/runtime/rpc/methods/collaboration-publish.test.tssrc/main/runtime/rpc/methods/collaboration-publish.tssrc/main/runtime/rpc/methods/collaboration-rpc-integration.test.tssrc/main/runtime/rpc/methods/collaboration-worker-completion-guard.test.tssrc/main/runtime/rpc/methods/index.tssrc/main/runtime/rpc/methods/orchestration-workers-new-worktree.test.tssrc/main/runtime/rpc/methods/orchestration-workers.tssrc/main/runtime/rpc/methods/orchestration.tssrc/main/runtime/runtime-rpc-long-poll-transport.test.tssrc/main/runtime/runtime-rpc.tssrc/shared/orchestration-rpc-contract.test.tssrc/shared/orchestration-rpc-contract.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
| const duplicate = ackCollaborationCheckpoint( | ||
| runtime.getOrchestrationDb(), | ||
| dispatch.task_id, | ||
| params.messageIds | ||
| ) |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Collaboration helpers throw plain Error for caller input, so the RPC boundary loses error codes. Both handlers use OrchestrationError with stable codes for their own checks, then call a collaboration helper that throws plain Error for caller-controlled input. Those failures surface as uncoded internal errors, so the CLI cannot distinguish a user input mistake from a runtime fault.
src/main/runtime/rpc/methods/collaboration-ack.ts#L27-L31: translateackCollaborationCheckpointfailures (foreign mailbox id, missing message, absent payload, mixed read/unread batch) intoOrchestrationErrorwith a stable code.src/main/runtime/rpc/methods/collaboration-configure.ts#L71-L72: translatecreateCollaborationTopologyfailures (duplicate taskId, subscription without admission policy, required topic without subscribers) intoOrchestrationError('invalid_argument', ...).
📍 Affects 2 files
src/main/runtime/rpc/methods/collaboration-ack.ts#L27-L31(this comment)src/main/runtime/rpc/methods/collaboration-configure.ts#L71-L72
7bcccc7 to
643021f
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 09fe26a5-9a97-4379-b02c-9d0026ee926c
📥 Commits
Reviewing files that changed from the base of the PR and between 97f19892e1535715804fa82b8c49374c88807174 and 643021f25ffb456780a1c2a6b00d36abd404c26e.
📒 Files selected for processing (15)
src/main/runtime/collaboration/collaboration-admission.tssrc/main/runtime/collaboration/collaboration-checkpoint-store.tssrc/main/runtime/collaboration/collaboration-topology.tssrc/main/runtime/collaboration/collaboration-worker-protocol.test.tssrc/main/runtime/collaboration/collaboration-worker-protocol.tssrc/main/runtime/rpc/errors.test.tssrc/main/runtime/rpc/errors.tssrc/main/runtime/rpc/methods/collaboration-ack.test.tssrc/main/runtime/rpc/methods/collaboration-configure.test.tssrc/main/runtime/rpc/methods/collaboration-publish.test.tssrc/main/runtime/rpc/methods/collaboration-publish.tssrc/main/runtime/rpc/methods/collaboration-worker-completion-guard.test.tssrc/main/runtime/rpc/methods/orchestration-tasks-dispatch.test.tssrc/main/runtime/rpc/methods/orchestration-workers.tssrc/main/runtime/rpc/methods/orchestration.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
643021f to
866c3a3
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/main/runtime/collaboration/collaboration-topology.ts (1)
25-25: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winKeep
MESSAGE_PRIORITIESsynchronized withMessagePriorityandPRIORITY_RANK.The current entries and order are correct. If either definition changes,
admittedPublishOptionsForTopiccan return an incorrectminPriority. Derive the list fromPRIORITY_RANKor enforce the invariant centrally.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: d8f091ca-4664-4b2a-b781-559cd666d673
📥 Commits
Reviewing files that changed from the base of the PR and between 643021f25ffb456780a1c2a6b00d36abd404c26e and 866c3a39dbd06e638b53b6686d9a76d304ffe231.
📒 Files selected for processing (7)
src/main/runtime/collaboration/collaboration-checkpoint-store.test.tssrc/main/runtime/collaboration/collaboration-checkpoint-store.tssrc/main/runtime/collaboration/collaboration-topology.test.tssrc/main/runtime/collaboration/collaboration-topology.tssrc/main/runtime/collaboration/collaboration-worker-protocol.test.tssrc/main/runtime/collaboration/collaboration-worker-protocol.tssrc/main/runtime/rpc/methods/collaboration-ack.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.
866c3a3 to
d00897c
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/runtime/orca-runtime.ts (1)
14394-14395: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDerive
devModefrom the startup mode.ORCA_DEV_USER_DATA_PATHallows development runs to use a path withoutorca-dev.configureOrcaUserDataPathEnv()then exports that path asORCA_USER_DATA_PATH, so this expression passesfalsetoresolveTerminalOrchestrationCliCommand. A local non-WSL terminal then selectsorcainstead oforca-devand can target the production runtime.Source: Path instructions
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: ee74f527-2542-40eb-9085-e5baaf48d82e
📥 Commits
Reviewing files that changed from the base of the PR and between 866c3a39dbd06e638b53b6686d9a76d304ffe231 and d00897ca6ec32b2971c7275227b0937c9b018899.
📒 Files selected for processing (9)
src/main/runtime/collaboration/collaboration-worker-protocol.test.tssrc/main/runtime/collaboration/collaboration-worker-protocol.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/orchestration/cli-command.test.tssrc/main/runtime/orchestration/cli-command.tssrc/main/runtime/orchestration/coordinator-runtime-contract.tssrc/main/runtime/orchestration/preamble.test.tssrc/main/runtime/orchestration/preamble.tssrc/main/runtime/rpc/methods/orchestration-tasks-dispatch.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
d00897c to
b826c4c
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/runtime/orca-runtime.ts (1)
4327-4348: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winRevalidate
current.runContextwhen only the target changes.In the
targetChangedbranch,assertAutomationRunContextMatchesRepo(updates.runContext, target.repo)only validatesupdates.runContext. The function returns early whenrunContextis falsy. When a caller changes onlyrepo/workspace/workspaceModeand does not also passrunContext, no validation runs against the new target, andpatch.runContextstays unset, so the store keeps the automation's oldrunContext(which still points at the old repo) paired with the newprojectId/workspaceMode/workspaceId.This produces an automation record whose repo and run context can disagree, which is exactly the state
assertAutomationRunContextMatchesRepoexists to prevent.Add a check for the case where the target changed but
runContextwas not part of this update:🐛 Proposed fix to revalidate the existing run context against the new target
if (targetChanged) { const target = await this.resolveAutomationTarget(updates, current) assertAutomationRunContextMatchesRepo(updates.runContext, target.repo) + if (!hasRuntimeAutomationUpdateValue(updates, 'runContext')) { + assertAutomationRunContextMatchesRepo(current.runContext, target.repo) + } if (patch.reuseSession === true && target.workspaceMode !== 'existing') {
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 2bf41f4f-59c7-4b17-aba2-0e7ce29684bf
📥 Commits
Reviewing files that changed from the base of the PR and between d00897ca6ec32b2971c7275227b0937c9b018899 and b826c4cf54044e4c255357c044260bc12b9b71b6.
📒 Files selected for processing (4)
src/main/runtime/collaboration/collaboration-worker-protocol.test.tssrc/main/runtime/collaboration/collaboration-worker-protocol.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/collaboration-rpc-integration.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
39b5c73 to
5756532
Compare
Greptile SummaryMigrates multi-agent collaboration onto the current Run, Task, Dispatch, and Worker architecture.
Confidence Score: 5/5The PR appears safe to merge because no blocking failure remains within the eligible follow-up review scope. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| src/main/runtime/orca-runtime.ts | Integrates collaboration state, worker completion enforcement, OMP prompt readiness, and lifecycle cleanup into the central runtime. |
| src/main/runtime/rpc/methods/collaboration-checkpoint.ts | Implements authenticated mailbox checkpoints with admission filtering, optional long polling, cancellation, and timeout handling. |
| src/main/runtime/rpc/methods/collaboration-publish.ts | Validates producer dispatch authority and routes persisted publications only to topology-derived subscribers. |
| src/main/runtime/collaboration/collaboration-topology.ts | Defines and validates Run-scoped task publication, subscription, admission, and required-publication relationships. |
| src/main/runtime/collaboration/collaboration-checkpoint-store.ts | Tracks per-task delivery and acknowledgement state for collaboration messages. |
| src/main/runtime/collaboration/collaboration-worker-completion.ts | Blocks worker completion until every required topic has a qualifying publication. |
| src/main/runtime/omp-prompt-readiness.ts | Tracks OMP readiness and correlates submitted prompts using input sequence and fingerprint evidence. |
| src/cli/handlers/orchestration/collaboration-handlers.ts | Adds validated CLI handlers for configuring, publishing, checkpointing, and acknowledging collaboration messages. |
Sequence Diagram
sequenceDiagram
participant C as Coordinator
participant R as Orca Runtime
participant P as Producer Worker
participant S as Subscriber Worker
C->>R: Configure Run collaboration topology
R->>R: Bind tasks, topics, and admission policies
S->>R: checkpoint --wait
R-->>S: Wait for admitted publication
P->>R: Publish topic message
R->>R: Validate dispatch and route by topology
R-->>S: Deliver publication
S->>R: Acknowledge message
P->>R: worker_done
R->>R: Verify required publications
R-->>P: Accept or block completion
Reviews (2): Last reviewed commit: "fix(omp): gate prompt delivery on compos..." | Re-trigger Greptile
|
Too many files changed for review (185 files, 100 file limit). Bypass the limit by tagging |
2c1b708 to
e42566f
Compare
022f24d to
48ccdb1
Compare
48ccdb1 to
12805f7
Compare
12805f7 to
cce878e
Compare
PR Description
Summary
Migrates the previous multi-agent/A2A collaboration work onto the current Orca main architecture and integrates it with the current Run / Task / Dispatch / worker lifecycle.
This adds a topology-driven collaboration protocol for supervised workers, including publish / checkpoint / acknowledgement semantics and runtime enforcement for required publications before task completion.
What changed
Add collaboration topology configuration scoped to an orchestration Run.
Add task-level collaboration capabilities:
collaboration-publishcollaboration-checkpointcollaboration-ackInject collaboration protocol guidance into supervised worker preambles.
Support task collaboration declarations:
publishesTosubscribesTorequiredPublishesToRoute publications only to topology-derived subscribers.
Support event-driven
checkpoint --wait.Track message acknowledgement per consuming Task.
Gate
worker_donewhen required publications have not been satisfied.Integrate collaboration with the current
worker-start/ Dispatch lifecycle rather than the retired orchestration model.Fix headless worker cleanup where a successful PTY shutdown could incorrectly leave the worker resource in
release_unknownafter post-kill cleanup returnedtab_not_found.Runtime validation
Validated on the current Orca runtime with two real Pi workers:
worker-startand blocked oncollaboration-checkpoint --wait.worker_donelifecycle handling.requiredPublishesTowas satisfied before Producer completion was accepted.A separate live worker lifecycle gate also reproduced and verified the headless cleanup fix:
Verification
Focused collaboration protocol, preamble, runtime guard, and lifecycle tests pass.
Additional verification for the worker-release fix includes:
orca-runtime.test.tspnpm tcThe final live validation was run on a rebuilt V2 runtime with its own Electron runtime and daemon, without relying on the previous Orca checkout.
Scope
This PR intentionally keeps collaboration inside the existing Orca orchestration model:
It does not reintroduce the retired scheduler or create a parallel orchestration subsystem.