Skip to content

Read who each agent works with: its manager, workers and peers - #34890

Merged
brennanb2025 merged 96 commits into
mainfrom
brennanb2025/crew-read-model
Nov 1, 2026
Merged

brennanb2025 merged 96 commits into
mainfrom
brennanb2025/crew-read-model

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 71 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​6835 $\color{#cf222e}{\Huge{\mathbf{−}}}$​230 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​6605
Prod 154 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​9092 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1384 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​7708

Problem and change

Orca has no single view of who an agent works with. Its manager, workers, conversations and unanswered questions live in separate records, so a panel cannot safely infer them from terminal labels or recent activity alone.

This PR supplies a read-only Crew view for each agent, using the existing host records and streaming transport. It keeps durable relationships separate from optional actions: a known agent can remain visible even when Orca cannot prove an address or an Open target for it. Pending questions belong to their recipient and do not disappear just because unrelated messages become old. Status and ownership changes refresh the view through existing event sources, without per-row polling or a saved roster. Passive observation does not launch, repair or redeploy a host.

Users see nothing from this PR alone: merging it alone ships an internal read model that can't be used until #34891 adds the panel; #34836 adds mentions. The base feature #34601 has landed, and this PR now targets main.

Design

The common pattern derives relationships from canonical records and keeps display data separate from action authority. This adopts that pattern. Intended differences cover existing terminal and native-chat agents, Run and Dispatch ownership, retained sessions, folder workspaces and independently updated paired hosts. Managed by follows proven durable parent assignments; Managing uses the existing active/recent worker lifecycle. Incomparable proven parents can both remain visible. An unsupported older host keeps its existing behavior and does not show the panel.

The view reuses generation-owned acquisition and the existing status/identity authorities. Selected revisions invalidate the relevant host or party; consumers share sources and release them with their final interest. Optional addresses are checked against the existing command contract rather than a new permission cache: Crew offers a follow-up address only when the messaging command's own checks for the current Run, the helpers the caller may continue and the nesting-depth limit would accept it.

Validation

Source-associated tests cover the real public command, relationship and question lifecycle, current identity, selected acquisition, fault/retry/disposal and operation bounds. The public command's four kept cases pass, including a worker sending through the actual Crew-advertised address to its settled, still-live helper. Previously accepted app evidence covers the unchanged saved-identity, paired-host and observation flows; it is carried by flow and source, not presented as a new full run.

Settled-parent address repair. With nested delegation enabled, Crew could offer an active child its settled parent's Dispatch address even though the command does not permit the child to continue the parent's work. Production commit c47cc349c6843c17a3dd3bf86f1902dccd2b22a2 uses the command's full checks for the current Run, which helpers the caller may continue and the nesting-depth limit before offering an address. It preserves the relationship and valid Open target, the existing same-party ordinary-message route, and the explicit foreign-helper refusal. Its regression lets the parent report done, captures Crew's actual address, sends that exact string through the real CLI → RPC → database path, and confirms an explicit send to the parent's Dispatch is still refused with no effects. This is a separate Crew repair after the main helper-command fix in #36663; it does not relax that ownership rule.

Construction recorded 145 passing tests in 16 complete files before small static fixes, then 15 of those same tests in four complete files on the exact committed bytes; the 15 are a subset, not additional tests. Test-only ac182c1dc6343211fa5edaedb5a2adbdcd90e3be completes the selected finite performance and recovery evidence: 20/20 passed across three whole files, recording actual work as targets, custody history and remote candidates grow independently, a warm custody transfer with queued-update cancellation, and a partial read failure that shows as unknown and then recovers on retry. Test-only 9ef08d3b9fecf779840bf303f628039d855c3303 makes the direct remote case assert the exact thrown error object; 7/7 passed in its whole file. These command and database fixtures do not establish a new app run, an OS-agent read or a provider response, and they do not prove universal latency, CPU, heap or GC bounds.

Ordinary merge 25af5a8e97396791e0aa9abaf6c422de4b302174 brings in main 21c86904d5d353b888d5848917c85f789e88ab31. Its only conflict, in the WSL host runtime call, keeps main's protection against a stale stopped status overwriting a newer Start; 55/55 passed across the two whole WSL host service and pending-removal test files, and the full merge hook passed. CI on that merge failed its static job on one duplicate import in a Crew test file, so its later compiler, casting and E2E ratchet steps did not run there. Test-only 19fc72a1066fdaaf2d24873ccad0cb583144cb05 merges that import into the existing one without changing any test body; it is this PR's final source, and its CI result is green. Earlier CI at e1ded7135a24db2264908542c08e855215ddfd92 was green, including all five configured compiler programs, the unchanged E2E typecheck ratchet and all 12 unit shards; configured skips remain skips. That result does not cover later heads.

The main command repair in #36663 is a fixed external dependency, included by ordinary merge and propagated through the stack without a Crew fallback or helper-policy workaround. Its earlier regression successfully sends to Crew's advertised address for an active worker's settled helper, reusing its resource with one prompt and no new terminal; all 59 tests passed across four complete command/authority files at that earlier head. That evidence keeps its own source association and is distinct from the settled-parent repair above. #34891 at e30ada67cf76d62a6a1a0e815fd783b9ea6d42fd and #34836 at b22995b3e0ae51838eb7f55007747a2fbcf52a30 carry this PR's source by ordinary merge.

Test trim. Tests-only commits 668570384ade63d232c409fa741e0d46d95e616d and d7e268cd0f39a0ded1f76382b3c7b863936bb660 cut this PR's added test lines from 16,373 to 7,896, now below its 8,008 added production lines. They keep the real CLI → RPC → database command paths, one regression per bug the review found, the cross-version and wire contracts, and one N vs 10N operation-count contract per scaling piece. They drop permutation matrices, equivalence oracles, near-duplicate cases, diagnostic output, five whole test files, and the SSH, managed-server and WSL test additions (those production changes were reverted earlier in this PR, or main's existing tests already cover them). All 40 edited test files that remain pass locally (255 tests). No production file changed.

