Skip to content

refactor: use concrete RPC and orchestration owners - #41158

Merged
nwparker merged 1 commit into
mainfrom
module-layout-v2/rpc-orchestration-owners-faced
Nov 11, 2026
Merged

nwparker merged 1 commit into
mainfrom
module-layout-v2/rpc-orchestration-owners-faced

Conversation

@nwparker

@nwparker nwparker commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

RPC and orchestration already have domain folders. This removes the remaining forwarding modules so callers import the code that owns each operation directly.

What Changed

  • Delete two export-only legacy remote facades and remove seven borrowed exports from substantive modules.
  • Redirect 36 production value/type bindings to their existing defining owners, preserving runtime versus type-only imports.
  • Keep method registration order, protocol names, security declarations, implementation bodies, and singleton ownership unchanged.
  • Retire the one touched ambiguous-caller test under repository copy-test policy and remove its two TypeScript project entries.

Why

The parent directory layout is already implemented. These forwarding exports obscure the actual ownership boundaries; no additional file moves are justified by the current layout review. Worker and federation child scopes remain separate.

Linked Issue

Maintainer-requested module layout cleanup.

Visual Proof

N/A — no application visual or interaction change.

Testing

  • Full pnpm tc, lint and formatting pass.
  • CLI and production Electron builds pass on macOS.
  • The focused run passes 18 suites / 120 cases before the policy-mandated one-case retirement. One .spec.ts argument is outside the unit include pattern and receives no standalone execution credit.
  • Independent final audit: 343 checks pass; all 109 substantive statements and 370 import slots reconcile, with 36 direct-owner reroutes. Actual Electron/Orcad entry reachability retains every implementation owner.
  • Final pnpm check:changed --timeout=6 --maxWorkers=2 passes all 24 non-test checks. The broad related-test selection times out at six minutes with no reported assertion/collection failures; this is an incomplete test result, not a pass. Focused owning-suite evidence is above; full hosted CI is required before merge.
  • Full hosted PR Checks run 43028568665 passes: all 12 unit shards, static analysis/typecheck, packages, relay integration and cross-version wire compatibility. Required aggregate passes. The actual checkout is 0c61d49c, authenticated as this candidate plus native 5796c30 with zero path overlaps.
  • No tests added; production behavior is unchanged.

Risk

Level: Low. Import evaluation is the primary risk for Electron and Orcad, including remote worker operations. The existing declaration bodies, registration arrays and state owners are preserved; independent entry and cycle audits pass. A plain revert restores the previous imports.

The retired test asserted CLI guidance copy, which repository policy forbids in touched tests. Its single case also covered own-Run mail selection, ambiguous-sender refusal, and cross-Run state/outstanding-delivery safety. This intentionally loses those checks; no equivalent replacement is claimed.

Review

Two independent source/ownership audits pass. Original D22/D35 identity provenance and existing-child obligations remain preserved; historical absences receive no new retirement credit.

Agent skill upstream boundary

  • Not applicable: no upstream skill-installer material copied or translated.

@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Federation and remote callers now import APIs and types from dedicated modules instead of legacy re-export modules. The change removes several type re-exports and deletes two legacy modules. Approval types and worker APIs also use dedicated modules. The ambiguous-caller test and its configuration entries are removed. Structured-session code imports the permission-mode option ID from a dedicated module.

Merge Risk: Minimal · up to 6bc6e

This refactor changes import sources and removes legacy re-export modules, so runtime behavior should be unchanged. It also retires one test, which lowers regression coverage for ambiguous-caller handling. Merge-readiness risk is minimal, subject to the hosted CI the PR itself names as a merge gate.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title clearly summarizes the main change: replacing legacy forwarding modules with concrete RPC and orchestration owners.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
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.
Description check Passed The description is mostly complete and covers the change, rationale, testing, risk, visual proof, and upstream boundary. The Linked Issue section gives context but does not provide an actual issue ref…
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. 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 0 functions across 21 files. (1 skipped: 1 unsupported.)

Full details: Description check

Explanation

The description is mostly complete and covers the change, rationale, testing, risk, visual proof, and upstream boundary. The Linked Issue section gives context but does not provide an actual issue reference, and the template checklist is omitted.

