Skip to content

refactor(runtime): split OrcaRuntimeService and compatibility tests - #17605

Merged
nwparker merged 23 commits into
stablyai:mainfrom
nwparker:nwparker/orca-runtime-refactor
Sep 1, 2026
Merged

nwparker merged 23 commits into
stablyai:mainfrom
nwparker:nwparker/orca-runtime-refactor

Conversation

@nwparker

@nwparker nwparker commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Replace the 43k-line OrcaRuntimeService implementation with focused, domain-named runtime modules and a small composition/export entrypoint.
  • Split the 52k-line compatibility suite into ordered domain fragments, with dedicated mock setup, fixtures, scenario builders, and nested runtime test folders.
  • Keep existing runtime/browser/file import surfaces and public exports stable while removing the retired max-lines baseline entries.
  • Add extraction regression and module-size guards so the files stay below the configured budget.
  • Preserve cancellation barriers, hook-environment cleanup, admission/reconciliation behavior, and structured-session owner/visibility behavior during extraction.

Validation

  • pnpm test src/main/runtime/orca-runtime.test.ts — 1,216 passed, 1 skipped.
  • Focused post-extraction compatibility suite — 10 files, 100 tests passed.
  • pnpm tc:node — passed.
  • pnpm check:max-lines-ratchet — passed; 44 grandfathered suppressions, no new bypasses.
  • pnpm run check:code-quality:changed — passed; 0 new findings across 494 changed files.
  • Targeted oxlint, oxfmt --check, and git diff --check — passed.
  • The feature branch includes the current main merge and is mergeable.

Unrelated pre-existing worktree edits were intentionally left unstaged and are not part of this PR.

@greptile-apps

greptile-apps Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

Too many files changed for review (499 files, 100 file limit).

Bypass the limit by tagging @greptile-apps to review.

@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

The split is mostly faithful, but two things need attention before merge: 172 implementation files now carry @ts-nocheck with a safety-net claim that does not hold up, and the refactor silently dropped three public members plus one characterization test despite the PR's stated "public exports stable" goal.

