Skip to content

fix: route native chat orchestration by agent session identity - #19648

Closed
brennanb2025 wants to merge 26 commits into
mainfrom
brennanb2025/fix-native-chat-orchestration
Closed

brennanb2025 wants to merge 26 commits into
mainfrom
brennanb2025/fix-native-chat-orchestration

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​94 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​93
Prod 42 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​505 $\color{#cf222e}{\Huge{\mathbf{−}}}$​140 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​365

Summary

Native chat orchestration now uses durable agent-session identity alongside the existing terminal compatibility path. Native coordinators can create, bind, and inspect Runs without fabricating a PTY projection, and task, gate, dispatch, and message scope can resolve through the authenticated session lease.

Changes

  • Persist nullable coordinator and assignee agent-session IDs with schema migration support.
  • Validate native session identity against the durable runtime lease and fence.
  • Route Run scope and mailbox ownership by session ID while preserving legacy terminal/pane fields.
  • Propagate session identity and runtime fence from CLI environments.
  • Keep terminal handles as compatibility and delivery projections.

Validation

  • pnpm tc:node
  • ORCA_BACKGROUND_LAUNCH=1 env -u ORCA_STRUCTURED_SESSION pnpm test src/cli/handlers/orchestration src/main/runtime/rpc/methods/orchestration --run — 913 passed.
  • Electron main/preload build succeeded with the background launch wrapper. CDP target discovery was unresponsive, so visible Electron proof remains unverified.

Merge Sim added 26 commits September 8, 2026 14:42
@coderabbitai

coderabbitai Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

📝 Walkthrough

Walkthrough

The change adds durable agent session identity and runtime fence support to orchestration CLI handlers and RPC schemas. Native sessions can create, use, and query runs without terminal handles. Run and dispatch database records store session identifiers through schema version 41 migrations. Run-scope resolution validates session authority and runtime fences before selecting the current run. Structured worker environments propagate session credentials. Legacy terminal-handle behavior remains available when no agent session is supplied.

Priority: ➖ Normal

Merge Risk: 🟠 High · up to 2ab24

Native orchestration can fail to start workers, route an explicit terminal request to the wrong run, create unbound runs, or reject valid session workflows. These paths should be corrected before merge.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the main changes and lists validation results, but it omits several required template sections. It has no linked issue, explicit visual-proof statement, testing checklist, AI … Add all required template sections. Include a valid issue reference under Linked Issue, state N/A with a reason or attach visual proof, document manual testing and platforms, complete the AI Disclosure and Agent skill upstream boundary sect…
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. Analyzed 32 functions across 44 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: routing native chat orchestration by durable agent-session identity while preserving the compatibility path.
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: Description check

Explanation

The description explains the main changes and lists validation results, but it omits several required template sections. It has no linked issue, explicit visual-proof statement, testing checklist, AI disclosure, review section, boundary confirmation, notes, or completion checklist.

Resolution

Add all required template sections. Include a valid issue reference under Linked Issue, state N/A with a reason or attach visual proof, document manual testing and platforms, complete the AI Disclosure and Agent skill upstream boundary sections, add security and compatibility notes, and complete the Review and Checklist sections.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

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.

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


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: a28b1f07-ba76-4a2e-a09c-f9c8ee65da72

📥 Commits

Reviewing files that changed from the base of the PR and between 12f2c6b and 429011f.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (24)
  • src/cli/handlers/orchestration/gate-handlers.ts
  • src/cli/handlers/orchestration/message-send-handler.ts
  • src/cli/handlers/orchestration/run-handlers.ts
  • src/cli/handlers/orchestration/task-handlers.ts
  • src/cli/handlers/orchestration/terminal-identity.ts
  • src/main/runtime/orchestration/db/contract-constants.ts
  • src/main/runtime/orchestration/db/dispatch-context/dispatch-context-store.ts
  • src/main/runtime/orchestration/db/dispatch-row-writer.ts
  • src/main/runtime/orchestration/db/row-column-lists.ts
  • src/main/runtime/orchestration/db/runs/run-binding.ts
  • src/main/runtime/orchestration/db/runs/run-create.ts
  • src/main/runtime/orchestration/db/runs/run-lookup.ts
  • src/main/runtime/orchestration/db/schema/create-core-tables-sql.ts
  • src/main/runtime/orchestration/db/schema/create-graph-tables-sql.ts
  • src/main/runtime/orchestration/db/schema/migrate-v2-v12.ts
  • src/main/runtime/orchestration/db/schema/migrate-v41.ts
  • src/main/runtime/orchestration/db/schema/migrate.ts
  • src/main/runtime/orchestration/types.ts
  • src/main/runtime/rpc/methods/orchestration/gates/gates.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/message-methods.ts
  • src/main/runtime/rpc/methods/orchestration/runs/dispatch-methods.ts
  • src/main/runtime/rpc/methods/orchestration/runs/run-scope.ts
  • src/main/runtime/rpc/methods/orchestration/runs/runs.ts
  • src/main/runtime/rpc/methods/orchestration/schemas.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.

objective: getRequiredStringFlag(flags, 'objective'),
from
...(from ? { from } : {}),
...(sessionId ? { agentSessionId: sessionId, runtimeFence: Number(fence) } : {})

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Require a complete session payload before disabling terminal routing.

If ORCA_AGENT_SESSION_ID is set and ORCA_AGENT_SESSION_RUNTIME_FENCE is absent, these branches omit from and send runtimeFence: Number(undefined), which is NaN. This breaks the terminal compatibility path for an incomplete native environment. Build orchestrationSessionPayload() once, and use its agentSessionId to choose session routing.

  • src/cli/handlers/orchestration/run-handlers.ts#L26-L26: derive the native payload from orchestrationSessionPayload() instead of converting an optional fence.
  • src/cli/handlers/orchestration/run-handlers.ts#L40-L40: apply the same complete-payload check for orchestration.runUse.
  • src/cli/handlers/orchestration/run-handlers.ts#L54-L54: apply the same complete-payload check for orchestration.runCurrent.
📍 Affects 1 file
  • src/cli/handlers/orchestration/run-handlers.ts#L26-L26 (this comment)
  • src/cli/handlers/orchestration/run-handlers.ts#L40-L40
  • src/cli/handlers/orchestration/run-handlers.ts#L54-L54

Comment on lines +32 to +34
params.coordinatorHandle ?? null,
params.coordinatorPaneKey ?? null,
params.coordinatorAgentSessionId ?? null

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.

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Reject run creation without a coordinator identity.

When a caller omits all identity fields, Lines 32-34 store a run with no session ID, handle, or pane key. Neither current-run lookup can resolve that run. Require coordinatorAgentSessionId or a complete terminal handle and pane pair before the insert.

Comment on lines +17 to +18
agentSessionId: OptionalString,
runtimeFence: z.number().int().positive().optional(),

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Bind native callers in orchestration.run.

When a caller supplies agentSessionId, this handler ignores both native fields. It creates the run with the fallback handle "coordinator" and does not persist a coordinator session ID. The caller then cannot resolve that run through the session-based scope path.

Validate the lease fence and create the coordinator run with the native session ID, or reject native identity for this method.

Comment on lines +195 to +196
agentSessionId: OptionalString,
runtimeFence: OptionalFiniteNumber,

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Forward native identity for all task operations.

TaskCreateParams, TaskListParams, and TaskUpdateParams now accept these fields, but their handlers pass only callerTerminalHandle to resolveRunScope. A native caller without a terminal handle therefore gets run_required instead of resolving its session-bound run.

Pass callerAgentSessionId: params.agentSessionId and callerRuntimeFence: params.runtimeFence in all three task-handler scope calls.

Also applies to: 207-208, 229-230

@pullfrog pullfrog 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.

Caution

The native coordinator path authorizes full run/task/gate/mailbox scope on a guessable sessionId + runtimeFence credential, dropping the random handle + pane key + launch-token attestation the terminal path (and the documented design) rely on — see the inline comment on run-scope.ts. Independently, the path is functionally incomplete: the env vars that would drive it are never set, and task scope is never actually routed by session identity.

Reviewed changes

Reviewed the full PR: persistent agent-session identity columns (runs, dispatch_contexts) with a v40→v41 migration, the resolveNativeCoordinatorSession authorization/scope path plus getCurrentRunForAgentSession / getRunMailboxOwnerIdsForAgentSession lookups, CLI propagation of agentSessionId / runtimeFence, and RPC schema/param threading through run/gate/message/dispatch.

  • Session-identity schema + migration — adds nullable coordinator_agent_session_id (runs) and assignee_agent_session_id (dispatch_contexts) columns, bumps SCHEMA_VERSION to 41, with a migrate-v41 step and a v2-v12 backfill.
  • Native session authorization + scope — resolveNativeCoordinatorSession validates a session id against the durable lease and its runtimeFence; resolveRunScope and the run methods route by session id when agentSessionId is present.
  • CLI identity propagation — CLI orchestration handlers read ORCA_AGENT_SESSION_ID / ORCA_AGENT_SESSION_RUNTIME_FENCE and substitute them for the terminal handle.
  • RPC surface — agentSessionId / runtimeFence added to run/gate/message/dispatch/task/check/reply params.

⚠️ The session-identity path is unreachable: the env vars are never set

The CLI now reads ORCA_AGENT_SESSION_ID and ORCA_AGENT_SESSION_RUNTIME_FENCE (terminal-identity.ts:53,58), but nothing in the tree ever sets them. structuredWorkerChildIdentityEnv (src/main/runtime/structured-worker-child-identity-env.ts:43-58) — the single place that stamps a structured worker's child environment with orchestration identity, and which both the Codex and Claude launchers call — still exports only ORCA_TERMINAL_HANDLE + ORCA_CLI_COMMAND. A grep for both variable names across the whole repo returns only those two read sites and zero writers. As merged, resolveOrchestrationAgentSessionId() always returns undefined, so the CLI falls through to the terminal-handle path and the new session-identity routing never occurs end-to-end.

Technical details
# Session-identity env propagation is missing

## Affected sites
- src/main/runtime/structured-worker-child-identity-env.ts:43-58 — the child identity env builder; sets ORCA_TERMINAL_HANDLE + ORCA_CLI_COMMAND only.
- src/main/codex/codex-structured-child-environment.ts:13 — calls structuredWorkerChildIdentityEnv.
- src/main/claude/claude-structured-launch-resolution.ts:243 — calls structuredWorkerChildIdentityEnv.
- src/cli/handlers/orchestration/terminal-identity.ts:52-69 — the new readers (ORCA_AGENT_SESSION_ID / ORCA_AGENT_SESSION_RUNTIME_FENCE).

## Required outcome
- The structured worker child environment (or the CLI launch path) must actually export ORCA_AGENT_SESSION_ID and ORCA_AGENT_SESSION_RUNTIME_FENCE for a dispatched native session, so the CLI can take the session path. Otherwise this PR is server-side plumbing with no production caller.

## Open questions for the human
- Is the env propagation intentionally split into a follow-up PR, or was it simply omitted?

ℹ️ Nitpicks

  • RunRow.coordinator_agent_session_id?: string | null is optional while the sibling coordinator_handle: string | null is required; the column now exists on every fresh and migrated DB, so it should be non-optional (string | null).
  • coordinator_runs.coordinator_agent_session_id is added in create-graph-tables-sql.ts:209 but (a) is never migrated for existing DBs and (b) is never read or written anywhere — a dead column with an inconsistent migration story.
  • run-handlers.ts:26,40,54 use Number(fence) guarded only by sessionId ?; if ORCA_AGENT_SESSION_ID is set without ORCA_AGENT_SESSION_RUNTIME_FENCE, Number(undefined) yields NaN (JSON null) and the zod .positive() rejects with invalid_argument. The other handlers sidestep this via orchestrationSessionPayload(), which returns {} unless both vars are present.
  • orchestrationSessionPayload() is evaluated twice per conditional (gate-handlers.ts:16, task-handlers.ts:116) to test-and-spread the same env read.
  • runtimeFence is typed z.number().int().positive().optional() in runs.ts/gates.ts but OptionalFiniteNumber in schemas.ts — inconsistent (both positive, so not a bug).
  • pnpm-lock.yaml adds an @pnpm/exe@12.0.0 packageManagerDependencies entry that looks unrelated to this feature; confirm it's intentional.
  • run-current still prints "No Run is bound to this terminal." for a native session.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

const authority = identity
? resolveStructuredWorkerAuthority(identity.handle, runtime.getOrchestrationDb())
: null
if (!authority || authority.record.lease.runtimeFence !== runtimeFence) {

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.

Authorizing the native coordinator path on sessionId + runtimeFence replaces the random structworker_ handle + random pane key + launch token that the terminal path (and the documented design) require, with two low-entropy, non-secret values: sessionId is plaintext in tab ids and runtimeFence is a small monotonic counter starting at 1. Unlike the terminal branch (run-scope.ts:135), this path never calls assertCallerHandleMatchesEvidence, so any same-user sibling process that reaches the orchestration socket can act as a session's coordinator — run takeover/redirect, mailbox consume, and gate/dispatch actions — by supplying the session id and guessing the fence.

run: getOptionalStringFlag(flags, 'run'),
callerTerminalHandle
callerTerminalHandle,
...session

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.

task-create (and task-list at :70, task-update at :116-118) propagate agentSessionId/runtimeFence, but the RPC handlers orchestration.taskCreate/taskList/taskUpdate (message-methods.ts:152,191,225) still pass only callerTerminalHandle into resolveRunScope and ignore agentSessionId. For a native session callerTerminalHandle is undefined, so these calls fall through to run_required — task scope never resolves through the session lease, contradicting the PR summary's claim that task scope routes by session identity.

@pullfrog pullfrog 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.

Important

Delta 429011f..2ab2405 closes the env-propagation gap and hardens the lease check, but it does not resolve the authorization concern: resolveNativeCoordinatorSession now reads the durable record directly and no longer requires the random structworker_ handle, so the coordinator credential is still just sessionId (public, in tab ids) + runtimeFence (a counter starting at 1). See inline.

Reviewed changes (delta since 429011f)

  • Env propagation added — structuredWorkerChildIdentityEnv now stamps ORCA_AGENT_SESSION_ID / ORCA_AGENT_SESSION_RUNTIME_FENCE and strips inherited credentials; Codex/Claude launchers thread the fence through; WSL and TUI-launch env passthrough included (wsl-orca-env.ts, orca-runtime-get-agent-session-execution-namespace.ts). This resolves the prior "env vars never set" finding.
  • Session authority rewritten — resolveNativeCoordinatorSession reads the durable record directly and adds claimStatus === 'live', !unreconciled, handoffStage === null guards, dropping the registry/random-handle lookup.
  • Check + worker-start routed by session — orchestration.check/checkRunMailbox and worker-start now resolve Run scope via agentSessionId, with resolveWorkerStartCallerHandle.
  • Worker-start schema — from becomes optional (.superRefine requires from || agentSessionId).

⚠️ Task scope remains unrouted by session identity

The new commits route check/worker-start/dispatch/send/gate/run by session, but orchestration.taskCreate/taskList/taskUpdate (message-methods.ts) are still unchanged: they pass only callerTerminalHandle into resolveRunScope and ignore agentSessionId. For a native session the CLI sends callerTerminalHandle = undefined + agentSessionId, so these calls still fall through to run_required. This is unchanged from the prior review and now stands out as the one gap in an otherwise-consistent session routing surface.

ℹ️ Nitpicks

  • resolveNativeCoordinatorSession returns { worktreeId: record.location.workspaceId } — a folder workspaceId, not necessarily a git worktree id — and no caller uses the return value.
  • resolveWorkerStartCallerHandle returns '' for an ordinary native coordinator with no registry identity; resolveDispatchCreator('') degrades to { kind: 'system' } (acceptable), but taskCreatedByTerminalHandle/coordinatorHandle are then written as the empty string.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

sessionId: string,
runtimeFence: number
): { sessionId: string; worktreeId: string } {
const record = readStructuredAgentSessionRecord(sessionId)

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.

Rewriting this to read the durable record directly removes the last possession requirement. Previously reaching authority required a registered structworker_ handle (a random secret); now a caller needs only sessionId (plaintext, embedded in tab ids via structuredAgentSessionTabId) plus runtimeFence (a monotonic counter minted from 1). The added claimStatus === 'live' / !unreconciled / handoffStage === null guards strengthen liveness, not authorization: no caller attestation, launch token, or pane key is checked, so any same-user sibling process that reaches the orchestration socket can act as this session's coordinator by supplying the id and brute-forcing the fence.

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

Caution

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

⚠️ Outside diff range comments (2)
src/main/runtime/rpc/methods/orchestration/gates/gates.ts (1)

17-18: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Bind native session authority during orchestration.run creation. When agentSessionId is present, validate its runtimeFence with resolveNativeCoordinatorSession and persist the session binding through createCoordinatorRun. The current handler passes only spec, coordinatorHandle, and pollIntervalMs, so a native request can create an unbound run without lease-fence validation.

src/cli/handlers/orchestration/run-handlers.ts (1)

10-56: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Use orchestrationSessionPayload() for all three run handlers.

When only ORCA_AGENT_SESSION_ID is set, run-create, run-use, and run-current omit terminal fallback and send runtimeFence: NaN. The RPC schemas require a positive integer, so all three calls are rejected. Branch on session.agentSessionId and spread the all-or-nothing session payload instead.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 92925fc6-a34a-45f0-9040-bedfa63ac765

📥 Commits

Reviewing files that changed from the base of the PR and between 429011f and 2ab2405.

📒 Files selected for processing (21)
  • src/cli/handlers/orchestration/dispatch-handlers.ts
  • src/cli/handlers/orchestration/message-check-handler.ts
  • src/cli/handlers/orchestration/question-handler.ts
  • src/cli/handlers/orchestration/worker-launch-handler.ts
  • src/main/claude/claude-structured-launch-resolution.ts
  • src/main/codex/codex-structured-child-environment.test.ts
  • src/main/codex/codex-structured-child-environment.ts
  • src/main/codex/codex-structured-session-acquire.ts
  • src/main/pty/wsl-orca-env.ts
  • src/main/runtime/orca-runtime-get-agent-session-execution-namespace.ts
  • src/main/runtime/orca-runtime-structured-agent-session-launch-tui.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/check-methods.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/check-run.ts
  • src/main/runtime/rpc/methods/orchestration/runs/dispatch-creator.ts
  • src/main/runtime/rpc/methods/orchestration/runs/native-session-authority.test.ts
  • src/main/runtime/rpc/methods/orchestration/runs/run-scope.ts
  • src/main/runtime/rpc/methods/orchestration/worker/local-worker-start.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-start-schema.ts
  • src/main/runtime/rpc/methods/orchestration/worker/workers.ts
  • src/main/runtime/structured-worker-child-identity-env.test.ts
  • src/main/runtime/structured-worker-child-identity-env.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.

Comment on lines +70 to +72
...(Object.keys(sessionPayload).length > 0
? sessionPayload
: { from: await resolveCoordinatorTerminalHandle(flags, cwd, client) }),

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.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Honor an explicit --from terminal handle.

When orchestrationSessionPayload() returns a non-empty payload, this branch ignores --from and sends only agentSessionId and runtimeFence. The worker then starts through the native session instead of the terminal selected by the caller. This breaks the legacy compatibility override and can select the wrong run or worker owner.

Create the session payload only when flags.has('from') is false, as the dispatch and question handlers already do.

Proposed fix
-    const sessionPayload = orchestrationSessionPayload()
+    const sessionPayload = flags.has('from') ? {} : orchestrationSessionPayload()

Comment on lines +34 to +37
const identity = params.agentSessionId
? structuredWorkerIdentities.getBySessionId(params.agentSessionId)
: undefined
return identity?.handle ?? params.from ?? ''

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.

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Resolve the native caller worktree without a terminal handle.

A valid native folder session can have no worker identity or PTY. Line 37 then returns '' when from is absent. Line 60 passes that value to resolveDispatchCallerWorktreeId, which falls through to runtime.showTerminal(''). Worker startup fails before it can create the dispatch.

  • src/main/runtime/rpc/methods/orchestration/runs/dispatch-creator.ts#L34-L37: Do not represent an unresolved native session as an empty terminal handle. Return native workspace authority separately.
  • src/main/runtime/rpc/methods/orchestration/worker/local-worker-start.ts#L52-L60: Use the validated native session workspace ID for native callers. Only use resolveDispatchCallerWorktreeId for terminal-backed callers.
📍 Affects 2 files
  • src/main/runtime/rpc/methods/orchestration/runs/dispatch-creator.ts#L34-L37 (this comment)
  • src/main/runtime/rpc/methods/orchestration/worker/local-worker-start.ts#L52-L60

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Superseded by #22568, stacked on #22555 and #22522 as part of a fresh orchestration stack for structured-session coordinators.

This PR held the only CLI conversion, so its intent carried forward. The design changed underneath it:

#22568 keeps this PR's check pane-key suppression, its send lifecycle guard, and the flagless ask resume. Closing in favour of #22568.

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