Ordinary main merges 57ef7f21b86 (main 274592eddc3, 12 conflicts resolved, keeping both sides) and c31c8535f2c (main be3d9b7e863, no conflicts) follow the trim. Test-only a0f1593ab2a passes the recorded-leaf reader in main's new check-details loader test. CI on a0f1593ab2a is green. CI on 19fc72a1066fdaaf2d24873ccad0cb583144cb05, the last head before the trim, was green: all twelve unit shards, the five configured compiler programs, changed-code casting/quality and the unchanged zero-baseline E2E typecheck ratchet passed. Configured skips remain skips. The first attempt timed out in main's unchanged 1,000-turn observer test and then failed its next test; a failed-job-only retry passed all 15 observer tests, with the 1,000-turn case completing in 22.393 seconds. No stack code was changed for that timing failure.

Main's lineage projection only walked terminal panes, so workers running
in the chat UI never got a parent link and listed flat in the sidebar.
It now also projects chat workers, keyed by their visible chat row, and
resolves a chat creator or coordinator to that chat's visible row
instead of its handle or private mailbox pane key.
@brennanb2025
brennanb2025 marked this pull request as ready for review October 28, 2026 16:54
@brennanb2025
brennanb2025 changed the base branch from brennanb2025/chat-worker-lineage to main October 28, 2026 23:09
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

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

The change adds crew data queries, parent and party resolution, snapshot construction, invalidation handling, and a streaming orchestration RPC. Runtime and database changes publish crew invalidations for session, status, workspace, and terminal identity updates. New read contexts capture and index terminal identity and structured-session inputs. Tests cover crew snapshots and streams, invalidation behavior, and captured identity reads.

Merge Risk: Moderate · up to 4700d

The CLI typecheck is blocked, and some tab changes can leave sidebar agent information stale. Correct the imports and stale-read paths before merging.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 25.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.
Description check Warning The description follows the repository template in most sections. It has an ELI5-style opening, a detailed What Changed/Design section, a Validation section with test evidence, and a Risk-related cont…
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly summarizes the main change: a view that shows each agent’s manager, workers, and peers.
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: Docstring Coverage

Explanation

Docstring coverage is 25.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 60 functions across 74 files.

Resolution

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

Full details: Description check

Explanation

