Skip to content

docs(cue): multi-root pipelines guide; fix validator misfire on missing source_session - #986

Closed
chr1syy wants to merge 2 commits into
RunMaestro:rcfrom
chr1syy:fix/cue-documentation
Closed

docs(cue): multi-root pipelines guide; fix validator misfire on missing source_session#986
chr1syy wants to merge 2 commits into
RunMaestro:rcfrom
chr1syy:fix/cue-documentation

Conversation

@chr1syy

@chr1syy chr1syy commented May 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Documents the per-agent-cwd model for multi-root Cue pipelines and fixes the doc/validator mismatch + misfiring shape-check guard flagged by reviewers. Updated from the original framing per @pedramamini's feedback — the validator + tests + renderer pieces that the original PR included are already on rc via #976, so this branch was rebased onto current upstream/rc and now carries only the genuinely new docs and review-fix work.

Multi-root pipelines docs (commit 1)

Document that the Cue engine reads only <projectRoot>/.maestro/cue.yaml per agent (no parent walk), so a single root cue.yaml is not a valid pattern for fleets spanning multiple project roots. Add per-role placement tables, hand-authoring checklists, and a <Note> callout under File Location.

Review-feedback fixes (commit 2)

  • Docs: reframe source_session_ids / fan_out_ids as required companions to source_session / fan_out, not replacements (Greptile + CodeRabbit caught the doc/validator mismatch — the validator unconditionally requires source_session, so the prior "prefer ids over names" prose would push agents to write invalid YAML).
  • Schema reference: add source_session_ids, source_sub, and fan_out_ids to both the Full Schema YAML block and the Optional Fields table — they were documented in prose but missing from the schema reference.
  • Validator (cue-config-validator.ts): skip the source_sub / source_session type-shape consistency check when source_session is undefined. The required-field check already errors on missing source_session; re-emitting "must be a string when source_session is a string" against an undefined value was misleading noise (Greptile + CodeRabbit).
  • Loader fixture (cue-yaml-loader.test.ts:108-136): add source_sub: researcher-step to the CLI-send fixture so the YAML remains semantically valid under the post-Harden Cue YAML command-chain validation and authoring docs #976 agent.completed + action: command rule (CodeRabbit's outside-diff "Quick win"); assert source_sub round-trips through the loader.
  • Validator test: new regression case asserting only the required-field error fires when source_session is missing — locks in the misfire fix.

Files changed (6)

  • docs/maestro-cue-configuration.md — Multi-root section + schema reference updates.
  • docs/maestro-cue.md — Configuration File copy now points at the new section.
  • docs/maestro-cue-examples.md — Note on the CI-Style Pipeline example clarifying the multi-root pattern.
  • src/prompts/_maestro-cue.md — Multi-Root Pipelines section + _ids companion-field framing.
  • src/main/cue/config/cue-config-validator.ts — type-shape guard fix (skip when source_session undefined).
  • src/__tests__/main/cue/cue-yaml-loader.test.ts — fixture update + regression case for the misfire fix.

Re: pedram's questions on the now-landed source_sub rule (#976)

That rule lives on rc already, but for the release-notes loop:

  1. Hard error, not a warning — intentional. The failure mode without it is silent edge mis-routing in the visual editor (Cmd(owner=S) → Agent(S) collapses to Agent(S) → Agent(S)), which is worse than a load-time validation message that points at the missing field.
  2. No migration / auto-repair. The visual editor has always written source_sub for Command nodes, so the affected surface is pre-existing hand-authored YAMLs that combine event: agent.completed + action: command without source_sub.
  3. Release-notes call-out recommended so anyone with a hand-authored sub of that shape knows to add source_sub: <upstream-name> before upgrading. Happy to add a CHANGELOG entry if you want.

Test plan

  • npx vitest run src/__tests__/main/cue/cue-yaml-loader.test.ts — 143 pass, 0 fail (includes new validator regression case).
  • npx vitest run src/__tests__/renderer/components/CuePipelineEditor/utils/ — 346 pass, 0 fail.
  • Prettier clean across all touched files.
  • CI lint-and-format + test green on the latest push.

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Documentation

    • Clarified that Cue reads only each agent's project root .maestro/cue.yaml (no parent/ancestor fallback)
    • Added comprehensive guidance for multi-root pipelines spanning different project roots
    • Documented new subscription schema fields for cross-agent chaining: source_session_ids, source_sub, and fan_out_ids
  • Bug Fixes

    • Improved validation error messages for cross-agent subscription configurations

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 11, 2026