Reviewed changes

  • Runtime service decomposition — the 43,928-line OrcaRuntimeService monolith becomes a 58-line composition entrypoint over ~132 chained OrcaRuntimeWith* extends classes (each ≤400 lines), with orca-runtime-core.ts / orca-runtime-state-fields.ts / orca-runtime-postlude.ts holding shared types, constants, and constructor wiring.
  • Browser/file adapter splits — orca-runtime-browser.ts becomes the runtime-browser-commands-* chain and orca-runtime-files.ts becomes runtime-file-commands-*, keeping the RuntimeBrowserCommands / command-surface entrypoints.
  • Compatibility suite split — the 52k-line test file becomes an ordered top-level await import(...) aggregator (orca-runtime.test.ts) over orca-runtime-tests/*.spec.ts fragments with dedicated mock, fixture, lifecycle, and scenario-builder setup.
  • Guards and baselines — new orca-runtime-module-size.test.ts (400-line ratchet) and runtime-extraction-regressions.test.ts; four retired entries removed from config/max-lines-baseline.txt.

⚠️ 172 implementation files are now type-unchecked, and the claimed AST-equivalence guard does not exist

The original orca-runtime.ts had zero @ts-nocheck directives — it was fully covered by pnpm tc:node. After the split, 172 of the 529 non-test files in src/main/runtime/ begin with // @ts-nocheck -- mechanically split from OrcaRuntimeService; behavior is covered by AST equivalence and characterization tests. That claim is not substantiated: there is no AST or structural equivalence test anywhere in the repo, and the only new guard, runtime-extraction-regressions.test.ts, contains three tests (skill-discovery wiring, getOrchestrationDbIfAvailable returning null, and the session-inventory capability gate) — none of which compare split output against the original. pnpm tc:node now passing says nothing about the split implementation.

Technical details
# title: restore type checking (or a real equivalence guard) for the split modules

## Affected sites
- `src/main/runtime/orca-runtime-core.ts:1` — representative `@ts-nocheck` header repeated across 172 non-test files
- `src/main/runtime/runtime-extraction-regressions.test.ts` — the only new "extraction" guard; 3 tests, no AST comparison
- `src/main/runtime/orca-runtime-module-size.test.ts` — counts lines only, no behavioral/structural check

## Required outcome
- Either remove `@ts-nocheck` from the split modules and make them type-check under `pnpm tc:node`, or
- Add the claimed AST/structural equivalence test that compares each split module against the original 43k-line file, and
- In both cases correct the header comment so it does not reference a non-existent guard.

## Why it matters
- A typo'd method reference, a renamed symbol, or a broken `this` access anywhere in the ~132-class `extends` chain now surfaces only at runtime (if at all), because nothing in CI type-checks these files.
- The 1,215-test characterization suite exercises behavior and passes, but it is not an equivalence check and cannot catch type-level drift.

## Open questions for the human
- Is the `@ts-nocheck` blanket temporary (follow-up PR to re-enable types) or intended to be permanent?

⚠️ Three public members of OrcaRuntimeService were silently dropped, and one characterization test vanished

Comparing the split against the original file shows the refactor was not a pure 1:1 transform. Three public members of OrcaRuntimeService were removed without any callout in the PR body, and the characterization suite lost exactly one test.

Technical details
# title: restore or explicitly retire the dropped public surface

## Affected sites (original locations)
- `orca-runtime.ts:40846` — `jiraSearchUsers(query?, siteId?)` removed; no replacement in `runtime-jira-commands.ts`, and the `searchUsers as searchJiraUsers` import was also dropped
- `orca-runtime.ts:41284` — `browserOpenUrlOnClient` bound field removed, along with the underlying `RuntimeBrowserCommands.browserOpenUrlOnClient` (old `orca-runtime-browser.ts:1732`); the new browser chain has no `browserOpenUrl*` method
- `orca-runtime.ts:6629` — `shouldRelayTerminalBrowserOpens()` removed; its characterization test `relays terminal browser launches only while headless owns the graph` (old `orca-runtime.test.ts:3138`) was dropped, not relocated

## Evidence
- Original suite: 1134 `it(` blocks; new fragments: 1133. A name-by-name diff shows the single dropped test is the `shouldRelayTerminalBrowserOpens` one.
- Repo-wide search shows none of the three members have live callers (no RPC registration, renderer, CLI, or shared reference), so this is likely dead public surface rather than an active break.

## Required outcome
- Restore the three members (and the test), or
- If intentional, document the removals in the PR description — "public exports stable" currently reads as false.

## Open questions for the human
- Were these intentionally pruned as dead surface, or lost during the split?

ℹ️ Nitpicks

  • orca-runtime-module-size.test.ts:14-17 — the guard's own message says "every split implementation module," but the filter only matches orca-runtime.ts, orca-runtime-*, runtime-browser-commands-*, and runtime-file-commands-*; the runtime-* families this PR also introduces (runtime-linear-*, runtime-worktree-*, runtime-terminal-*, runtime-github-*, runtime-gitlab-*, runtime-repository-*) are unguarded. No file currently exceeds 400 lines, so this is latent, but broadening the filter would make the guard honest.

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

@nwparker
nwparker force-pushed the nwparker/orca-runtime-refactor branch from 6f3dfbc to 8e327dd Compare August 31, 2026 05:35

@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

This delta restores the three public members the prior review flagged as dropped (jiraSearchUsers, browserOpenUrlOnClient, shouldRelayTerminalBrowserOpens) and ports the remaining compatibility fixes; I verified every restored member and fix byte-for-byte equivalent to origin/main. I'm not approving yet because the prior review's type-checking concern is still open: 172 implementation files still carry @ts-nocheck, and no AST/structural equivalence guard exists to back the header comment's claim.

Reviewed changes

  • Restored dropped public members — jiraSearchUsers, browserOpenUrlOnClient, and shouldRelayTerminalBrowserOpens are back, re-registered over RPC as jira.searchUsers and browser.openUrl, with the shouldRelayTerminalBrowserOpens characterization test re-added in window-authority.spec.ts.
  • Admission-tier threading — getHostedReviewExecutionOptions now carries a GitAdmissionTier through hosted-review branch lookup ('background'), create/eligibility ('interactive'), refresh (admissionTierForRefreshReason), and cloneRepo.
  • Structured-session visibility persistence — publishStructuredAgentSessionTab / closeStructuredAgentSessionTab now drive setSessionTabVisibility, and startup restoration prefers getPersistedVisibleSessionTabIndex when present.
  • Owner-record fidelity — the two resolvePaneAgentOwner call sites now use resolvePaneAgentOwnerRecord and thread ownerIsLaunch into normalizeCompatibleAgentTitleForOwner / resolveCompatibleAgentTypeForOwner.
  • Strict worktree reconciliation — worktree-create verification now uses listWorktreesSharedStrict + resolveCreatedWorktree (with describeCreatedWorktree fallback) instead of the lenient listWorktrees + findCreatedWorktree.
  • Skill-share cancellation barrier — a post-preparation if (signal?.aborted) check restores the pre-publish cancellation barrier, covered by a new test.
  • Hook transport env cleanup — ORCA_AGENT_HOOK_TRANSPORT rejoins the agent-hook env list and its stale-value removal test.

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

…-refactor

# Conflicts:
#	src/main/runtime/orca-runtime-files.ts
…nfirmed contract

Audit follow-ups for the OrcaRuntimeService split:

- Freeze the 171 @ts-nocheck files behind a ratchet so no new file can disable
  type checking. The split's linear mixin chain cannot express forward
  references yet, so the existing suppressions are grandfathered; the baseline
  may only shrink.
- Drop the stray @ts-nocheck at the end of orca-runtime-get-status.ts. It sat
  after the first statement, where TypeScript ignores it, so the module was
  already checked.
- Restore `retireRejectedPty(ptyId, stopConfirmed: boolean)` as a required
  argument. The split widened it to optional and patched the resulting error
  with `stopConfirmed === true`; an omitted argument would have silently taken
  the unverified-stop path instead of failing to compile.
- Guard that every orca-runtime-tests fragment is imported by the compatibility
  entrypoint. The fragments are .spec.ts, which no Vitest include glob matches,
  so one left out of the list would silently stop running.
…-refactor

main hoisted the runtime-local `runtimeWorktreeIdsEqual` into a shared
`worktreeIdsEqual` (stablyai#17428) inside the file this branch split apart. Kept the
split and ported the change into the module that now owns that code:
runtime-worktree-path-identity.ts delegates to the shared implementation
instead of keeping its own copy, so the duplicate the upstream commit was
removing does not survive the merge. All 51 call sites keep their import.

@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

The delta's headline mitigation — freezing the grandfathered @ts-nocheck set behind a ratchet — is wired into lint but never executes in desktop PR CI, so the guard currently enforces nothing.

Reviewed changes

  • @ts-nocheck ratchet — new check-ts-nocheck-ratchet script (plus a 171-entry baseline and unit tests) freezes the grandfathered set so any new file carrying the directive fails; the ratchet is appended to the lint aggregate.
  • Stray directive removal — orca-runtime-get-status.ts drops its trailing // @ts-nocheck, which sat after the first statement where TypeScript ignores it (verified: tsc still reports errors past that point).
  • Stop-confirmed contract restore — retireRejectedPty(ptyId, stopConfirmed: boolean) is required again and passes the boolean through directly, reverting the split's optional widening plus === true patch.
  • Fragment coverage guard — orca-runtime-test-fragment-coverage.test.ts asserts every orca-runtime-tests/*.spec.ts fragment is imported exactly once from the compatibility entrypoint.
  • Worktree identity consolidation — the split now re-exports the shared worktreeIdsEqual (from the origin/main merge) as runtimeWorktreeIdsEqual; I verified the shared implementation is byte-identical to the removed local function.

⚠️ The @ts-nocheck ratchet never runs in desktop PR CI

The ratchet is this delta's core response to the still-open type-checking concern, but it is only appended to the lint aggregate script. Desktop PR CI's static_analysis job does not invoke pnpm lint — it runs discrete steps, and its two sibling ratchets (check:max-lines-ratchet, check:runtime-electron-ratchet) each get their own step while check:ts-nocheck-ratchet does not. The only workflows that run pnpm lint are mobile.yml (mobile workspace) and docs.yml (docs workspace). A new @ts-nocheck file would therefore pass every desktop PR check today. And even once wired, note the ratchet only freezes the set — it does not restore type checking for the 171 grandfathered modules or substantiate the per-file AST equivalence header claim, so the prior merge-blocker stands regardless.

Technical details
# Title: run the ts-nocheck ratchet in desktop PR CI

## Affected sites
- `package.json:14` — `check:ts-nocheck-ratchet` added to the `lint` aggregate, which PR CI never invokes
- `.github/workflows/pr.yml` `static_analysis` — has steps for `check:max-lines-ratchet` and `check:runtime-electron-ratchet` but no `check:ts-nocheck-ratchet` step

## Required outcome
- Add an explicit `pnpm run check:ts-nocheck-ratchet` step to the `static_analysis` job in `.github/workflows/pr.yml`, mirroring the two sibling ratchet steps, so the gate actually runs on every desktop PR.

## Why it matters
- The freeze is the intended enforcement layer for the type-unchecked split; unwired, it provides false assurance and the PR's validation section overstates what CI will catch.

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

…pped

Audit findings against the refactor's true base (ad5ba25):

- retirePtyAgentLaunchAuthority collected pane keys after deleting the
  restored-authority receipt instead of before it. collectPaneKeysForPty reads
  that receipt, so a receipt-only pane lost its key and never had its agent-hook
  compatibility authority retired. on-pty-exit.ts already carried a comment
  naming this exact invariant.
- The PTY-exit path kept orchestrationMailboxNotifications.retirePty but lost
  the loop that schedules a debounced mail-pointer repoint for the dead pty's
  terminal handle and any run bound to its panes. Restores the schedule call
  count to 7, matching base.
- subscribeToPtyExit lost isPtyKnownExited's leaf fallback and its
  post-registration lifecycle-generation recheck. leavesByPtyId is rebuilt from
  the renderer graph independently of ptysById, so a leaf can outlive its pty
  record; without the fallback a caller waiting on an already-dead pty never
  gets released.
- The chain root declared `[key: string]: unknown`, which base had nowhere. It
  leaked through the exported runtime type into every consumer, so any misspelled
  member access typechecked as unknown instead of erroring, and it accounted for
  957 of the suppressed errors. Removing it costs zero type errors.
…ation

Two more behaviors the split dropped, each with a regression test that fails
against the pre-fix code:

- The worker-exit escalation stopped deriving its title through
  buildOrchestrationTaskDisplayMetadata and inlined `task.spec` instead. That
  ignored an explicit task_title, dropped the single-line normalization and the
  80-character bound, and turned the no-spec case into a quoted, duplicated id.
  A multi-paragraph spec landed verbatim in the coordinator's banner. The
  existing 11 tests all use short single-line specs, where the derived title and
  the raw spec are identical, so none of them could see it.
  Also reverts an added `if (!handle) return` guard: the dispatch lookup is
  deliberately keyed on the pane as well, because a reminted handle no longer
  matches the row while the pane identity outlives the remint.
- updateAutomation stopped going through automationChangePublications and
  published `source` unconditionally while gating the fallback on a non-null
  destination. A destination the store can no longer name then published only
  the stale source, so subscribers scoped elsewhere kept rendering a row that
  had left them — the exact case the helper documents. The helper had been left
  with zero callers; all three sites use it again.
…sh hosts

Follow-ups from auditing the skill install path against the refactor's base:

- resolveWorktree wrapped showManagedWorktree in `.catch(() => null)`, so a
  transient git or IO failure surfaced to the user as
  skill-install-workspace-not-found with the real cause discarded. Errors
  propagate again; a genuine id mismatch still returns null.
- resolveSkillSshTarget threw skill-install-workspace-host-unavailable when the
  execution host was neither local nor ssh, on both the repo and folder
  branches. Base gated these on connectionId, so a runtime-owned repo simply
  was not an SSH install and fell through to the local path. Both return null
  again, and the error code the split invented is now unreferenced.
- listManagedSkillInstalls awaited the receipt walk and the worktree resolve in
  sequence. They are independent and either can hit disk, WSL, or an SSH scan,
  so Promise.all is restored.

Deliberately unchanged: resolving the worktree through listResolvedWorktrees
rather than showManagedWorktree, which disambiguates a worktree id colliding
across hosts and is covered by its own test, and the SSH-folder
skill-install-ssh-dispatch-required throw, which matches the repo branch.
…-refactor

main advanced 45 commits, six of them landing inside the orca-runtime.ts this
branch splits apart. Git resolves that as a plain "take one side", and either
side silently loses work, so each was ported into the module that now owns the
code:

- stablyai#17655 bound ref and worktree scans -> runtime-repository-ref-queries
- stablyai#17448 preserve user-set workspace names -> the worktree-create modules
- stablyai#17667 cut cold worktree-switch attach latency -> the mutation lock, including
  the deletion half (worktree-terminal-mutation-wait.ts is gone)
- stablyai#17718 preserve large agent prompt pastes -> the agent-prompt write path
- stablyai#17486 unblock targeted SSH session tab refresh -> the mobile refresh modules
- stablyai#17159 close readiness gaps -> 34 runtime hunks and 5 test hunks

Every added line of the six was checked against the merged tree; the unmatched
ones are all renames or line splits, verified individually.

Two defects surfaced while porting, both predating this merge:

- isMobileSessionSurfaceMembershipAllowed read a session accessor that answers
  null where main's answers undefined, so main's `session !== undefined` guard
  was always true and the fence stopped fencing. Three clauses found in neither
  main nor the split base had been added ahead of it to compensate, and one of
  them dropped a freshly published split leaf out of syncWindowGraph. Restored
  to main's control flow with the sentinel normalized; stablyai#17159's two new tests
  cover it from both directions.
- retiredMobileSessionPtyIds was write-only state this branch invented. Its only
  reader was the clause above, and it exists in neither main nor the split base.
- RuntimeTerminalWriter.writeAgentPrompt had no callers and still carried the
  chunked-paste shape stablyai#17718 replaced.
@nwparker

nwparker commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Pre-merge audit

Audited as a claimed pure refactor. It is not one — the extraction renames methods into service classes and, in two places, changes behavior deliberately. Nine behavior regressions were found and fixed on the branch; every one was green in CI beforehand.

Fixed

# Regression Found by
1 retirePtyAgentLaunchAuthority collected pane keys after deleting the receipt they come from — the repo's own comment in on-pty-exit.ts names this invariant method-body byte diff
2 PTY-exit dropped the leaf/run mailPointerRepointScheduler loop (schedule sites 7 → 5) call-site counting
3 [key: string]: unknown on the chain root leaked through the exported type, so any misspelled member access on the runtime typechecked as unknown in every consumer stripping @ts-nocheck
4 subscribeToPtyExit lost isPtyKnownExited's leaf fallback and its post-registration race guard symbol-disappearance sweep
5 Worker-exit escalation inlined task.spec: ignored task_title, dropped single-line normalization and the 80-char bound, duplicated the id when spec was absent method-body byte diff
6 updateAutomation published only the stale source when the destination was unnameable, never the unscoped fallback automationChangePublications documents; that helper had dropped to zero callers orphaned-helper detection
7 .catch(() => null) reported transient git/IO failures as skill-install-workspace-not-found —
8 A non-ssh execution host hard-errored (skill-install-workspace-host-unavailable, an error code this PR invented) where the base fell through to local —
9 isMobileSessionSurfaceMembershipAllowed read an accessor returning null where main's returns undefined, so session !== undefined was permanently true and the fence stopped fencing; three clauses in neither main nor the split base had been added to compensate, one of which dropped freshly published split leaves out of syncWindowGraph a test main landed mid-merge

#9 shipped with the original split and survived 1,176 tests plus a full green CI. It surfaced only because upstream landed a test that happened to walk into it.

Also removed: retiredMobileSessionPtyIds (write-only state this branch invented, sole reader was #9's deleted clause) and RuntimeTerminalWriter.writeAgentPrompt (no callers, still carried the chunked-paste shape #17718 replaced).

Three regression tests added, each verified to fail against the pre-fix code.

Guards added

  • config/ts-nocheck-baseline.txt + check:ts-nocheck-ratchet — this PR introduces 171 @ts-nocheck files where the repo had zero, hiding ~1,259 type errors. They are structurally required by the linear mixin chain (a link calls members defined further down), so the set is frozen rather than removed: no new file can disable type checking, and removing one forces the baseline to shrink. Restoring chain typing is worth a follow-up.
  • orca-runtime-test-fragment-coverage.test.ts — the 98 test fragments are .spec.ts, which no Vitest include glob matches; they run only because the entrypoint imports them. One dropped from that list would silently never run.

Merge

main advanced 45 commits during review, six of them landing inside the orca-runtime.ts this PR deletes. Git resolves that as a plain "take one side" and either side loses work silently, so each was ported into the module that now owns the code — including #17667's deletion half, where applying only the additions would have kept the slow path the commit exists to remove.

Not addressed — needs a feature review, not refactor sign-off

  1. orca-runtime-deliver-pending-messages.ts — ~180 lines of net-new mailbox retry/parking/probe logic with no counterpart at the refactor's base (ad5ba2572e9e). Every split file carries a header asserting "behavior is covered by AST equivalence"; for this one there is no prior AST.
  2. Skill SSH-target resolution was generalized to the ExecutionHostId model. The worktree resolver now filters the scan-derived listResolvedWorktrees() instead of the authoritative showManagedWorktree, so a cold or timed-out SSH scan yields skill-install-workspace-not-found for a workspace that exists — loss of contact read as absence, which docs/reference/ssh-execution-boundary.md forbids. Left in place because it is intentional and covered by its own test for cross-host id collisions.

The stablyai#17448 port added a third import from ../ipc/worktree-logic, which the
code-quality oxlint config rejects under --deny-warnings. Plain oxlint does not
flag it, so it only surfaced in CI's static analysis job.
pr-workflow-lint-parity requires every leaf command in `pnpm lint` to have a
matching step in pr.yml. The ratchet was wired into lint but not the workflow,
so PR CI would not have enforced it.
…launch evaluate

main advanced 9 commits; none touch the orca-runtime.ts this branch splits, so
nothing needed porting.

CI failed twice on `Execution context was destroyed` thrown from
headless-paired-runtime-host's first `evaluate` after launch — a different spec
each run, which is the signature of the flake stablyai#17780 describes rather than a
regression. That commit added retryTransientMainEvaluate and adopted it in five
helpers but not this call site, even though its docblock names exactly this
case: the first evaluate after electron.launch() resolves, before the app is
ready. Wrapped it the same way.

@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

No new issues in this delta — the three restoration commits and the origin/main merge re-sync all verify byte-for-byte against the base — but the standing merge-blocker is unchanged: 171 implementation files still carry @ts-nocheck, and check:ts-nocheck-ratchet is still absent from desktop PR CI, so the freeze enforces nothing.

Reviewed changes

  • Restored four dropped behaviors — collectPaneKeysForPty is now read before retirePtyAgentLaunchAuthority deletes the restored-authority receipt; the onPtyExit mail-pointer repoint loop is back; subscribeToPtyExit regains isPtyKnownExited's leaf fallback plus its post-registration lifecycle-generation recheck; and the [key: string]: unknown index signature is removed from the chain root.
  • Restored escalation prose and unscoped automation publication — worker-exit escalation titles derive through buildOrchestrationTaskDisplayMetadata, and the three automation mutation sites route through automationChangePublications again.
  • Restored skill-install error propagation — transient lookup errors propagate instead of surfacing as skill-install-workspace-not-found; non-ssh hosts return null instead of hard-erroring; and the receipt walk + worktree resolve run in parallel.
  • Merged origin/main — re-synced the split modules with upstream terminal/PTY/mobile/worktree changes (handle-replacement fencing, durable headless-terminal retirement, PTY-close surface authority, absent-tab adjudication, shared/exclusive worktree mutation lock, atomic agent-prompt paste, repo-search limit clamping, worktree display-name resolution).

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

@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

The ts-nocheck ratchet is now wired into desktop PR CI, closing the prior CI-enforcement gap. The substantive merge-blocker is unchanged, however: 171 implementation files still carry @ts-nocheck with a header that claims "covered by AST equivalence and characterization tests", but no type-checking or structural-equivalence guard backs that claim.

Reviewed changes

  • Wired check:ts-nocheck-ratchet into PR CI — bb7f38bfb7 adds an Enforce ts-nocheck ratchet step to pr.yml static_analysis (between the max-lines and Electron-import ratchet steps), satisfying pr-workflow-lint-parity. The ratchet passes locally (171 grandfathered, no new suppressions), so the freeze is now actually enforced on desktop PRs.
  • Merged duplicate worktree-logic imports — c8332b98e0 collapses a third ../ipc/worktree-logic import in runtime-local-worktree-create-candidate.ts that oxlint --deny-warnings rejected.
  • Merged origin/main — including the paired-host launch evaluate retry and unrelated upstream fixes.

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

@nwparker
nwparker merged commit a5796ec into stablyai:main Sep 1, 2026
59 of 61 checks passed
brennanb2025 pushed a commit that referenced this pull request Sep 1, 2026
main's #17605 split RuntimeFileCommands into a mixin chain and gutted
orca-runtime-files.ts to a re-export barrel, so every guard this branch added
sat in a file that no longer holds the code. Resolved orca-runtime-files.ts to
main's barrel verbatim and ported each guard to the method's new home:

- the mutation funnel (resolveFileExplorerMutationPath/Paths) into
  runtime-file-commands-search-local-runtime-files.ts, beside the read funnel it
  wraps
- the ten mutation methods and their 13 resolveAuthorizedMutablePath sites into
  runtime-file-commands-write-file-explorer-file.ts and
  runtime-file-commands-create-file-explorer-dir-no-clobber.ts, preserving which
  operands pass followsLink
- assertMutableHostPath into runtime-file-commands-write-terminal-artifact-file.ts

Verified by intent, not by compiling: neutering all 3 isRepositoryAdminPath call
sites turns 51 of 119 tests red, matching the pre-merge figure, so the guards are
still attached to the code the RPC actually reaches. All 13 authorization sites
remain downstream of their SSH early-return and the funnel remains above the
fork in every method.
bluehansl added a commit to bluehansl/orca that referenced this pull request Sep 1, 2026
Upstream split OrcaRuntimeService into modules (stablyai#17605); the two call
sites this PR touches moved out of orca-runtime.ts, so the same lines are
re-applied in their new homes: the leaderPaneKey pass-through in
orca-runtime-create-terminal.ts and the resolver injection plus paneKey
plumbing in orca-runtime-resolve-terminal-split-source-authority.ts.
Everything else auto-merged.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016gHoNRQpffLLRjf6aSDDWc
nwparker added a commit that referenced this pull request Sep 4, 2026
`resolveOmittedHostScopeSelectors` documented `omittedHostIds` as built partly
from workspace sessions and explicitly rejected filtering any id out of it. The
sourcing rule changed in #18595 and the comment has to change with it, or the
next reader finds a comment contradicting the code and re-derives the whole
investigation — which is how this bug survived #17605, where a mechanical split
carried the code across and dropped the comment explaining it.

The disclosure duty is unchanged: a repo, folder workspace, mirrored row, or
resolved worktree on a `runtime:` host is content the listing did not cover, so
it stays named. A bare `workspaceSessionsByHostId` partition is not a gap — the
client holds no repo, worktree, or row behind it.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…tablyai#17605)

* refactor(runtime): split OrcaRuntimeService into focused modules

* test(runtime): cover admission tiers and strict worktree reconciliation

* fix(runtime): preserve owner and structured session visibility

* fix(runtime): port post-extraction compatibility fixes

* fix(runtime): preserve skill-share cancellation barrier

* test(runtime): update identity inventory after extraction

* fix(runtime): preserve hook transport environment cleanup

* fix(runtime): consolidate idle probe imports

* test(runtime): retire split file process allowlist entry

* fix(runtime): route child process types through shared boundary

* test(runtime): preserve worktree host metadata precedence

* fix(runtime): update extracted test seams

* fix(runtime): gate the split's ts-nocheck set and restore the stop-confirmed contract

Audit follow-ups for the OrcaRuntimeService split:

- Freeze the 171 @ts-nocheck files behind a ratchet so no new file can disable
  type checking. The split's linear mixin chain cannot express forward
  references yet, so the existing suppressions are grandfathered; the baseline
  may only shrink.
- Drop the stray @ts-nocheck at the end of orca-runtime-get-status.ts. It sat
  after the first statement, where TypeScript ignores it, so the module was
  already checked.
- Restore `retireRejectedPty(ptyId, stopConfirmed: boolean)` as a required
  argument. The split widened it to optional and patched the resulting error
  with `stopConfirmed === true`; an omitted argument would have silently taken
  the unverified-stop path instead of failing to compile.
- Guard that every orca-runtime-tests fragment is imported by the compatibility
  entrypoint. The fragments are .spec.ts, which no Vitest include glob matches,
  so one left out of the list would silently stop running.

* fix(runtime): restore four behaviors the OrcaRuntimeService split dropped

Audit findings against the refactor's true base (9dd3804):

- retirePtyAgentLaunchAuthority collected pane keys after deleting the
  restored-authority receipt instead of before it. collectPaneKeysForPty reads
  that receipt, so a receipt-only pane lost its key and never had its agent-hook
  compatibility authority retired. on-pty-exit.ts already carried a comment
  naming this exact invariant.
- The PTY-exit path kept orchestrationMailboxNotifications.retirePty but lost
  the loop that schedules a debounced mail-pointer repoint for the dead pty's
  terminal handle and any run bound to its panes. Restores the schedule call
  count to 7, matching base.
- subscribeToPtyExit lost isPtyKnownExited's leaf fallback and its
  post-registration lifecycle-generation recheck. leavesByPtyId is rebuilt from
  the renderer graph independently of ptysById, so a leaf can outlive its pty
  record; without the fallback a caller waiting on an already-dead pty never
  gets released.
- The chain root declared `[key: string]: unknown`, which base had nowhere. It
  leaked through the exported runtime type into every consumer, so any misspelled
  member access typechecked as unknown instead of erroring, and it accounted for
  957 of the suppressed errors. Removing it costs zero type errors.

* fix(runtime): restore escalation prose and unscoped automation publication

Two more behaviors the split dropped, each with a regression test that fails
against the pre-fix code:

- The worker-exit escalation stopped deriving its title through
  buildOrchestrationTaskDisplayMetadata and inlined `task.spec` instead. That
  ignored an explicit task_title, dropped the single-line normalization and the
  80-character bound, and turned the no-spec case into a quoted, duplicated id.
  A multi-paragraph spec landed verbatim in the coordinator's banner. The
  existing 11 tests all use short single-line specs, where the derived title and
  the raw spec are identical, so none of them could see it.
  Also reverts an added `if (!handle) return` guard: the dispatch lookup is
  deliberately keyed on the pane as well, because a reminted handle no longer
  matches the row while the pane identity outlives the remint.
- updateAutomation stopped going through automationChangePublications and
  published `source` unconditionally while gating the fallback on a non-null
  destination. A destination the store can no longer name then published only
  the stale source, so subscribers scoped elsewhere kept rendering a row that
  had left them — the exact case the helper documents. The helper had been left
  with zero callers; all three sites use it again.

* fix(skills): stop swallowing lookup errors and hard-erroring on non-ssh hosts

Follow-ups from auditing the skill install path against the refactor's base:

- resolveWorktree wrapped showManagedWorktree in `.catch(() => null)`, so a
  transient git or IO failure surfaced to the user as
  skill-install-workspace-not-found with the real cause discarded. Errors
  propagate again; a genuine id mismatch still returns null.
- resolveSkillSshTarget threw skill-install-workspace-host-unavailable when the
  execution host was neither local nor ssh, on both the repo and folder
  branches. Base gated these on connectionId, so a runtime-owned repo simply
  was not an SSH install and fell through to the local path. Both return null
  again, and the error code the split invented is now unreferenced.
- listManagedSkillInstalls awaited the receipt walk and the worktree resolve in
  sequence. They are independent and either can hit disk, WSL, or an SSH scan,
  so Promise.all is restored.

Deliberately unchanged: resolving the worktree through listResolvedWorktrees
rather than showManagedWorktree, which disambiguates a worktree id colliding
across hosts and is covered by its own test, and the SSH-folder
skill-install-ssh-dispatch-required throw, which matches the repo branch.

* fix(runtime): merge duplicate worktree-logic imports

The stablyai#17448 port added a third import from ../ipc/worktree-logic, which the
code-quality oxlint config rejects under --deny-warnings. Plain oxlint does not
flag it, so it only surfaced in CI's static analysis job.

* ci: run the ts-nocheck ratchet in PR checks

pr-workflow-lint-parity requires every leaf command in `pnpm lint` to have a
matching step in pr.yml. The ratchet was wired into lint but not the workflow,
so PR CI would not have enforced it.

* Merge remote-tracking branch 'origin/main' and retry the paired-host launch evaluate

main advanced 9 commits; none touch the orca-runtime.ts this branch splits, so
nothing needed porting.

CI failed twice on `Execution context was destroyed` thrown from
headless-paired-runtime-host's first `evaluate` after launch — a different spec
each run, which is the signature of the flake stablyai#17780 describes rather than a
regression. That commit added retryTransientMainEvaluate and adopted it in five
helpers but not this call site, even though its docblock names exactly this
case: the first evaluate after electron.launch() resolves, before the app is
ready. Wrapped it the same way.
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