Finishing Touches

Generate docstrings

  • 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

Recent 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: f71952b5-f613-489c-a505-346028445031
Commits

Reviewing files that changed from the base of the PR and between 5796c30 and 6bc6e65.

Files selected for processing: 30

  • config/tsconfig.node.json
  • config/tsconfig.test.pane-launch.json
  • src/main/runtime/orchestration/crew/crew-recipient-dispatches.ts
  • src/main/runtime/orchestration/db/federation/federation-relay-ack.ts
  • src/main/runtime/orchestration/db/remote-owned/remote-placements.ts
  • src/main/runtime/orchestration/federation/relay/federation-relay-prefix.ts
  • src/main/runtime/orchestration/federation/runtime-orchestration-federation.ts
  • src/main/runtime/orchestration/legacy-remote-home/legacy-remote-home.ts
  • src/main/runtime/orchestration/legacy-remote/legacy-remote-db-methods.ts
  • src/main/runtime/orchestration/legacy-remote/legacy-remote.ts
  • src/main/runtime/orchestration/terminal-authority/release/worker-terminal-auto-release-scheduler.ts
  • src/main/runtime/orchestration/terminal-authority/release/worker-terminal-release-reconciliation.ts
  • src/main/runtime/orchestration/workers/approvals/chat-worker-approval-prompt.ts
  • src/main/runtime/orchestration/workers/approvals/terminal-worker-approval-hold.ts
  • src/main/runtime/orchestration/workers/approvals/terminal-worker-approval-holds.ts
  • src/main/runtime/orchestration/workers/approvals/worker-approval.ts
  • src/main/runtime/orchestration/workers/turn-stops/terminal-worker-turn-stops.ts
  • src/main/runtime/orchestration/workers/turn-stops/worker-turn-stop-report.ts
  • src/main/runtime/rpc/methods/orchestration/federation/federation-methods.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/ask-methods.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/reply-method.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/send-methods.ts
  • src/main/runtime/rpc/methods/orchestration/orchestration-check-ambiguous-caller.test.ts
  • src/main/runtime/rpc/methods/orchestration/worker/single-worker-stop.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-control.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-observation.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-release.ts
  • src/main/runtime/rpc/methods/orchestration/worker/workers.ts
  • src/main/runtime/rpc/methods/structured-sessions/creation/structured-agent-session-create-handler.ts
  • src/main/runtime/rpc/methods/structured-sessions/creation/structured-agent-session-create.ts
Files with no reviewable changes: 8

  • src/main/runtime/orchestration/legacy-remote/legacy-remote.ts
  • src/main/runtime/orchestration/db/remote-owned/remote-placements.ts
  • config/tsconfig.test.pane-launch.json
  • src/main/runtime/orchestration/workers/approvals/worker-approval.ts
  • src/main/runtime/orchestration/legacy-remote/legacy-remote-db-methods.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-observation.ts
  • src/main/runtime/rpc/methods/orchestration/orchestration-check-ambiguous-caller.test.ts
  • src/main/runtime/orchestration/legacy-remote-home/legacy-remote-home.ts

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

@nwparker
nwparker merged commit 8ae4823 into main Nov 11, 2026
51 checks passed
Jinwoo-H added a commit that referenced this pull request Nov 12, 2026
This reverts commit 818055f.

The feature misbehaves in real use: an Allow on a worker's approval card
was recorded as closed without an answer, and closed approval cards render
at the bottom of the coordinator chat, below newer messages.

Removed: the Claude PermissionRequest hook hold and its 130 s timeout,
the approval card in the coordinator chat, `orchestration deny`, the
approval payload on stop escalations, and the held-delivery lines on send
receipts. Escalation text goes back to its pre-#40756 wording.

Kept from later commits:
- #40983 (lost-worker alerts): its `lost` reason, cause/leftover/settled
  fields, turnStartedAt and the rejected-report check stay; only the
  approval branches around them are removed.
- #41158 (owner moves) and the test cleanups (#41151, #41175, #41177)
  only touched approval code that is now deleted.