Copy link
Copy Markdown

Note

Reviews paused

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR documents multi-root Cue pipeline support and validates source_sub chain fields. It clarifies that each Cue engine reads only its agent's .maestro/cue.yaml without parent-directory fallback, formalizes cross-agent subscriptions through UUID-companion fields, and adds validator logic with test coverage.

Changes

Multi-root Cue Pipelines with source_sub Validation

Layer / File(s) Summary
Configuration Discovery Rules
docs/maestro-cue.md, docs/maestro-cue-configuration.md, src/prompts/_maestro-cue.md
Cue reads only each agent's own <projectRoot>/.maestro/cue.yaml with no parent-directory fallback or shared workspace file; multi-root fleets require one config per project root.
Multi-root Pipeline Pattern & Schema
docs/maestro-cue-configuration.md, docs/maestro-cue-examples.md, src/prompts/_maestro-cue.md
Introduces multi-root pipelines section with subscription ownership rules via agent_id, documents new UUID-companion fields (source_session_ids, source_sub, fan_out_ids), specifies positional pairing for arrays, and clarifies multi-agent authoring across roots.
source_sub Validation Logic
src/main/cue/config/cue-config-validator.ts
Guards source_sub/source_session alignment checks to run only when both fields are present; enforces equal array lengths and reports array-vs-string type mismatches to prevent misleading errors.
Test Coverage
src/__tests__/main/cue/cue-yaml-loader.test.ts
Tests loader parsing of source_sub in command-action fixtures, validates positional/type consistency between source_session and source_sub, and regression-tests that missing source_session produces only the required-field error without shape-mismatch errors.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • RunMaestro/Maestro#976: Modifies Cue subscription validation and tests for agent.completed chain fields (source_sub/source_session) in the same validator and test files.

Poem

🐇 Across project roots, Cue now knows the way,
Each agent reads its own config, come what may.
With source_sub paired and UUID friends,
Multi-root pipelines flow 'til the journey ends!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ 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%. 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.
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.
Title check ✅ Passed The title accurately summarizes the two main changes: documentation for multi-root pipelines and a validator fix for the source_session requirement.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@pedramamini

Copy link
Copy Markdown
Collaborator

Thanks for the contribution, @chr1syy — the multi-root docs are a clear improvement, and the per-role placement table is exactly the kind of thing future hand-authoring agents will need. A couple of things worth resolving before this lands:

PR description vs. actual diff

The description says:

Docs-only diff (+67 / -2). No code, no tests touched.

…but the diff also includes:

  • src/main/cue/config/cue-config-validator.ts (+26): new source_sub requirement and array-shape consistency checks.
  • src/__tests__/main/cue/cue-yaml-loader.test.ts (+61): three new validator tests, plus a modification to an existing action: command fixture to add source_sub: 'researcher-step' so it still passes.
  • src/renderer/components/CuePipelineEditor/utils/yamlToPipeline.ts (+40): new error-node rendering when source_sub references an unknown subscription.

Could you update the description (and ideally the PR title) so reviewers and the release notes step have an accurate picture? The current framing made me almost approve it as a doc tweak.

Backward-incompatible validator change

cue-config-validator.ts:364 adds:

if (sub.action === 'command' && sub.source_sub === undefined) {
  errors.push(`${prefix}: "source_sub" is required for agent.completed subscriptions when action is "command"`);
}

Any existing user cue.yaml that has an event: agent.completed + action: command subscription without source_sub will fail validation on next load after upgrading. The existing test at cue-yaml-loader.test.ts:1300 had to be modified to add source_sub: 'researcher-step', which confirms the breakage path.

A few questions:

  1. Is this intentionally a hard error, or should it start as a warning while users migrate?
  2. Is there a one-shot migration / auto-repair somewhere I'm missing (e.g. on load in cue-session-runtime-service.ts)?
  3. The reasoning in the comment ("YAML→graph reconstruction has to guess by session name and can collapse Command→Agent into Agent→Agent") is solid — but if the visual editor always writes source_sub going forward, the only configs hit by this are hand-authored ones from before this rule existed. Worth calling that out in the release notes if we go ahead.