The description follows the repository template in most sections. It has an ELI5-style opening, a detailed What Changed/Design section, a Validation section with test evidence, and a Risk-related context. It is long and dense, and it is not in the template's section layout. The Linked Issue section is missing. The description links PRs #34891, #34836, #34601, and #36663, but it does not contain a "Fixes #" issue reference, and the template says an actual issue must be linked. The Visual Proof section is missing. The description does not state that it is a UI change, and it says users see no panel from this PR alone, so N/A with a reason is expected. The Testing section is present but does not tick the manual testing checkbox or mention the platforms tested (macOS, Linux, Windows, SSH). The Risk section does not name a Level (Low/Medium/High) or describe how to back out the change. The AI Disclosure section is not filled in. The Review and Agent skill upstream boundary sections are absent. The Notes and Checklist sections are absent.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Fix failing CI checks
  • Commit to this branch
  • 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

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 7


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2855c4b4-5068-4471-984c-f1d6139db1d4
Commits

Reviewing files that changed from the base of the PR and between 78ad9f4 and e79237b.

Files selected for processing: 124
  • config/mobile-ci.vitest.config.mjs
  • mobile/scripts/check-tests-typecheck-ratchet.mjs
  • mobile/src/components/WorktreeAgentList.runtime-lineage.test.tsx
  • mobile/tsconfig.test.json
  • src/cli/index-omitted-host-scope-selectors.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-registry.ts
  • src/main/runtime/agent-session-record-store-slot.test.ts
  • src/main/runtime/agent-session-record-store-slot.ts
  • src/main/runtime/agent-session-store-transactions.test.ts
  • src/main/runtime/agent-session-store-transactions.ts
  • src/main/runtime/construction/runtime-construction-services.ts
  • src/main/runtime/construction/runtime-service-state.ts
  • src/main/runtime/dispatch-predicate-visits.test-fixture.ts
  • src/main/runtime/orca-runtime-agent-transitions.ts
  • src/main/runtime/orca-runtime-test-orchestration-messages.spec.ts
  • src/main/runtime/orca-runtime-test-scenario-builders.spec.ts
  • src/main/runtime/orca-runtime-tests/lineage-and-scan-cache-part-04.spec.ts
  • src/main/runtime/orca-runtime-tests/lineage-and-scan-cache-part-05.spec.ts
  • src/main/runtime/orca-runtime-tests/lineage-and-scan-cache-part-06.spec.ts
  • src/main/runtime/orca-runtime-tests/mobile-summaries.spec.ts
  • src/main/runtime/orca-runtime-tests/terminal-creation-and-readiness-part-02.spec.ts
  • src/main/runtime/orca-runtime-tests/terminal-output-and-worker-recovery-part-02.spec.ts
  • src/main/runtime/orca-runtime-tests/terminal-output-and-worker-recovery-part-03.spec.ts
  • src/main/runtime/orca-runtime-tests/terminal-output-and-worker-recovery-part-04.spec.ts
  • src/main/runtime/orca-runtime-tests/terminal-output-and-worker-recovery-part-05.spec.ts
  • src/main/runtime/orca-runtime-tests/terminal-output-and-worker-recovery-part-06.spec.ts
  • src/main/runtime/orchestration/canonical-orca-session-id.ts
  • src/main/runtime/orchestration/crew/crew-changes.ts
  • src/main/runtime/orchestration/crew/crew-claim-origins.test.ts
  • src/main/runtime/orchestration/crew/crew-claim-reduction.ts
  • src/main/runtime/orchestration/crew/crew-cli-addresses.test.ts
  • src/main/runtime/orchestration/crew/crew-host-derivation.ts
  • src/main/runtime/orchestration/crew/crew-identity-inputs.ts
  • src/main/runtime/orchestration/crew/crew-mutation-notifications.ts
  • src/main/runtime/orchestration/crew/crew-parent-inputs.ts
  • src/main/runtime/orchestration/crew/crew-parent-persistence.test.ts
  • src/main/runtime/orchestration/crew/crew-parent-relations.test.ts
  • src/main/runtime/orchestration/crew/crew-parent-relations.ts
  • src/main/runtime/orchestration/crew/crew-parent-rpc.test.ts
  • src/main/runtime/orchestration/crew/crew-parties.ts
  • src/main/runtime/orchestration/crew/crew-party-snapshot.ts
  • src/main/runtime/orchestration/crew/crew-query.ts
  • src/main/runtime/orchestration/crew/crew-read-model-performance.test.ts
  • src/main/runtime/orchestration/crew/crew-read-model.test-fixture.ts
  • src/main/runtime/orchestration/crew/crew-read-model.test.ts
  • src/main/runtime/orchestration/crew/crew-read-model.ts
  • src/main/runtime/orchestration/crew/crew-rules.ts
  • src/main/runtime/orchestration/crew/crew-runtime-watch.ts
  • src/main/runtime/orchestration/crew/crew-source-inputs.ts
  • src/main/runtime/orchestration/crew/crew-stream.ts
  • src/main/runtime/orchestration/crew/crew-workspace-names.ts
  • src/main/runtime/orchestration/db/attach-orchestration-db-methods.ts
  • src/main/runtime/orchestration/db/dispatch-context/dispatch-lookup.ts
  • src/main/runtime/orchestration/db/hot-path-statement-compilation.test.ts
  • src/main/runtime/orchestration/db/orchestration-db.ts
  • src/main/runtime/orchestration/db/remaining-dispatch-statement-compilation.test.ts
  • src/main/runtime/orchestration/db/schema/schema-column-probes.ts
  • src/main/runtime/orchestration/orchestration-orca-session-column-migration.test.ts
  • src/main/runtime/orchestration/orchestration-sender-name.ts
  • src/main/runtime/orchestration/structured-session-lineage.ts
  • src/main/runtime/orchestration/terminal-pane-mail-routing.ts
  • src/main/runtime/rpc/methods/orchestration.ts
  • src/main/runtime/rpc/methods/orchestration/crew-methods.ts
  • src/main/runtime/runtime-agent-lineage-catalog.test-fixture.ts
  • src/main/runtime/runtime-agent-lineage.test-fixture.ts
  • src/main/runtime/runtime-agent-orchestration-benchmark.test-fixture.ts
  • src/main/runtime/runtime-agent-orchestration-projection.test.ts
  • src/main/runtime/runtime-agent-orchestration-projection.ts
  • src/main/runtime/runtime-agent-orchestration-scope.ts
  • src/main/runtime/runtime-orchestration-crew-names.test.ts
  • src/main/runtime/runtime-orchestration-db.test-fixture.ts
  • src/main/runtime/runtime-orchestration-sender-names.test.ts
  • src/main/runtime/runtime-orchestration-sender-names.ts
  • src/main/runtime/session-graph/visible-graph-changed-worktrees.ts
  • src/main/runtime/session-lifecycle/projection/prune-mobile-session-tab-group-layout.ts
  • src/main/runtime/session-tabs/session-tabs-inventory.ts
  • src/main/runtime/terminal-send-stale-leaf-liveness.test.ts
  • src/main/runtime/terminal/adoption/adopt-terminal-orphans-from-inventory.ts
  • src/main/runtime/terminal/identity/terminal-handle-bindings.ts
  • src/main/runtime/terminal/output/headless-buffer-snapshot.ts
  • src/main/runtime/terminal/output/terminal-orchestration-authority.ts
  • src/main/runtime/terminal/query/pty-terminal-summary.ts
  • src/main/runtime/terminal/query/terminal-identity-read-context.test.ts
  • src/main/runtime/terminal/query/terminal-identity-read-context.ts
  • src/main/runtime/terminal/surface/main-terminal-acquisition.test.ts
  • src/main/runtime/terminal/surface/main-terminal-surfaces.ts
  • src/main/runtime/terminal/surface/pty-pane-query.ts
  • src/main/runtime/terminal/wait/terminal-interactive-wait.ts
  • src/main/runtime/workspaces/persisted-surfaces/automation-operations.ts
  • src/main/runtime/workspaces/session-hosts/get-runtime-id.ts
  • src/main/runtime/workspaces/workspace-process-listing.ts
  • src/renderer/src/components/activity/activity-event-builder-sources.ts
  • src/renderer/src/components/activity/activity-event-builder.ts
  • src/renderer/src/components/activity/use-agent-pane-threads.ts
  • src/renderer/src/components/dashboard/build-dashboard-snapshot.ts
  • src/renderer/src/components/dashboard/useAgentBucketCounts.gate.test.ts
  • src/renderer/src/components/dashboard/useAgentBucketCounts.ts
  • src/renderer/src/components/dashboard/useLiveDashboardSnapshot.ts
  • src/renderer/src/components/dashboard/worktree-agent-rows-cache.ts
  • src/renderer/src/components/native-chat/structured-agent-session-tabs.ts
  • src/renderer/src/components/sidebar/WorkerLineage.fixture.tsx
  • src/renderer/src/components/sidebar/WorktreeCard.affiliate-list-mode.test.tsx
  • src/renderer/src/components/sidebar/mirrored-terminal-lineage.test-fixture.tsx
  • src/renderer/src/components/sidebar/use-worktree-agent-rows-subscriptions.test.tsx
  • src/renderer/src/components/sidebar/useWorktreeAgentRows.ts
  • src/renderer/src/components/sidebar/worktree-agent-activity-summary.test.ts
  • src/renderer/src/components/sidebar/worktree-agent-activity-summary.ts
  • src/renderer/src/components/sidebar/worktree-agent-live-index-patch.ts
  • src/renderer/src/components/sidebar/worktree-agent-orchestration-index.ts
  • src/renderer/src/components/sidebar/worktree-agent-row-fallback-tab.ts
  • src/renderer/src/components/sidebar/worktree-agent-row-orchestration.ts
  • src/renderer/src/components/sidebar/worktree-agent-row-selectors.ts
  • src/renderer/src/components/sidebar/worktree-agent-rows.ts
  • src/renderer/src/runtime/structured-agent-session-owner.ts
  • src/renderer/src/runtime/visible-agent-orchestration.ts
  • src/renderer/src/store/slices/agent-status/agent-status-live-entry-builder.ts
  • src/renderer/src/store/slices/agent-status/agent-status-orchestration-actions.ts
  • src/renderer/src/store/slices/agent-status/agent-status-retention-actions.ts
  • src/renderer/src/store/slices/agent-status/agent-status-slice-contract.ts
  • src/renderer/src/store/slices/workspace-cleanup-agent-evidence.ts
  • src/shared/agent-status-worktree-attribution.ts
  • src/shared/orchestration-agent-reference.ts
  • src/shared/orchestration-crew.ts
  • src/shared/runtime-agent-lineage-consumer.test-fixture.ts

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

