Skip to content

fix(cue): route Dispatch completions by agent and retain worker identity - #1955

Merged
chr1syy merged 2 commits into
RunMaestro:rcfrom
chr1syy:fix/cue-dispatch-completion-20261030
Oct 30, 2026
Merged

chr1syy merged 2 commits into
RunMaestro:rcfrom
chr1syy:fix/cue-dispatch-completion-20261030

Conversation

@chr1syy

@chr1syy chr1syy commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Dispatch AI-tab exits currently use a composite process ID where Cue subscriptions expect an agent ID or name, so the subscriber is never notified.

worker AI-tab exit -> base-agent matching -> Cue completion
                  -> process/tab identity on single-source and fan-in events

Reuse the canonical process-ID parser, preserve structured outcomes, and retain each source's known process/tab identity in full and partial fan-in results. External Dispatch completions still have no stdout or source_sub provenance; Cue-owned lineage and the separate plugin event remain unchanged.

Evidence

  • Before: four real exit-listener → completion-service → fan-in adapter regressions failed on rc. Two additional red/green regressions exposed identity loss from complete and timed-out fan-in payloads.
    After: 167 tests passed across eight targeted exit, parser, completion-chain, fan-in, durability and output-filter suites on 2bb36e99bb16d5ac562670c16884343823009bde.
  • Main TypeScript, targeted source/test ESLint, formatting, documentation verification and whitespace checks passed. Independent local Standards/Spec review findings were addressed.
  • Local fixture tests on Linux; no native/live desktop or Windows 1.1.0-RC reproduction. Desktop fan-in/callback state remains transient across restart; the standalone persistence schema does not restore desktop process/tab metadata.
  • Full local pre-push validation was skipped for this branch push using a command-scoped hook override; no repository/global hook setting was changed.

Merge Danger

Door: two-way

Optional completion payload fields; no storage migration or productive configuration change.

Blast Radius: Cue

Completion routing is technical execution evidence. Deliverable acceptance and dependency release remain the controller's responsibility.

Summary by CodeRabbit

  • New Features

    • Completion notifications now include the originating process and, when available, its tab.
    • Fan-in completion and timeout results can include per-source process and tab details.
    • Desktop worker completions can be matched and filtered by agent or tab, with fan-in results grouped by base agent.
  • Documentation

    • Clarified how Cue-owned and external desktop completions differ, including provenance, matching, filtering, and restart behavior.

@mintlify

mintlify Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit 2bb36e9.

Approve preview

@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 42ee0dc and 2bb36e9.

Files selected for processing: 9
  • CLAUDE-CUE.md
  • docs/maestro-cue-events.md
  • src/__tests__/main/process-listeners/exit-listener-cue.test.ts
  • src/main/cue/cue-completion-service.ts
  • src/main/cue/cue-fan-in-tracker.ts
  • src/main/cue/cue-output-filter.ts
  • src/main/cue/cue-types.ts
  • src/main/process-listeners/__tests__/exit-listener.test.ts
  • src/main/process-listeners/exit-listener.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Walkthrough

The exit listener now matches process exits to Cue subscriptions using parsed agent IDs and includes source process and tab identifiers when available. Cue completion events and fan-in results preserve those identifiers. Tests and documentation describe matching, provenance, and restart behavior.

Changes: Desktop completion identity

Layer / File(s) Summary
Route desktop exits with source identity
src/main/cue/cue-types.ts, src/main/process-listeners/exit-listener.ts, src/__tests__/main/process-listeners/exit-listener-cue.test.ts, src/main/process-listeners/__tests__/exit-listener.test.ts, CLAUDE-CUE.md, docs/maestro-cue-events.md
The exit listener looks up subscriptions using a parsed agent ID when available. Completion notifications include the source process ID and, for tab targets, the source tab ID. Tests cover matching, filters, completion outcomes, provenance, and excluded process types. Documentation describes Cue-owned and external completions and their matching behavior.
Propagate identity through completion events
src/main/cue/cue-completion-service.ts, src/main/cue/cue-output-filter.ts, src/main/cue/cue-fan-in-tracker.ts, src/__tests__/main/process-listeners/exit-listener-cue.test.ts
Single-source events and fan-in results include available source process and tab identifiers. Fan-in tests cover per-agent aggregation, latest completion selection, and partial results after timeout.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant ExitListener
  participant CueCompletionService
  participant CueFanInTracker
  ExitListener->>CueCompletionService: Notify completion with process and tab identity
  CueCompletionService->>CueFanInTracker: Record completion data for fan-in
  CueFanInTracker->>CueCompletionService: Return filtered outputs and source identities
Loading

Possibly related issues

Suggested reviewers: pedramamini

Merge Risk: Minimal · up to 2bb36

No merge-blocking issue was established. The change is ready for normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix(cue): route Dispatch completions by agent and retain worker identity" matches the main change. The raw summary and objectives show the PR routes Dispatch AI-tab exit completions by base…
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.
Full details: Title check

Explanation

The title "fix(cue): route Dispatch completions by agent and retain worker identity" matches the main change. The raw summary and objectives show the PR routes Dispatch AI-tab exit completions by base agent ID instead of composite process ID, and keeps sourceProcessId and sourceTabId through single-source and fan-in events. The title names the fix, the Cue scope, and both parts of the change. It is specific and fits the changeset.

Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 4 functions across 7 files. (2 skipped: 2 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

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

@greptile-apps

greptile-apps Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Routes desktop AI-tab completions to Cue subscriptions by base agent while keeping the process and explicit tab IDs.

  • Desktop AI-tab exits trigger Cue chains for the matching agent.
  • Fan-in results keep the worker identity for each completed source.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  E[Desktop AI-tab exit] --> P[Parse process ID]
  P --> A[Match base agent]
  A --> S{Source count}
  S -->|One| O[Event with process and tab IDs]
  S -->|Several| F[Collect latest arrival per agent]
  F --> J[Full or partial event with per-source IDs]
  O --> D[Cue dispatch]
  J --> D
Loading

Reviews (1) · Last reviewed commit: "fix(cue): preserve dispatch identities t..." · Reviewed by Greptile

@chr1syy
chr1syy merged commit 17b0d2f into RunMaestro:rc Oct 30, 2026
8 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