If 1–3 are answered (intentional, no migration, only legacy hand-authored configs affected), I'm fine with this — just want it acknowledged rather than smuggled in under a docs PR.

Mergeability

Mergeable against rc, no conflicts. CI was still in progress at review time; please make sure lint-and-format and test go green before we land it.

@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: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/__tests__/main/cue/cue-yaml-loader.test.ts (1)

108-136: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Update this fixture to satisfy the new source_sub requirement.

agent.completed subscriptions with action: 'command' are now invalid without source_sub, so the loader should skip relay here and result!.subscriptions[0] stops being a happy-path assertion. Add the upstream subscription name to keep this test exercising a valid CLI-command config.

Suggested fixture update
 subscriptions:
   - name: relay
     event: agent.completed
     source_session: researcher
+    source_sub: researcher-step
     action: command
     command:
       mode: cli
🤖 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/__tests__/main/cue/cue-yaml-loader.test.ts` around lines 108 - 136, The
test fixture must be updated so the command-action subscription includes the
required source_sub field; in the YAML returned by mockReadFileSync inside the
'parses an action: command cli send subscription' test, add a source_sub:
'<upstream-name>' (e.g. source_sub: 'upstream') to the relay subscription so
loadCueConfig will treat it as valid and the subsequent assertions against
result!.subscriptions[0] and its command (checked by the test) continue to
exercise a valid CLI-command config.
🤖 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/maestro-cue-configuration.md`:
- Around line 76-99: Add documentation entries for the UUID-keyed fields
`source_session_ids` and `fan_out_ids` to the schema tables referenced as "Full
Schema" and "Optional Fields": describe both as arrays of agent UUID strings
(e.g., type: array of string, format: uuid), explain their semantics (stable
cross-root references used for chaining and fan-out, resilient to agent
renames), and note that they are preferred over the legacy `source_session` and
`fan_out` name-based fields; update any examples or table rows that list
`source_session`/`fan_out` to include the new `_ids` counterparts so readers can
see the expected YAML shape and usage.

In `@src/main/cue/config/cue-config-validator.ts`:
- Around line 369-385: The validator currently rejects mixed-shape source
mappings by erroring when source_session and source_sub differ in type; instead,
update the logic in cue-config-validator (the block handling sub.source_session
and sub.source_sub where sourceSessionIsArray and sourceSubIsArray are computed)
to only validate positional alignment when both sourceSession and sourceSub are
arrays (i.e., keep the length check when Array.isArray(sourceSession) &&
Array.isArray(sourceSub)), and remove the two else-if branches that push errors
for scalar/array combinations so scalar/array mixes are allowed; keep using the
existing prefix and errors array to report only the true positional-mismatch
case.

In `@src/renderer/components/CuePipelineEditor/utils/yamlToPipeline.ts`:
- Line 535: source_sub resolution is order-dependent because you check
knownSubNames and call subNameToNode.get(subRef) while iterating sorted, so if
the producer appears later you miss it; restructure into two passes: first
iterate sorted to create all producer nodes and populate subNameToNode (and
knownSubNames) without resolving edges, then in a second pass resolve edges
using source_sub/subRef lookups (the logic currently around knownSubNames,
subNameToNode.get(subRef), and the source_sub handling), ensuring deferred edge
resolution also for the other affected blocks around the same pattern (the
sections noted at ~866-885 and ~961-980).

---

Outside diff comments:
In `@src/__tests__/main/cue/cue-yaml-loader.test.ts`:
- Around line 108-136: The test fixture must be updated so the command-action
subscription includes the required source_sub field; in the YAML returned by
mockReadFileSync inside the 'parses an action: command cli send subscription'
test, add a source_sub: '<upstream-name>' (e.g. source_sub: 'upstream') to the
relay subscription so loadCueConfig will treat it as valid and the subsequent
assertions against result!.subscriptions[0] and its command (checked by the
test) continue to exercise a valid CLI-command config.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a1fb6710-1c2d-47c3-95d0-9daa152562ac

📥 Commits

Reviewing files that changed from the base of the PR and between 56ece61 and 1f4f06f.

📒 Files selected for processing (7)
  • docs/maestro-cue-configuration.md
  • docs/maestro-cue-examples.md
  • docs/maestro-cue.md
  • src/__tests__/main/cue/cue-yaml-loader.test.ts
  • src/main/cue/config/cue-config-validator.ts
  • src/prompts/_maestro-cue.md
  • src/renderer/components/CuePipelineEditor/utils/yamlToPipeline.ts

