mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 16:02:32 +00:00
* 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 (ad5ba2572e):
- 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 #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 #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.
71 lines
3.7 KiB
TypeScript
71 lines
3.7 KiB
TypeScript
// @ts-nocheck -- mechanically split from OrcaRuntimeService; behavior is covered by AST equivalence and characterization tests.
|
|
import { RESOLVED_WORKTREE_REPO_TIMEOUT_MS } from './repo-worktree-row-resolution'
|
|
import { REPO_SEARCH_REFS_DEFAULT_LIMIT } from '../../shared/repo-search-limits'
|
|
|
|
export const WAIT_BLOCKED_CHECK_MIN_INTERVAL_MS = 50
|
|
|
|
// Why: chunks that could complete an actionable prompt bypass the throttle so blocked stamps stay immediate; scanned over the new chunk + short carry, never the whole window.
|
|
export const WAIT_BLOCKED_KEYWORD_PATTERN =
|
|
/press enter|press t to trust|do you trust|trust this|trusted workspace|permission required|requires permission|allow once|allow always|update available|choose working directory|codex just got an upgrade|hooks need review/
|
|
|
|
export const WAIT_BLOCKED_KEYWORD_CARRY_CHARS = 31
|
|
|
|
export const AUTHORITATIVE_TERMINAL_SNAPSHOT_TIMEOUT_MS = 8_000
|
|
|
|
export const VISIBLE_TERMINAL_SNAPSHOT_TIMEOUT_MS = 750
|
|
|
|
export const VISIBLE_TERMINAL_SNAPSHOT_RETRY_MS = 1_000
|
|
|
|
export const TUI_IDLE_VISIBLE_PROBE_SETTLE_MARGIN_MS = 10
|
|
|
|
export const DEFAULT_REPO_SEARCH_REFS_LIMIT = REPO_SEARCH_REFS_DEFAULT_LIMIT
|
|
|
|
export const DEFAULT_TERMINAL_LIST_LIMIT = 200
|
|
|
|
export const DEFAULT_WORKTREE_LIST_LIMIT = 200
|
|
|
|
export const DEFAULT_WORKTREE_PS_LIMIT = 200
|
|
|
|
export const DISCONNECTED_PTY_RECORD_MAX = 128
|
|
|
|
export const RESOLVED_WORKTREE_CACHE_TTL_MS = 1000
|
|
|
|
// Why: the Git-admin fingerprint reads HEAD and its ref tip exactly, but sparse-checkout pattern
|
|
// edits are invisible to it and a tip living in packed-refs or reftable only gets an mtime + size
|
|
// stamp, so a real scan still runs on this interval even while the probe reports "unchanged".
|
|
export const WORKTREE_SCAN_ADMIN_RECONCILE_INTERVAL_MS = 5 * 60_000
|
|
|
|
// Why reserved rather than spent on the probe: when the probe expires the caller still has to run
|
|
// `git worktree list` and answer inside the same budget, so the fallback needs its own room. Sized
|
|
// for a healthy Git on a busy host, well above the tens of milliseconds a warm list costs.
|
|
export const WORKTREE_SCAN_FALLBACK_ALLOWANCE_MS = 1500
|
|
|
|
// Why derived from the caller's budget instead of a generous absolute: this wait runs *inside*
|
|
// RESOLVED_WORKTREE_REPO_TIMEOUT_MS, so outlasting it buys nothing — the caller has already given up
|
|
// and restored persisted rows — while turning a reusable scan into a full-budget stall that repeats
|
|
// on every TTL expiry. Subtracting keeps that invariant true by construction if either side moves.
|
|
// Why not smaller: the probe reads a subset of what the fallback scan reads, so a probe too slow to
|
|
// fit is a scan that will not fit either — waiting is strictly better right up to the budget.
|
|
// Expiring yields `null`, the existing "cannot prove unchanged" sentinel, so a real scan runs.
|
|
export const WORKTREE_SCAN_ADMIN_FINGERPRINT_TIMEOUT_MS =
|
|
RESOLVED_WORKTREE_REPO_TIMEOUT_MS - WORKTREE_SCAN_FALLBACK_ALLOWANCE_MS
|
|
|
|
export const PTY_CONTROLLER_LIST_TIMEOUT_MS = 3000
|
|
|
|
export const PTY_CONTROLLER_LIST_PROVIDER_MARGIN_MS = 500
|
|
|
|
// Why: the renderer waits 15s; leave room for the verified failure response and release the spawn fence before its caller times out.
|
|
export const WORKTREE_TERMINAL_SLEEP_TIMEOUT_MS = 12_000
|
|
|
|
// Why: tui-idle needs OSC title transitions; an unsupported CLI/plain shell never fires one, so cap at 5min to avoid indefinite hangs.
|
|
export const TUI_IDLE_DEFAULT_TIMEOUT_MS = 5 * 60 * 1000
|
|
|
|
export const TUI_IDLE_POLL_INTERVAL_MS = 2000
|
|
|
|
export const TUI_IDLE_QUIESCENCE_MS = 3000
|
|
|
|
// Clamp for mobileAutoRestoreFitMs: floor above the legacy 300ms debounce, 1h ceiling (a held PTY beyond that is "I forgot", not intentional).
|
|
export const MOBILE_AUTO_RESTORE_FIT_MIN_MS = 5_000
|
|
|
|
export const MOBILE_AUTO_RESTORE_FIT_MAX_MS = 60 * 60 * 1000
|