…d-model

# Conflicts:
#	src/main/runtime/rpc/methods/orchestration/messaging/worker-follow-up.ts
Keep the real CLI/RPC/database command paths, one regression per review-found bug, the cross-version contracts and one N vs 10N operation contract per scaling piece. Drop permutation matrices, equivalence oracles, near-duplicate scenarios and diagnostic output, and return the SSH, managed-server and WSL test files to main, since their production changes were reverted earlier in this PR.
Remove two leftover console.log diagnostics, an unused 2x2 sample matrix and unused return fields in the follow-up cost contract, and the subscription AbortError serialization case that the subscription identity and preload tests already cover.
Resolve conflicts with main's agent-session records move, terminal sender snapshots, and pane-shown retained handles, and update one identity test for main's rule that an alias no pane shows answers only exit waits.
Main's hosted-review routing grew the workspace loader past its line limit alongside this branch's recorded-leaf reader, so the reader moves into the recorded-key module it already depends on.
@brennanb2025
brennanb2025 merged commit 0fa5dae into main Nov 1, 2026
67 checks passed
@brennanb2025
brennanb2025 deleted the brennanb2025/crew-read-model branch November 1, 2026 23:44
richarddaros added a commit to richarddaros/orca that referenced this pull request Nov 1, 2026
…ó do upstream

O sync de 2026-11-01 parou no pai de stablyai#34890 porque automation-operations.ts, idêntico ao do upstream, passou do max-lines no hook de pre-commit. Documenta o procedimento no runbook e no AGENTS.md e atualiza o parágrafo do plugin-authoring.md, que o upstream passou a trazer com a mesma formatação.
tomarai85 added a commit to tomarai85/orca that referenced this pull request Nov 2, 2026
tomarai85 added a commit to tomarai85/orca that referenced this pull request Nov 2, 2026
tomarai85 added a commit to tomarai85/orca that referenced this pull request Nov 2, 2026
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