Comment thread docs/maestro-cue-configuration.md
Comment thread src/main/cue/config/cue-config-validator.ts
Comment thread src/renderer/components/CuePipelineEditor/utils/yamlToPipeline.ts
@greptile-apps

greptile-apps Bot commented May 11, 2026

Copy link
Copy Markdown

Greptile Summary

Despite the PR description calling this a "Docs-only diff", the change includes meaningful code additions across the validator, pipeline renderer, and test suite alongside the documentation. The documentation correctly captures the per-agent-cwd discovery model and adds clear role tables for multi-root authoring.

  • Docs (_maestro-cue.md, maestro-cue-configuration.md, maestro-cue.md, maestro-cue-examples.md): New Multi-Root Pipelines sections with per-role placement tables, hand-authoring checklists, and annotated CI-Style Pipeline example; accurate and well-organized, but the "prefer source_session_ids over source_session" prose implies source_session is optional when the validator unconditionally requires it.
  • Validator (cue-config-validator.ts): Two new rules — source_sub required for agent.completed + action: command, and source_sub / source_session array-length alignment check; the alignment guard !sourceSessionIsArray misfires when source_session is absent and emits a misleading error message.
  • Pipeline renderer (yamlToPipeline.ts): Builds a knownSubNames set to surface missing source_sub references as visible error nodes instead of silently falling back to session-name resolution.

Confidence Score: 3/5

The documentation additions are accurate and well-structured, but the new validation rules introduce a breaking change for existing YAML files and a doc/validator mismatch that will cause agents following the new guidance to produce configs that fail validation.

The new 'prefer source_session_ids over source_session' prose in both the agent prompt and the user docs directly contradicts the validator's hard requirement for source_session on every agent.completed subscription. Any agent or user that reads the new guidance and omits source_session while supplying only source_session_ids will get a validation error with no clear signal in the docs explaining why. Additionally, the new source_sub required for command rule silently invalidates existing cue.yaml files that lack source_sub on agent.completed + command subscriptions, with no migration note.

src/prompts/_maestro-cue.md and docs/maestro-cue-configuration.md need the source_session / source_session_ids guidance clarified; src/main/cue/config/cue-config-validator.ts needs the alignment-check guard tightened and a note about the new source_sub requirement being a breaking change.

Important Files Changed

Filename Overview
src/main/cue/config/cue-config-validator.ts Adds two new validation rules: (1) source_sub required for agent.completed + action: command — a breaking change for existing YAML without this field; (2) source_sub / source_session array-length alignment check with a guard condition that misfires when source_session is absent.
src/tests/main/cue/cue-yaml-loader.test.ts Adds three new test cases covering the new validator rules and patches one existing test to supply the now-required source_sub field; tests look correct and cover happy/error paths.
src/renderer/components/CuePipelineEditor/utils/yamlToPipeline.ts Builds a knownSubNames set and uses it to render a visible error node when a source_sub reference cannot be found, replacing silent session-name fallback for unknown subscription references; logic is sound.
src/prompts/_maestro-cue.md Adds Multi-Root Pipelines section with role table and checklist; the 'prefer UUID fields' prose implies source_session is optional when the validator still requires it — a mismatch that will produce validation failures for agents following the guidance literally.
docs/maestro-cue-configuration.md Adds Note callout under File Location and a full Multi-root pipelines section; same source_session / source_session_ids documentation mismatch as in _maestro-cue.md; example YAML correctly includes both fields but prose guidance does not.
docs/maestro-cue-examples.md Adds a Note callout to the CI-Style Pipeline example clarifying the three-file per-agent-root pattern vs. single-root with agent_id routing; accurate and well-scoped.
docs/maestro-cue.md Expands the Configuration File paragraph to note the per-agent-cwd model and links to the new Multi-root section; accurate and minimal.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[agent.completed subscription\naction: command] -->|new rule| B{source_sub\npresent?}
    B -->|No| C[Validation error: source_sub required]
    B -->|Yes| D{source_sub in knownSubNames?}
    D -->|Found in subNameToNode| E[Resolve to upstream node]
    D -->|Not in knownSubNames| F[Render error node: missing-source]
    D -->|Known name, resolves later| G[Session-name fallback lookup]
    H[source_session array + source_sub array] -->|new rule| I{lengths match?}
    I -->|No| J[length mismatch error]
    I -->|Yes| E
    K[source_session string + source_sub array] -->|new rule| L[must-be-string error - also fires when source_session is undefined]