Jinwoo-H added a commit that referenced this pull request Nov 12, 2026
…dinator (re-land with fixes) (#41259)

* revert: worker permission approvals (#40756)

This reverts commit 818055f.

The feature misbehaves in real use: an Allow on a worker's approval card
was recorded as closed without an answer, and closed approval cards render
at the bottom of the coordinator chat, below newer messages.

Removed: the Claude PermissionRequest hook hold and its 130 s timeout,
the approval card in the coordinator chat, `orchestration deny`, the
approval payload on stop escalations, and the held-delivery lines on send
receipts. Escalation text goes back to its pre-#40756 wording.

Kept from later commits:
- #40983 (lost-worker alerts): its `lost` reason, cause/leftover/settled
  fields, turnStartedAt and the rejected-report check stay; only the
  approval branches around them are removed.
- #41158 (owner moves) and the test cleanups (#41151, #41175, #41177)
  only touched approval code that is now deleted.

* feat(orchestration): answer workers' permission prompts from the coordinator (re-land of #40756)

* fix(orchestration): credit an approval from Claude's own decision record and place each worker card at its time

- An Allow that Claude took is answered by the person even when the command then fails or is still running; a failed command's PostToolUseFailure counts as ran.
- Expired means the agent's own timeout only; a close Orca can't name is not an expiry, and reasonDelivered is true only with a reason.
- Escalations wait for the dialog to paint and read Claude's warning even when a long command hides the top of its box.
- Worker cards and receipts render after the message they followed in time, not after the whole conversation; the toast says what happened.

* fix(native-chat): place timed rows without a memo the compiler skips

* perf(orchestration): feed chat approvals from their own stream, pin open cards, close cards whose worker ended

Native chats no longer subscribe to the crew stream for worker approvals. A
narrow orchestration.workerApprovalsSubscribe stream per chat party wakes only
on that party's own mail and on Run/Dispatch changes, never on agent status,
and reads the crew only when the approval list itself changes. The pane no
longer redraws for approvals: the transcript receipts and the pinned stack
each hold the feed themselves.

Open worker prompts are pinned above the composer (above the chat's own
prompt), oldest first, in a bounded scrolling stack; the transcript keeps only
receipts, at the time the worker asked. The countdown ticks only for open
cards in a visible pane.

An approval whose Dispatch is no longer running reads as closed ("No longer
open · worker ended"); a hook that hangs up after its worker is gone closes as
worker-ended rather than "answer it in the terminal"; and a click that finds
the prompt or Dispatch already gone turns the card into its receipt at once.

Also carries over: a stop owes a closing line only to an approval whose
escalation went out.

* fix(native-chat): no toast when a worker approval answer lands; the card's receipt says it

* fix(native-chat): a worker approval card answers on click, as the chat's own prompt does

The card turns into 'Allowed by you' at once and Claude's confirmation runs behind it; only an answer
Claude did not take changes it to the real outcome, and a failure reopens the card.

* fix(orchestration): keep main's stop-report index for the open-approval sweep after the re-land

* fix(orchestration): final-review fixes for chat worker approvals

- A click that gets approval_not_open no longer hides the card: the host's list decides, so a
  prompt the host still holds stays answerable. Only dispatch_inactive closes it locally.
- The approvals stream watches only the orchestration database's own changes (Runs, Dispatches,
  mail), not terminal identity notices, so agent status and title changes cost it nothing in main.
- Receipts are the chat's history: no 30-minute window, bounded by 100 rows with still-open
  prompts kept first.
- The pinned stack is capped against the pane and gives way first, so the chat's own prompt keeps
  its room; a prompt that closes while shown stays pinned as its receipt for 4 s, and one only the
  worker's terminal can answer stays pinned.
- A close no one named, after the worker's Dispatch ended, reads as worker-ended, and an
  unanswered close of an ended worker sends the coordinator no second notice.
- The transcript's receipts keep one array until a receipt changes.

* refactor(native-chat): a worker approval card waits on the host after a click instead of answering ahead of it

Both buttons turn off and the clicked one shows a spinner until the answer returns; the host's list
then turns the card into its receipt. Drops the client-side close and its reconciliation.

* fix(native-chat): let the compiler memoize the worker approval answer handler
audichuang pushed a commit to audichuang/orca that referenced this pull request Nov 13, 2026
…dinator (re-land with fixes) (stablyai#41259)

* revert: worker permission approvals (stablyai#40756)

This reverts commit 818055f.

The feature misbehaves in real use: an Allow on a worker's approval card
was recorded as closed without an answer, and closed approval cards render
at the bottom of the coordinator chat, below newer messages.

Removed: the Claude PermissionRequest hook hold and its 130 s timeout,
the approval card in the coordinator chat, `orchestration deny`, the
approval payload on stop escalations, and the held-delivery lines on send
receipts. Escalation text goes back to its pre-stablyai#40756 wording.

Kept from later commits:
- stablyai#40983 (lost-worker alerts): its `lost` reason, cause/leftover/settled
  fields, turnStartedAt and the rejected-report check stay; only the
  approval branches around them are removed.
- stablyai#41158 (owner moves) and the test cleanups (stablyai#41151, stablyai#41175, stablyai#41177)
  only touched approval code that is now deleted.

* feat(orchestration): answer workers' permission prompts from the coordinator (re-land of stablyai#40756)

* fix(orchestration): credit an approval from Claude's own decision record and place each worker card at its time

- An Allow that Claude took is answered by the person even when the command then fails or is still running; a failed command's PostToolUseFailure counts as ran.
- Expired means the agent's own timeout only; a close Orca can't name is not an expiry, and reasonDelivered is true only with a reason.
- Escalations wait for the dialog to paint and read Claude's warning even when a long command hides the top of its box.
- Worker cards and receipts render after the message they followed in time, not after the whole conversation; the toast says what happened.

* fix(native-chat): place timed rows without a memo the compiler skips

* perf(orchestration): feed chat approvals from their own stream, pin open cards, close cards whose worker ended

Native chats no longer subscribe to the crew stream for worker approvals. A
narrow orchestration.workerApprovalsSubscribe stream per chat party wakes only
on that party's own mail and on Run/Dispatch changes, never on agent status,
and reads the crew only when the approval list itself changes. The pane no
longer redraws for approvals: the transcript receipts and the pinned stack
each hold the feed themselves.

Open worker prompts are pinned above the composer (above the chat's own
prompt), oldest first, in a bounded scrolling stack; the transcript keeps only
receipts, at the time the worker asked. The countdown ticks only for open
cards in a visible pane.

An approval whose Dispatch is no longer running reads as closed ("No longer
open · worker ended"); a hook that hangs up after its worker is gone closes as
worker-ended rather than "answer it in the terminal"; and a click that finds
the prompt or Dispatch already gone turns the card into its receipt at once.

Also carries over: a stop owes a closing line only to an approval whose
escalation went out.

* fix(native-chat): no toast when a worker approval answer lands; the card's receipt says it

* fix(native-chat): a worker approval card answers on click, as the chat's own prompt does

The card turns into 'Allowed by you' at once and Claude's confirmation runs behind it; only an answer
Claude did not take changes it to the real outcome, and a failure reopens the card.

* fix(orchestration): keep main's stop-report index for the open-approval sweep after the re-land

* fix(orchestration): final-review fixes for chat worker approvals

- A click that gets approval_not_open no longer hides the card: the host's list decides, so a
  prompt the host still holds stays answerable. Only dispatch_inactive closes it locally.
- The approvals stream watches only the orchestration database's own changes (Runs, Dispatches,
  mail), not terminal identity notices, so agent status and title changes cost it nothing in main.
- Receipts are the chat's history: no 30-minute window, bounded by 100 rows with still-open
  prompts kept first.
- The pinned stack is capped against the pane and gives way first, so the chat's own prompt keeps
  its room; a prompt that closes while shown stays pinned as its receipt for 4 s, and one only the
  worker's terminal can answer stays pinned.
- A close no one named, after the worker's Dispatch ended, reads as worker-ended, and an
  unanswered close of an ended worker sends the coordinator no second notice.
- The transcript's receipts keep one array until a receipt changes.

* refactor(native-chat): a worker approval card waits on the host after a click instead of answering ahead of it

Both buttons turn off and the clicked one shows a spinner until the answer returns; the host's list
then turns the card into its receipt. Drops the client-side close and its reconciliation.

* fix(native-chat): let the compiler memoize the worker approval answer handler

(cherry picked from commit b8950a4)
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