Loading

Reviews (1): Last reviewed commit: "Document per-agent-cwd model for multi-r..." | Re-trigger Greptile

Comment thread src/prompts/_maestro-cue.md
Comment thread docs/maestro-cue-configuration.md
Comment thread src/main/cue/config/cue-config-validator.ts Outdated
Comment on lines +364 to +368
if (sub.action === 'command' && sub.source_sub === undefined) {
errors.push(
`${prefix}: "source_sub" is required for agent.completed subscriptions when action is "command"`
);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Breaking validation change not called out in PR description

The new check makes source_sub required whenever event === 'agent.completed' and action === 'command'. The PR description states "Docs-only diff (+67 / -2). No code, no tests touched." but this introduces a breaking validator rule: any existing cue.yaml with an agent.completed + action: command subscription lacking source_sub will now fail validation. There is no migration note documented. If intentional, the PR description and the configuration reference should call it out as a required field addition for this subscription shape.

@chr1syy chr1syy changed the title Document per-agent-cwd model for multi-root Cue pipelines docs(cue) + validator: multi-root pipelines guide; require source_sub for action:command May 11, 2026
chr1syy and others added 2 commits May 11, 2026 13:46
The engine reads only <projectRoot>/.maestro/cue.yaml for each agent and
never walks parents, so a single root cue.yaml cannot manage a fleet of
agents living at distinct project roots. Document the correct authoring
pattern: each subscription lives in its owning agent's local cue.yaml,
cross-agent chains stitch at runtime via source_session_ids / fan_out_ids,
and orchestration / fan-in subs live with their target agent (which is
the workspace root only when the orchestrator's cwd happens to sit
there).

- src/prompts/_maestro-cue.md: add Multi-Root Pipelines section above
  Shared Workspaces with per-role placement table and hand-authoring
  checklist; update Configuration File and Authoring Guidance to point
  at it.
- docs/maestro-cue-configuration.md: add Note callout under File
  Location and a Multi-root pipelines section after Sharing a workspace
  across agents.
- docs/maestro-cue.md: clarify Configuration File copy and link to the
  new section.
- docs/maestro-cue-examples.md: add Note on the CI-Style Pipeline
  example calling out that its three yamls are the multi-root pattern
  (vs. a same-root setup with agent_id routing in one file).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ture

Resolves doc/validator mismatch flagged by Greptile + CodeRabbit, the
misfiring shape-check guard, and the now-invalid CLI-send loader fixture.

- Validator (cue-config-validator.ts): skip the source_sub/source_session
  type-shape check when source_session is undefined. The required-field
  check above already errors; re-emitting "source_sub must be a string
  when source_session is a string" against an undefined source_session
  was misleading noise.
- Validator test: add regression case asserting only the required-field
  error fires when source_session is missing (no misleading shape error).
- Loader fixture (cue-yaml-loader.test.ts:108-136): add
  source_sub: researcher-step to the CLI-send fixture so the YAML is
  semantically valid under the new agent.completed + action: command
  rule. Assert source_sub round-trips through the loader.
- Docs (_maestro-cue.md, maestro-cue-configuration.md): reframe
  source_session_ids / fan_out_ids as REQUIRED COMPANIONS to
  source_session / fan_out, not replacements. Validator requires
  source_session on every agent.completed sub; the _ids fields are
  additional UUID arrays for rename stability (dispatcher prefers ids
  at lookup time, falls back to names).
- Schema reference (maestro-cue-configuration.md): add
  source_session_ids, source_sub, and fan_out_ids to both the Full
  Schema YAML block and the Optional Fields table — they were
  documented in prose but missing from the schema reference.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@chr1syy
chr1syy force-pushed the fix/cue-documentation branch from d660fd9 to e87a8db Compare May 11, 2026 11:47
@chr1syy chr1syy changed the title docs(cue) + validator: multi-root pipelines guide; require source_sub for action:command docs(cue): multi-root pipelines guide; fix validator misfire on missing source_session May 11, 2026
@chr1syy

chr1syy commented May 11, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the careful read, @pedramamini — and apologies for the misframing on the original PR description. Walking through what happened and what's now in the PR:

Why the diff was bigger than "docs-only"

The fix/cue-documentation branch already had two prior commits (b9f5b401 "Harden cue.yaml command chains and document authoring contract" + a8cb55f5 "Fix CI lint and chain-source validation edge cases") sitting on top of rc before my docs commit landed. Those carried the validator + tests + yamlToPipeline work you called out. I missed that those commits were part of the PR's rc...HEAD diff when I wrote the description.

Looking at rc history now, those exact two commits already landed via #976 "Harden Cue YAML command-chain validation and authoring docs" (squashed as 3a12a3c6, merged May 10). So they were duplicating work that was already in.

I've rebased this branch onto current upstream/rc (which contains #976). The two duplicate commits drop out cleanly, leaving:

The PR now shows 6 files / +139 / -32. No code duplication with #976.

Review-feedback fixes in the second commit

Both Greptile and CodeRabbit flagged two things in #976's validator that I went ahead and fixed here since they're directly downstream of #976's source_sub rule and naturally pair with the multi-root docs:

  1. Doc/validator mismatch. The original Multi-root prose said "prefer source_session_ids over source_session" — but the validator (correctly) requires source_session on every agent.completed sub. An agent reading the guidance literally would write invalid YAML. Reframed the prose to make the _ids fields companions (for rename stability) rather than replacements, and added source_session_ids / source_sub / fan_out_ids to the schema reference (Full Schema block + Optional Fields table — they were documented in prose but missing from the schema).
  2. Misfiring type-shape guard. cue-config-validator.ts line ~381 emitted "source_sub" must be a string when "source_session" is a string even when source_session was undefined (the required-field check above already errored). Skipped the type-shape check entirely when source_session is undefined. New regression test locks in the fix.

Also patched the loader fixture at cue-yaml-loader.test.ts:108-136 to add source_sub: researcher-step per CodeRabbit's outside-diff "Quick win" — the fixture was a CLI-send agent.completed + action: command config that became semantically invalid under #976's new rule.

Re: your three questions on the source_sub requirement (#976)

Even though that rule's already merged, for the release-notes loop:

  1. Hard error, intentional. The failure mode without it is silent edge mis-routing in the visual editor (Cmd(owner=S) → Agent(S) collapses to Agent(S) → Agent(S) because they share an owning session). Better to refuse the load with a pointer to the missing field than to mis-route silently.
  2. No migration / auto-repair. The visual editor has always written source_sub for Command nodes, so the affected surface is pre-existing hand-authored YAMLs that combine event: agent.completed + action: command without source_sub.
  3. Release-notes call-out recommended. Happy to add a CHANGELOG entry pointing affected users at adding source_sub: <upstream-name> if you want — let me know and I'll fold it into this PR or a follow-up.

CI on the latest push (e87a8dbf) — please tell me if lint-and-format / test flag anything beyond what I ran locally (vitest cue-yaml-loader: 143 pass, vitest CuePipelineEditor utils: 346 pass, prettier clean).

@chr1syy

chr1syy commented May 11, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favor of #987 — same final tree, fresh branch, clean PR history.

This PR accumulated noise from two force-pushes: the branch originally carried two prior commits (b9f5b401, a8cb55f5) that turned out to be duplicates of work already merged via #976, plus rebase + review-fix iterations on top. The replacement is a clean two-commit PR on a fresh docs/cue-multi-root-pipelines branch off current rc, with an accurate description from the start. The review feedback from @pedramamini, @coderabbitai, and @greptile-apps is addressed there.

See #987.

@chr1syy chr1syy closed this May 11, 2026
@coderabbitai

coderabbitai Bot commented May 11, 2026

Copy link
Copy Markdown

@chr1syy: Understood — thanks for the clear handoff note. I'll pause automated reviews on this PR. I'll pick up the review fresh on #987 with the clean history.

✅ Actions performed

Reviews paused.

@greptile-apps

greptile-apps Bot commented May 11, 2026

Copy link
Copy Markdown

Thanks for the heads-up — closing out review activity here. The fixes and docs look solid; will pick up in #987.

Tip: You can customize Greptile's behavior for this repo with .greptile/rules.md and .greptile/config.json.

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.

2 participants