From fb71c6ae4ccf69de30027a45d2406baddbb7b3ba Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Tue, 17 Nov 2026 14:49:39 -0800 Subject: [PATCH] ci(ratchets): fail PRs that add callers of sync helpers on Electron main (#43399) * ci(ratchets): guard callers of sync helpers on main and skip worker-only modules The main-thread ratchets counted blocking call syntax per file, so a new caller of an existing sync helper in another file (env store reads, Codex transcript cursor, durable secure writes) passed CI. A new ratchet counts references to functions that make a synchronous fs, child_process or SQLite call. Modules imported only by worker/utility entries are no longer charged as main-thread work, and SQLite pragma()/transaction() now count. * ci(ratchets): follow sync helpers two levels so timer and handler callers count * ci(ratchets): guard event-loop entries, follow default exports and barrels, carry rows across renames * test(ratchets): keep the shared import when checking a guarded entry * ci(ratchets): shadow helpers only by parameters in scope, fail on unreadable entry lists, keep transaction results out of SQLite receivers * ci(ratchets): match helper names file-wide (council ruling), harden entry discovery, count transaction modes * Merge origin/main; baseline main's new WSL helper callers * fix(ratchets): preserve helper exports and fail closed on missing roots * Keep main's note on the worker large-send log baseline row --- .github/workflows/main-blocking-work.yml | 1 + config/main-blocking-atomics-baseline.txt | 2 +- config/main-blocking-compression-baseline.txt | 2 +- config/main-blocking-crypto-baseline.txt | 2 +- config/main-blocking-helper-baseline.txt | 1628 +++++++++++++++++ config/main-blocking-ipc-baseline.txt | 7 +- config/main-blocking-sqlite-baseline.txt | 126 +- config/main-sync-fs-baseline.txt | 86 +- config/performance-audit.md | 8 +- .../check-changed-selection.mjs | 34 +- .../preflight/changed-checks/run-lint.mjs | 1 + .../gated-call-use-collector.mjs | 64 +- .../main-blocking-helper-propagation.mjs | 306 ++++ .../main-blocking-import-graph.mjs | 243 +++ .../main-blocking-source-paths.mjs | 3 +- .../sqlite-call-use-collector.mjs | 84 +- .../ratchet-baseline/ratchet-baseline.mjs | 58 +- .../check-main-blocking-api-ratchet.mjs | 11 +- .../check-main-blocking-api-ratchet.test.mjs | 87 +- .../check-main-blocking-helper-ratchet.mjs | 76 + .../check-main-sync-fs-ratchet.mjs | 28 +- package.json | 1 + 22 files changed, 2614 insertions(+), 244 deletions(-) create mode 100644 config/main-blocking-helper-baseline.txt create mode 100644 config/scripts/static-analysis/process-boundaries/main-blocking-helper-propagation.mjs create mode 100644 config/scripts/static-analysis/process-boundaries/main-blocking-import-graph.mjs create mode 100644 config/scripts/static-analysis/ratchets/runtime-lifecycle/check-main-blocking-helper-ratchet.mjs diff --git a/.github/workflows/main-blocking-work.yml b/.github/workflows/main-blocking-work.yml index 312f4dcd487..c0533e46094 100644 --- a/.github/workflows/main-blocking-work.yml +++ b/.github/workflows/main-blocking-work.yml @@ -20,6 +20,7 @@ jobs: run: | node config/scripts/static-analysis/ratchets/runtime-lifecycle/check-main-sync-fs-ratchet.mjs node config/scripts/static-analysis/ratchets/runtime-lifecycle/check-main-blocking-api-ratchet.mjs + node config/scripts/static-analysis/ratchets/runtime-lifecycle/check-main-blocking-helper-ratchet.mjs # The PR preflight runs spawn separately, so the discovery runner intentionally excludes it. - name: Enforce synchronous launches if: '!cancelled()' diff --git a/config/main-blocking-atomics-baseline.txt b/config/main-blocking-atomics-baseline.txt index 37cb369942a..13f67b1943d 100644 --- a/config/main-blocking-atomics-baseline.txt +++ b/config/main-blocking-atomics-baseline.txt @@ -1,5 +1,5 @@ # Legacy synchronous atomics uses per file; counts may only go DOWN. -# Only explicit worker/utility entry files are exempt; their imports remain guarded. +# Worker/utility entries and modules only they import are exempt; anything event-loop code imports stays guarded. 1 src/main/runtime/rpc/server/pairing/device-registry-disk-merge.ts 1 src/main/startup/linux-display/ensure-virtual-display.ts 1 src/shared/file-write/windows-retry-file-operations.ts diff --git a/config/main-blocking-compression-baseline.txt b/config/main-blocking-compression-baseline.txt index cc52cbd6728..3c306216117 100644 --- a/config/main-blocking-compression-baseline.txt +++ b/config/main-blocking-compression-baseline.txt @@ -1,5 +1,5 @@ # Legacy synchronous compression uses per file; counts may only go DOWN. -# Only explicit worker/utility entry files are exempt; their imports remain guarded. +# Worker/utility entries and modules only they import are exempt; anything event-loop code imports stays guarded. 1 src/main/browser/extensions/actions/browser-extension-action-icon.ts 2 src/main/native-chat/agent-session-journal/journal-stored-output.ts 1 src/main/runtime/rpc/mobile/e2ee/mobile-e2ee-v2-compressed-frame.ts diff --git a/config/main-blocking-crypto-baseline.txt b/config/main-blocking-crypto-baseline.txt index 3c13aacf628..2aea77a6b0f 100644 --- a/config/main-blocking-crypto-baseline.txt +++ b/config/main-blocking-crypto-baseline.txt @@ -1,3 +1,3 @@ # Legacy synchronous crypto uses per file; counts may only go DOWN. -# Only explicit worker/utility entry files are exempt; their imports remain guarded. +# Worker/utility entries and modules only they import are exempt; anything event-loop code imports stays guarded. 3 src/main/browser/cookies/sources/browser-cookie-key.ts diff --git a/config/main-blocking-helper-baseline.txt b/config/main-blocking-helper-baseline.txt new file mode 100644 index 00000000000..0f1b55cc8ab --- /dev/null +++ b/config/main-blocking-helper-baseline.txt @@ -0,0 +1,1628 @@ +# References to functions that make a synchronous fs, child_process or SQLite call, or call such a +# function, per file, in event-loop code (Electron main, orcad, daemon, preload; worker-only modules excluded). +# This is a RATCHET: counts may only go DOWN. +# Prune: node config/scripts/static-analysis/ratchets/runtime-lifecycle/check-main-blocking-helper-ratchet.mjs --prune +1 src/main/acp/conversation-copy/acp-conversation-copies.ts +3 src/main/acp/conversation-copy/acp-conversation-copy.ts +5 src/main/acp/launch/acp-launch-command.ts +2 src/main/acp/launch/acp-private-temp.ts +1 src/main/acp/launch/acp-structured-launch-resolution.ts +1 src/main/acp/process/acp-agent-connection.ts +1 src/main/acp/session/acp-structured-acquire.ts +1 src/main/acp/text-task/acp-text-task.ts +1 src/main/agent-hooks/first-work/first-work-generation-target.ts +1 src/main/agent-hooks/installation/bare-shell-plugin-agent-presence.ts +2 src/main/agent-hooks/installation/configuration/hooks-json-read.ts +7 src/main/agent-hooks/installation/configuration/hooks-json-write.ts +2 src/main/agent-hooks/installation/local-agent-cli-presence.ts +1 src/main/agent-hooks/installation/managed-agent-hook-controls.ts +1 src/main/agent-hooks/installation/scripts/managed-hook-script-refresh.ts +6 src/main/agent-hooks/installation/scripts/managed-hook-script-write.ts +1 src/main/agent-hooks/server/server-opencode-binder.ts +1 src/main/agent-hooks/server/server-runtime-env.ts +1 src/main/agent-hooks/server/server-status-hook-lifecycle.ts +1 src/main/agent-hooks/server/server-status-retries.ts +2 src/main/agent-hooks/wsl-relay/wsl-hook-relay-deps.ts +3 src/main/agent-hooks/wsl-relay/wsl-hook-relay-launch.ts +2 src/main/agent-launch/trust/agent-trust-ownership-ledger.ts +12 src/main/agent-launch/trust/agent-trust-presets.ts +2 src/main/agent-launch/trust/agent-workspace-trust-spawn.ts +5 src/main/agent-launch/trust/agent-workspace-trust.ts +3 src/main/agent-launch/trust/antigravity-workspace-trust-ownership.ts +12 src/main/agent-launch/trust/execution-host-workspace-trust.ts +3 src/main/ai-vault-search/session-search-child-service.ts +4 src/main/ai-vault-search/session-search-enablement.ts +2 src/main/ai-vault-search/storage/session-search-schema.ts +1 src/main/ai-vault-search/worker/session-search-worker-client.ts +3 src/main/ai-vault/discovery/ai-vault-scan-roots.ts +1 src/main/ai-vault/discovery/session-scanner-agent-sources.ts +3 src/main/ai-vault/discovery/session-scanner-roots.ts +3 src/main/ai-vault/discovery/session-scanner-source-discovery.ts +2 src/main/ai-vault/listing/cached-session-list.ts +9 src/main/ai-vault/parse-cache/session-parse-cache-database.ts +1 src/main/ai-vault/parse-cache/session-parse-cache-legacy-json.ts +14 src/main/ai-vault/parse-cache/session-parse-cache-persistence.ts +1 src/main/ai-vault/parse-cache/session-scanner-sidecar-enrichment.ts +14 src/main/ai-vault/parsing/session-scanner-agent-parser.ts +1 src/main/ai-vault/prompts/session-first-user-prompt-handler.ts +5 src/main/ai-vault/scan-service/session-scanner-background.ts +3 src/main/ai-vault/scan-service/session-scanner-service-entry-path.ts +12 src/main/ai-vault/scan-service/session-scanner-service-spawn.ts +2 src/main/ai-vault/scanners/devin/session-scanner-devin-db.ts +2 src/main/ai-vault/scanners/hermes/hermes-state-db-conversations.ts +3 src/main/ai-vault/scanners/hermes/hermes-state-db-schema.ts +2 src/main/ai-vault/scanners/hermes/session-scanner-hermes-sources.ts +15 src/main/ai-vault/scanners/hermes/session-scanner-hermes-sqlite.ts +5 src/main/ai-vault/scanners/hermes/session-scanner-hermes-worker.ts +1 src/main/ai-vault/scanners/omp/omp-session-root.ts +2 src/main/ai-vault/scanners/opencode/reader-transport/opencode-wsl-runtime-preparation.ts +15 src/main/ai-vault/scanners/opencode/reader-transport/session-scanner-opencode-sqlite-dispatch.ts +1 src/main/ai-vault/scanners/opencode/reader-transport/session-scanner-opencode-sqlite-process-entry.ts +25 src/main/ai-vault/scanners/opencode/reader-transport/session-scanner-opencode-sqlite-worker-spawn.ts +2 src/main/ai-vault/scanners/opencode/reader-transport/session-scanner-opencode-wsl-client.ts +3 src/main/ai-vault/scanners/opencode/session-scanner-opencode-sources.ts +3 src/main/ai-vault/scanners/opencode/sqlite/session-scanner-opencode-sqlite-capture.ts +1 src/main/ai-vault/scanners/opencode/sqlite/session-scanner-opencode-sqlite-discovery.ts +2 src/main/ai-vault/scanners/opencode/sqlite/session-scanner-opencode-sqlite-list.ts +1 src/main/ai-vault/scanners/opencode/sqlite/session-scanner-opencode-sqlite-open.ts +3 src/main/ai-vault/scanners/opencode/sqlite/session-scanner-opencode-sqlite.ts +1 src/main/ai-vault/scanners/opencode2/session-scanner-opencode2-sqlite-list.ts +4 src/main/ai-vault/scanners/opencode2/session-scanner-opencode2-sqlite.ts +1 src/main/ai-vault/scanners/zcode/session-scanner-zcode-sources.ts +2 src/main/ai-vault/session-handoff-snapshot.ts +1 src/main/ai-vault/session-titles/session-title-resolver.ts +1 src/main/ai-vault/transcripts/session-transcript-reader.ts +4 src/main/amp/hook-service.ts +1 src/main/antigravity/antigravity-acp-launch-spec.ts +1 src/main/antigravity/antigravity-chat-sign-in.ts +2 src/main/antigravity/antigravity-host-acp.ts +8 src/main/antigravity/hook-service.ts +4 src/main/antigravity/native-account-host.ts +4 src/main/antigravity/native-account-launch.ts +2 src/main/antigravity/native-account-store.ts +6 src/main/antigravity/native-credential-backend.ts +4 src/main/antigravity/native-file-credentials.ts +13 src/main/antigravity/native-windows-credentials.ts +1 src/main/antigravity/native-wsl-credentials.ts +6 src/main/artifacts/artifact-cloud-auth-context.ts +10 src/main/artifacts/artifact-cloud-service.ts +8 src/main/artifacts/artifact-create-intent-store.ts +9 src/main/artifacts/artifact-publisher.ts +12 src/main/artifacts/artifact-share-record-store.ts +1 src/main/automations/external-managers/external-manager-discovery.ts +1 src/main/automations/external-managers/scoped-external-automations.ts +1 src/main/automations/launch/automation-run-setup-skip.ts +2 src/main/automations/runtime-automation-service.ts +5 src/main/backend/backend-entry.ts +12 src/main/backend/core-runtime-activation.ts +2 src/main/backend/core-runtime.ts +4 src/main/bitbucket/client.ts +5 src/main/bitbucket/credential-connection.ts +7 src/main/bitbucket/credential-store.ts +2 src/main/bitbucket/pull-request-creation.ts +2 src/main/bitbucket/resolve-auth.ts +4 src/main/browser-passwords/browser-password-chromium-import.ts +3 src/main/browser-passwords/browser-password-store.ts +1 src/main/browser-passwords/browser-password-vault-file.ts +1 src/main/browser/agent-browser/helper-process/agent-browser-binary.ts +2 src/main/browser/agent-browser/helper-process/agent-browser-bridge-execution.ts +1 src/main/browser/agent-browser/session-lifecycle/agent-browser-bridge-lifecycle.ts +2 src/main/browser/agent-browser/session-lifecycle/agent-browser-session-reset.ts +2 src/main/browser/agent-browser/session-routing/agent-browser-bridge-state.ts +2 src/main/browser/client-hosts/leases/browser-host-client-identity.ts +1 src/main/browser/client-hosts/lifecycle/browser-client-host-id.ts +3 src/main/browser/cookies/browser-cookie-import.ts +12 src/main/browser/cookies/chromium/chromium-cookie-snapshot.ts +2 src/main/browser/cookies/chromium/finalize-import.ts +8 src/main/browser/cookies/chromium/import-cookies.ts +5 src/main/browser/cookies/chromium/prepare-import.ts +1 src/main/browser/cookies/chromium/scan-source-rows.ts +7 src/main/browser/cookies/client-route/browser-client-route-cookie-import.ts +3 src/main/browser/cookies/client-route/client-route-cookie-import-source-store.ts +1 src/main/browser/cookies/imports/import-cookie-file.ts +4 src/main/browser/cookies/imports/import-validated-cookies.ts +2 src/main/browser/cookies/session-restore/browser-session-cookie-restore.ts +1 src/main/browser/cookies/session-restore/browser-session-cookie-snapshot-file.ts +5 src/main/browser/cookies/sources/browser-cookie-detection.ts +4 src/main/browser/cookies/sources/browser-cookie-firefox-import.ts +5 src/main/browser/cookies/sources/browser-cookie-key.ts +5 src/main/browser/cookies/sources/browser-cookie-safari-import.ts +1 src/main/browser/cookies/sources/browser-cookie-source-profiles.ts +6 src/main/browser/cookies/staging/browser-cookie-staged-import.ts +16 src/main/browser/cookies/staging/browser-session-cookie-staging.ts +3 src/main/browser/extensions/api-runtime/browser-extension-worker-shim-source.ts +3 src/main/browser/extensions/browser-extension-management.ts +1 src/main/browser/extensions/browser-extension-startup.ts +6 src/main/browser/extensions/installation/browser-extension-load-directory.ts +2 src/main/browser/extensions/installation/browser-extension-webstore-install.ts +1 src/main/browser/extensions/native-messaging/browser-extension-native-host-process.ts +1 src/main/browser/extensions/native-messaging/browser-extension-native-ports.ts +1 src/main/browser/extensions/profile-sessions/browser-extension-profile-reload.ts +4 src/main/browser/extensions/profile-sessions/browser-extension-session-load.ts +6 src/main/browser/extensions/profile-sessions/browser-extension-session-loader.ts +10 src/main/browser/extensions/profile-storage/browser-extension-data-removal.ts +8 src/main/browser/extensions/profile-storage/browser-extension-retired-profile-storage.ts +1 src/main/browser/extensions/web-store/browser-extension-webstore-service.ts +1 src/main/browser/guest-lifecycle/prompts/browser-system-dialogs.ts +7 src/main/browser/identity/mode/browser-identity-mode-store.ts +1 src/main/browser/network/egress/browser-route-egress-electron-launch.ts +1 src/main/browser/network/execution-routes/browser-network-execution-route-dispatch.ts +1 src/main/browser/network/execution-routes/ssh-browser-network-execution-route.ts +2 src/main/browser/network/execution-routes/wsl-browser-network-execution-route.ts +2 src/main/browser/network/execution-routes/wsl-browser-network-relay-launch.ts +2 src/main/browser/routing/local-host-partitions/local-ssh-browser-partitions.ts +1 src/main/browser/routing/local-host-partitions/wsl-host-browser-route-partition.ts +4 src/main/browser/routing/partitions/browser-route-partition-binding-store.ts +5 src/main/browser/routing/partitions/browser-route-partition-pending-deletes.ts +2 src/main/browser/routing/partitions/browser-route-partition-storage-dependencies.ts +3 src/main/browser/routing/partitions/browser-route-partition-storage-runtime.ts +1 src/main/browser/routing/sessions/browser-route-session-runtime.ts +1 src/main/browser/sessions/browser-session-frame-preloads.ts +1 src/main/browser/sessions/browser-session-startup.ts +1 src/main/browser/sessions/profiles/browser-session-meta-store.ts +1 src/main/browser/sessions/profiles/browser-session-profile-retirement.ts +6 src/main/browser/sessions/profiles/browser-session-registry.ts +1 src/main/browser/site-settings/browser-profile-site-store.ts +1 src/main/browser/site-settings/display/browser-site-display-store.ts +1 src/main/browser/site-settings/permissions/browser-site-permission-store.ts +1 src/main/claude-accounts/profiles/claude-profile-homes.ts +11 src/main/claude-accounts/profiles/claude-profile-paths.ts +3 src/main/claude-accounts/profiles/routing/claude-observed-config-dirs.ts +1 src/main/claude-accounts/profiles/routing/claude-profile-installed-router.ts +1 src/main/claude-accounts/profiles/routing/claude-profile-launch-preparation.ts +1 src/main/claude-accounts/profiles/routing/claude-profile-routed-home.ts +11 src/main/claude-accounts/profiles/routing/claude-profile-router.ts +3 src/main/claude-accounts/profiles/setup/claude-profile-history.ts +14 src/main/claude-accounts/profiles/setup/claude-profile-prompt-history.ts +11 src/main/claude-accounts/profiles/setup/claude-profile-provisioning.ts +6 src/main/claude-accounts/profiles/setup/claude-profile-settings.ts +1 src/main/claude-accounts/profiles/setup/claude-profile-setup-worker.ts +3 src/main/claude-accounts/profiles/setup/claude-profile-setup.ts +1 src/main/claude-accounts/profiles/setup/claude-profile-sharing.ts +1 src/main/claude-accounts/profiles/wsl/claude-profile-wsl-entry.ts +1 src/main/claude-accounts/profiles/wsl/claude-profile-wsl-provision.ts +1 src/main/claude-accounts/profiles/wsl/claude-profile-wsl-router.ts +2 src/main/claude-accounts/runtime-auth/keychain.ts +5 src/main/claude-accounts/selection/claude-account-selection.ts +1 src/main/claude-accounts/service.ts +6 src/main/claude-accounts/sign-in/claude-account-folder.ts +2 src/main/claude-accounts/sign-in/claude-account-registration.ts +7 src/main/claude-accounts/sign-in/claude-command-process.ts +2 src/main/claude-usage/store.ts +2 src/main/claude-usage/transcript-file-discovery.ts +13 src/main/claude/agent-view/agent-view-install.ts +2 src/main/claude/agent-view/agent-view-plugin.ts +1 src/main/claude/agent-view/agent-view-service.ts +1 src/main/claude/child-process/claude-agent-sdk-process-spawn.ts +1 src/main/claude/claude-cli-conversations.ts +1 src/main/claude/claude-stream-json-connection.ts +1 src/main/claude/configuration/claude-diff-panel-auto-open.ts +13 src/main/claude/configuration/claude-folder-trust-file.ts +1 src/main/claude/configuration/claude-in-chrome-default.ts +1 src/main/claude/configuration/claude-rejected-api-key.ts +1 src/main/claude/conversation-naming/claude-naming-invocation.ts +15 src/main/claude/hook-service.ts +2 src/main/claude/hooks/claude-profile-hook-target.ts +1 src/main/claude/hooks/statusline-install.ts +3 src/main/claude/hooks/windows-hook-files.ts +2 src/main/claude/structured/claude-structured-session-adapter.ts +2 src/main/claude/structured/launch/claude-structured-child-env.ts +1 src/main/claude/structured/launch/claude-structured-launch-home.ts +1 src/main/claude/structured/launch/claude-structured-launch-resolution.ts +1 src/main/claude/theme-sync/claude-code-theme-sync-schedule.ts +10 src/main/claude/theme-sync/claude-code-theme-sync.ts +2 src/main/claude/transcripts/claude-conversation-copy.ts +4 src/main/claude/transcripts/claude-rewind-fork.ts +2 src/main/claude/transcripts/claude-rewind-transcript.ts +2 src/main/claude/transcripts/claude-transcript-catch-up.ts +1 src/main/claude/transcripts/claude-transcript-recovery.ts +12 src/main/cli/appimage/appimage-copy-pre-extraction.ts +29 src/main/cli/appimage/appimage-extracted-root.ts +5 src/main/cli/appimage/appimage-extraction-pruning.ts +1 src/main/cli/appimage/appimage-generation-residency.ts +1 src/main/cli/appimage/appimage-generation-stable-launcher.ts +3 src/main/cli/appimage/appimage-serve-preparation.ts +22 src/main/cli/appimage/appimage-stable-launcher.ts +6 src/main/cli/cli-installer.ts +1 src/main/cli/installation/cli-command-installation.ts +4 src/main/cli/installation/cli-install-location.ts +5 src/main/cli/launchers/linux-bare-orca-dispatcher.ts +14 src/main/cli/launchers/linux-terminal-orca-cli-shim.ts +1 src/main/cli/launchers/orca-cli-child-path.ts +1 src/main/cli/wsl/wsl-cli-installer.ts +1 src/main/cli/wsl/wsl-cli-registration-reconciliation.ts +6 src/main/cli/wsl/wsl-cli-registration-registry.ts +1 src/main/cli/wsl/wsl-managed-cli.ts +2 src/main/codex-accounts/account-management/codex-account-registration.ts +1 src/main/codex-accounts/credentials/codex-credential-absence-grace.ts +5 src/main/codex-accounts/credentials/managed-codex-auth-readiness.ts +1 src/main/codex-accounts/legacy-wsl-auth-drain/legacy-wsl-runtime-auth-drain-script-harness.ts +4 src/main/codex-accounts/legacy-wsl-auth-drain/legacy-wsl-runtime-auth-drain.ts +10 src/main/codex-accounts/login/codex-login-session.ts +3 src/main/codex-accounts/managed-homes/codex-config-mirror.ts +7 src/main/codex-accounts/managed-homes/codex-managed-home-lifecycle.ts +4 src/main/codex-accounts/managed-homes/codex-managed-home-path.ts +2 src/main/codex-accounts/managed-homes/guest-codex-account-homes.ts +5 src/main/codex-accounts/managed-homes/host-codex-managed-home-ownership.ts +3 src/main/codex-accounts/runtime-home/credentials/runtime-home-service-auth-core.ts +1 src/main/codex-accounts/runtime-home/credentials/runtime-home-service-auth-provenance.ts +4 src/main/codex-accounts/runtime-home/credentials/runtime-home-service-auth-sync.ts +19 src/main/codex-accounts/runtime-home/legacy-host/legacy-shared-auth-migration.ts +2 src/main/codex-accounts/runtime-home/legacy-host/legacy-shared-config-compatibility.ts +3 src/main/codex-accounts/runtime-home/legacy-host/runtime-home-service-legacy-migration.ts +9 src/main/codex-accounts/runtime-home/routing/runtime-home-service-home-routing.ts +9 src/main/codex-accounts/runtime-home/routing/runtime-home-service-launch.ts +8 src/main/codex-accounts/runtime-home/routing/runtime-home-service-managed-home.ts +1 src/main/codex-accounts/runtime-home/runtime-home-service-paths.ts +1 src/main/codex-accounts/runtime-home/runtime-home-service-sync.ts +1 src/main/codex-accounts/runtime-home/wsl/runtime-home-service-wsl.ts +1 src/main/codex-accounts/runtime-home/wsl/wsl-codex-auth-batch-reader.ts +2 src/main/codex-accounts/service.ts +10 src/main/codex-cli/command.ts +1 src/main/codex-usage/codex-usage-provider.ts +1 src/main/codex-usage/store.ts +1 src/main/codex/app-server/codex-app-server-connection.ts +2 src/main/codex/app-server/codex-app-server-session.ts +2 src/main/codex/codex-conversation-copy.ts +2 src/main/codex/configuration/agent-state-file-reader.ts +1 src/main/codex/configuration/codex-path-observation.ts +22 src/main/codex/configuration/homes/codex-home-paths.ts +1 src/main/codex/configuration/homes/codex-managed-home-resource-copy-marker.ts +3 src/main/codex/configuration/homes/codex-managed-home-rules.ts +12 src/main/codex/configuration/homes/codex-pane-account-registry.ts +3 src/main/codex/configuration/homes/codex-real-home-path.ts +1 src/main/codex/configuration/homes/codex-runtime-home-launch-preparation.ts +1 src/main/codex/configuration/homes/codex-stale-pane-accounts.ts +9 src/main/codex/configuration/homes/codex-windows-sandbox-read-grant.ts +1 src/main/codex/configuration/settings/codex-config-mirror-merge.ts +30 src/main/codex/configuration/settings/codex-config-mirror.ts +2 src/main/codex/configuration/settings/codex-config-path-reference-rewrite.ts +1 src/main/codex/configuration/settings/codex-config-runtime-owned-values.ts +2 src/main/codex/configuration/settings/config-settings-baseline.ts +1 src/main/codex/configuration/settings/config-settings-promotion-write-target.ts +8 src/main/codex/configuration/settings/config-settings-promotion.ts +1 src/main/codex/configuration/settings/config-sync-stall.ts +2 src/main/codex/configuration/shared-server/codex-daemon-socket-path-guard.ts +1 src/main/codex/configuration/shared-server/codex-shared-server-fix.ts +3 src/main/codex/configuration/shared-server/codex-shared-server-pane.ts +2 src/main/codex/configuration/shared-server/codex-shared-server-probe.ts +6 src/main/codex/configuration/toml/config-toml-atomic-write.ts +4 src/main/codex/configuration/toml/config-toml-runtime-owned-sections.ts +9 src/main/codex/history/backfill/codex-session-backfill-marker.ts +6 src/main/codex/history/backfill/codex-session-backfill.ts +3 src/main/codex/history/backfill/desktop-codex-session-migration.ts +22 src/main/codex/history/bridges/codex-session-bridge.ts +3 src/main/codex/history/cleanup/codex-host-rollout-homes.ts +1 src/main/codex/history/index/codex-account-session-index-heal.ts +1 src/main/codex/history/index/codex-session-index-heal-state.ts +13 src/main/codex/history/index/codex-session-index-heal.ts +3 src/main/codex/history/index/codex-state-db-backfill-recovery-process.ts +5 src/main/codex/history/index/codex-state-db-backfill-recovery.ts +5 src/main/codex/history/index/codex-state-db.ts +2 src/main/codex/history/journal-views/codex-cli-conversations.ts +3 src/main/codex/history/resume/codex-ai-vault-session-resume.ts +2 src/main/codex/history/resume/codex-legacy-session-resume.ts +6 src/main/codex/history/resume/codex-session-resume-home.ts +4 src/main/codex/history/resume/codex-session-resume-launch-preparation.ts +1 src/main/codex/history/resume/codex-session-resume-preparation.ts +3 src/main/codex/history/resume/codex-thread-account-move.ts +1 src/main/codex/history/rollouts/codex-session-file-listing.ts +2 src/main/codex/history/rollouts/codex-session-link.ts +2 src/main/codex/history/shared-store/wsl-codex-account-history.ts +3 src/main/codex/hooks/definitions/codex-hook-definition.ts +9 src/main/codex/hooks/installation/codex-hook-launch-preparation.ts +14 src/main/codex/hooks/installation/codex-hook-local-install.ts +21 src/main/codex/hooks/installation/codex-hook-local-maintenance.ts +13 src/main/codex/hooks/installation/codex-hook-service-implementation.ts +9 src/main/codex/hooks/installation/codex-hook-wsl-runtime.ts +1 src/main/codex/hooks/installation/codex-wsl-hook-install-plan.ts +2 src/main/codex/hooks/installation/hook-service.ts +4 src/main/codex/hooks/reconciliation/codex-account-home-hook.ts +13 src/main/codex/hooks/reconciliation/codex-hook-legacy-cleanup.ts +4 src/main/codex/hooks/reconciliation/codex-hook-reconcile.ts +8 src/main/codex/hooks/reconciliation/codex-hook-status.ts +12 src/main/codex/hooks/reconciliation/codex-real-home-hook-install.ts +4 src/main/codex/hooks/reconciliation/codex-real-home-hook-sweep.ts +7 src/main/codex/hooks/reconciliation/codex-real-home-hooks-json.ts +2 src/main/codex/structured/catalog/codex-at-rest-skills-probe.ts +1 src/main/codex/structured/catalog/codex-model-catalog-probe.ts +1 src/main/codex/structured/launch/codex-structured-launch-resolution.ts +1 src/main/codex/structured/launch/codex-structured-orca-hooks-off.ts +3 src/main/codex/structured/session-lifecycle/codex-provider-session-rename.ts +1 src/main/codex/structured/session-lifecycle/codex-session-account-usage.ts +1 src/main/codex/structured/session-lifecycle/codex-session-mcp.ts +1 src/main/codex/structured/session-lifecycle/codex-structured-session-adapter.ts +5 src/main/codex/trust/grants/codex-hook-trust-grant.ts +4 src/main/codex/trust/grants/codex-managed-trust-grant-plan.ts +11 src/main/codex/trust/grants/codex-managed-trust-reconciliation.ts +3 src/main/codex/trust/grants/codex-trust-grant-host.ts +6 src/main/codex/trust/grants/codex-trust-grant-ledger.ts +7 src/main/codex/trust/hooks/codex-hook-approval-first-write.ts +14 src/main/codex/trust/hooks/codex-hook-hash-lookup.ts +11 src/main/codex/trust/hooks/codex-hook-orca-approvals.ts +1 src/main/codex/trust/hooks/codex-hook-system-trust.ts +11 src/main/codex/trust/hooks/codex-hook-trust-cleanup.ts +4 src/main/codex/trust/hooks/codex-hook-trust-derivation.ts +6 src/main/codex/trust/hooks/codex-hook-trust-memo.ts +1 src/main/codex/trust/hooks/codex-hook-trust-queue.ts +7 src/main/codex/trust/hooks/codex-hook-user-mirroring.ts +1 src/main/codex/trust/hooks/codex-user-hook-trust-moves.ts +15 src/main/codex/trust/hooks/hook-trust-promotion.ts +1 src/main/codex/trust/identity/codex-trust-identity.ts +1 src/main/codex/trust/toml/config-toml-project-trust.ts +30 src/main/codex/trust/toml/config-toml-trust.ts +6 src/main/command-code/hook-service.ts +1 src/main/computer/macos-native/macos-native-provider-paths.ts +1 src/main/computer/macos-permissions/macos-computer-use-permission-status-gate.ts +6 src/main/computer/macos-permissions/macos-computer-use-permission-status.ts +5 src/main/computer/macos-permissions/macos-computer-use-permissions.ts +7 src/main/computer/sidecar-transport/sidecar-client.ts +2 src/main/connector-cloud/connector-cloud-install.ts +5 src/main/connector-cloud/connector-token-mint.ts +1 src/main/connector-cloud/connector-turn-events.ts +6 src/main/copilot/hook-service.ts +4 src/main/crash-reporting/capture/appimage-crashpad-handler-exit.ts +1 src/main/crash-reporting/capture/crashpad-capture.ts +2 src/main/crash-reporting/process-exits/process-gone-diagnostics.ts +1 src/main/crash-reporting/process-exits/process-gone-recorder.ts +2 src/main/crash-reporting/reports/crash-feedback-diagnostic-bundle.ts +1 src/main/crash-reporting/reports/crash-report-store.ts +4 src/main/credentials/encrypted-api-key-file-store.ts +7 src/main/credentials/integration-credential-file.ts +1 src/main/credentials/integration-state-file-cache.ts +2 src/main/credentials/integration-token-file-cache.ts +1 src/main/cursor-accounts/status.ts +6 src/main/cursor/hook-service.ts +3 src/main/daemon/admission/automatic-work-run-marker-store.ts +2 src/main/daemon/admission/daemon-process-growth-monitor.ts +6 src/main/daemon/admission/host-terminal-ledger.ts +1 src/main/daemon/admission/host-terminal-policy.ts +1 src/main/daemon/admission/legacy-restore-records.ts +13 src/main/daemon/daemon-entry.ts +7 src/main/daemon/endpoint/identity/daemon-pid-identity.ts +1 src/main/daemon/endpoint/identity/daemon-process-inspection.ts +4 src/main/daemon/endpoint/identity/daemon-process-start-time.ts +6 src/main/daemon/endpoint/publication/daemon-endpoint-lifecycle.ts +6 src/main/daemon/endpoint/publication/daemon-endpoint-ownership.ts +1 src/main/daemon/endpoint/publication/daemon-private-file-modes.ts +3 src/main/daemon/endpoint/publication/daemon-socket-endpoint-path.ts +4 src/main/daemon/executable-host/linux/daemon-appimage-generation-launch.ts +1 src/main/daemon/executable-host/linux/daemon-appimage-launch.ts +1 src/main/daemon/executable-host/macos/macos-daemon-bundle.ts +3 src/main/daemon/executable-host/macos/macos-daemon-launchd.ts +5 src/main/daemon/executable-host/macos/macos-retired-daemon-recovery.ts +11 src/main/daemon/executable-host/windows/daemon-host-build-inventory.ts +2 src/main/daemon/executable-host/windows/daemon-host-file-hash-cache.ts +1 src/main/daemon/executable-host/windows/daemon-host-reclaim.ts +18 src/main/daemon/executable-host/windows/daemon-host-relocation.ts +4 src/main/daemon/health/daemon-health.ts +3 src/main/daemon/health/daemon-liveness-report.ts +5 src/main/daemon/history/restoration/history-reader.ts +16 src/main/daemon/history/storage/history-manager.ts +3 src/main/daemon/history/storage/terminal-history-file-reader.ts +6 src/main/daemon/history/storage/terminal-history-metadata.ts +4 src/main/daemon/history/storage/terminal-history-permission-repair.ts +2 src/main/daemon/history/storage/terminal-history-recovery-quarantine.ts +2 src/main/daemon/history/storage/terminal-history-session-files.ts +3 src/main/daemon/history/storage/terminal-history-session-tombstone.ts +3 src/main/daemon/history/storage/terminal-history-session-writer.ts +1 src/main/daemon/launch/daemon-bundle-staleness.ts +5 src/main/daemon/launch/daemon-endpoint-adoption.ts +7 src/main/daemon/launch/daemon-generation-liveness.ts +3 src/main/daemon/launch/daemon-launch-paths.ts +1 src/main/daemon/launch/daemon-launched-child-spawn.ts +8 src/main/daemon/launch/daemon-launched-child.ts +20 src/main/daemon/launch/daemon-out-of-process-launcher.ts +5 src/main/daemon/launch/daemon-protocol-cleanup.ts +13 src/main/daemon/launch/daemon-replacement-preflight.ts +6 src/main/daemon/launch/daemon-spawner.ts +8 src/main/daemon/launch/daemon-stale-kill.ts +4 src/main/daemon/launch/local-terminal-daemon-stop.ts +5 src/main/daemon/observability/daemon-adoption-telemetry-event.ts +1 src/main/daemon/observability/daemon-file-log.ts +2 src/main/daemon/permissions/daemon-tcc-attribution.ts +11 src/main/daemon/process-scopes/daemon-cgroup-scope.ts +1 src/main/daemon/process-scopes/daemon-rttime-limit.ts +3 src/main/daemon/process-scopes/terminal-scopes-runtime.ts +2 src/main/daemon/process-scopes/terminal-scopes.ts +3 src/main/daemon/providers/adapter/daemon-pty-daemon-recovery.ts +1 src/main/daemon/providers/adapter/daemon-pty-runtime-state.ts +1 src/main/daemon/providers/adapter/daemon-pty-session-control.ts +6 src/main/daemon/providers/adapter/daemon-pty-session-spawn.ts +18 src/main/daemon/providers/lifecycle/daemon-provider-init.ts +7 src/main/daemon/providers/lifecycle/daemon-provider-restart.ts +5 src/main/daemon/providers/lifecycle/daemon-provider-state.ts +4 src/main/daemon/providers/lifecycle/daemon-severed-restart.ts +1 src/main/daemon/providers/lifecycle/daemon-uninstall-shutdown.ts +3 src/main/daemon/providers/routing/daemon-legacy-adapters.ts +8 src/main/daemon/providers/routing/daemon-newer-protocol-hold.ts +2 src/main/daemon/providers/routing/daemon-unlisted-session.ts +1 src/main/daemon/providers/wsl/daemon-wsl-bridge-boot-identity.ts +2 src/main/daemon/pty-subprocess/native-pty-spawn.ts +5 src/main/daemon/pty-subprocess/pty-subprocess.ts +4 src/main/daemon/pty-subprocess/shell-launch-plan.ts +3 src/main/daemon/pty-subprocess/spawn-file-child-processes.ts +2 src/main/daemon/pty-subprocess/spawn-file-foreground-process.ts +10 src/main/daemon/pty-subprocess/spawn-preflight.ts +1 src/main/daemon/server/daemon-request-router.ts +2 src/main/daemon/server/daemon-server.ts +1 src/main/daemon/server/daemon-session-background-routing.ts +1 src/main/daemon/server/daemon-terminal-admission.ts +7 src/main/daemon/shell-readiness/shell-ready.ts +1 src/main/daemon/terminal-host/terminal-host-session-create.ts +1 src/main/daemon/terminal-host/terminal-host-session-process.ts +2 src/main/daemon/terminal-host/terminal-host-session-publish.ts +1 src/main/daemon/transport/client/daemon-client-socket-connect.ts +3 src/main/daemon/transport/client/daemon-client.ts +1 src/main/daemon/transport/stream/daemon-stream-data-batcher.ts +2 src/main/daemon/transport/stream/daemon-stream-droppable-membership.ts +1 src/main/daemon/transport/stream/daemon-stream-keep-tail-drop.ts +6 src/main/devin/hook-service.ts +2 src/main/diagnostics/main-thread-churn-probe.ts +6 src/main/droid/hook-service.ts +11 src/main/dsh/hook-service.ts +2 src/main/emulator/android/android-avd-boot.ts +2 src/main/emulator/android/android-command-runner.ts +1 src/main/emulator/android/android-sdk-host-discovery.ts +1 src/main/emulator/android/android-sdk-state.ts +5 src/main/emulator/android/scrcpy-server-download.ts +10 src/main/emulator/android/scrcpy-stream-session.ts +3 src/main/emulator/backends/android-emulator-backend.ts +4 src/main/emulator/backends/ios-emulator-backend.ts +2 src/main/emulator/emulator-probe.ts +4 src/main/emulator/serve-sim-execution.ts +9 src/main/emulator/serve-sim-runtime-materializer.ts +1 src/main/emulator/simctl-simulator-devices.ts +2 src/main/environment-doctor/environment-doctor-host.ts +4 src/main/environment-providers/shell-recipe-driver.ts +2 src/main/ephemeral-vm/failed-start-cleanup.ts +6 src/main/ephemeral-vm/owned-runtime-cleanup.ts +2 src/main/ephemeral-vm/recipe-vm-asleep.ts +4 src/main/ephemeral-vm/recipe-workspace-removal-wiring.ts +2 src/main/ephemeral-vm/runtime-attachment.ts +21 src/main/ephemeral-vm/runtime-provisioning-persistence.ts +19 src/main/ephemeral-vm/runtime-service.ts +9 src/main/ephemeral-vm/runtime-ssh-cleanup.ts +4 src/main/ephemeral-vm/workspace-removal.ts +8 src/main/ephemeral-vm/workspace-resume.ts +3 src/main/ephemeral-vm/workspace-suspend.ts +8 src/main/external-editors/external-editor-launch.ts +1 src/main/external-editors/remote-ssh-editor-launch.ts +28 src/main/filesystem/atomic-file-publication.ts +5 src/main/filesystem/durable-file-write.ts +2 src/main/filesystem/local-file-io/filesystem-path-containment.ts +2 src/main/filesystem/rolling-file-backup.ts +1 src/main/foreign-sqlite-readers/foreign-sqlite-reader-entry-path.ts +5 src/main/foreign-sqlite-readers/foreign-sqlite-reader-spawn.ts +6 src/main/gemini/hook-service.ts +1 src/main/git/command-runner/git-environment/git-ssh-policy-env.ts +1 src/main/git/command-runner/git-exec-file-sync.ts +3 src/main/git/command-runner/git-exec-file.ts +4 src/main/git/command-runner/host-routing/git-command-resolution.ts +1 src/main/git/command-runner/host-routing/wsl-aware-spawn.ts +5 src/main/git/command-runner/host-routing/wsl-command-resolution.ts +2 src/main/git/command-runner/host-routing/wsl-drive-checkout-git-routing.ts +2 src/main/git/command-runner/host-routing/wsl-git-read-environment.ts +9 src/main/git/command-runner/host-routing/wsl-windows-checkout-git-probe.ts +1 src/main/git/command-runner/hosted-cli/default-wsl-cli-fallback.ts +2 src/main/git/command-runner/hosted-cli/gh-exec-file.ts +2 src/main/git/command-runner/hosted-cli/gh-executable-absence-batch.ts +2 src/main/git/command-runner/hosted-cli/glab-exec-file.ts +4 src/main/git/command-runner/process-capture/command-exec-file.ts +1 src/main/git/command-runner/process-capture/exec-file-capture-to-termination.ts +3 src/main/git/command-runner/process-capture/exec-file-capture.ts +1 src/main/git/command-runner/process-capture/worker-exec-file.ts +1 src/main/git/command-runner/process-capture/wsl-process-group-termination.ts +22 src/main/git/repositories/discovery/repo-detection.ts +16 src/main/git/repositories/discovery/repo-git-marker-scan.ts +2 src/main/git/worktrees/catalog/worktree-git-path.ts +1 src/main/git/worktrees/catalog/wsl-worktree-git-path.ts +3 src/main/git/worktrees/content-paths/worktree-shared-directories.ts +1 src/main/github/accounts/account-binding-required-host.ts +1 src/main/github/client/fetch/repo-slug-upstream.ts +17 src/main/github/pr-watch/pr-head-evaluation.ts +3 src/main/github/pr-watch/pr-pending-actions.ts +1 src/main/github/pr-watch/pr-push-remote-resolution.ts +18 src/main/github/pr-watch/pr-watch-storage.ts +3 src/main/github/pr-watch/pr-watch-tables.ts +1 src/main/github/repositories/github-api-repository-remote-probe.ts +1 src/main/github/repositories/github-enterprise-repository.ts +1 src/main/github/repositories/github-repository-identity.ts +5 src/main/github/repositories/github-ssh-host-alias-resolution.ts +1 src/main/grok-accounts/status.ts +1 src/main/grok/grok-hook-backup-cleanup.ts +1 src/main/grok/grok-text-task.ts +1 src/main/grok/grok-transcript-import.ts +17 src/main/grok/hook-service.ts +1 src/main/hang-watchdog/hang-detection-marker.ts +1 src/main/hang-watchdog/main-thread-hang-watchdog.ts +6 src/main/hang-watchdog/previous-hang-detection.ts +4 src/main/hang-watchdog/renderer-hang-records.ts +4 src/main/hermes/hermes-acp-launch-spec.ts +4 src/main/hermes/hermes-default-home.ts +15 src/main/hermes/hermes-home-filesystem.ts +3 src/main/hermes/hermes-transcript-import.ts +27 src/main/hermes/hook-service.ts +2 src/main/host/deferred-secret-protection-report.ts +1 src/main/host/electron-speech-services.ts +1 src/main/host/secret-protection-report.ts +14 src/main/index.ts +2 src/main/ipc/accounts/codex-accounts.ts +1 src/main/ipc/accounts/codex-config-sync.ts +1 src/main/ipc/accounts/cursor-accounts.ts +1 src/main/ipc/accounts/grok-accounts.ts +5 src/main/ipc/accounts/minimax-credentials.ts +3 src/main/ipc/accounts/zcode-plan-credentials.ts +1 src/main/ipc/ai-vault/ai-vault-search.ts +1 src/main/ipc/ai-vault/ai-vault-subagent-list.ts +6 src/main/ipc/app.ts +1 src/main/ipc/automations.ts +3 src/main/ipc/browser/browser-client-host-cookie-import-ipc.ts +1 src/main/ipc/browser/browser-extensions.ts +1 src/main/ipc/browser/browser-passwords-import-ipc.ts +1 src/main/ipc/browser/browser-passwords-ipc.ts +8 src/main/ipc/browser/browser-session-profile-ipc.ts +1 src/main/ipc/browser/browser.ts +7 src/main/ipc/cli.ts +1 src/main/ipc/command-path/command-path-directory-worker-client.ts +2 src/main/ipc/computer-use-permissions.ts +2 src/main/ipc/custom-app-icon.ts +22 src/main/ipc/diagnostics.ts +1 src/main/ipc/emulator/emulator-video-stream.ts +6 src/main/ipc/ephemeral-vm/ephemeral-vm-recipe-context.ts +7 src/main/ipc/ephemeral-vm/ephemeral-vm-runtime-handlers.ts +11 src/main/ipc/ephemeral-vm/ephemeral-vm.ts +15 src/main/ipc/filesystem/access/filesystem-auth.ts +20 src/main/ipc/filesystem/access/local-file-access-resolution.ts +3 src/main/ipc/filesystem/filesystem.ts +6 src/main/ipc/filesystem/mutations/filesystem-mutations.ts +3 src/main/ipc/filesystem/mutations/filesystem-write-handlers.ts +1 src/main/ipc/filesystem/reads/filesystem-chunk-read-handler.ts +8 src/main/ipc/filesystem/reads/filesystem-read-handlers.ts +2 src/main/ipc/filesystem/reads/local-log-tail.ts +1 src/main/ipc/filesystem/search/filesystem-content-search-handler.ts +2 src/main/ipc/filesystem/search/filesystem-list-files.ts +2 src/main/ipc/filesystem/search/filesystem-search-file-paths.ts +1 src/main/ipc/filesystem/search/markdown-documents.ts +1 src/main/ipc/filesystem/source-control/filesystem-git-commit-generation-handlers.ts +4 src/main/ipc/filesystem/source-control/filesystem-git-diff-handlers.ts +1 src/main/ipc/filesystem/source-control/filesystem-git-history-handlers.ts +8 src/main/ipc/filesystem/source-control/filesystem-git-index-handlers.ts +1 src/main/ipc/filesystem/source-control/filesystem-git-model-discovery-handlers.ts +1 src/main/ipc/filesystem/source-control/filesystem-git-pull-request-generation-handlers.ts +6 src/main/ipc/filesystem/source-control/filesystem-git-status-handlers.ts +2 src/main/ipc/filesystem/source-control/filesystem-source-control-ai-targets.ts +2 src/main/ipc/filesystem/watcher-process/child-lifecycle/parcel-watcher-child-launch.ts +1 src/main/ipc/filesystem/watcher-process/child-lifecycle/parcel-watcher-child-slot.ts +3 src/main/ipc/filesystem/watcher-process/parcel-watcher-entry-path.ts +6 src/main/ipc/filesystem/watcher-process/supervision/parcel-watcher-process-supervisor.ts +1 src/main/ipc/filesystem/watcher-process/supervision/parcel-watcher-supervisor-disposal.ts +1 src/main/ipc/filesystem/watcher-process/supervision/parcel-watcher-supervisor-subscribe.ts +1 src/main/ipc/filesystem/watchers/filesystem-watcher-wsl.ts +1 src/main/ipc/filesystem/watchers/wsl-watcher-spawn.ts +3 src/main/ipc/hooks/register-worktree-hook-check-handler.ts +2 src/main/ipc/hooks/register-worktree-hook-file-handlers.ts +3 src/main/ipc/jira/register-handlers.ts +1 src/main/ipc/keyboard/macos-keyboard-layout-snapshot.ts +1 src/main/ipc/linear/custom-view-handlers.ts +7 src/main/ipc/linear/issue-handlers.ts +2 src/main/ipc/linear/project-handlers.ts +4 src/main/ipc/linear/register-handlers.ts +4 src/main/ipc/linear/team-handlers.ts +1 src/main/ipc/memory.ts +1 src/main/ipc/native-chat.ts +7 src/main/ipc/notebook.ts +1 src/main/ipc/notifications/notification-authorization-status.ts +2 src/main/ipc/notifications/notifications.ts +5 src/main/ipc/orca-uninstall.ts +4 src/main/ipc/plugins/plugins.ts +3 src/main/ipc/preflight/preflight-command-exec.ts +1 src/main/ipc/preflight/preflight-local-env.ts +1 src/main/ipc/preflight/preflight-wsl-agent-detection.ts +1 src/main/ipc/preflight/preflight-wsl-command.ts +5 src/main/ipc/profiles/orca-profile-org-members-handlers.ts +18 src/main/ipc/profiles/orca-profiles.ts +2 src/main/ipc/pty/delivery/producer-sync.ts +2 src/main/ipc/pty/delivery/wire-session.ts +8 src/main/ipc/pty/host-env/assembly.ts +6 src/main/ipc/pty/host-env/codex-home.ts +2 src/main/ipc/pty/host-env/opencode-config.ts +3 src/main/ipc/pty/host-env/pi-agent.ts +2 src/main/ipc/pty/host-env/spawn-host-env.ts +1 src/main/ipc/pty/host-env/spawn-startup-target.ts +2 src/main/ipc/pty/ipc/claude-diff-panel-notice.ts +2 src/main/ipc/pty/ipc/codex-shared-server.ts +1 src/main/ipc/pty/ipc/newer-daemon-hold.ts +2 src/main/ipc/pty/ipc/pty-management.ts +2 src/main/ipc/pty/ipc/spawn-env.ts +1 src/main/ipc/pty/ipc/spawn-run.ts +2 src/main/ipc/pty/provider/local-configure.ts +3 src/main/ipc/pty/register-handlers.ts +1 src/main/ipc/pty/register-headless-runtime.ts +1 src/main/ipc/pty/runtime/spawn-options.ts +1 src/main/ipc/pty/runtime/spawn.ts +1 src/main/ipc/pty/spawn/spawn-begin.ts +1 src/main/ipc/pty/spawn/spawn-options-assembly.ts +17 src/main/ipc/register-core-handlers/register-core-handlers.ts +1 src/main/ipc/register-core-handlers/runtime-host-handler-registration.ts +2 src/main/ipc/renderer-shutdown-checkpoint.ts +5 src/main/ipc/repos.ts +2 src/main/ipc/repos/local-repo-registration.ts +1 src/main/ipc/repos/nested-repo-import-handler.ts +1 src/main/ipc/repos/nested-repo-scan-ipc.ts +2 src/main/ipc/repos/project-host-setup-handlers.ts +2 src/main/ipc/repos/repo-clone-lifecycle.ts +2 src/main/ipc/repos/repo-creation-handlers.ts +1 src/main/ipc/repos/repo-update-handler.ts +2 src/main/ipc/runtime-environments/catalog/runtime-environment-preference.ts +1 src/main/ipc/runtime-environments/managed-orcad/managed-orcad-actions.ts +1 src/main/ipc/runtime-environments/managed-orcad/orcad-runtime-lifecycle-handlers.ts +1 src/main/ipc/runtime-environments/managed-orcad/runtime-environment-recipe-vm-wake.ts +1 src/main/ipc/runtime-environments/mobile-relay/runtime-environment-mobile-relay-hosts.ts +1 src/main/ipc/runtime-environments/runtime-environments.ts +2 src/main/ipc/session.ts +3 src/main/ipc/settings/settings.ts +3 src/main/ipc/shell/shell.ts +3 src/main/ipc/source-control/bitbucket.ts +5 src/main/ipc/source-control/hosted-review.ts +5 src/main/ipc/speech.ts +3 src/main/ipc/ssh/plain-ssh-terminal-handlers.ts +2 src/main/ipc/ssh/ssh-connection-handlers.ts +2 src/main/ipc/ssh/ssh-host-server-on-connect-wiring.ts +2 src/main/ipc/ssh/ssh-target-crud-handlers.ts +2 src/main/ipc/ssh/ssh.ts +1 src/main/ipc/workspace-cleanup/workspace-cleanup-git-evidence.ts +1 src/main/ipc/workspace-cleanup/workspace-cleanup-worktree-listing.ts +1 src/main/ipc/workspace-space/workspace-space.ts +3 src/main/ipc/worktrees.ts +3 src/main/ipc/worktrees/create/register-worktree-create-handlers.ts +3 src/main/ipc/worktrees/floating-workspace-directory.ts +1 src/main/ipc/worktrees/listing/detected-provider-listing.ts +3 src/main/ipc/worktrees/listing/detected-worktree-scan-cache.ts +11 src/main/ipc/worktrees/listing/folder-repo-git-upgrade.ts +1 src/main/ipc/worktrees/listing/ssh-worktree-fallback.ts +2 src/main/ipc/worktrees/removal/execute-worktree-removal.ts +1 src/main/ipc/worktrees/removal/register-worktree-removal-handlers.ts +1 src/main/ipc/worktrees/removal/registered-worktree-root-match.ts +1 src/main/ipc/worktrees/removal/registered-worktree-root-probes.ts +3 src/main/ipc/worktrees/removal/registered-worktree-roots-cache.ts +1 src/main/ipc/worktrees/removal/remove-folder-workspace.ts +1 src/main/ipc/worktrees/removal/remove-registered-local-worktree.ts +2 src/main/ipc/worktrees/removal/remove-unregistered-worktree.ts +1 src/main/ipc/worktrees/removal/worktree-removal-filesystem.ts +1 src/main/ipc/worktrees/removal/worktree-removal-ownership.ts +6 src/main/ipc/worktrees/worktree-remote.ts +1 src/main/ipc/wsl/wsl-drive-project-handlers.ts +4 src/main/ipc/wsl/wsl-drive-unc-conversion-handlers.ts +2 src/main/ipc/wsl/wsl-host-automation-wake-wiring.ts +8 src/main/ipc/wsl/wsl-host-handlers.ts +6 src/main/ipc/wsl/wsl-move-driver-wiring.ts +3 src/main/ipc/wsl/wsl-move-orchestrator-wiring.ts +1 src/main/ipc/wsl/wsl-move-release-here.ts +2 src/main/ipc/wsl/wsl-move-undo-wiring.ts +8 src/main/jcode/hook-service.ts +8 src/main/jira/client.ts +1 src/main/jira/jira-issue-comments.ts +5 src/main/jira/jira-issue-create-metadata.ts +3 src/main/jira/jira-issue-mutations.ts +1 src/main/jira/jira-issue-read.ts +1 src/main/jira/jira-issue-search.ts +1 src/main/jira/jira-project-queries.ts +2 src/main/jira/jira-transition-queries.ts +8 src/main/jira/site-credential-store.ts +1 src/main/jsonl-rpc/agent-connection.ts +10 src/main/keybindings/keybinding-file.ts +4 src/main/keybindings/keybinding-service.ts +6 src/main/kimi/hook-service.ts +8 src/main/kiro/hook-service.ts +5 src/main/kiro/standalone-hooks.ts +19 src/main/linear/accounts/linear-account-client.ts +1 src/main/linear/accounts/linear-legacy-viewer-store.ts +16 src/main/linear/accounts/linear-token-store.ts +12 src/main/linear/accounts/linear-workspace-registry.ts +4 src/main/linear/custom-views/linear-custom-view-queries.ts +1 src/main/linear/issues/context/issue-context-children.ts +2 src/main/linear/issues/context/issue-context-relations.ts +9 src/main/linear/issues/context/issue-context-resolution.ts +3 src/main/linear/issues/context/issue-context-sections.ts +1 src/main/linear/issues/context/read-issue-context.ts +1 src/main/linear/issues/issue-relation-write.ts +6 src/main/linear/issues/linear-issue-comments.ts +4 src/main/linear/issues/linear-issue-listing.ts +6 src/main/linear/issues/linear-issue-lookups.ts +4 src/main/linear/issues/linear-issue-mutations.ts +2 src/main/linear/issues/linear-issue-write-support.ts +1 src/main/linear/issues/mcp-issue-list.ts +2 src/main/linear/projects/linear-project-collection-read.ts +1 src/main/linear/projects/linear-project-issue-queries.ts +4 src/main/linear/projects/linear-project-queries.ts +1 src/main/linear/projects/linear-project-team-queries.ts +11 src/main/linear/teams/linear-team-queries.ts +7 src/main/macos-permissions/macos-tcc-prompt-notice.ts +7 src/main/managed-data-accounts/credential-capture.ts +1 src/main/managed-data-accounts/profile-removal.ts +2 src/main/managed-data-accounts/service.ts +2 src/main/managed-server/activation/orcad-activation-fence-hold.ts +15 src/main/managed-server/activation/orcad-activation-lock.ts +1 src/main/managed-server/activation/orcad-activation-recovery.ts +3 src/main/managed-server/activation/orcad-exited-own-lock.ts +5 src/main/managed-server/activation/orcad-held-fence-tokens.ts +1 src/main/managed-server/activation/orcad-installed-activation.ts +1 src/main/managed-server/install/orcad-local-build-hash.ts +1 src/main/managed-server/install/orcad-remote-decommission.ts +6 src/main/managed-server/install/orcad-remote-deploy.ts +4 src/main/managed-server/install/orcad-remote-install.ts +1 src/main/managed-server/install/orcad-remote-rollback.ts +4 src/main/managed-server/lifecycle/orcad-managed-auto-update.ts +1 src/main/managed-server/lifecycle/orcad-managed-launch-session.ts +1 src/main/managed-server/lifecycle/orcad-managed-runtime-context.ts +1 src/main/managed-server/lifecycle/orcad-managed-stale-lock-reclaim.ts +1 src/main/managed-server/lifecycle/orcad-managed-tunnel-transport.ts +4 src/main/managed-server/lifecycle/orcad-managed-wake.ts +1 src/main/managed-server/lifecycle/orcad-runtime-conversion.ts +1 src/main/managed-server/lifecycle/orcad-runtime-decommission.ts +3 src/main/managed-server/lifecycle/orcad-runtime-deployment.ts +3 src/main/managed-server/lifecycle/orcad-runtime-maintenance.ts +1 src/main/managed-server/lifecycle/orcad-runtime-status.ts +1 src/main/managed-server/migration/cutover/orcad-unreachable-setup-release.ts +1 src/main/media/local-preview-grant-file.ts +1 src/main/media/media-preview-protocol.ts +3 src/main/memory/collector.ts +1 src/main/memory/darwin-process-footprint.ts +1 src/main/memory/hydrate-local-pty-registry.ts +13 src/main/mimo/hook-service.ts +1 src/main/minimax/minimax-api-key-store.ts +4 src/main/minimax/minimax-cookie-store.ts +13 src/main/minimax/minimax-credential-commands.ts +1 src/main/muse-usage/muse-usage-provider.ts +1 src/main/muse-usage/store.ts +8 src/main/muse/hook-service.ts +5 src/main/native-chat/agent-launch/structured-agent-command-resolution.ts +1 src/main/native-chat/agent-model-catalog/agent-model-catalog-probe-runner.ts +1 src/main/native-chat/agent-model-catalog/agent-model-catalog-refresh.ts +1 src/main/native-chat/agent-model-catalog/agent-model-catalog-scope.ts +4 src/main/native-chat/agent-session-attachments/agent-session-attachment-claims.ts +1 src/main/native-chat/agent-session-journal/context-epochs/journal-context-cursor.ts +12 src/main/native-chat/agent-session-journal/database/journal-database.ts +12 src/main/native-chat/agent-session-journal/database/journal-domain-database.ts +2 src/main/native-chat/agent-session-journal/database/journal-domain-migrations.ts +8 src/main/native-chat/agent-session-journal/database/journal-domain-profile-import.ts +3 src/main/native-chat/agent-session-journal/database/journal-host-database.ts +40 src/main/native-chat/agent-session-journal/database/journal-legacy-reconcile.ts +1 src/main/native-chat/agent-session-journal/database/journal-legacy-source-receipt.ts +4 src/main/native-chat/agent-session-journal/database/journal-legacy-source.ts +1 src/main/native-chat/agent-session-journal/durable-rows/journal-row-table.ts +2 src/main/native-chat/agent-session-journal/history-import/adopted-transcript-source.ts +1 src/main/native-chat/agent-session-journal/history-import/journal-hermes-import.ts +5 src/main/native-chat/agent-session-journal/history-import/journal-legacy-import.ts +2 src/main/native-chat/agent-session-journal/input-order/journal-input-conversion.ts +1 src/main/native-chat/agent-session-journal/journal-domain-import-discard.ts +10 src/main/native-chat/agent-session-journal/journal-domain-import-rows.ts +1 src/main/native-chat/agent-session-journal/journal-domain-import-submissions.ts +7 src/main/native-chat/agent-session-journal/journal-domain-import.ts +1 src/main/native-chat/agent-session-journal/journal-domain-input-eligibility.ts +2 src/main/native-chat/agent-session-journal/journal-domain-item-display.ts +1 src/main/native-chat/agent-session-journal/journal-domain-queue-failures.ts +2 src/main/native-chat/agent-session-journal/journal-domain-queue-pauses.ts +6 src/main/native-chat/agent-session-journal/journal-domain-queue-reads.ts +1 src/main/native-chat/agent-session-journal/journal-domain-schema.ts +2 src/main/native-chat/agent-session-journal/journal-domain-stop-notes.ts +2 src/main/native-chat/agent-session-journal/journal-domain-submission-consume.ts +1 src/main/native-chat/agent-session-journal/journal-forgotten-chats.ts +11 src/main/native-chat/agent-session-journal/journal-sql-queue-read.ts +1 src/main/native-chat/agent-session-journal/journal-sql-queued-messages.ts +2 src/main/native-chat/agent-session-journal/journal-sql-status-context.ts +1 src/main/native-chat/agent-session-journal/journal-sql-status-items.ts +1 src/main/native-chat/agent-session-journal/journal-sql-work-read.ts +3 src/main/native-chat/agent-session-journal/journal-stored-output-rows.ts +2 src/main/native-chat/agent-session-journal/outcomes/journal-outcome-format.ts +2 src/main/native-chat/agent-session-journal/outcomes/journal-outcome-table.ts +1 src/main/native-chat/agent-session-journal/queued-messages/journal-queue-import.ts +1 src/main/native-chat/agent-session-journal/replay/journal-historical-inputs.ts +13 src/main/native-chat/agent-session-journal/replay/journal-open.ts +4 src/main/native-chat/agent-session-journal/replay/journal-read-row.ts +2 src/main/native-chat/agent-session-journal/replay/journal-retained-inputs.ts +3 src/main/native-chat/agent-session-journal/replay/journal-stored-cursor.ts +3 src/main/native-chat/agent-session-journal/writing/command-receipt-table.ts +1 src/main/native-chat/agent-session-journal/writing/command-receipt-transaction.ts +2 src/main/native-chat/agent-session-journal/writing/journal-row-writer.ts +1 src/main/native-chat/agent-session-journal/writing/mail-withdrawal-receipts.ts +1 src/main/native-chat/agent-session-wire/acquisition/imported-agent-session-fork-tip.ts +1 src/main/native-chat/agent-session-wire/acquisition/structured-agent-session-adopted-import.ts +2 src/main/native-chat/agent-session-wire/operations/structured-agent-session-command-receipt.ts +2 src/main/native-chat/conversation-adoption/codex-adoption-preparation.ts +1 src/main/native-chat/conversation-adoption/structured-agent-cli-conversations.ts +3 src/main/native-chat/conversation-files/native-chat-media-path.ts +3 src/main/native-chat/session-file-resolver.ts +1 src/main/native-chat/transcript-discovery/host-readable-transcript-path.ts +1 src/main/native-chat/transcript-discovery/transcript-path-admission.ts +3 src/main/native-chat/transcript-filesystem/process/wsl-transcript-fs-process-dispatch.ts +1 src/main/native-chat/transcript-filesystem/process/wsl-transcript-fs-process-spawn.ts +2 src/main/native-chat/transcript-filesystem/wsl-transcript-fs-access.ts +2 src/main/native-chat/transcript-history/codex/codex-rollout-history-source.ts +7 src/main/native-chat/transcript-history/hermes/transcript-hermes-sqlite.ts +4 src/main/native-chat/transcript-history/opencode/transcript-opencode-database.ts +7 src/main/native-chat/transcript-history/opencode/transcript-opencode-sqlite-query.ts +4 src/main/native-chat/transcript-history/opencode/transcript-opencode.ts +2 src/main/native-chat/transcript-history/opencode/transcript-opencode2-fork-coverage.ts +2 src/main/native-chat/transcript-history/opencode/transcript-opencode2-sqlite.ts +1 src/main/native-chat/transcript-read-cache.ts +1 src/main/native-chat/transcript-reader.ts +1 src/main/native-chat/transcript-tail-reader.ts +3 src/main/native-chat/transcript-watch.ts +1 src/main/network/macos-tailscale-dns-diagnostic.ts +3 src/main/node-runtime/managed-runtime-installation.ts +1 src/main/node-runtime/managed-runtime-release-install.ts +1 src/main/node-runtime/managed-runtime-release.ts +9 src/main/notebook/python-environments.ts +4 src/main/observability/bundle.ts +4 src/main/observability/index.ts +4 src/main/observability/local-file-sink.ts +2 src/main/omp/omp-transcript-import.ts +1 src/main/opencode-usage/opencode-usage-provider.ts +1 src/main/opencode-usage/store.ts +1 src/main/opencode/accounts/opencode-go-api-key-store.ts +1 src/main/opencode/acp/opencode-acp-connection.ts +1 src/main/opencode/model-launch/opencode-launch-capabilities.ts +1 src/main/opencode/model-launch/opencode-launch-model-context.ts +2 src/main/opencode/opencode-private-server.ts +2 src/main/opencode/opencode-pty-launch.ts +3 src/main/opencode/startup-prompts/opencode-startup-prompt-installer.ts +10 src/main/opencode/status-hooks/hook-service.ts +2 src/main/opencode/status-hooks/legacy-plugin-acl-retry.ts +2 src/main/opencode/status-hooks/opencode-overlay-manifest.ts +7 src/main/opencode/status-hooks/opencode-plugin-config-writer.ts +1 src/main/opencode/status-hooks/overlay-dir-gc-lifecycle.ts +3 src/main/opencode/status-hooks/overlay-dir-gc.ts +1 src/main/opencode/text-tasks/opencode-text-task.ts +1 src/main/opencode/text-tasks/wsl/opencode-wsl-text-task-entry.ts +4 src/main/opencode/text-tasks/wsl/opencode-wsl-text-task.ts +3 src/main/opencode/transcripts/opencode-transcript-import.ts +7 src/main/orca-profiles/catalog/other-profile-workspace-catalog.ts +2 src/main/orca-profiles/catalog/profile-project-presence.ts +11 src/main/orca-profiles/cloud-auth/profile-artifact-cloud-cleanup.ts +1 src/main/orca-profiles/cloud-auth/profile-cloud-auth-status.ts +3 src/main/orca-profiles/cloud-auth/profile-cloud-capability-refresh.ts +11 src/main/orca-profiles/cloud-auth/profile-cloud-dev-service.ts +19 src/main/orca-profiles/cloud-auth/profile-cloud-index.ts +30 src/main/orca-profiles/cloud-auth/profile-cloud-service.ts +5 src/main/orca-profiles/cloud-org/profile-cloud-org-members-service.ts +2 src/main/orca-profiles/cloud-org/profile-cloud-org-selection.ts +19 src/main/orca-profiles/cloud-session/profile-cloud-session-owner.ts +6 src/main/orca-profiles/cloud-session/profile-cloud-session-refresh.ts +6 src/main/orca-profiles/cloud-session/profile-cloud-session-store.ts +20 src/main/orca-profiles/profile-index-store.ts +1 src/main/orca-profiles/profile-storage-paths.ts +6 src/main/orca-profiles/project-transfer/profile-active-transfer.ts +2 src/main/orca-profiles/project-transfer/profile-project-domain-move-intent.ts +10 src/main/orca-profiles/project-transfer/profile-project-domain-state.ts +13 src/main/orca-profiles/project-transfer/profile-project-move-intent.ts +2 src/main/orca-profiles/project-transfer/profile-project-move-record.ts +15 src/main/orca-profiles/project-transfer/profile-project-state-file.ts +2 src/main/orca-profiles/project-transfer/profile-project-transfer-migration.ts +13 src/main/orca-profiles/project-transfer/profile-project-transfer.ts +2 src/main/orca-profiles/storage/new-profile-state.ts +3 src/main/orca-profiles/storage/profile-legacy-state-import.ts +5 src/main/orcad/account-launch/orcad-account-services.ts +4 src/main/orcad/account-launch/orcad-codex-account-homes.ts +4 src/main/orcad/account-launch/orcad-host-account-launch-env-store.ts +2 src/main/orcad/account-launch/orcad-wsl-host-claude-profile-refresh.ts +3 src/main/orcad/artifact-slots/orcad-artifact-cache-retention.ts +1 src/main/orcad/artifact-slots/orcad-artifact-identity.ts +1 src/main/orcad/artifact-slots/orcad-artifact-materializer.ts +3 src/main/orcad/artifact-slots/orcad-daemon-slot-pins.ts +3 src/main/orcad/browser-providers/electron/electron-serve-browser-process.ts +1 src/main/orcad/browser-providers/electron/electron-sidecar-profile.ts +1 src/main/orcad/browser-providers/orcad-agent-browser-binary.ts +3 src/main/orcad/browser-providers/orcad-browser-provider.ts +1 src/main/orcad/browser-providers/orcad-browser-startup.ts +1 src/main/orcad/browser-providers/orcad-sidecar-runtime-client.ts +8 src/main/orcad/credentials/orcad-plaintext-credential-migration.ts +7 src/main/orcad/credentials/orcad-secret-key-record.ts +10 src/main/orcad/credentials/orcad-secret-key-resolution.ts +2 src/main/orcad/credentials/orcad-secret-store-startup.ts +3 src/main/orcad/credentials/orcad-secret-store.ts +3 src/main/orcad/daemon/orcad-daemon-supervision.ts +7 src/main/orcad/diagnostics/orcad-health.ts +1 src/main/orcad/diagnostics/orcad-observability.ts +2 src/main/orcad/host-lifecycle/idle-exit/orcad-idle-stop-record.ts +10 src/main/orcad/host-lifecycle/idle-exit/orcad-managed-idle-exit-host.ts +8 src/main/orcad/host-lifecycle/managed-stop/orcad-completed-stop-receipt.ts +1 src/main/orcad/host-lifecycle/managed-stop/orcad-managed-stop-admission.ts +3 src/main/orcad/host-lifecycle/managed-stop/orcad-managed-stop-cancellation.ts +8 src/main/orcad/host-lifecycle/managed-stop/orcad-managed-stop-command.ts +14 src/main/orcad/host-lifecycle/managed-stop/orcad-managed-stop-completion.ts +3 src/main/orcad/host-lifecycle/managed-stop/orcad-managed-stop-decision.ts +4 src/main/orcad/host-lifecycle/managed-stop/orcad-managed-stop-request.ts +3 src/main/orcad/host-lifecycle/managed-stop/orcad-stop-request-listener.ts +5 src/main/orcad/host-lifecycle/orcad-lifecycle.ts +3 src/main/orcad/host-runtime/orcad-entry.ts +5 src/main/orcad/host-runtime/orcad-host-adapters.ts +2 src/main/orcad/host-runtime/orcad-runtime-rpc.ts +2 src/main/orcad/host-runtime/orcad-session-scanner-idle.ts +1 src/main/orcad/host-runtime/orcad-session-search.ts +2 src/main/orcad/host-runtime/orcad-speech-services.ts +2 src/main/orcad/host-runtime/orcad-wsl-host-login-environment.ts +1 src/main/orcad/instance-lock/orcad-data-root-privacy.ts +5 src/main/orcad/instance-lock/orcad-instance-lock-hold.ts +14 src/main/orcad/instance-lock/orcad-instance-lock-reclaim.ts +1 src/main/orcad/instance-lock/orcad-instance-lock-record.ts +20 src/main/orcad/instance-lock/orcad-instance-lock.ts +1 src/main/orcad/instance-lock/orcad-lock-clone-machine.ts +2 src/main/orcad/instance-lock/orcad-lock-holder-locality.ts +7 src/main/orcad/instance-lock/orcad-process-start-time.ts +14 src/main/orcad/instance-lock/orcad-stale-lock-reclaim.ts +1 src/main/orcad/instance-lock/orcad-wsl-holder-release.ts +2 src/main/orcad/launcher.ts +9 src/main/orcad/main.ts +1 src/main/orcad/migration/orcad-migration-destination-capabilities.ts +3 src/main/orcad/migration/orcad-migration-wsl-destination.ts +2 src/main/orcad/native-runtime/node-pty-prebuilt-slot.ts +2 src/main/orcad/native-runtime/node-pty-precondition.ts +3 src/main/orcad/native-runtime/orcad-native-preflight.ts +9 src/main/orcad/native-runtime/orcad-runtime-native-preflight.ts +2 src/main/orcad/profile-state/orcad-host-identity-reset.ts +3 src/main/orcad/profile-state/orcad-profile-state-startup.ts +6 src/main/orcad/runtime-launch/orcad-bundled-runtime.ts +9 src/main/orcad/runtime-launch/orcad-profile-preflight.ts +1 src/main/orcad/runtime-launch/orcad-startup-qualification.ts +3 src/main/orcad/runtime-launch/windows-breakaway-launcher.ts +6 src/main/orcad/serve-startup/orcad-cli-launcher.ts +3 src/main/orcad/serve-startup/orcad-command-startup.ts +2 src/main/orcad/serve-startup/orcad-ws-port-policy.ts +8 src/main/persistence/loading-store/profile-loading/loaded-state-parsing.ts +2 src/main/persistence/loading-store/profile-loading/prepare-loaded-terminal-settings.ts +1 src/main/persistence/loading-store/project-catalog/repo-lifecycle-operations.ts +1 src/main/persistence/loading-store/store-runtime-state.ts +1 src/main/persistence/loading-store/store.ts +1 src/main/persistence/loading-store/user-data-path.ts +2 src/main/persistence/loading-store/workspace-sessions/session-snapshot-operations.ts +1 src/main/persistence/loading-store/workspace-sessions/terminal-session-cleanup.ts +2 src/main/persistence/loading-store/workspace-sessions/workspace-session-snapshot-publication.ts +5 src/main/persistence/migrating-orcad-catalog/blob-transfer/orcad-migration-blob-install-persistence.ts +11 src/main/persistence/migrating-orcad-catalog/blob-transfer/orcad-migration-blob-installers.ts +26 src/main/persistence/migrating-orcad-catalog/blob-transfer/orcad-migration-blob-staging.ts +6 src/main/persistence/migrating-orcad-catalog/blob-transfer/orcad-migration-staged-file.ts +1 src/main/persistence/migrating-orcad-catalog/catalog-commit/orcad-staged-automation-run-history.ts +6 src/main/persistence/migrating-orcad-catalog/cutover-journals/migration-journal-directory.ts +1 src/main/persistence/migrating-orcad-catalog/cutover-journals/orcad-migration-cutover-journal.ts +21 src/main/persistence/migrating-orcad-catalog/orcad-catalog-import.ts +2 src/main/persistence/migrating-orcad-catalog/source/catalog/orcad-source-export.ts +1 src/main/persistence/migrating-orcad-catalog/source/scrollback/orcad-source-scrollback-cleanup.ts +5 src/main/persistence/migrating-orcad-catalog/source/scrollback/orcad-source-scrollback-retention.ts +4 src/main/persistence/migrating-orcad-catalog/source/scrollback/orcad-source-scrollback-state.ts +1 src/main/persistence/migrating-orcad-catalog/source/sessions/orcad-source-workspace-session.ts +14 src/main/persistence/migrating-orcad-catalog/terminal-history/orcad-scrollback-snapshot-transfer.ts +16 src/main/persistence/migrating-orcad-catalog/terminal-history/orcad-shell-history-installer.ts +8 src/main/persistence/migrating-orcad-catalog/terminal-history/orcad-terminal-history-installer.ts +3 src/main/persistence/migrating-orcad-catalog/terminal-history/orcad-terminal-restore-hint-store.ts +1 src/main/persistence/moving-wsl-projects/cutover-recovery/wsl-move-cutover-journal.ts +1 src/main/persistence/moving-wsl-projects/cutover-recovery/wsl-move-owed-host-aborts.ts +1 src/main/persistence/moving-wsl-projects/desktop-state/wsl-move-desktop-rewrite-registry.ts +13 src/main/persistence/moving-wsl-projects/desktop-state/wsl-move-orchestration-history-rewrite.ts +1 src/main/persistence/moving-wsl-projects/execution/wsl-move-driver-transfer.ts +1 src/main/persistence/moving-wsl-projects/orchestration/wsl-move-orchestrator-store.ts +2 src/main/persistence/moving-wsl-projects/startup/wsl-move-startup.ts +1 src/main/persistence/moving-wsl-projects/wsl-move-driver.ts +1 src/main/persistence/preferences/active-view-preference.ts +5 src/main/persistence/profile-state/access/profile-state-access-identity.ts +26 src/main/persistence/profile-state/access/profile-state-access-owner.ts +7 src/main/persistence/profile-state/access/profile-state-access.ts +6 src/main/persistence/profile-state/automation-runs/profile-state-automation-runs-migration.ts +4 src/main/persistence/profile-state/automation-runs/profile-state-automation-runs-reader.ts +1 src/main/persistence/profile-state/automation-runs/profile-state-automation-runs-storage.ts +5 src/main/persistence/profile-state/automation-runs/profile-state-automation-runs-writer.ts +1 src/main/persistence/profile-state/automation-runs/profile-state-automation-runs.ts +5 src/main/persistence/profile-state/backup/profile-state-backup-job.ts +1 src/main/persistence/profile-state/backup/profile-state-backup-path.ts +2 src/main/persistence/profile-state/backup/profile-state-backup-rotation.ts +4 src/main/persistence/profile-state/backup/profile-state-backup-temporary-files.ts +5 src/main/persistence/profile-state/backup/profile-state-backup-worker.ts +1 src/main/persistence/profile-state/backup/profile-state-pre-migration-backup.ts +2 src/main/persistence/profile-state/database/profile-state-authority-marker.ts +1 src/main/persistence/profile-state/database/profile-state-database-publication.ts +3 src/main/persistence/profile-state/database/profile-state-database-snapshot.ts +8 src/main/persistence/profile-state/database/profile-state-database-validation.ts +16 src/main/persistence/profile-state/database/profile-state-database.ts +2 src/main/persistence/profile-state/database/profile-state-revision-readmission.ts +1 src/main/persistence/profile-state/database/profile-state-revision.ts +1 src/main/persistence/profile-state/database/profile-state-storage-classification.ts +3 src/main/persistence/profile-state/document-parts/profile-state-document-parts-reader.ts +9 src/main/persistence/profile-state/document-parts/profile-state-document-parts-storage.ts +9 src/main/persistence/profile-state/document-parts/profile-state-legacy-document-refresh.ts +5 src/main/persistence/profile-state/documents/profile-state-document-reader.ts +22 src/main/persistence/profile-state/documents/profile-state-documents.ts +8 src/main/persistence/profile-state/documents/profile-state-domain-reader.ts +12 src/main/persistence/profile-state/documents/profile-state-domain-writes.ts +7 src/main/persistence/profile-state/legacy-json/profile-state-authority-exports.ts +5 src/main/persistence/profile-state/legacy-json/profile-state-json-acceptance.ts +8 src/main/persistence/profile-state/legacy-json/profile-state-recovery.ts +5 src/main/persistence/profile-state/legacy-json/profile-state-versioned-export.ts +18 src/main/persistence/profile-state/offline-access/profile-state-offline-settings.ts +17 src/main/persistence/profile-state/profile-state-sqlite-authority.ts +2 src/main/persistence/profile-state/profile-state-worker-authority.ts +5 src/main/persistence/profile-state/recovery/profile-state-database-quarantine.ts +16 src/main/persistence/profile-state/recovery/profile-state-database-recovery.ts +36 src/main/persistence/profile-state/recovery/profile-state-recovery-command.ts +2 src/main/persistence/profile-state/recovery/profile-state-recovery-copy.ts +7 src/main/persistence/profile-state/recovery/profile-state-recovery-required.ts +16 src/main/persistence/profile-state/recovery/profile-state-section-repair.ts +13 src/main/persistence/profile-state/startup/profile-state-authority-bootstrap.ts +1 src/main/persistence/profile-state/startup/profile-state-live-store-factory.ts +9 src/main/persistence/profile-state/startup/profile-state-migration.ts +5 src/main/persistence/profile-state/startup/profile-state-runtime-preflight.ts +3 src/main/persistence/profile-state/startup/profile-state-startup-recovery-dialog.ts +2 src/main/persistence/profile-state/startup/profile-state-store-factory.ts +1 src/main/persistence/profile-state/writer/profile-state-writer-connection.ts +1 src/main/persistence/restoring-sessions/floating-workspace-normalization.ts +1 src/main/persistence/window-save-divergence.ts +13 src/main/pi/managed-extensions/legacy-omp-overlay-migration.ts +3 src/main/pi/managed-extensions/titlebar-extension-service.ts +2 src/main/pi/rpc/launch/rpc-launch-resolution.ts +1 src/main/plugins/appearance/plugin-appearance-service.ts +1 src/main/plugins/bootstrap/plugin-bundled-bootstrap.ts +1 src/main/plugins/catalog/plugin-marketplace-installer.ts +2 src/main/plugins/cli/plugin-cli-install-candidates.ts +5 src/main/plugins/development/plugin-dev-watcher.ts +4 src/main/plugins/installation/plugin-install.ts +2 src/main/plugins/installation/plugin-staged-install.ts +1 src/main/plugins/panels/frame-serving/plugin-frame-module-transform.ts +4 src/main/plugins/panels/guest-isolation/plugin-frame-guest-sessions.ts +1 src/main/plugins/panels/plugin-frame-protocol.ts +2 src/main/plugins/panels/plugin-source-transpile-client.ts +2 src/main/plugins/storage/plugin-secrets-store.ts +2 src/main/plugins/storage/plugin-storage-store.ts +2 src/main/ports/darwin-process-metadata.ts +7 src/main/ports/local-workspace-platform-port-scanner.ts +1 src/main/ports/local-workspace-port-scanner.ts +1 src/main/ports/port-scan-command-client.ts +3 src/main/preflight/agent-command-detection.ts +2 src/main/preflight/agent-detection.ts +1 src/main/preflight/installed-agent-detection.ts +1 src/main/project-groups/nested-repo-discovery.ts +2 src/main/provider-process/managed-provider-process.ts +2 src/main/provider-process/provider-executable-missing.ts +1 src/main/provider-process/provider-ownership-journal.ts +1 src/main/provider-process/provider-process-spawn.ts +1 src/main/provider-process/supervised-provider-child-location.ts +4 src/main/providers/accounts/provider-account-services.ts +1 src/main/providers/execution-host-provider-dispatch.ts +2 src/main/providers/foreground/agent-process.ts +1 src/main/providers/foreground/windows/process-rows.ts +1 src/main/providers/foreground/windows/shell-alone-in-job.ts +1 src/main/providers/git/local-provider.ts +5 src/main/providers/local-pty/local-pty-executable-spawn.ts +3 src/main/providers/local-pty/local-pty-finalize-environment.ts +8 src/main/providers/local-pty/local-pty-launch-plan.ts +2 src/main/providers/local-pty/local-pty-provider.ts +1 src/main/providers/local-pty/local-pty-runtime-spawn.ts +2 src/main/providers/local-pty/local-pty-session-activation.ts +1 src/main/providers/local-pty/local-pty-session-operations.ts +4 src/main/providers/local-pty/local-pty-shell-ready-wrapper-generation.ts +8 src/main/providers/local-pty/local-pty-shell-ready.ts +6 src/main/providers/local-pty/local-pty-spawn.ts +2 src/main/providers/local-pty/local-pty-termination.ts +4 src/main/providers/shell-launch/macos/tcc-login-shell.ts +8 src/main/providers/shell-launch/windows/powershell-executable.ts +3 src/main/providers/shell-launch/windows/shell-args.ts +1 src/main/providers/shell-launch/windows/shell-fallback-chain.ts +4 src/main/providers/shell-launch/windows/windows-interactive-login-spawn.ts +3 src/main/pty/history/fish-history-session.ts +1 src/main/pty/history/history-gc-worktree-ids.ts +23 src/main/pty/history/terminal-history-deletion.ts +13 src/main/pty/history/terminal-history-gc.ts +1 src/main/pty/history/terminal-history-session-folder-gc.ts +6 src/main/pty/history/terminal-history.ts +2 src/main/pty/process-retirement/posix-pty-process-groups.ts +3 src/main/pty/scrollback/overlay-mirror.ts +2 src/main/pty/scrollback/terminal-scrollback-snapshots.ts +1 src/main/pty/shell-startup/codex-shell-launch-preflight.ts +3 src/main/pty/shell-startup/git-bash.ts +4 src/main/pty/shell-startup/legacy-terminal-posix-tombstone.ts +10 src/main/pty/shell-startup/legacy-terminal-shim-dir.ts +1 src/main/pty/shell-startup/powershell-profile-env.ts +10 src/main/pty/shell-startup/shell-startup-env.ts +3 src/main/pty/shell-startup/zsh-startup-hook-pty-harness.ts +3 src/main/pty/shell-startup/zsh-wrapper-dir-ownership.ts +2 src/main/qoder/workspace-trust.ts +1 src/main/rate-limits/providers/antigravity/antigravity-usage-fetcher.ts +1 src/main/rate-limits/providers/claude/claude-active-usage-fetch.ts +5 src/main/rate-limits/providers/claude/claude-oauth-credentials.ts +9 src/main/rate-limits/providers/codex/codex-fetcher.ts +4 src/main/rate-limits/providers/codex/codex-rpc-rate-limit-probe.ts +4 src/main/rate-limits/providers/cursor/cursor-auth.ts +1 src/main/rate-limits/providers/cursor/cursor-fetcher.ts +1 src/main/rate-limits/providers/gemini/gemini-oauth-sources.ts +2 src/main/rate-limits/providers/gemini/gemini-usage-fetcher.ts +1 src/main/rate-limits/providers/grok/grok-fetcher.ts +1 src/main/rate-limits/providers/muse/muse-usage-fetcher.ts +3 src/main/rate-limits/providers/opencode-go/opencode-go-api-key-source.ts +1 src/main/rate-limits/providers/opencode-go/opencode-go-usage-source-selection.ts +4 src/main/rate-limits/providers/zcode/zcode-usage-credentials.ts +2 src/main/rate-limits/providers/zcode/zcode-usage-fetcher.ts +2 src/main/rate-limits/service/rate-limit-service.ts +1 src/main/rate-limits/service/service-fetch-targets.ts +1 src/main/rate-limits/service/service-full-cycle-application.ts +7 src/main/rate-limits/service/service-full-cycle-preparation.ts +1 src/main/rate-limits/service/service-inactive-accounts.ts +1 src/main/rate-limits/service/service-muse-usage-fetch.ts +3 src/main/rate-limits/service/service-provider-cycles.ts +1 src/main/rate-limits/service/service-state.ts +4 src/main/ripgrep/bundled-ripgrep-path.ts +1 src/main/ripgrep/bundled-ripgrep-spawn.ts +1 src/main/ripgrep/bundled-ripgrep-text-search.ts +1 src/main/runtime/agent-session/environment/structured-agent-account-home.ts +2 src/main/runtime/agent-session/environment/structured-session-child-env.ts +2 src/main/runtime/agent-session/installation/runtime-structured-agent-host.ts +6 src/main/runtime/agent-session/installation/structured-agent-runtime-metadata.ts +2 src/main/runtime/agent-session/installation/structured-agent-runtime-registrations.ts +1 src/main/runtime/agent-session/installation/structured-agent-session-host-assembly.ts +1 src/main/runtime/agent-session/installation/structured-agent-session-runtime-teardown.ts +2 src/main/runtime/agent-session/installation/structured-agent-session-runtime.ts +1 src/main/runtime/agent-session/model-catalog/structured-agent-model-catalog-discovery.ts +1 src/main/runtime/agent-session/ownership/agent-session-claim-identity.ts +4 src/main/runtime/agent-session/ownership/agent-session-process-identity-probe.ts +3 src/main/runtime/agent-session/records/agent-session-record-rows.ts +1 src/main/runtime/agent-session/records/agent-session-record-store-slot.ts +8 src/main/runtime/agent-session/records/agent-session-runtime-end-record.ts +2 src/main/runtime/agent-session/records/agent-session-store-transactions.ts +1 src/main/runtime/agent-session/records/local-agent-session-record-store-startup-open.ts +4 src/main/runtime/browser/commands/browser-profiles.ts +1 src/main/runtime/client/runtime-client-state.ts +1 src/main/runtime/client/settings/runtime-client-settings.ts +3 src/main/runtime/construction/desktop-workspace-services.ts +1 src/main/runtime/construction/runtime-identity-state.ts +2 src/main/runtime/files/chat-scratch-file-root.ts +4 src/main/runtime/files/file-mutations.ts +4 src/main/runtime/files/file-reads.ts +1 src/main/runtime/files/file-target.ts +1 src/main/runtime/files/paths/orca-runtime-read-kitty-file.ts +1 src/main/runtime/files/staged-file-save-commands.ts +1 src/main/runtime/files/staged-file-saves.ts +2 src/main/runtime/files/watch/file-watches.ts +16 src/main/runtime/host-instance-identity.ts +7 src/main/runtime/hosts/platform-probe/host-descriptor.ts +3 src/main/runtime/hosts/runtime-status.ts +1 src/main/runtime/integrations/git/runtime-git-command-target.ts +3 src/main/runtime/integrations/git/runtime-git-generation-commands.ts +3 src/main/runtime/integrations/jira/runtime-jira-commands.ts +8 src/main/runtime/integrations/linear/runtime-linear-browse-commands.ts +6 src/main/runtime/integrations/linear/runtime-linear-connection-commands.ts +5 src/main/runtime/integrations/linear/runtime-linear-context-commands.ts +1 src/main/runtime/integrations/linear/runtime-linear-label-write-commands.ts +5 src/main/runtime/integrations/linear/runtime-linear-project-write-commands.ts +3 src/main/runtime/integrations/linear/runtime-linear-read-commands.ts +1 src/main/runtime/integrations/linear/runtime-linear-state-commands.ts +2 src/main/runtime/integrations/linear/runtime-linear-task-fields-commands.ts +3 src/main/runtime/integrations/linear/runtime-linear-team-write-commands.ts +2 src/main/runtime/mobile-cloud-relay/authentication/relay-auth-context.ts +1 src/main/runtime/mobile-cloud-relay/desktop-relay-service.ts +2 src/main/runtime/mobile-cloud-relay/pairing/relay-revoke-outbox.ts +4 src/main/runtime/mobile-cloud-relay/region-selection/relay-region-preference.ts +1 src/main/runtime/orca-runtime.ts +16 src/main/runtime/orchestration/db/attach-orchestration-db-methods.ts +1 src/main/runtime/orchestration/db/database-file-permissions.ts +2 src/main/runtime/orchestration/db/decision-gates/decision-gate-store.ts +8 src/main/runtime/orchestration/db/dispatch-context/attempt-task-settlement.ts +19 src/main/runtime/orchestration/db/dispatch-context/dispatch-completion.ts +3 src/main/runtime/orchestration/db/dispatch-context/dispatch-context-store.ts +2 src/main/runtime/orchestration/db/dispatch-context/task-dispatch-reconciliation.ts +10 src/main/runtime/orchestration/db/dispatch-context/worker-report-settlement.ts +2 src/main/runtime/orchestration/db/lifecycle-transition.ts +3 src/main/runtime/orchestration/db/lifecycle-write-transaction-runner.ts +2 src/main/runtime/orchestration/db/maintenance/orchestration-db-maintenance.ts +2 src/main/runtime/orchestration/db/maintenance/settled-run-retention.ts +5 src/main/runtime/orchestration/db/maintenance/settled-run-retirement.ts +1 src/main/runtime/orchestration/db/messages/message-insert.ts +3 src/main/runtime/orchestration/db/messages/structured-mail-send-store.ts +2 src/main/runtime/orchestration/db/mutation-receipts/mutation-receipt-capacity.ts +2 src/main/runtime/orchestration/db/mutation-receipts/mutation-receipt-store.ts +10 src/main/runtime/orchestration/db/orchestration-db.ts +1 src/main/runtime/orchestration/db/remote-owned/remote-dispatch-records.ts +6 src/main/runtime/orchestration/db/remote-owned/remote-owned-import.ts +16 src/main/runtime/orchestration/db/remote-owned/remote-placements.ts +10 src/main/runtime/orchestration/db/remote-owned/remote-run-links.ts +4 src/main/runtime/orchestration/db/reset/orchestration-reset.ts +3 src/main/runtime/orchestration/db/reset/removed-orchestration-work-read.ts +1 src/main/runtime/orchestration/db/schema/migrate-v13-v30.ts +1 src/main/runtime/orchestration/db/schema/migrate-v40.ts +4 src/main/runtime/orchestration/db/schema/migrate.ts +10 src/main/runtime/orchestration/db/schema/orchestration-schema-version-skew.ts +1 src/main/runtime/orchestration/db/schema/structured-worker-orca-session-backfill.ts +9 src/main/runtime/orchestration/db/tasks/task-status-transition.ts +2 src/main/runtime/orchestration/db/tasks/task-store.ts +5 src/main/runtime/orchestration/db/worker-dispatch/worker-dispatch-abandon.ts +11 src/main/runtime/orchestration/db/worker-dispatch/worker-dispatch-outcome.ts +5 src/main/runtime/orchestration/db/worker-dispatch/worker-dispatch-settlement.ts +4 src/main/runtime/orchestration/db/worker-dispatch/worker-dispatch-stage.ts +6 src/main/runtime/orchestration/db/worker-dispatch/worker-dispatch-start.ts +22 src/main/runtime/orchestration/db/worker-dispatch/worker-dispatch-stop.ts +5 src/main/runtime/orchestration/db/worker-dispatch/worker-terminal-recovery.ts +2 src/main/runtime/orchestration/federation/peer-mail/peer-mail-relay.ts +1 src/main/runtime/orchestration/federation/remote-owned/remote-owed-actions.ts +1 src/main/runtime/orchestration/federation/remote-owned/remote-owned-calls.ts +2 src/main/runtime/orchestration/federation/remote-owned/remote-owned-route.ts +5 src/main/runtime/orchestration/federation/remote-owned/remote-owned-start.ts +1 src/main/runtime/orchestration/legacy-remote-home/federated-worker-child-parent.ts +15 src/main/runtime/orchestration/legacy-remote-home/federated-worker-start-reconcile.ts +1 src/main/runtime/orchestration/legacy-remote-home/federated-worker-start.ts +1 src/main/runtime/orchestration/legacy-remote-home/legacy-remote-home-db-methods.ts +5 src/main/runtime/orchestration/legacy-remote/federated-dispatch-observation-fence.ts +2 src/main/runtime/orchestration/legacy-remote/legacy-remote-db-methods.ts +3 src/main/runtime/orchestration/legacy-remote/remote-dispatch-attachment-create.ts +2 src/main/runtime/orchestration/workers/lifecycle/context-only-dispatch-release.ts +1 src/main/runtime/orchestration/workers/transcripts/worker-transcript-read.ts +2 src/main/runtime/push/push-unregister-outbox.ts +1 src/main/runtime/repositories/folder-workspace-deletion.ts +3 src/main/runtime/repositories/runtime-nested-repo-import.ts +1 src/main/runtime/repositories/runtime-project-host-setup-controller.ts +2 src/main/runtime/repositories/runtime-repository-clone-controller.ts +6 src/main/runtime/repositories/runtime-repository-hooks-commands.ts +2 src/main/runtime/repositories/runtime-repository-issue-command.ts +2 src/main/runtime/repositories/runtime-repository-registration-controller.ts +1 src/main/runtime/repositories/runtime-repository-settings-controller.ts +2 src/main/runtime/rpc/dispatcher.ts +4 src/main/runtime/rpc/methods/accounts/antigravity-accounts.ts +11 src/main/runtime/rpc/methods/accounts/usage-credentials.ts +1 src/main/runtime/rpc/methods/browser/browser-identity-rpc.ts +15 src/main/runtime/rpc/methods/computer/computer.ts +1 src/main/runtime/rpc/methods/host-management/environment-doctor.ts +1 src/main/runtime/rpc/methods/host-management/host-capabilities.ts +1 src/main/runtime/rpc/methods/host-management/managed-runtime-install.ts +1 src/main/runtime/rpc/methods/mobile-delivery/bundled-mobile-web-bundle.ts +8 src/main/runtime/rpc/methods/mobile-delivery/mobile-web-bundle.ts +1 src/main/runtime/rpc/methods/native-chat/native-chat.ts +1 src/main/runtime/rpc/methods/orcad/orcad-migration.ts +1 src/main/runtime/rpc/methods/orchestration/messaging/check-mail-reconciliation.ts +1 src/main/runtime/rpc/methods/orchestration/runs/runs.ts +1 src/main/runtime/rpc/methods/terminal/session-terminal-scrollback.ts +2 src/main/runtime/rpc/methods/workspaces/worktree.ts +5 src/main/runtime/rpc/server/network-source-policy-store.ts +11 src/main/runtime/rpc/server/pairing/device-registry-disk-merge.ts +2 src/main/runtime/rpc/server/pairing/device-registry-file-read.ts +3 src/main/runtime/rpc/server/pairing/e2ee-keypair.ts +3 src/main/runtime/rpc/server/runtime-metadata.ts +2 src/main/runtime/rpc/server/runtime-rpc-binary-routing.ts +8 src/main/runtime/rpc/server/runtime-rpc-lifecycle.ts +1 src/main/runtime/rpc/server/runtime-rpc-network-exposure.ts +1 src/main/runtime/rpc/server/runtime-rpc-request-admission.ts +1 src/main/runtime/rpc/server/serve-network-source-policy.ts +1 src/main/runtime/rpc/transports/websocket/static-web-client-handler.ts +1 src/main/runtime/rpc/transports/websocket/ws-transport.ts +2 src/main/runtime/session-construction/agent-session/get-agent-session-execution-namespace.ts +3 src/main/runtime/session-lifecycle/projection/restored-pane-materialize.ts +1 src/main/runtime/session-tabs/chat/structured-session-create-support.ts +1 src/main/runtime/sidebar-inputs/sidebar-inputs-feed-domains.ts +1 src/main/runtime/speech/runtime-mobile-dictation-controller.ts +6 src/main/runtime/speech/runtime-mobile-speech-catalog.ts +1 src/main/runtime/terminal/launch/agent-launch-scope-runtime.ts +1 src/main/runtime/terminal/launch/agent-teams-launch-plan.ts +7 src/main/runtime/terminal/launch/claude-agent-teams-shim-env.ts +1 src/main/runtime/terminal/launch/mobile-terminal-chat-fork.ts +2 src/main/runtime/terminal/launch/mobile-terminal-startup.ts +1 src/main/runtime/terminal/launch/qoder-terminal-command-resolution.ts +1 src/main/runtime/terminal/launch/runtime-agent-terminal-startup.ts +1 src/main/runtime/terminal/launch/terminal-create-team-allocation.ts +1 src/main/runtime/terminal/launch/terminal-split-source-authority.ts +7 src/main/runtime/terminal/launch/wsl-host-agent-terminal-launch.ts +1 src/main/runtime/terminal/launch/wsl-host-windows-drive-guard.ts +1 src/main/runtime/terminal/output/tail/terminal-history-last-output.ts +2 src/main/runtime/terminal/output/terminal-kitty-file-read.ts +1 src/main/runtime/workspaces/archive/runtime-workspace-archive.ts +2 src/main/runtime/workspaces/catalog/repo-worktree-row-resolution.ts +1 src/main/runtime/workspaces/catalog/resolved-worktree-scan-join.ts +1 src/main/runtime/workspaces/catalog/runtime-worktree-filesystem.ts +2 src/main/runtime/workspaces/catalog/scoped-worktree-row-resolution.ts +2 src/main/runtime/workspaces/catalog/workspace-catalog.ts +1 src/main/runtime/workspaces/catalog/workspace-repo-scan-refresh.ts +3 src/main/runtime/workspaces/creation/created-worktree-approved-setup.ts +1 src/main/runtime/workspaces/creation/runtime-folder-worktree-setup.ts +1 src/main/runtime/workspaces/creation/runtime-group-folder-setup.ts +2 src/main/runtime/workspaces/creation/runtime-local-worktree-create.ts +1 src/main/runtime/workspaces/creation/runtime-local-worktree-materialization.ts +4 src/main/runtime/workspaces/creation/runtime-local-worktree-setup.ts +2 src/main/runtime/workspaces/creation/workspace-creation.ts +1 src/main/runtime/workspaces/lineage/runtime-worktree-lineage-controller.ts +1 src/main/runtime/workspaces/process-listing/workspace-process-listing.ts +1 src/main/runtime/workspaces/removal/runtime-interrupted-local-worktree-removal.ts +4 src/main/runtime/workspaces/removal/runtime-registered-local-worktree-removal.ts +2 src/main/runtime/workspaces/removal/runtime-unregistered-worktree-removal.ts +2 src/main/runtime/workspaces/removal/workspace-registration-removal.ts +2 src/main/runtime/workspaces/removal/workspace-removal.ts +2 src/main/runtime/workspaces/removal/worktree-removal-agent-trust-cleanup.ts +2 src/main/runtime/workspaces/workspace-removal-target.ts +1 src/main/server/serve-pairing-readiness.ts +2 src/main/skills/cloud/skill-cloud-auth.ts +1 src/main/skills/cloud/skill-cloud-package-service.ts +1 src/main/skills/discovery/claude-plugin-skill-sources-wsl.ts +1 src/main/skills/discovery/skill-discovery-sources.ts +1 src/main/skills/discovery/skill-discovery-wsl.ts +1 src/main/skills/filesystem/skill-wsl-install-filesystem.ts +2 src/main/skills/providers/skill-provider-runtime-roots.ts +1 src/main/skills/providers/skill-wsl-provider-detection.ts +1 src/main/source-control/hosted-review-creation-provider.ts +4 src/main/speech/cloud-transcription-target.ts +1 src/main/speech/dictation-cleanup-service.ts +2 src/main/speech/model-cache-path.ts +7 src/main/speech/model-manager.ts +6 src/main/speech/openai-api-key-store.ts +1 src/main/speech/openai-api-key-verification.ts +2 src/main/speech/openai-compatible-speech-provider-store.ts +2 src/main/speech/speech-vad-model.ts +4 src/main/speech/stt-gpu-failure-marker.ts +2 src/main/speech/stt-service.ts +2 src/main/speech/stt-session-prewarm.ts +6 src/main/speech/stt-session-start.ts +2 src/main/speech/stt-worker-paths.ts +12 src/main/sqlite/row-cache/keyed-json-row-cache.ts +1 src/main/sqlite/row-cache/legacy-json-source.ts +8 src/main/sqlite/versioned-cache-database.ts +1 src/main/ssh/authentication/ssh-agent-identity-filter.ts +2 src/main/ssh/authentication/ssh-auth-resolution.ts +1 src/main/ssh/authentication/ssh-identity-file-read.ts +2 src/main/ssh/authentication/ssh2-credential-fallback.ts +2 src/main/ssh/config/ssh-config-alias-claim.ts +4 src/main/ssh/config/ssh-config-host-picker.ts +6 src/main/ssh/config/ssh-config-include-expander.ts +2 src/main/ssh/config/ssh-config-parser.ts +1 src/main/ssh/config/ssh-g-config-resolution.ts +2 src/main/ssh/connection/channels/ssh-connection-session-channels.ts +2 src/main/ssh/connection/ssh-connect-config.ts +8 src/main/ssh/connection/ssh-connection.ts +1 src/main/ssh/file-transfer/ssh-connection-file-transfers.ts +1 src/main/ssh/host-keys/ssh2-host-key-verification.ts +1 src/main/ssh/host-server/managed-server-update-deps.ts +1 src/main/ssh/port-forwarding/system-ssh-port-forward-provider.ts +5 src/main/ssh/system-transport/file-transfer/system-ssh-file-binary-transfer.ts +6 src/main/ssh/system-transport/file-transfer/system-ssh-file-transfer.ts +5 src/main/ssh/system-transport/file-transfer/system-ssh-sftp-transfer.ts +5 src/main/ssh/system-transport/file-transfer/system-ssh-windows-write-strategy.ts +2 src/main/ssh/system-transport/forwarding/system-ssh-dynamic-forward-process.ts +3 src/main/ssh/system-transport/forwarding/system-ssh-forward-process.ts +4 src/main/ssh/system-transport/forwarding/system-ssh-loopback-route-admission.ts +3 src/main/ssh/system-transport/forwarding/system-ssh-loopback-route.ts +2 src/main/ssh/system-transport/forwarding/system-ssh-muxed-forward-cancel.ts +2 src/main/ssh/system-transport/ssh-control-socket.ts +1 src/main/ssh/system-transport/ssh-transport-selection.ts +3 src/main/ssh/system-transport/system-ssh-args.ts +1 src/main/ssh/system-transport/system-ssh-binary.ts +4 src/main/ssh/system-transport/system-ssh-command.ts +3 src/main/ssh/targets/ssh-connection-store.ts +5 src/main/ssh/targets/ssh-target-route-resolution.ts +1 src/main/startup/agent-accounts/codex-launch-preparation.ts +1 src/main/startup/agent-accounts/codex-session-resume-launch.ts +1 src/main/startup/agent-accounts/main-process-account-services.ts +7 src/main/startup/configure-process.ts +1 src/main/startup/diagnostics/event-loop-stall-probe.ts +2 src/main/startup/diagnostics/startup-diagnostics.ts +3 src/main/startup/gpu-recovery/gpu-fallback-marker.ts +11 src/main/startup/gpu-recovery/gpu-lifecycle.ts +21 src/main/startup/linux-display/ensure-virtual-display.ts +3 src/main/startup/linux-display/x-display-artifacts.ts +1 src/main/startup/linux-runtime/linux-dev-shm-policy.ts +4 src/main/startup/linux-runtime/linux-realtime-scheduling-guard.ts +2 src/main/startup/linux-runtime/linux-rttime-limit.ts +1 src/main/startup/main-process-ipc-bootstrap.ts +2 src/main/startup/main-process-observers.ts +1 src/main/startup/main-process-preflight-failure.ts +25 src/main/startup/main-process-preflight.ts +15 src/main/startup/main-process-ready-foundation.ts +8 src/main/startup/main-process-ready-runtime.ts +4 src/main/startup/main-process-ready.ts +1 src/main/startup/main-window/main-process-i18n-menu.ts +15 src/main/startup/main-window/main-window-controller.ts +4 src/main/startup/main-window/main-window-core-services.ts +3 src/main/startup/network-compatibility/http1-compatibility-marker.ts +9 src/main/startup/network-compatibility/http1-compatibility-profile-state.ts +1 src/main/startup/plugin-startup/main-process-plugin-rpc.ts +4 src/main/startup/plugin-startup/main-process-plugins.ts +2 src/main/startup/profile-startup/desktop-profile-instance-lock.ts +5 src/main/startup/profile-startup/profile-state-recovery-preflight.ts +2 src/main/startup/profile-startup/single-instance-lock.ts +12 src/main/startup/pty-startup/main-process-pty-startup.ts +2 src/main/startup/quit/main-process-quit.ts +15 src/main/startup/runtime-startup/main-process-runtime-launch.ts +4 src/main/startup/runtime-startup/main-process-runtime-service.ts +1 src/main/startup/serve-launch/headless-serve-ssh-registration.ts +3 src/main/startup/serve-launch/main-process-serve.ts +3 src/main/startup/serve-launch/serve-cli-registration.ts +1 src/main/startup/serve-launch/serve-user-data-path-guard.ts +4 src/main/startup/shell-environment/windows-shell-path-hydration.ts +1 src/main/startup/uninstall/agent-hooks-uninstall-preflight.ts +2 src/main/startup/uninstall/wsl-holder-uninstall-preflight.ts +3 src/main/startup/windows-install-permissions/windows-install-dir-acl-probe.ts +13 src/main/startup/windows-install-permissions/windows-install-dir-acl-recovery.ts +4 src/main/startup/windows-install-permissions/windows-install-dir-package-acl-grant.ts +5 src/main/startup/windows-install-permissions/windows-install-dir-package-acl-repair.ts +1 src/main/startup/windows-startup/windows-isolated-spawner.ts +2 src/main/startup/windows-startup/windows-renderer-runtime-files.ts +1 src/main/startup/windows-startup/windows-std-handle-inheritance.ts +6 src/main/startup/windows-startup/windows-user-data-acl.ts +1 src/main/stats/collector.ts +1 src/main/text-generation/agent-generation-request.ts +1 src/main/text-generation/commit-message-text-generation.ts +3 src/main/text-generation/execution/commit-message-agent-environment.ts +3 src/main/text-generation/execution/source-control-agent-launch.ts +1 src/main/text-generation/execution/source-control-local-generation.ts +2 src/main/text-generation/execution/source-control-local-process.ts +1 src/main/text-generation/execution/source-control-remote-generation.ts +4 src/main/text-generation/execution/source-control-supervised-agent-spawn.ts +1 src/main/text-generation/failures/kimi-generation-failure.ts +4 src/main/text-generation/failures/source-control-agent-failure.ts +1 src/main/text-generation/models/commit-message-model-discovery-policy.ts +4 src/main/text-generation/models/commit-message-model-discovery.ts +1 src/main/text-generation/policies/source-control-read-only-policy.ts +1 src/main/text-generation/requests/jira-issue-summary-requests.ts +1 src/main/tray/system-tray.ts +2 src/main/updater/lifecycle/main-window-updater.ts +1 src/main/updater/lifecycle/updater-check-state.ts +1 src/main/updater/lifecycle/updater-download-install.ts +5 src/main/updater/lifecycle/updater-install-execution.ts +2 src/main/updater/lifecycle/updater-remote-status.ts +4 src/main/updater/lifecycle/updater-setup.ts +1 src/main/updater/lifecycle/windows-update-install-directory.ts +10 src/main/updater/linux-package/appimage-runtime-identity.ts +2 src/main/updater/linux-package/linux-package-downloaded-status.ts +3 src/main/updater/linux-package/linux-package-install-command.ts +2 src/main/updater/linux-package/linux-package-update-recovery.ts +4 src/main/updater/linux-package/linux-update-package-type.ts +1 src/main/updater/linux-package/updater-package-recovery.ts +8 src/main/updater/serve-update-handoff.ts +1 src/main/updater/update-install-exit-watchdog.ts +3 src/main/updater/updater-events.ts +6 src/main/usage/scan-worker/usage-scan-worker-spawn.ts +1 src/main/warp-themes/auto-discovered-theme-files.ts +6 src/main/warp-themes/discovery.ts +1 src/main/warp-themes/index.ts +8 src/main/window/attach-main-window-services.ts +1 src/main/window/clipboard/clipboard-ipc-handlers.ts +2 src/main/window/createMainWindow.ts +3 src/main/window/desktop-integration/app-icon.ts +1 src/main/window/desktop-integration/custom-app-icon.ts +2 src/main/window/desktop-integration/macos-press-and-hold-default.ts +1 src/main/windows/windows-administrator-restart.ts +2 src/main/windows/windows-directory-acl.ts +15 src/main/windows/windows-process-table.ts +1 src/main/worker-thread-child-process/worker-thread-child-process.ts +3 src/main/worker-threads/forked-child-entry-path.ts +2 src/main/worker-threads/worker-send-ledger.ts +2 src/main/workspace-hooks/hook-orca-cli-env.ts +5 src/main/workspace-hooks/hooks.ts +5 src/main/workspace-hooks/issue-command-file.ts +5 src/main/workspace-hooks/worktree-runner-script.ts +8 src/main/workspaces/catalog/folder-repo-git-conversion.ts +1 src/main/workspaces/catalog/folder-upgrade-worktree-path.ts +2 src/main/workspaces/catalog/provisioned-root-ssh-adoption.ts +2 src/main/workspaces/catalog/repo-worktree-catalog-owner.ts +5 src/main/workspaces/catalog/repo-worktrees.ts +1 src/main/workspaces/cleanup/chat-history/deleted-workspace-chat-history.ts +3 src/main/workspaces/cleanup/workspace-cleanup-removal-step.ts +2 src/main/workspaces/cleanup/workspace-cleanup-runner.ts +3 src/main/workspaces/creation/preparation/worktree-create-preparation-pool.ts +2 src/main/workspaces/creation/preparation/worktree-create-preparation-stale-cleanup.ts +2 src/main/workspaces/creation/preparation/worktree-create-preparation.ts +1 src/main/workspaces/execution-host/local-project-runtime-pty-options.ts +1 src/main/workspaces/execution-host/local-project-runtime-resolution.ts +4 src/main/workspaces/execution-host/project-runtime-git-router.ts +2 src/main/workspaces/removal/folder-workspace-archive-hook.ts +2 src/main/workspaces/removal/local-orphaned-worktree-cleanup.ts +3 src/main/workspaces/removal/local-worktree-filesystem.ts +1 src/main/workspaces/removal/local-worktree-removal-recovery.ts +1 src/main/workspaces/removal/retirement/worktree-retirement-discovery.ts +1 src/main/workspaces/removal/worktree-prunable-git-file.ts +1 src/main/workspaces/removal/worktree-removal-process-cleanup.ts +3 src/main/workspaces/space-analysis/workspace-space-analysis.ts +2 src/main/workspaces/space-analysis/workspace-space-repo-scan.ts +2 src/main/workspaces/space-analysis/workspace-space-scan-worker-client.ts +9 src/main/wsl/discovery/distro-catalog.ts +3 src/main/wsl/discovery/wsl-availability.ts +2 src/main/wsl/discovery/wsl-console-running-distros.ts +2 src/main/wsl/discovery/wsl-distro-boot-id.ts +4 src/main/wsl/discovery/wsl-distro-holder.ts +4 src/main/wsl/discovery/wsl-installation.ts +1 src/main/wsl/discovery/wsl-registered-distro-fallback.ts +2 src/main/wsl/execution/wsl-exe-process.ts +3 src/main/wsl/execution/wsl-guest-environment.ts +1 src/main/wsl/execution/wsl-guest-node-helper.ts +1 src/main/wsl/execution/wsl-guest-pane-processes.ts +1 src/main/wsl/execution/wsl-guest-process-table.ts +1 src/main/wsl/execution/wsl-interop-health.ts +2 src/main/wsl/execution/wsl-interop-spawn-directory.ts +2 src/main/wsl/execution/wsl-node-runtime-prefetch.ts +4 src/main/wsl/execution/wsl-runner.ts +2 src/main/wsl/filesystem/unc-path-access.ts +4 src/main/wsl/filesystem/wsl-automount-root.ts +1 src/main/wsl/filesystem/wsl-drive-project-new-default.ts +1 src/main/wsl/filesystem/wsl-drive-unc-conversion-journal.ts +5 src/main/wsl/filesystem/wsl-drive-unc-conversion-startup.ts +7 src/main/wsl/filesystem/wsl-drive-unc-conversion-stores.ts +2 src/main/wsl/filesystem/wsl-drive-unc-mounts.ts +1 src/main/wsl/filesystem/wsl-guest-drive-path.ts +8 src/main/wsl/filesystem/wsl-guest-windows-drive-path.ts +1 src/main/wsl/filesystem/wsl-unc-delete.ts +1 src/main/wsl/history/wsl-fish-history-cleanup.ts +4 src/main/wsl/host-lifecycle/wsl-host-connector.ts +1 src/main/wsl/host-lifecycle/wsl-host-gate-startup.ts +6 src/main/wsl/host-lifecycle/wsl-host-kept-for-peers.ts +2 src/main/wsl/host-lifecycle/wsl-host-removal.ts +1 src/main/wsl/host-lifecycle/wsl-host-uninstall-server-stop.ts +2 src/main/wsl/host-lifecycle/wsl-hosts-policy-live-update.ts +1 src/main/wsl/host-lifecycle/wsl-orphan-holder-release.ts +1 src/main/wsl/orcad/wsl-orcad-active-probe.ts +2 src/main/wsl/orcad/wsl-orcad-connection.ts +7 src/main/wsl/orcad/wsl-orcad-deploy.ts +1 src/main/wsl/orcad/wsl-orcad-failed-install-removal.ts +2 src/main/wsl/orcad/wsl-orcad-host-transport.ts +5 src/main/wsl/orcad/wsl-orcad-instance-adoption.ts +1 src/main/wsl/orcad/wsl-orcad-liveness-wiring.ts +1 src/main/wsl/orcad/wsl-orcad-pairing-repair.ts +6 src/main/zcode/hook-service.ts +6 src/main/zcode/zcode-plan-api-key-store.ts +10 src/main/zcode/zcode-plan-credential-commands.ts +3 src/main/zcode/zcode-v2-plan-credentials.ts +13 src/shared/agent-hook-listener/claude-session-continuation.ts +2 src/shared/agent-hook-listener/command-code-transcript.ts +3 src/shared/agent-hook-listener/grok-result-discovery.ts +1 src/shared/agent-hook-listener/normalization/normalize-hook-payload.ts +4 src/shared/agent-hook-listener/pane-provider-session.ts +4 src/shared/agent-hook-listener/provider-dispatch.ts +7 src/shared/agent-hook-listener/providers/codex/codex-events.ts +1 src/shared/agent-hook-listener/providers/codex/codex-subagent-identity.ts +1 src/shared/agent-hook-listener/providers/codex/codex-subagent-reviewer.ts +3 src/shared/agent-hook-listener/providers/codex/codex-subagent-roster.ts +4 src/shared/agent-hook-listener/providers/codex/codex-subagent-transcript.ts +3 src/shared/agent-hook-listener/providers/codex/codex-transcript-poll.ts +1 src/shared/agent-hook-listener/providers/grok/grok-session-paths.ts +1 src/shared/agent-hook-listener/providers/grok/grok-tool-fields.ts +3 src/shared/agent-hook-listener/providers/jcode/jcode-session-files.ts +2 src/shared/agent-hook-listener/providers/jcode/jcode-turn-prompt.ts +1 src/shared/agent-hook-listener/providers/muse/muse-events.ts +2 src/shared/agent-hook-listener/providers/muse/muse-session-log.ts +2 src/shared/agent-hook-listener/transcript-lines.ts +2 src/shared/agent-hook-listener/transcript-reader.ts +4 src/shared/agent-hook-listener/transport/agent-hook-spool.ts +1 src/shared/agent-hook-listener/transport/endpoint-publication.ts +1 src/shared/agent-launch/installation/local-agent-install-dir-detection.ts +2 src/shared/agent-launch/plugins/opencode/opencode-installed-plugin.ts +4 src/shared/agent-launch/plugins/opencode/opencode-plugin-atomic-write.ts +1 src/shared/agent-launch/plugins/opencode/opencode-startup-prompt-install.ts +3 src/shared/agent-launch/plugins/opencode/opencode-tui-config-registration.ts +10 src/shared/agent-launch/plugins/opencode/opencode-tui-plugin-install.ts +2 src/shared/file-content/node-source-copy-content-equality.ts +4 src/shared/plugins/declarative/testing/orca-testing.ts +7 src/shared/remote-runtime/e2ee/node/remote-runtime-e2ee-v2-host-latch.ts +4 src/shared/remote-runtime/ephemeral-vm-recipes/ephemeral-vm-recipe-doctor.ts +4 src/shared/remote-runtime/ephemeral-vm-recipes/ephemeral-vm-recipe-runner.ts +1 src/shared/remote-runtime/ephemeral-vm-store/ephemeral-vm-environment-sleep.ts +4 src/shared/remote-runtime/ephemeral-vm-store/ephemeral-vm-runtime-feature-store.ts +14 src/shared/remote-runtime/ephemeral-vm-store/ephemeral-vm-runtime-store.ts +6 src/shared/remote-runtime/ephemeral-vm-store/ephemeral-vm-runtime-write-ahead-store.ts +1 src/shared/remote-runtime/ephemeral-vm-store/ephemeral-vm-workspace-runtime.ts +2 src/shared/remote-runtime/host-store/runtime-e2ee-keypair-file.ts +3 src/shared/remote-runtime/host-store/runtime-environment-managed-orcad-operations.ts +2 src/shared/remote-runtime/host-store/runtime-environment-resume-pairing-operations.ts +2 src/shared/remote-runtime/host-store/runtime-environment-sidecar.ts +4 src/shared/remote-runtime/host-store/runtime-environment-store-command.ts +2 src/shared/remote-runtime/host-store/runtime-environment-store-file.ts +6 src/shared/remote-runtime/host-store/runtime-environment-store-observation.ts +9 src/shared/remote-runtime/host-store/runtime-environment-store-operations.ts +1 src/shared/remote-runtime/host-store/runtime-environment-store-read-cache.ts +2 src/shared/remote-runtime/host-store/runtime-environment-store-records.ts +1 src/shared/remote-runtime/host-store/runtime-environment-store-worker-entry.ts +3 src/shared/remote-runtime/host-store/runtime-environment-wsl-host-operations.ts +2 src/shared/remote-runtime/host-store/wsl-host-deployment-store.ts +1 src/shared/remote-runtime/relay/relay-version-marker.ts +6 src/shared/remote-runtime/remote-runtime-client-framing.ts +1 src/shared/remote-runtime/requests/remote-runtime-request-socket.ts +1 src/shared/remote-runtime/requests/remote-runtime-request-websocket.ts +1 src/shared/remote-runtime/requests/remote-runtime-subscription-transport.ts +5 src/shared/remote-runtime/serve-supervisor/serve-bundle-park.ts +2 src/shared/remote-runtime/serve-supervisor/serve-user-data-path.ts +1 src/shared/secure-storage/bounded-secure-json-file.ts +19 src/shared/secure-storage/secure-file.ts +6 src/shared/secure-storage/secure-path-windows-acl.ts +2 src/shared/secure-storage/windows-security-addon.ts +2 src/shared/shell/command-resolution/cli-fs-reads.ts +16 src/shared/shell/command-resolution/node-cli-command-resolution.ts +1 src/shared/shell/command-resolution/nvm-version-directories.ts +1 src/shared/shell/launch/startup-command-staging.ts diff --git a/config/main-blocking-ipc-baseline.txt b/config/main-blocking-ipc-baseline.txt index 46ae02b43cc..5296dd63214 100644 --- a/config/main-blocking-ipc-baseline.txt +++ b/config/main-blocking-ipc-baseline.txt @@ -1,12 +1,11 @@ # Legacy synchronous ipc uses per file; counts may only go DOWN. -# Only explicit worker/utility entry files are exempt; their imports remain guarded. -# Guest retirement must reserve and remove DOM in one renderer turn; async replies race visibility. -1 src/main/ipc/browser/browser-guest-discard-ipc.ts -1 src/preload/api/browser/browser-bridge-guest-discard.ts +# Worker/utility entries and modules only they import are exempt; anything event-loop code imports stays guarded. 3 src/main/host/native-chat-visual-guest-theme.ts +1 src/main/ipc/browser/browser-guest-discard-ipc.ts 1 src/main/ipc/renderer-shutdown-checkpoint.ts 1 src/main/ipc/settings/settings.ts 1 src/preload/api/app-bridge.ts +1 src/preload/api/browser/browser-bridge-guest-discard.ts 1 src/preload/api/native-chat/native-chat-bridge.ts 1 src/preload/api/preferences/settings-bridge.ts 1 src/preload/native-chat/native-chat-visual-guest-theme.ts diff --git a/config/main-blocking-sqlite-baseline.txt b/config/main-blocking-sqlite-baseline.txt index 8fee14ed329..cd953759bc3 100644 --- a/config/main-blocking-sqlite-baseline.txt +++ b/config/main-blocking-sqlite-baseline.txt @@ -1,22 +1,8 @@ # Legacy synchronous sqlite uses per file; counts may only go DOWN. -# Only explicit worker/utility entry files are exempt; their imports remain guarded. -3 src/main/ai-vault-search/query/session-search-engine.ts -6 src/main/ai-vault-search/query/session-search-postings.ts -8 src/main/ai-vault-search/query/session-search-retrieval.ts -2 src/main/ai-vault-search/query/session-search-snippet.ts -2 src/main/ai-vault-search/query/session-search-source-presence.ts -2 src/main/ai-vault-search/query/session-search-typo-repair.ts -10 src/main/ai-vault-search/storage/session-search-file-records.ts -8 src/main/ai-vault-search/storage/session-search-index-generation.ts -17 src/main/ai-vault-search/storage/session-search-index-writer.ts +# Worker/utility entries and modules only they import are exempt; anything event-loop code imports stays guarded. 10 src/main/ai-vault-search/storage/session-search-message-rows.ts -3 src/main/ai-vault-search/storage/session-search-query-schema.ts -22 src/main/ai-vault-search/storage/session-search-retention-delete.ts 13 src/main/ai-vault-search/storage/session-search-schema.ts -16 src/main/ai-vault-search/storage/session-search-store.ts -26 src/main/ai-vault-search/storage/session-search-tool-purge.ts -9 src/main/ai-vault-search/storage/session-search-write-buffer.ts -19 src/main/ai-vault/parse-cache/session-parse-cache-database.ts +20 src/main/ai-vault/parse-cache/session-parse-cache-database.ts 13 src/main/ai-vault/parse-cache/session-scope-cwds-table.ts 1 src/main/ai-vault/scanners/hermes/hermes-state-db-activity.ts 16 src/main/ai-vault/scanners/hermes/hermes-state-db-conversations.ts @@ -25,115 +11,48 @@ 2 src/main/ai-vault/scanners/hermes/session-scanner-hermes-sqlite.ts 2 src/main/ai-vault/scanners/opencode/sqlite/session-scanner-opencode-sqlite-capture.ts 4 src/main/ai-vault/scanners/opencode/sqlite/session-scanner-opencode-sqlite-list.ts -1 src/main/ai-vault/scanners/opencode/sqlite/session-scanner-opencode-sqlite-open.ts +2 src/main/ai-vault/scanners/opencode/sqlite/session-scanner-opencode-sqlite-open.ts 6 src/main/ai-vault/scanners/opencode/sqlite/session-scanner-opencode-sqlite.ts -5 src/main/ai-vault/scanners/opencode2/session-scanner-opencode2-sqlite-list.ts -9 src/main/ai-vault/scanners/opencode2/session-scanner-opencode2-sqlite.ts +6 src/main/ai-vault/scanners/opencode2/session-scanner-opencode2-sqlite-list.ts +10 src/main/ai-vault/scanners/opencode2/session-scanner-opencode2-sqlite.ts 5 src/main/browser-passwords/browser-password-chromium-import.ts 1 src/main/browser/cookies/chromium/prepare-import.ts 5 src/main/browser/cookies/sources/browser-cookie-firefox-import.ts 25 src/main/browser/cookies/staging/browser-cookie-staged-import.ts 5 src/main/codex/history/index/codex-state-db.ts -3 src/main/foreign-sqlite-readers/readers/cursor-profile.ts 44 src/main/github/pr-watch/pr-check-event-tables.ts 14 src/main/github/pr-watch/pr-pending-actions.ts 18 src/main/github/pr-watch/pr-watch-tables.ts -6 src/main/managed-data-accounts/credential-capture.ts +7 src/main/managed-data-accounts/credential-capture.ts 19 src/main/native-chat/agent-session-attachments/agent-session-attachment-claims.ts -3 src/main/native-chat/agent-session-journal/database/journal-checkpoint-owner.ts -13 src/main/native-chat/agent-session-journal/database/journal-database.ts -7 src/main/native-chat/agent-session-journal/database/journal-domain-database.ts -5 src/main/native-chat/agent-session-journal/database/journal-domain-migrations.ts -20 src/main/native-chat/agent-session-journal/database/journal-domain-profile-import.ts +5 src/main/native-chat/agent-session-journal/database/journal-checkpoint-owner.ts +22 src/main/native-chat/agent-session-journal/database/journal-database.ts +14 src/main/native-chat/agent-session-journal/database/journal-domain-database.ts +7 src/main/native-chat/agent-session-journal/database/journal-domain-migrations.ts +22 src/main/native-chat/agent-session-journal/database/journal-domain-profile-import.ts 1 src/main/native-chat/agent-session-journal/database/journal-host-database.ts 32 src/main/native-chat/agent-session-journal/database/journal-legacy-reconcile.ts 18 src/main/native-chat/agent-session-journal/database/journal-legacy-source.ts 12 src/main/native-chat/agent-session-journal/durable-rows/journal-row-table.ts 18 src/main/native-chat/agent-session-journal/history-import/journal-pi-active-branch.ts -14 src/main/native-chat/agent-session-journal/journal-domain-command-turn.ts -2 src/main/native-chat/agent-session-journal/journal-domain-context-command.ts -17 src/main/native-chat/agent-session-journal/journal-domain-context-replacement.ts -10 src/main/native-chat/agent-session-journal/journal-domain-control-command.ts -8 src/main/native-chat/agent-session-journal/journal-domain-current-item.ts -4 src/main/native-chat/agent-session-journal/journal-domain-dispatch-attempt.ts -2 src/main/native-chat/agent-session-journal/journal-domain-dispatch-placement.ts -8 src/main/native-chat/agent-session-journal/journal-domain-dispatch.ts -24 src/main/native-chat/agent-session-journal/journal-domain-edit-leases.ts -10 src/main/native-chat/agent-session-journal/journal-domain-generation-reads.ts -2 src/main/native-chat/agent-session-journal/journal-domain-generation-settlement.ts -10 src/main/native-chat/agent-session-journal/journal-domain-history-after.ts -9 src/main/native-chat/agent-session-journal/journal-domain-history-page.ts -4 src/main/native-chat/agent-session-journal/journal-domain-history-roster.ts -8 src/main/native-chat/agent-session-journal/journal-domain-history-window.ts 6 src/main/native-chat/agent-session-journal/journal-domain-import-discard.ts 24 src/main/native-chat/agent-session-journal/journal-domain-import-rows.ts 4 src/main/native-chat/agent-session-journal/journal-domain-import-submissions.ts 2 src/main/native-chat/agent-session-journal/journal-domain-import.ts -16 src/main/native-chat/agent-session-journal/journal-domain-input-ends.ts -12 src/main/native-chat/agent-session-journal/journal-domain-input-recovery.ts 4 src/main/native-chat/agent-session-journal/journal-domain-item-display.ts 4 src/main/native-chat/agent-session-journal/journal-domain-item-names.ts -2 src/main/native-chat/agent-session-journal/journal-domain-item-normalization.ts -4 src/main/native-chat/agent-session-journal/journal-domain-item-presentation.ts -24 src/main/native-chat/agent-session-journal/journal-domain-item-removal.ts -18 src/main/native-chat/agent-session-journal/journal-domain-item.ts -4 src/main/native-chat/agent-session-journal/journal-domain-lifecycle-dispatch.ts -12 src/main/native-chat/agent-session-journal/journal-domain-lifecycle-item.ts -12 src/main/native-chat/agent-session-journal/journal-domain-lifecycle.ts -11 src/main/native-chat/agent-session-journal/journal-domain-maintenance.ts -14 src/main/native-chat/agent-session-journal/journal-domain-outline.ts -8 src/main/native-chat/agent-session-journal/journal-domain-queue-clear.ts -6 src/main/native-chat/agent-session-journal/journal-domain-queue-command.ts +12 src/main/native-chat/agent-session-journal/journal-domain-maintenance.ts 10 src/main/native-chat/agent-session-journal/journal-domain-queue-failures.ts 6 src/main/native-chat/agent-session-journal/journal-domain-queue-pauses.ts 8 src/main/native-chat/agent-session-journal/journal-domain-queue-reads.ts 4 src/main/native-chat/agent-session-journal/journal-domain-queue-revision.ts 10 src/main/native-chat/agent-session-journal/journal-domain-queue-rows.ts -2 src/main/native-chat/agent-session-journal/journal-domain-request-failure.ts -8 src/main/native-chat/agent-session-journal/journal-domain-retained-failures.ts 6 src/main/native-chat/agent-session-journal/journal-domain-stop-notes.ts -12 src/main/native-chat/agent-session-journal/journal-domain-submission-admission.ts 2 src/main/native-chat/agent-session-journal/journal-domain-submission-consume.ts 4 src/main/native-chat/agent-session-journal/journal-domain-submission-records.ts -2 src/main/native-chat/agent-session-journal/journal-domain-submission-revision.ts -4 src/main/native-chat/agent-session-journal/journal-domain-taken-stop.ts -2 src/main/native-chat/agent-session-journal/journal-domain-text-snapshot.ts -14 src/main/native-chat/agent-session-journal/journal-domain-timeline-reads.ts -4 src/main/native-chat/agent-session-journal/journal-domain-turn-scope.ts 20 src/main/native-chat/agent-session-journal/journal-forgotten-chats.ts -10 src/main/native-chat/agent-session-journal/journal-fork-capture.ts -30 src/main/native-chat/agent-session-journal/journal-fork-preparation.ts -20 src/main/native-chat/agent-session-journal/journal-fork-presentation.ts -4 src/main/native-chat/agent-session-journal/journal-fork-source-proof.ts -10 src/main/native-chat/agent-session-journal/journal-fork-stage-page.ts -12 src/main/native-chat/agent-session-journal/journal-fork-stages.ts -4 src/main/native-chat/agent-session-journal/journal-fork-workspace.ts -2 src/main/native-chat/agent-session-journal/journal-items-by-kind-page.ts -2 src/main/native-chat/agent-session-journal/journal-open-queue-withdrawal.ts 4 src/main/native-chat/agent-session-journal/journal-sql-accepted-inputs.ts -6 src/main/native-chat/agent-session-journal/journal-sql-automatic-submission-command.ts -6 src/main/native-chat/agent-session-journal/journal-sql-batch.ts -10 src/main/native-chat/agent-session-journal/journal-sql-claude-identities.ts -2 src/main/native-chat/agent-session-journal/journal-sql-command-dispatch.ts -8 src/main/native-chat/agent-session-journal/journal-sql-continuation-context.ts -21 src/main/native-chat/agent-session-journal/journal-sql-database-read.ts -2 src/main/native-chat/agent-session-journal/journal-sql-edit-lease-command.ts -12 src/main/native-chat/agent-session-journal/journal-sql-event-tail.ts -4 src/main/native-chat/agent-session-journal/journal-sql-history-items.ts -22 src/main/native-chat/agent-session-journal/journal-sql-item-reads.ts -10 src/main/native-chat/agent-session-journal/journal-sql-lifecycle-reads.ts -5 src/main/native-chat/agent-session-journal/journal-sql-message-commit.ts -12 src/main/native-chat/agent-session-journal/journal-sql-message-effects.ts -13 src/main/native-chat/agent-session-journal/journal-sql-open-command.ts -5 src/main/native-chat/agent-session-journal/journal-sql-read-transaction.ts -10 src/main/native-chat/agent-session-journal/journal-sql-rewind-command.ts -4 src/main/native-chat/agent-session-journal/journal-sql-send-admission.ts -7 src/main/native-chat/agent-session-journal/journal-sql-steps.ts -10 src/main/native-chat/agent-session-journal/journal-stored-output-compaction.ts 4 src/main/native-chat/agent-session-journal/journal-stored-output-rows.ts -4 src/main/native-chat/agent-session-journal/journal-writer-effects.ts -4 src/main/native-chat/agent-session-journal/journal-writer-operation-expiry.ts -12 src/main/native-chat/agent-session-journal/journal-writer-store-mutation.ts 15 src/main/native-chat/agent-session-journal/outcomes/journal-outcome-format.ts 6 src/main/native-chat/agent-session-journal/outcomes/journal-outcome-table.ts 2 src/main/native-chat/agent-session-journal/queued-messages/journal-queue-import.ts @@ -148,18 +67,16 @@ 10 src/main/native-chat/transcript-history/opencode/transcript-opencode-sqlite-query.ts 14 src/main/native-chat/transcript-history/opencode/transcript-opencode2-fork-coverage.ts 10 src/main/native-chat/transcript-history/opencode/transcript-opencode2-sqlite.ts -10 src/main/opencode-usage/opencode-usage-row-queries.ts -1 src/main/opencode-usage/scanner.ts -12 src/main/persistence/moving-wsl-projects/desktop-state/wsl-move-orchestration-history-rewrite.ts +13 src/main/persistence/moving-wsl-projects/desktop-state/wsl-move-orchestration-history-rewrite.ts 8 src/main/persistence/profile-state/automation-runs/profile-state-automation-runs-migration.ts 4 src/main/persistence/profile-state/automation-runs/profile-state-automation-runs-reader.ts 6 src/main/persistence/profile-state/automation-runs/profile-state-automation-runs-storage.ts 2 src/main/persistence/profile-state/automation-runs/profile-state-automation-runs-validation.ts 8 src/main/persistence/profile-state/automation-runs/profile-state-automation-runs-writer.ts 2 src/main/persistence/profile-state/automation-runs/profile-state-automation-runs.ts -3 src/main/persistence/profile-state/database/profile-state-database-snapshot.ts -4 src/main/persistence/profile-state/database/profile-state-database-validation.ts -6 src/main/persistence/profile-state/database/profile-state-database.ts +4 src/main/persistence/profile-state/database/profile-state-database-snapshot.ts +5 src/main/persistence/profile-state/database/profile-state-database-validation.ts +15 src/main/persistence/profile-state/database/profile-state-database.ts 3 src/main/persistence/profile-state/database/profile-state-read-snapshot.ts 4 src/main/persistence/profile-state/database/profile-state-revision.ts 3 src/main/persistence/profile-state/database/profile-state-write-transaction.ts @@ -172,7 +89,7 @@ 8 src/main/persistence/profile-state/documents/profile-state-domain-writes.ts 4 src/main/persistence/profile-state/legacy-json/profile-state-json-acceptance.ts 2 src/main/persistence/profile-state/recovery/profile-state-section-repair.ts -3 src/main/rate-limits/providers/opencode-go/opencode-go-api-key-source.ts +4 src/main/rate-limits/providers/opencode-go/opencode-go-api-key-source.ts 2 src/main/runtime/agent-session/records/agent-session-record-lineage.ts 40 src/main/runtime/agent-session/records/agent-session-record-rows.ts 23 src/main/runtime/orchestration/db/dispatch-context/presentation-completion-source.ts @@ -180,16 +97,15 @@ 1 src/main/runtime/orchestration/db/federation/federated-stub-home-run-backfill.ts 9 src/main/runtime/orchestration/db/lifecycle-transition.ts 7 src/main/runtime/orchestration/db/mutation-receipts/mutation-receipt-capacity.ts -5 src/main/runtime/orchestration/db/orchestration-db.ts +11 src/main/runtime/orchestration/db/orchestration-db.ts 4 src/main/runtime/orchestration/db/peer-runs/peer-run-queue-sql.ts 10 src/main/runtime/orchestration/db/reset/removed-orchestration-work-read.ts 6 src/main/runtime/orchestration/db/reset/removed-orchestration-work-store.ts 4 src/main/runtime/orchestration/db/runs/run-coordinator-mail-routing.ts -12 src/main/runtime/orchestration/db/schema/orchestration-schema-version-skew.ts +15 src/main/runtime/orchestration/db/schema/orchestration-schema-version-skew.ts 15 src/main/runtime/orchestration/db/schema/structured-worker-orca-session-backfill.ts 5 src/main/runtime/orchestration/db/worker-dispatch/worker-dispatch-settlement.ts 4 src/main/runtime/orchestration/workers/lifecycle/context-only-dispatch-release.ts -19 src/main/sqlite/row-cache/keyed-json-row-cache.ts +24 src/main/sqlite/row-cache/keyed-json-row-cache.ts 5 src/main/sqlite/sync-database.ts -8 src/main/sqlite/versioned-cache-database.ts -6 src/main/wsl/filesystem/wsl-drive-unc-chat-rekey.ts +14 src/main/sqlite/versioned-cache-database.ts diff --git a/config/main-sync-fs-baseline.txt b/config/main-sync-fs-baseline.txt index 17d93d8e00c..541be1a9edd 100644 --- a/config/main-sync-fs-baseline.txt +++ b/config/main-sync-fs-baseline.txt @@ -1,4 +1,5 @@ -# Synchronous node:fs calls (every *Sync export) in production src/main and src/shared, per file. +# Synchronous node:fs calls (every *Sync export) in production src/main and src/shared, per file; +# modules imported only by worker/utility entries are excluded. # Startup-only or one-shot uses are fine to keep; per-RPC, per-spawn, per-focus or per-poll uses are the target. # This is a RATCHET: counts may only go DOWN. # Prune after removing calls: pnpm check:main-sync-fs-ratchet --prune @@ -128,7 +129,6 @@ 1 src/main/codex-accounts/runtime-home/routing/runtime-home-service-managed-home.ts 14 src/main/codex-accounts/runtime-home/runtime-home-service-paths.ts 1 src/main/codex-accounts/runtime-home/runtime-home-service-sync.ts -1 src/main/codex-usage/codex-session-file-discovery.ts 1 src/main/codex/configuration/codex-path-observation.ts 21 src/main/codex/configuration/homes/codex-home-paths.ts 6 src/main/codex/configuration/homes/codex-managed-home-resource-copy-marker.ts @@ -146,7 +146,6 @@ 5 src/main/codex/history/index/codex-session-index-heal-state.ts 2 src/main/codex/history/index/codex-state-db.ts 2 src/main/codex/history/resume/codex-session-resume-home.ts -2 src/main/codex/history/rollouts/codex-account-home-discovery.ts 1 src/main/codex/history/rollouts/codex-session-file-listing.ts 2 src/main/codex/history/rollouts/codex-session-link.ts 1 src/main/codex/hooks/installation/codex-hook-local-install.ts @@ -160,10 +159,7 @@ 1 src/main/codex/trust/hooks/hook-trust-promotion.ts 1 src/main/codex/trust/identity/codex-trust-identity.ts 1 src/main/codex/trust/toml/config-toml-project-trust.ts -2 src/main/computer/desktop-script/desktop-script-provider-paths.ts -1 src/main/computer/macos-native/macos-native-provider-client.ts 3 src/main/computer/macos-native/macos-native-provider-paths.ts -5 src/main/computer/macos-native/macos-native-provider-transport.ts 1 src/main/computer/sidecar-transport/sidecar-client.ts 3 src/main/connector-cloud/connector-turn-events.ts 1 src/main/copilot/hook-service.ts @@ -244,11 +240,10 @@ 14 src/main/filesystem/atomic-file-publication.ts 9 src/main/filesystem/durable-file-write.ts 3 src/main/filesystem/file-content-observation.ts # Existing reads/existence checks relocated from observed callers; no new synchronous I/O. +2 src/main/filesystem/local-file-io/filesystem-path-containment.ts 2 src/main/filesystem/rolling-file-backup.ts 2 src/main/foreign-sqlite-readers/foreign-sqlite-reader-entry-path.ts 1 src/main/foreign-sqlite-readers/foreign-sqlite-reader-spawn.ts -1 src/main/foreign-sqlite-readers/readers/cursor-profile.ts -1 src/main/foreign-sqlite-readers/readers/opencode-binder-sessions.ts 5 src/main/git/repositories/discovery/repo-detection.ts 13 src/main/git/repositories/discovery/repo-git-marker-scan.ts 1 src/main/git/source-control/ignores/huge-folder-ignore.ts @@ -259,7 +254,6 @@ 4 src/main/grok/grok-hook-symlink-cleanup-marker.ts 4 src/main/grok/hook-service.ts 8 src/main/hang-watchdog/hang-detection-marker.ts -4 src/main/hang-watchdog/hang-incident-snapshot.ts 1 src/main/hang-watchdog/hang-watchdog-worker-path.ts 1 src/main/hang-watchdog/previous-hang-detection.ts 9 src/main/hang-watchdog/renderer-hang-records.ts @@ -271,23 +265,19 @@ 1 src/main/ipc/command-path/command-path-directory-worker-client.ts 1 src/main/ipc/command-path/command-path-resolver.ts 4 src/main/ipc/diagnostics.ts -2 src/main/filesystem/local-file-io/filesystem-path-containment.ts 2 src/main/ipc/filesystem/watcher-process/child-lifecycle/parcel-watcher-canary-directory.ts 1 src/main/ipc/filesystem/watcher-process/child-lifecycle/parcel-watcher-child-launch.ts 4 src/main/ipc/filesystem/watcher-process/event-delivery/parcel-watcher-delivery-canary.ts -1 src/main/ipc/filesystem/watcher-process/native-subscriptions/parcel-watcher-shallow-file-subscription.ts -1 src/main/ipc/filesystem/watcher-process/native-subscriptions/parcel-watcher-shallow-subscription.ts 1 src/main/ipc/filesystem/watcher-process/native-subscriptions/rebinding-file-watch.ts 3 src/main/ipc/filesystem/watcher-process/parcel-watcher-entry-path.ts 1 src/main/ipc/filesystem/watcher-process/root-paths/watcher-event-root-path-rewrite.ts 1 src/main/ipc/filesystem/watcher-process/supervision/parcel-watcher-supervisor-subscribe.ts -1 src/main/ipc/worktrees/floating-workspace-directory.ts 1 src/main/ipc/keyboard/macos-keyboard-layout-snapshot.ts 1 src/main/ipc/notifications/notification-authorization-status.ts 1 src/main/ipc/pty/host-env/spawn-pane-env.ts 1 src/main/ipc/ssh/ssh-connect-flow.ts +1 src/main/ipc/worktrees/floating-workspace-directory.ts 2 src/main/ipc/worktrees/worktree-remote.ts -2 src/main/wsl/filesystem/wsl-guest-windows-drive-path.ts 7 src/main/jcode/hook-service.ts 8 src/main/jira/site-credential-store.ts 7 src/main/keybindings/keybinding-file-parser.ts @@ -318,7 +308,6 @@ 3 src/main/native-chat/agent-session-journal/database/journal-legacy-source-receipt.ts 1 src/main/native-chat/transcript-discovery/host-readable-transcript-path.ts 2 src/main/native-chat/transcript-filesystem/process/wsl-transcript-fs-process-spawn.ts -1 src/main/node-runtime/appimage-bundled-node-runtime.ts 2 src/main/node-runtime/managed-runtime-release-install.ts 7 src/main/node-runtime/managed-runtime-release.ts 11 src/main/notebook/python-environments.ts @@ -370,11 +359,10 @@ 7 src/main/orcad/native-runtime/node-pty-prebuilt-slot.ts 2 src/main/orcad/native-runtime/node-pty-precondition.ts 1 src/main/orcad/profile-state/orcad-host-identity-reset.ts -1 src/main/orcad/profile-state/serve-profile-ssh-targets.ts 12 src/main/orcad/runtime-launch/orcad-bundled-runtime.ts +8 src/main/orcad/runtime-launch/windows-breakaway-launcher.ts 2 src/main/orcad/serve-startup/orcad-cli-launcher.ts 1 src/main/orcad/serve-startup/orcad-command-arguments.ts -7 src/main/orcad/serve-startup/orcad-local-serve-selection.ts 6 src/main/persistence/atomic-snapshot-writer.ts 5 src/main/persistence/loading-store/user-data-path.ts 4 src/main/persistence/migrating-orcad-catalog/blob-transfer/orcad-migration-blob-installers.ts @@ -432,13 +420,9 @@ 3 src/main/plugins/storage/plugin-secrets-store.ts 3 src/main/plugins/storage/plugin-storage-store.ts 1 src/main/plugins/testing/plugin-editor-static-check.ts -3 src/main/plugins/workers/child-runtime/plugin-worker-source-hooks.ts 1 src/main/plugins/workers/parent-process/plugin-host-process.ts -8 src/main/ports/darwin-port-scan-lock.ts 1 src/main/ports/port-scan-command-client.ts -1 src/main/ports/port-scan-command-execution.ts 2 src/main/provider-process/provider-executable-missing.ts -# One cached startup capability check per state directory, before choosing native versus legacy dispatch. 3 src/main/provider-process/provider-ownership-journal.ts 5 src/main/providers/local-pty/local-pty-executable-spawn.ts 1 src/main/providers/local-pty/local-pty-session-operations.ts @@ -446,6 +430,7 @@ 1 src/main/providers/shell-launch/macos/login-session-pty-probe.ts 3 src/main/providers/shell-launch/macos/tcc-login-shell.ts 3 src/main/providers/shell-launch/windows/powershell-executable.ts +2 src/main/providers/shell-launch/windows/windows-interactive-login-spawn.ts 2 src/main/providers/working-directory/validation.ts 4 src/main/pty/history/fish-history-session.ts 4 src/main/pty/history/terminal-history-deletion.ts @@ -470,10 +455,10 @@ 2 src/main/rate-limits/providers/opencode-go/opencode-go-api-key-source.ts 1 src/main/rate-limits/providers/zcode/zcode-usage-credentials.ts 3 src/main/ripgrep/bundled-ripgrep-path.ts +1 src/main/runtime/agent-session/installation/structured-agent-session-attachment-wiring.ts 8 src/main/runtime/agent-session/ownership/agent-session-claim-identity.ts 1 src/main/runtime/agent-session/records/agent-session-record-store-slot.ts 7 src/main/runtime/agent-session/records/agent-session-runtime-end-record.ts -1 src/main/runtime/agent-session/installation/structured-agent-session-attachment-wiring.ts 1 src/main/runtime/client/navigation/desktop-chat-creation-history.ts 9 src/main/runtime/host-instance-identity.ts 4 src/main/runtime/hosts/platform-probe/host-descriptor.ts @@ -564,6 +549,7 @@ 1 src/main/wsl/execution/wsl-node-runtime-prefetch.ts 3 src/main/wsl/filesystem/wsl-drive-project-new-default.ts 9 src/main/wsl/filesystem/wsl-drive-unc-conversion-stores.ts +2 src/main/wsl/filesystem/wsl-guest-windows-drive-path.ts 2 src/main/wsl/host-lifecycle/wsl-host-automation-wake-store.ts 4 src/main/wsl/host-lifecycle/wsl-host-e2e-fake-connector.ts 1 src/main/wsl/host-lifecycle/wsl-host-early-wake.ts @@ -571,51 +557,49 @@ 1 src/main/zcode/hook-config-json.ts 12 src/main/zcode/zcode-plan-api-key-store.ts 6 src/shared/agent-hook-listener/claude-session-continuation.ts +9 src/shared/agent-hook-listener/providers/codex/codex-rollout-jsonl-cursor.ts +1 src/shared/agent-hook-listener/providers/codex/codex-subagent-roster.ts +3 src/shared/agent-hook-listener/providers/grok/grok-session-paths.ts +2 src/shared/agent-hook-listener/providers/jcode/jcode-session-files.ts +1 src/shared/agent-hook-listener/providers/muse/muse-session-log.ts 4 src/shared/agent-hook-listener/reverse-file-region-scan.ts 3 src/shared/agent-hook-listener/transcript-reader.ts 3 src/shared/agent-hook-listener/transport/agent-hook-endpoint-temp-cleanup.ts 13 src/shared/agent-hook-listener/transport/agent-hook-spool.ts 5 src/shared/agent-hook-listener/transport/endpoint-publication.ts -4 src/shared/agent-launch/startup/omp-fresh-config.ts -2 src/shared/desktop-distribution/appimage/appimage-cache-identity.ts -2 src/shared/web-client/bundled-web-client-manifest.ts -3 src/shared/web-client/bundled-web-client-root.ts -5 src/shared/shell/command-resolution/cli-fs-reads.ts -3 src/shared/shell/launch/cli-runtime-pairing-inputs.ts -9 src/shared/agent-hook-listener/providers/codex/codex-rollout-jsonl-cursor.ts -1 src/shared/agent-hook-listener/providers/codex/codex-subagent-roster.ts -4 src/shared/remote-runtime/ephemeral-vm-recipes/ephemeral-vm-recipe-doctor.ts -1 src/shared/remote-runtime/ephemeral-vm-recipes/ephemeral-vm-recipe-runner.ts -1 src/shared/remote-runtime/ephemeral-vm-store/ephemeral-vm-runtime-feature-store.ts -1 src/shared/remote-runtime/ephemeral-vm-store/ephemeral-vm-runtime-store.ts -6 src/shared/file-content/node-bounded-file-reader.ts -5 src/shared/file-content/node-file-content-equality.ts -6 src/shared/file-content/node-source-copy-content-equality.ts -3 src/shared/agent-hook-listener/providers/grok/grok-session-paths.ts -2 src/shared/agent-hook-listener/providers/jcode/jcode-session-files.ts -1 src/shared/agent-hook-listener/providers/muse/muse-session-log.ts 1 src/shared/agent-launch/plugins/opencode/opencode-installed-plugin.ts 10 src/shared/agent-launch/plugins/opencode/opencode-plugin-atomic-write.ts 5 src/shared/agent-launch/plugins/opencode/opencode-tui-config-registration.ts 1 src/shared/agent-launch/plugins/opencode/opencode-tui-plugin-install.ts -2 src/shared/remote-runtime/orcad-distribution/orcad-build-identity.ts -1 src/shared/plugins/declarative/testing/orca-testing.ts +4 src/shared/agent-launch/startup/omp-fresh-config.ts +2 src/shared/desktop-distribution/appimage/appimage-cache-identity.ts 2 src/shared/file-access/real-path-sync.ts +6 src/shared/file-content/node-bounded-file-reader.ts +5 src/shared/file-content/node-file-content-equality.ts +6 src/shared/file-content/node-source-copy-content-equality.ts +2 src/shared/file-write/windows-retry-file-operations.ts +1 src/shared/file-write/windows-transient-lock-removal.ts +1 src/shared/plugins/declarative/testing/orca-testing.ts 1 src/shared/remote-runtime/e2ee/node/remote-runtime-e2ee-v2-host-latch.ts +4 src/shared/remote-runtime/ephemeral-vm-recipes/ephemeral-vm-recipe-doctor.ts +1 src/shared/remote-runtime/ephemeral-vm-recipes/ephemeral-vm-recipe-runner.ts +1 src/shared/remote-runtime/ephemeral-vm-store/ephemeral-vm-runtime-feature-store.ts +1 src/shared/remote-runtime/ephemeral-vm-store/ephemeral-vm-runtime-store.ts 1 src/shared/remote-runtime/host-store/runtime-e2ee-keypair-file.ts 1 src/shared/remote-runtime/host-store/runtime-environment-store-records.ts -13 src/shared/secure-storage/secure-file.ts -1 src/shared/secure-storage/secure-path-metadata-snapshot.ts -1 src/shared/secure-storage/secure-path-windows-acl.ts +2 src/shared/remote-runtime/orcad-distribution/orcad-build-identity.ts 3 src/shared/remote-runtime/serve-supervisor/serve-abort-park.ts 7 src/shared/remote-runtime/serve-supervisor/serve-bundle-park.ts 1 src/shared/remote-runtime/serve-supervisor/serve-user-data-path.ts +13 src/shared/secure-storage/secure-file.ts +1 src/shared/secure-storage/secure-path-metadata-snapshot.ts +1 src/shared/secure-storage/secure-path-windows-acl.ts +2 src/shared/secure-storage/windows-security-addon.ts +5 src/shared/shell/command-resolution/cli-fs-reads.ts +3 src/shared/shell/launch/cli-runtime-pairing-inputs.ts +5 src/shared/shell/launch/startup-command-staging.ts 3 src/shared/source-scan/source-tree-scan.ts 2 src/shared/speech/native-recognizer/speech-recognizer-package.ts -5 src/shared/shell/launch/startup-command-staging.ts 1 src/shared/terminal/pty/native-process/pty-process-ceiling-state.ts -8 src/main/orcad/runtime-launch/windows-breakaway-launcher.ts -2 src/main/providers/shell-launch/windows/windows-interactive-login-spawn.ts -2 src/shared/file-write/windows-retry-file-operations.ts -2 src/shared/secure-storage/windows-security-addon.ts -1 src/shared/file-write/windows-transient-lock-removal.ts +2 src/shared/web-client/bundled-web-client-manifest.ts +3 src/shared/web-client/bundled-web-client-root.ts diff --git a/config/performance-audit.md b/config/performance-audit.md index dea9dd03e00..08fa7054518 100644 --- a/config/performance-audit.md +++ b/config/performance-audit.md @@ -54,10 +54,14 @@ old behavior. Use controlled, counterbalanced benchmark samples for timings; avoid new machine-dependent millisecond gates in the normal unit suite. A green source scan and these contracts cannot establish that the whole app is fast. -Two count ratchets (counts per file may only fall) cover classes the audit only warns about: +Count ratchets (counts per file may only fall) cover classes the audit only warns about: `pnpm check:main-sync-fs-ratchet` counts synchronous `node:fs` calls (every `*Sync` export) in production `src/main` and `src/shared` (`config/main-sync-fs-baseline.txt`), and `pnpm check:recurring-timer-ratchet` counts `setInterval` calls in production `src/main`, `src/renderer`, `src/shared` and `src/cli` -(`config/recurring-timer-baseline.txt`). Both run in `check:ratchets` on every non-draft PR that runs static analysis. A new use either +(`config/recurring-timer-baseline.txt`). `pnpm check:main-blocking-helper-ratchet` counts references to +functions that make a synchronous fs, child_process or SQLite call, or call such a function (`config/main-blocking-helper-baseline.txt`), +so a new caller of an existing sync helper in another file fails too. The main-blocking ratchets skip modules +imported only by worker or utility entries (`config/main-blocking-worker-entries.json`). All run in +`check:ratchets` on every non-draft PR that runs static analysis. A new use either moves off the hot path (async fs or a stat-fingerprint cache; a push signal, a visibility-gated or backing-off timer) or raises its file's count with reviewer sign-off. diff --git a/config/scripts/preflight/changed-checks/check-changed-selection.mjs b/config/scripts/preflight/changed-checks/check-changed-selection.mjs index cdb8d89cc90..2dbc86714f4 100644 --- a/config/scripts/preflight/changed-checks/check-changed-selection.mjs +++ b/config/scripts/preflight/changed-checks/check-changed-selection.mjs @@ -27,6 +27,18 @@ const SOURCE_ROOTS = ['src/', 'mobile/', 'tests/', 'config/'] const TEST_FILE = /\.(?:test|spec|e2e|bench)\.[cm]?[jt]sx?$/ const LOCALES = 'src/renderer/src/i18n/' +const MAIN_BLOCKING_GRAPH_INPUTS = [ + 'src/main/', + 'src/shared/', + 'src/preload/', + 'src/packages/', + 'src/cli/', + 'config/build-plugins/', + 'config/main-blocking-worker-entries.json', + 'config/scripts/static-analysis/process-boundaries/main-blocking-source-paths.mjs', + 'config/scripts/workspace/source-exports/' +] + // Ratchets default to SOURCE_ROOTS; list narrower inputs only where a scan is clearly scoped. const RATCHET_INPUTS = { 'check-daemon-blocking-call-ratchet.mjs': ['src/main/'], @@ -35,12 +47,9 @@ const RATCHET_INPUTS = { 'check-host-list-render-ratchet.mjs': ['src/renderer/src/'], 'check-id-only-store-write-ratchet.mjs': ['src/main/persistence/'], 'check-layout-writer-ratchets.mjs': ['src/main/', 'src/renderer/src/'], - 'check-main-sync-fs-ratchet.mjs': [ - 'src/main/', - 'src/shared/', - 'config/main-blocking-worker-entries.json', - 'config/scripts/static-analysis/process-boundaries/main-blocking-source-paths.mjs' - ], + // Both build the event-loop import graph, so anything that changes graph edges selects them. + 'check-main-blocking-helper-ratchet.mjs': MAIN_BLOCKING_GRAPH_INPUTS, + 'check-main-sync-fs-ratchet.mjs': MAIN_BLOCKING_GRAPH_INPUTS, 'check-main-sync-spawn-ratchet.mjs': [ 'src/main/', 'src/shared/', @@ -306,11 +315,24 @@ export function selectTypecheckProjects(files) { const RATCHET_SHARED_MODULES = { 'config/scripts/static-analysis/process-boundaries/gated-call-use-collector.mjs': [ 'check-main-blocking-api-ratchet.mjs', + 'check-main-blocking-helper-ratchet.mjs', 'check-daemon-blocking-call-ratchet.mjs', 'check-main-sync-fs-ratchet.mjs', 'check-main-sync-spawn-ratchet.mjs', 'check-recurring-timer-ratchet.mjs' ], + 'config/scripts/static-analysis/process-boundaries/main-blocking-import-graph.mjs': [ + 'check-main-blocking-api-ratchet.mjs', + 'check-main-blocking-helper-ratchet.mjs', + 'check-main-sync-fs-ratchet.mjs' + ], + 'config/scripts/static-analysis/process-boundaries/main-blocking-helper-propagation.mjs': [ + 'check-main-blocking-helper-ratchet.mjs' + ], + 'config/scripts/static-analysis/process-boundaries/sqlite-call-use-collector.mjs': [ + 'check-main-blocking-api-ratchet.mjs', + 'check-main-blocking-helper-ratchet.mjs' + ], 'config/scripts/static-analysis/ratchets/react-compiler/react-compiler-hazards.mjs': [ 'check-react-compiler-compat-ratchet.mjs' ], diff --git a/config/scripts/preflight/changed-checks/run-lint.mjs b/config/scripts/preflight/changed-checks/run-lint.mjs index d24d8ef969a..4582ec4736d 100644 --- a/config/scripts/preflight/changed-checks/run-lint.mjs +++ b/config/scripts/preflight/changed-checks/run-lint.mjs @@ -46,6 +46,7 @@ export const LINT_STEPS = [ 'check:unproven-pty-retirement-ratchet', 'check:daemon-blocking-call-ratchet', 'check:main-sync-fs-ratchet', + 'check:main-blocking-helper-ratchet', 'check:recurring-timer-ratchet', 'check:node-runtime-pin', 'check:path-literal-ratchet', diff --git a/config/scripts/static-analysis/process-boundaries/gated-call-use-collector.mjs b/config/scripts/static-analysis/process-boundaries/gated-call-use-collector.mjs index 8ecf456adfc..d106d5c5735 100644 --- a/config/scripts/static-analysis/process-boundaries/gated-call-use-collector.mjs +++ b/config/scripts/static-analysis/process-boundaries/gated-call-use-collector.mjs @@ -16,7 +16,7 @@ function moduleKey(file) { return normalized(file).replace(/\.[cm]?[jt]sx?$/, '') } -function isValueReference(node) { +export function isValueReference(node) { const parent = node.parent if ( ts.isImportSpecifier(parent) || @@ -55,22 +55,36 @@ export function createGatedCallCollector(families, ratchetName) { const advice = new Map(families.flatMap((family) => Object.entries(family.advice))) const markers = [ ...advice.keys(), + ...families.flatMap((family) => Object.keys(family.localAdvice ?? {})), ...families.filter((family) => family.exportPattern).map(() => 'Sync'), ...new Set( families.flatMap((family) => family.modules.map((module) => path.posix.basename(module))) ) ] - function symbolsOf(key) { - const matched = families.filter((family) => family.modules.includes(key)) - if (!matched.length) { + const familiesByModule = new Map() + for (const family of families) { + for (const module of family.modules) { + familiesByModule.set(module, [...(familiesByModule.get(module) ?? []), family]) + } + } + + function symbolsOf(key, local = false) { + const matched = familiesByModule.get(key) + if (!matched) { return null } - const names = new Set(matched.flatMap((family) => Object.keys(family.advice))) + const names = new Set( + matched.flatMap((family) => [ + ...Object.keys(family.advice), + ...(local ? Object.keys(family.localAdvice ?? {}) : []) + ]) + ) const patterns = matched.map((family) => family.exportPattern).filter(Boolean) names.has = (name) => Set.prototype.has.call(names, name) || (typeof name === 'string' && patterns.some((pattern) => pattern.test(name))) + names.moduleKey = key return names } @@ -100,16 +114,21 @@ export function createGatedCallCollector(families, ratchetName) { throw new Error(`Cannot parse ${file}; the ${ratchetName} ratchet must not skip it.`) } if (!analyze) { - return { count: 0, symbols: [] } + return { count: 0, symbols: [], sites: [] } } const used = new Set() + const sites = [] let count = 0 const namespaces = new Map( families.flatMap((family) => (family.globals ?? []).map((name) => [name, new Set(Object.keys(family.advice))]) ) ) - const functions = new Map([...(symbolsOf(moduleKey(file)) ?? [])].map((name) => [name, name])) + const functions = new Map( + [...(symbolsOf(moduleKey(file), true) ?? [])].map((name) => [name, name]) + ) + // Which module each local function binding came from, so same-named exports stay distinct. + const origins = new Map([...functions.keys()].map((name) => [name, moduleKey(file)])) const aliases = [] const members = [] const identifiers = [] @@ -154,8 +173,9 @@ export function createGatedCallCollector(families, ratchetName) { } return null } - function recordUse(name) { + function recordUse(name, node, module) { used.add(name) + sites.push({ name, position: node.getStart(source), module }) count += 1 } function visitImport(node) { @@ -166,6 +186,10 @@ export function createGatedCallCollector(families, ratchetName) { } if (clause.name) { namespaces.set(clause.name.text, symbols) + if (symbols.has('default')) { + functions.set(clause.name.text, 'default') + origins.set(clause.name.text, symbols.moduleKey) + } } const named = clause.namedBindings if (named && ts.isNamespaceImport(named)) { @@ -175,6 +199,7 @@ export function createGatedCallCollector(families, ratchetName) { const imported = (element.propertyName ?? element.name).text if (!element.isTypeOnly && symbols.has(imported)) { functions.set(element.name.text, imported) + origins.set(element.name.text, symbols.moduleKey) } } } @@ -193,8 +218,7 @@ export function createGatedCallCollector(families, ratchetName) { .filter((element) => !element.isTypeOnly) .map((element) => (element.propertyName ?? element.name).text) for (const name of names.filter((name) => symbols.has(name))) { - used.add(name) - count += 1 + recordUse(name, node, symbols.moduleKey) } } function visit(node) { @@ -241,6 +265,16 @@ export function createGatedCallCollector(families, ratchetName) { changed = true } else if (gated && !functions.has(name)) { functions.set(name, gated) + const target = unwrap(initializer) + origins.set( + name, + target && ts.isIdentifier(target) + ? origins.get(target.text) + : target && + (ts.isPropertyAccessExpression(target) || ts.isElementAccessExpression(target)) + ? moduleSymbols(target.expression)?.moduleKey + : undefined + ) changed = true } } @@ -255,6 +289,7 @@ export function createGatedCallCollector(families, ratchetName) { !functions.has(element.name.text) ) { functions.set(element.name.text, name) + origins.set(element.name.text, symbols.moduleKey) changed = true } } @@ -278,17 +313,18 @@ export function createGatedCallCollector(families, ratchetName) { } for (const node of members) { const name = propertyName(node) - if (!aliasSetup.has(node) && moduleSymbols(node.expression)?.has(name)) { - recordUse(name) + const symbols = aliasSetup.has(node) ? null : moduleSymbols(node.expression) + if (symbols?.has(name)) { + recordUse(name, node, symbols.moduleKey) } } for (const node of identifiers) { const name = aliasSetup.has(node) ? null : functions.get(node.text) if (name) { - recordUse(name) + recordUse(name, node, origins.get(node.text)) } } - return { count, symbols: [...used].sort() } + return { count, symbols: [...used].sort(), sites } } function adviceFor(symbols) { diff --git a/config/scripts/static-analysis/process-boundaries/main-blocking-helper-propagation.mjs b/config/scripts/static-analysis/process-boundaries/main-blocking-helper-propagation.mjs new file mode 100644 index 00000000000..eca97d7baeb --- /dev/null +++ b/config/scripts/static-analysis/process-boundaries/main-blocking-helper-propagation.mjs @@ -0,0 +1,306 @@ +import path from 'node:path' +import ts from 'typescript-api' +import { createGatedCallCollector, isValueReference } from './gated-call-use-collector.mjs' +import { unwrap } from '../module-requests/static-module-specifiers.mjs' + +// Per-file call counts never see a new caller of an existing sync helper in another file; this +// marks top-level functions that reach a blocking call (directly or through other marked functions) +// and counts every reference to them, so the helper's callers are guarded too. + +function moduleKeys(file) { + const key = file.replace(/\.[cm]?[jt]sx?$/, '') + return path.posix.basename(key) === 'index' ? [key, path.posix.dirname(key)] : [key] +} + +function hasModifier(node, kind) { + return !!ts.getModifiers?.(node)?.some((modifier) => modifier.kind === kind) +} + +function isFunctionLike(node) { + node = unwrap(node) + return !!node && (ts.isArrowFunction(node) || ts.isFunctionExpression(node)) +} + +/** Runtime references inside a function body: type positions and property names are not calls. Names match + * file-wide, like the direct collectors: a local or parameter reusing a helper's name is counted (never missed). */ +function scanBody(node) { + const references = new Set() + const visit = (child) => { + if (ts.isTypeNode(child) && !ts.isExpressionWithTypeArguments(child)) { + return + } + if (ts.isIdentifier(child) && isValueReference(child)) { + references.add(child.text) + } + ts.forEachChild(child, visit) + } + ts.forEachChild(node, visit) + return { references } +} + +/** Top-level functions with their ranges, runtime references, export names and re-exports. */ +function scanDeclarations(file, contents) { + const source = ts.createSourceFile(file, contents, ts.ScriptTarget.Latest, true) + const functions = [] + const exportNames = new Map() + const reexports = [] + const imports = new Map() + const explicitExports = new Set() + const exportAs = (local, exported) => + exportNames.set(local, [...(exportNames.get(local) ?? []), exported]) + const targetModule = (specifier) => + path.posix + .normalize(path.posix.join(path.posix.dirname(file), specifier)) + .replace(/\.[cm]?[jt]sx?$/, '') + const reserveBinding = (name) => { + if (ts.isIdentifier(name)) { + explicitExports.add(name.text) + } else { + for (const element of name.elements) { + if (ts.isBindingElement(element)) { + reserveBinding(element.name) + } + } + } + } + const addFunction = (name, node) => { + functions.push({ name, start: node.getStart(source), end: node.getEnd(), ...scanBody(node) }) + } + for (const statement of source.statements) { + const exported = hasModifier(statement, ts.SyntaxKind.ExportKeyword) + const isDefault = hasModifier(statement, ts.SyntaxKind.DefaultKeyword) + if ( + exported && + !ts.isTypeAliasDeclaration(statement) && + !ts.isInterfaceDeclaration(statement) && + statement.name && + ts.isIdentifier(statement.name) + ) { + explicitExports.add(isDefault ? 'default' : statement.name.text) + } + if ( + ts.isImportDeclaration(statement) && + ts.isStringLiteral(statement.moduleSpecifier) && + statement.moduleSpecifier.text.startsWith('.') && + statement.importClause && + !statement.importClause.isTypeOnly + ) { + const target = targetModule(statement.moduleSpecifier.text) + const clause = statement.importClause + if (clause.name) { + imports.set(clause.name.text, { target, name: 'default' }) + } + if (clause.namedBindings && ts.isNamedImports(clause.namedBindings)) { + for (const element of clause.namedBindings.elements) { + if (!element.isTypeOnly) { + imports.set(element.name.text, { + target, + name: (element.propertyName ?? element.name).text + }) + } + } + } + } + if (ts.isFunctionDeclaration(statement) && statement.body) { + const name = statement.name?.text ?? 'default' + addFunction(name, statement) + if (exported) { + exportAs(name, isDefault ? 'default' : name) + } + } else if (ts.isVariableStatement(statement)) { + for (const declaration of statement.declarationList.declarations) { + if (exported) { + reserveBinding(declaration.name) + } + if (ts.isIdentifier(declaration.name) && isFunctionLike(declaration.initializer)) { + addFunction(declaration.name.text, declaration) + if (exported) { + exportAs(declaration.name.text, declaration.name.text) + } + } + } + } else if (ts.isExportAssignment(statement) && !statement.isExportEquals) { + const target = unwrap(statement.expression) + if (target && ts.isIdentifier(target)) { + exportAs(target.text, 'default') + } else if (isFunctionLike(target)) { + addFunction('default', statement) + exportAs('default', 'default') + } + } else if ( + ts.isExportDeclaration(statement) && + !statement.isTypeOnly && + statement.exportClause && + ts.isNamedExports(statement.exportClause) && + !statement.moduleSpecifier + ) { + for (const element of statement.exportClause.elements) { + if (!element.isTypeOnly) { + exportAs((element.propertyName ?? element.name).text, element.name.text) + } + } + } else if ( + ts.isExportDeclaration(statement) && + !statement.isTypeOnly && + statement.moduleSpecifier && + ts.isStringLiteral(statement.moduleSpecifier) && + statement.moduleSpecifier.text.startsWith('.') + ) { + const target = targetModule(statement.moduleSpecifier.text) + const names = + statement.exportClause && ts.isNamedExports(statement.exportClause) + ? statement.exportClause.elements + .filter((element) => !element.isTypeOnly) + .map((element) => [(element.propertyName ?? element.name).text, element.name.text]) + : null + if (statement.exportClause && ts.isNamespaceExport(statement.exportClause)) { + explicitExports.add(statement.exportClause.name.text) + } else { + reexports.push({ target, names }) + for (const [, name] of names ?? []) { + explicitExports.add(name) + } + } + } + } + for (const [local, exported] of exportNames) { + for (const name of exported) { + explicitExports.add(name) + } + const imported = imports.get(local) + if (imported) { + reexports.push({ + target: imported.target, + names: exported.map((name) => [imported.name, name]) + }) + } + } + return { functions, exportNames, reexports, explicitExports } +} + +/** + * `direct`: file -> start offsets of blocking calls, with the call each one reaches. Returns file -> helper + * references counted and the helpers used (each with the blocking call it reaches). + */ +export function collectBlockingHelperUses(sources, direct, { depth = Infinity } = {}) { + const scans = new Map() + const scan = (file) => { + if (!scans.has(file)) { + scans.set(file, scanDeclarations(file, sources.get(file))) + } + return scans.get(file) + } + // file -> helper name -> description of the blocking call it reaches. + const helpers = new Map() + const markSites = (file, sites) => { + const { functions } = scan(file) + const marked = helpers.get(file) ?? new Map() + let added = false + for (const { position, reaches } of sites) { + const owner = functions.find((fn) => position >= fn.start && position < fn.end) + if (owner && !marked.has(owner.name)) { + marked.set(owner.name, reaches) + added = true + } + } + // A function calling a marked function in its own file reaches the same blocking call. + for (let changed = true; changed;) { + changed = false + for (const fn of functions) { + if (marked.has(fn.name)) { + continue + } + const via = [...fn.references].find((name) => marked.has(name)) + if (via) { + marked.set(fn.name, marked.get(via)) + changed = added = true + } + } + } + if (marked.size > 0) { + helpers.set(file, marked) + } + return added + } + for (const [file, sites] of direct) { + if (sources.has(file)) { + markSites(file, sites) + } + } + const barrels = [...sources.keys()].filter((file) => scan(file).reexports.length > 0) + for (let round = 0; ; round++) { + // module key -> exported name -> what it reaches + const reachesByModule = new Map() + for (const [file, marked] of helpers) { + const { exportNames } = scan(file) + const names = new Map() + for (const [local, reaches] of marked) { + for (const exported of exportNames.get(local) ?? []) { + names.set(exported, reaches) + } + } + for (const key of moduleKeys(file)) { + reachesByModule.set(key, names) + } + } + // Re-exports add no call depth, so barrels (and barrels of barrels) resolve fully every round. + for (let changed = true; changed;) { + changed = false + for (const file of barrels) { + const own = reachesByModule.get(moduleKeys(file)[0]) ?? new Map() + const { reexports, explicitExports } = scan(file) + for (const { target, names } of reexports) { + const reached = reachesByModule.get(target) + const pairs = names ?? [...(reached?.keys() ?? [])].map((name) => [name, name]) + for (const [from, to] of pairs) { + if (!names && (from === 'default' || explicitExports.has(to))) { + continue + } + if (reached?.has(from) && !own.has(to)) { + own.set(to, reached.get(from)) + changed = true + } + } + } + if (own.size > 0) { + for (const key of moduleKeys(file)) { + reachesByModule.set(key, own) + } + } + } + } + const families = [...reachesByModule].map(([key, names]) => ({ + modules: [key], + advice: Object.fromEntries(names) + })) + for (const [file, marked] of helpers) { + families.push({ + modules: [moduleKeys(file)[0]], + advice: {}, + localAdvice: Object.fromEntries(marked) + }) + } + const collector = createGatedCallCollector(families, 'main blocking helper') + const uses = new Map() + let grew = false + for (const [file, contents] of sources) { + const { count, sites } = collector.collectUses(file, contents) + if (count === 0) { + continue + } + const reached = sites.map(({ name, position, module }) => ({ + position, + name, + reaches: reachesByModule.get(module)?.get(name) ?? helpers.get(file)?.get(name) ?? name + })) + uses.set(file, { + count, + reaches: [...new Set(reached.map(({ name, reaches }) => `${name} (${reaches})`))].sort() + }) + grew = markSites(file, reached) || grew + } + if (!grew || round + 1 >= depth) { + return { uses, helpers } + } + } +} diff --git a/config/scripts/static-analysis/process-boundaries/main-blocking-import-graph.mjs b/config/scripts/static-analysis/process-boundaries/main-blocking-import-graph.mjs new file mode 100644 index 00000000000..347eefe3871 --- /dev/null +++ b/config/scripts/static-analysis/process-boundaries/main-blocking-import-graph.mjs @@ -0,0 +1,243 @@ +import { build } from 'esbuild' +import { existsSync, readFileSync } from 'node:fs' +import path from 'node:path' +import ts from 'typescript-api' +import { createWorkspaceSourceResolver } from '../../workspace/source-exports/workspace-source-exports.mjs' +import { listTrackedFiles, readTrackedSources } from '../ratchet-baseline/ratchet-baseline.mjs' +import { unwrap } from '../module-requests/static-module-specifiers.mjs' +import { + isMainBlockingSource, + MAIN_BLOCKING_WORKER_ENTRIES +} from './main-blocking-source-paths.mjs' + +const EXTERNAL = [ + 'electron', + 'node-pty', + '@parcel/watcher', + 'better-sqlite3', + 'keytar', + 'fsevents', + 'cpu-features' +] + +const externalNativeAddons = { + name: 'external-native-addons', + setup(pluginBuild) { + pluginBuild.onResolve({ filter: /\.node$|\?[\w&]+$/ }, (args) => ({ + path: args.path, + external: true + })) + } +} + +/** Repo-relative file -> repo-relative files it imports, for every scanned source in one bundle pass. */ +export async function collectImportGraph(root, files) { + const workspace = createWorkspaceSourceResolver(root) + const result = await build({ + stdin: { + contents: files + .map( + (file, index) => `export * as m${index} from ${JSON.stringify(path.resolve(root, file))}` + ) + .join('\n'), + resolveDir: root, + loader: 'ts', + sourcefile: 'main-blocking-import-graph-entry.ts' + }, + bundle: true, + write: false, + outdir: path.join(root, 'main-blocking-import-graph-metafile-only'), + platform: 'node', + target: 'node20', + format: 'esm', + external: EXTERNAL, + packages: 'external', + metafile: true, + absWorkingDir: root, + logLevel: 'silent', + plugins: [ + externalNativeAddons, + { + name: 'main-blocking-workspace-sources', + setup(pluginBuild) { + pluginBuild.onResolve({ filter: /^@orca\// }, ({ path: specifier }) => { + const source = workspace.resolve(specifier) + return source ? { path: source.path } : undefined + }) + } + } + ] + }) + const relative = (file) => path.relative(root, path.resolve(root, file)).split(path.sep).join('/') + const graph = new Map() + for (const [file, info] of Object.entries(result.metafile.inputs)) { + graph.set( + relative(file), + (info.imports ?? []).filter((edge) => !edge.external).map((edge) => relative(edge.path)) + ) + } + return graph +} + +// esbuild does not follow `createRequire(...)('./x')`; without the edge a main-loaded module could look worker-only. +const RESOLVE_EXTENSIONS = ['.ts', '.tsx', '.mts', '.cts', '.js', '.mjs', '.cjs'] + +function createRequireTargets(file, contents, sources) { + const source = ts.createSourceFile(file, contents, ts.ScriptTarget.Latest, true) + const loaders = new Set() + const targets = [] + const isCreateRequire = (node) => + ts.isCallExpression(node) && + ts.isIdentifier(node.expression) && + node.expression.text === 'createRequire' + const visit = (node) => { + if ( + ts.isVariableDeclaration(node) && + ts.isIdentifier(node.name) && + node.initializer && + isCreateRequire(node.initializer) + ) { + loaders.add(node.name.text) + } + if ( + ts.isCallExpression(node) && + (isCreateRequire(node.expression) || + (ts.isIdentifier(node.expression) && loaders.has(node.expression.text))) && + node.arguments[0] && + ts.isStringLiteralLike(node.arguments[0]) && + node.arguments[0].text.startsWith('.') + ) { + const base = path.posix.normalize( + path.posix.join(path.posix.dirname(file), node.arguments[0].text) + ) + const resolved = [ + base, + ...RESOLVE_EXTENSIONS.map((ext) => `${base}${ext}`), + ...RESOLVE_EXTENSIONS.map((ext) => `${base}/index${ext}`) + ].find((candidate) => sources.has(candidate)) + if (resolved) { + targets.push(resolved) + } + } + ts.forEachChild(node, visit) + } + visit(source) + return targets +} + +/** Electron main, CLI, orcad and preload entries: guarded even when a worker happens to import one. */ +export function eventLoopEntryFiles(root) { + // Fixtures lack build config; a renamed main entry must not disable root validation in the real repo. + const realRepo = + listTrackedFiles(root, ['config/build-plugins/main-build-entry-points.ts']).length > 0 + const read = (file) => { + try { + return readFileSync(path.join(root, file), 'utf8') + } catch { + return '' + } + } + const builtSource = read('config/build-plugins/main-build-entry-points.ts') + const built = [...builtSource.matchAll(/resolve\(\s*(['"])([^'"]+)\1\s*\)/g)].map( + (match) => match[2] + ) + const cliSource = ts.createSourceFile( + 'cli-main-entry-names.ts', + read('config/build-plugins/cli-main-entry-names.ts'), + ts.ScriptTarget.Latest, + true + ) + const cliList = unwrap( + cliSource.statements + .filter(ts.isVariableStatement) + .flatMap((statement) => [...statement.declarationList.declarations]) + .find( + (declaration) => + ts.isIdentifier(declaration.name) && declaration.name.text === 'CLI_MAIN_ENTRY_NAMES' + )?.initializer + ) + const validCli = + cliSource.parseDiagnostics.length === 0 && + cliList && + ts.isArrayLiteralExpression(cliList) && + cliList.elements.every(ts.isStringLiteral) + const cli = validCli ? cliList.elements.map((element) => `src/main/${element.text}.ts`) : [] + const preload = listTrackedFiles(root, ['src/preload']).filter( + (file) => file.split('/').length === 3 && isMainBlockingSource(file) + ) + const entries = [...built, ...cli, 'src/main/index.ts', 'src/main/orcad/main.ts', ...preload] + if (realRepo) { + const tracked = new Set(listTrackedFiles(root, entries)) + const missing = entries.filter( + (file) => !tracked.has(file) || !existsSync(path.join(root, file)) + ) + // Every non-template resolve() in the entry list must be a literal we read, or a root went missing. + const resolveCalls = (builtSource.match(/resolve\(\s*(?!`)/g) ?? []).length + if ( + !built.includes('src/main/index.ts') || + built.length !== resolveCalls || + !validCli || + cli.length === 0 || + missing.length > 0 + ) { + throw new Error( + `main-blocking-import-graph: cannot read the event-loop entries from config/build-plugins (main ${built.length}, CLI ${cli.length}, missing: ${missing.join(', ') || 'none'}); update eventLoopEntryFiles` + ) + } + } + return entries.filter((file) => !Object.hasOwn(MAIN_BLOCKING_WORKER_ENTRIES, file)) +} + +/** Files imported only beneath worker/utility entries; anything an event-loop file or entry imports stays guarded. */ +export function workerOnlyFiles(graph, files, eventLoopEntries = []) { + const entries = new Set(Object.keys(MAIN_BLOCKING_WORKER_ENTRIES)) + const underWorker = new Set() + const walk = (start, seen) => { + const stack = [start] + while (stack.length > 0) { + const file = stack.pop() + if (seen.has(file)) { + continue + } + seen.add(file) + stack.push(...(graph.get(file) ?? [])) + } + } + for (const entry of entries) { + walk(entry, underWorker) + } + const guarded = new Set() + for (const entry of eventLoopEntries) { + walk(entry, guarded) + } + for (const file of files) { + if (!underWorker.has(file)) { + walk(file, guarded) + } + } + return new Set(files.filter((file) => underWorker.has(file) && !guarded.has(file))) +} + +/** Tracked event-loop sources under `pathspecs`: main-blocking sources minus worker-only modules. */ +export async function readEventLoopSources(root, pathspecs) { + const sources = readTrackedSources( + root, + ['src/main', 'src/shared', 'src/preload'], + isMainBlockingSource + ) + // Worker entries themselves are not main-blocking sources, but the graph must start from them. + const entries = new Set(listTrackedFiles(root, Object.keys(MAIN_BLOCKING_WORKER_ENTRIES))) + const graph = await collectImportGraph(root, [...sources.keys(), ...entries]) + for (const [file, contents] of sources) { + if (contents.includes('createRequire')) { + graph.set(file, [ + ...(graph.get(file) ?? []), + ...createRequireTargets(file, contents, sources) + ]) + } + } + const workerOnly = workerOnlyFiles(graph, [...sources.keys()], eventLoopEntryFiles(root)) + const inPathspecs = (file) => + pathspecs.some((spec) => file === spec || file.startsWith(`${spec}/`)) + return new Map([...sources].filter(([file]) => inPathspecs(file) && !workerOnly.has(file))) +} diff --git a/config/scripts/static-analysis/process-boundaries/main-blocking-source-paths.mjs b/config/scripts/static-analysis/process-boundaries/main-blocking-source-paths.mjs index 035176aed0b..6807904577d 100644 --- a/config/scripts/static-analysis/process-boundaries/main-blocking-source-paths.mjs +++ b/config/scripts/static-analysis/process-boundaries/main-blocking-source-paths.mjs @@ -1,10 +1,11 @@ import { existsSync, readFileSync } from 'node:fs' import { isTestOnlySourcePath } from './test-only-source-path.mjs' -// Exact entry files only: dependencies remain guarded, even when a worker imports them. +// Entry files are exempt here; main-blocking-import-graph.mjs also exempts modules only these entries import. const entries = JSON.parse( readFileSync(new URL('../../../main-blocking-worker-entries.json', import.meta.url), 'utf8') ) +export const MAIN_BLOCKING_WORKER_ENTRIES = entries for (const [file, reason] of Object.entries(entries)) { if ( !file.startsWith('src/main/') || diff --git a/config/scripts/static-analysis/process-boundaries/sqlite-call-use-collector.mjs b/config/scripts/static-analysis/process-boundaries/sqlite-call-use-collector.mjs index ad689f0b3b3..9f2e52ade00 100644 --- a/config/scripts/static-analysis/process-boundaries/sqlite-call-use-collector.mjs +++ b/config/scripts/static-analysis/process-boundaries/sqlite-call-use-collector.mjs @@ -1,12 +1,28 @@ import ts from 'typescript-api' import { propertyName, unwrap } from '../module-requests/static-module-specifiers.mjs' -const METHODS = new Set(['prepare', 'run', 'get', 'all', 'iterate', 'exec']) +// pragma() and transaction() run SQL too: a durability pragma or BEGIN/COMMIT blocks like any statement. +const TRANSACTION_MODES = new Set(['immediate', 'deferred', 'exclusive']) +const METHODS = new Set([ + 'prepare', + 'run', + 'get', + 'all', + 'iterate', + 'exec', + 'pragma', + 'transaction' +]) const SQLITE_MODULE = /^(?:node:sqlite|better-sqlite3)$|(?:^|\/)(?:sync-database|sqlite-statement)(?:\.[cm]?[jt]s)?$/ -// Local syntax only: imported SQLite types, typed receivers, constructors and prepare() results. export function countSqliteCalls(file, contents) { + return collectSqliteCallSites(file, contents).length +} + +// Local syntax only: imported SQLite types, typed receivers, constructors and prepare() results. +/** Start offsets of each synchronous SQLite call. */ +export function collectSqliteCallSites(file, contents) { const source = ts.createSourceFile(file, contents, ts.ScriptTarget.Latest, true) if (source.parseDiagnostics.length) { throw new Error(`Cannot parse ${file}; SQLite ratchet must not skip it.`) @@ -131,9 +147,32 @@ export function countSqliteCalls(file, contents) { } return false } + // `const insertMany = db.transaction(fn)`: each insertMany() call runs BEGIN/COMMIT; its result is not a database. + const transactionCalls = new Set() + const transactionWrapper = (node) => { + node = unwrap(node) + return ( + !!node && + ts.isCallExpression(node) && + (ts.isPropertyAccessExpression(node.expression) || + ts.isElementAccessExpression(node.expression)) && + propertyName(node.expression) === 'transaction' && + instance(node.expression.expression) + ) + } for (let changed = true; changed;) { changed = false for (const node of declarations) { + if ( + ts.isVariableDeclaration(node) && + ts.isIdentifier(node.name) && + !transactionCalls.has(node.name.text) && + transactionWrapper(node.initializer) + ) { + transactionCalls.add(node.name.text) + changed = true + continue + } if (!ts.isIdentifier(node.name) || !(sqliteType(node.type) || instance(node.initializer))) { continue } @@ -149,18 +188,31 @@ export function countSqliteCalls(file, contents) { } } } - return calls.filter((node) => { - const target = unwrap(node.expression) - if (ts.isNewExpression(node)) { - return constructor(target) - } - if (callableConstructors.has(key(target))) { - return true - } - return ( - (ts.isPropertyAccessExpression(target) || ts.isElementAccessExpression(target)) && - METHODS.has(propertyName(target)) && - instance(target.expression) - ) - }).length + return calls + .filter((node) => { + const target = unwrap(node.expression) + if (ts.isNewExpression(node)) { + return constructor(target) + } + if ( + callableConstructors.has(key(target)) || + transactionCalls.has(key(target)) || + transactionWrapper(target) + ) { + return true + } + if ( + (ts.isPropertyAccessExpression(target) || ts.isElementAccessExpression(target)) && + TRANSACTION_MODES.has(propertyName(target)) && + transactionCalls.has(key(target.expression)) + ) { + return true + } + return ( + (ts.isPropertyAccessExpression(target) || ts.isElementAccessExpression(target)) && + METHODS.has(propertyName(target)) && + instance(target.expression) + ) + }) + .map((node) => node.getStart(source)) } diff --git a/config/scripts/static-analysis/ratchet-baseline/ratchet-baseline.mjs b/config/scripts/static-analysis/ratchet-baseline/ratchet-baseline.mjs index 23cb7586345..4618a113479 100644 --- a/config/scripts/static-analysis/ratchet-baseline/ratchet-baseline.mjs +++ b/config/scripts/static-analysis/ratchet-baseline/ratchet-baseline.mjs @@ -155,17 +155,53 @@ export function totalCount(counts) { return [...counts.values()].reduce((sum, count) => sum + count, 0) } -/** Lowers baseline rows to `current` and keeps their notes; growth still has to be fixed in code. */ +/** Files renamed since the change's base (ORCA_CODE_QUALITY_BASE, else the merge base with origin/main). */ +function renamedSinceBase(root) { + try { + const base = + process.env.ORCA_CODE_QUALITY_BASE || + execFileSync('git', ['merge-base', 'HEAD', 'origin/main'], { + cwd: root, + encoding: 'utf8' + }).trim() + const fields = execFileSync( + 'git', + ['diff', '-M', '--name-status', '-z', '--diff-filter=R', base], + { + cwd: root, + encoding: 'utf8' + } + ) + .split('\0') + .filter(Boolean) + const renames = [] + for (let index = 0; index + 2 < fields.length; index += 3) { + renames.push([fields[index + 1], fields[index + 2]]) + } + return renames + } catch { + return [] + } +} + +/** Lowers baseline rows to `current` and keeps their notes; a renamed file keeps its row. Growth still needs a code fix. */ export function pruneCountBaseline(root, baselinePath, header, current) { const file = path.join(root, baselinePath) const text = fs.existsSync(file) ? fs.readFileSync(file, 'utf8') : '' + const baseline = parseCountBaseline(text) + const notes = parseCountNotes(text) + for (const [from, to] of renamedSinceBase(root)) { + if (baseline.has(from) && !baseline.has(to) && !current.get(from)) { + baseline.set(to, baseline.get(from)) + if (notes.has(from)) { + notes.set(to, notes.get(from)) + } + } + } const pruned = new Map( - [...parseCountBaseline(text)].map(([rel, allowed]) => [ - rel, - Math.min(allowed, current.get(rel) ?? 0) - ]) + [...baseline].map(([rel, allowed]) => [rel, Math.min(allowed, current.get(rel) ?? 0)]) ) - fs.writeFileSync(file, formatCountBaseline(pruned, header, parseCountNotes(text))) + fs.writeFileSync(file, formatCountBaseline(pruned, header, notes)) return totalCount(pruned) } @@ -185,10 +221,18 @@ export function runCountRatchet(ratchet, root, arg) { const keep = (counts) => (inScope ? new Map([...counts].filter(([key]) => inScope(key))) : counts) const { grown, shrunk } = diffCounts(keep(current), keep(baseline)) for (const { file, now, allowed } of grown) { - console.error(`${file}: ${now} ${ratchet.unit}, baseline allows ${allowed}.`) + const detail = ratchet.detail?.(file) + console.error( + `${file}: ${now} ${ratchet.unit}, baseline allows ${allowed}.${detail ? ` ${detail}` : ''}` + ) } if (grown.length > 0) { console.error(ratchet.fix.join('\n')) + if (grown.some(({ allowed }) => allowed === 0) && shrunk.length > 0) { + console.error( + `A moved or renamed file keeps its allowance: ${ratchet.pruneCommand ?? `pnpm check:${ratchet.name}-ratchet --prune`} carries its row to the new path.` + ) + } } for (const { file, now, allowed } of shrunk) { console.error(`${file}: now ${now}, baseline ${allowed}.`) diff --git a/config/scripts/static-analysis/ratchets/runtime-lifecycle/check-main-blocking-api-ratchet.mjs b/config/scripts/static-analysis/ratchets/runtime-lifecycle/check-main-blocking-api-ratchet.mjs index 3be64ba86ca..c5302e385fa 100644 --- a/config/scripts/static-analysis/ratchets/runtime-lifecycle/check-main-blocking-api-ratchet.mjs +++ b/config/scripts/static-analysis/ratchets/runtime-lifecycle/check-main-blocking-api-ratchet.mjs @@ -5,7 +5,8 @@ import { createGatedCallCollector } from '../../process-boundaries/gated-call-us import { countSqliteCalls } from '../../process-boundaries/sqlite-call-use-collector.mjs' import { isMainBlockingSource } from '../../process-boundaries/main-blocking-source-paths.mjs' import { propertyName } from '../../module-requests/static-module-specifiers.mjs' -import { readTrackedSources, runCountRatchet } from '../../ratchet-baseline/ratchet-baseline.mjs' +import { runCountRatchet } from '../../ratchet-baseline/ratchet-baseline.mjs' +import { readEventLoopSources } from '../../process-boundaries/main-blocking-import-graph.mjs' export const OFF_MAIN_ADVICE = 'Move CPU or SQL work to a worker, utility process or the backend; async is right only for real I/O waits. Use asynchronous requests and replies for IPC.' @@ -102,9 +103,9 @@ export function countBlockingApis(sources) { return counts } -export function main(root = process.cwd(), arg = undefined) { +export async function main(root = process.cwd(), arg = undefined) { const counts = countBlockingApis( - readTrackedSources(root, ['src/main', 'src/shared', 'src/preload'], isMainBlockingSource) + await readEventLoopSources(root, ['src/main', 'src/shared', 'src/preload']) ) let status = 0 for (const [category, current] of counts) { @@ -114,7 +115,7 @@ export function main(root = process.cwd(), arg = undefined) { baselinePath: `config/main-blocking-${category}-baseline.txt`, header: [ `# Legacy synchronous ${category} uses per file; counts may only go DOWN.`, - '# Only explicit worker/utility entry files are exempt; their imports remain guarded.' + '# Worker/utility entries and modules only they import are exempt; anything event-loop code imports stays guarded.' ], collect: () => current, pruneCommand: @@ -131,5 +132,5 @@ export function main(root = process.cwd(), arg = undefined) { } if (process.argv[1] && import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href) { - process.exitCode = main(process.cwd(), process.argv[2]) + process.exitCode = await main(process.cwd(), process.argv[2]) } diff --git a/config/scripts/static-analysis/ratchets/runtime-lifecycle/check-main-blocking-api-ratchet.test.mjs b/config/scripts/static-analysis/ratchets/runtime-lifecycle/check-main-blocking-api-ratchet.test.mjs index 5765f795b3a..c91ea71d81c 100644 --- a/config/scripts/static-analysis/ratchets/runtime-lifecycle/check-main-blocking-api-ratchet.test.mjs +++ b/config/scripts/static-analysis/ratchets/runtime-lifecycle/check-main-blocking-api-ratchet.test.mjs @@ -6,6 +6,9 @@ import { afterEach, describe, expect, it, vi } from 'vitest' import { main as fsMain } from './check-main-sync-fs-ratchet.mjs' import '../../process-boundaries/check-main-sync-spawn-ratchet.mjs' import { countBlockingApis, main } from './check-main-blocking-api-ratchet.mjs' +import { collectDirectBlockingSites } from './check-main-blocking-helper-ratchet.mjs' +import { collectBlockingHelperUses } from '../../process-boundaries/main-blocking-helper-propagation.mjs' +import { workerOnlyFiles } from '../../process-boundaries/main-blocking-import-graph.mjs' const file = 'src/main/consumer.ts' const counts = (source, name = file) => @@ -24,17 +27,17 @@ afterEach(() => { }) describe('main blocking API ratchets', () => { - it('guards typed SQL receivers without charging Map.get or async backup', () => { + it('guards typed SQL receivers and pragmas without charging Map.get or async backup', () => { expect( counts(`import type Database from '../sqlite/sync-database' class Owner { db: Database.Database | null - query() { this.db.prepare('select').get(); this.db.backup('copy') } + query() { this.db.prepare('select').get(); this.db.backup('copy'); this.db.pragma('synchronous = FULL') } } function query(db: Database.Database, statement: Database.Statement, cache: Map) { db.exec('schema'); statement.run(); cache.get('key') }`) - ).toEqual({ compression: 0, crypto: 0, atomics: 0, sqlite: 4, ipc: 0 }) + ).toEqual({ compression: 0, crypto: 0, atomics: 0, sqlite: 5, ipc: 0 }) }) it('guards constructor properties and namespace SQLite types', () => { @@ -59,7 +62,7 @@ describe('main blocking API ratchets', () => { ).toEqual({ compression: 0, crypto: 0, atomics: 0, sqlite: 0, ipc: 0 }) }) - it('rejects growth and shrinkage; prune cannot raise a baseline', () => { + it('rejects growth and shrinkage; prune cannot raise a baseline', async () => { const root = mkdtempSync(path.join(tmpdir(), 'orca-blocking-ratchet-')) roots.push(root) mkdirSync(path.join(root, 'src/main'), { recursive: true }) @@ -81,20 +84,80 @@ describe('main blocking API ratchets', () => { execFileSync('git', ['add', '.'], { cwd: root }) vi.spyOn(console, 'error').mockImplementation(() => {}) vi.spyOn(console, 'log').mockImplementation(() => {}) - expect(fsMain(root)).toBe(0) + expect(await fsMain(root)).toBe(0) writeFileSync( daemon, "import { statSync } from 'node:fs'; statSync('file'); statSync('another')" ) - expect(fsMain(root)).toBe(1) - expect(main(root)).toBe(1) - main(root, '--prune') + expect(await fsMain(root)).toBe(1) + expect(await main(root)).toBe(1) + await main(root, '--prune') expect(readFileSync(cryptoFile, 'utf8')).not.toContain('1 src/') writeFileSync(cryptoFile, '1 src/main/consumer.ts\n') - expect(main(root)).toBe(0) + expect(await main(root)).toBe(0) writeFileSync(path.join(root, file), '') - expect(main(root)).toBe(1) - main(root, '--prune') - expect(main(root)).toBe(0) + expect(await main(root)).toBe(1) + await main(root, '--prune') + expect(await main(root)).toBe(0) + }) + + it('counts callers of a sync helper in another file, not only the helper itself', () => { + const sources = new Map([ + [ + 'src/main/config-read.ts', + `import { readFileSync } from 'node:fs' + function readRaw(file: string) { return readFileSync(file, 'utf8') } + export const readConfig = (file: string) => JSON.parse(readRaw(file)) + export function configPath() { return '/tmp/config.json' }` + ], + [ + 'src/main/poller.ts', + `import { readConfig, configPath } from './config-read' + setInterval(() => readConfig(configPath()), 1000)` + ] + ]) + const { uses } = collectBlockingHelperUses(sources, collectDirectBlockingSites(sources), { + depth: 1 + }) + expect(uses.get('src/main/poller.ts')?.count).toBe(1) + }) + + it('counts callers through locally exported imported helpers', () => { + const sources = new Map([ + [ + 'src/main/impl.ts', + `import { readFileSync } from 'node:fs' + export function readConfig() { return readFileSync('config') } + export default function readDefault() { return readFileSync('default') }` + ], + [ + 'src/main/barrel.ts', + `import readDefault, { readConfig as read } from './impl' + export { read as load, readDefault as default }` + ], + [ + 'src/main/consumer.ts', + `import readDefault, { load } from './barrel' + load(); readDefault()` + ] + ]) + const { uses } = collectBlockingHelperUses(sources, collectDirectBlockingSites(sources), { + depth: 1 + }) + expect(uses.get('src/main/consumer.ts')?.count).toBe(2) + }) + + it('exempts modules only worker entries import', () => { + const entry = 'src/main/native-chat/agent-session-journal/journal-sql-worker-entry.ts' + const graph = new Map([ + [entry, ['src/main/worker-only.ts', 'src/main/shared-store.ts']], + ['src/main/index.ts', ['src/main/shared-store.ts']] + ]) + const files = ['src/main/index.ts', 'src/main/worker-only.ts', 'src/main/shared-store.ts'] + expect([...workerOnlyFiles(graph, files)]).toEqual(['src/main/worker-only.ts']) + // An event-loop entry a worker imports stays guarded, and so does everything it imports. + graph.get(entry).push('src/main/index.ts') + graph.get('src/main/index.ts').push('src/main/worker-only.ts') + expect([...workerOnlyFiles(graph, files, ['src/main/index.ts'])]).toEqual([]) }) }) diff --git a/config/scripts/static-analysis/ratchets/runtime-lifecycle/check-main-blocking-helper-ratchet.mjs b/config/scripts/static-analysis/ratchets/runtime-lifecycle/check-main-blocking-helper-ratchet.mjs new file mode 100644 index 00000000000..03a394d4384 --- /dev/null +++ b/config/scripts/static-analysis/ratchets/runtime-lifecycle/check-main-blocking-helper-ratchet.mjs @@ -0,0 +1,76 @@ +import path from 'node:path' +import { pathToFileURL } from 'node:url' +import { createGatedCallCollector } from '../../process-boundaries/gated-call-use-collector.mjs' +import { collectSqliteCallSites } from '../../process-boundaries/sqlite-call-use-collector.mjs' +import { readEventLoopSources } from '../../process-boundaries/main-blocking-import-graph.mjs' +import { collectBlockingHelperUses } from '../../process-boundaries/main-blocking-helper-propagation.mjs' +import { runCountRatchet } from '../../ratchet-baseline/ratchet-baseline.mjs' +import { OFF_MAIN_ADVICE } from './check-main-blocking-api-ratchet.mjs' + +const BASELINE_PATH = 'config/main-blocking-helper-baseline.txt' +// Two levels: a timer or handler calling a function that calls the sync reader (the 11-09 and 11-13 regressions). +const HELPER_DEPTH = 2 +const BLOCKING_FAMILIES = [ + { modules: ['fs', 'node:fs', 'original-fs', 'graceful-fs'], exportPattern: /Sync$/, advice: {} }, + { modules: ['child_process', 'node:child_process'], exportPattern: /Sync$/, advice: {} } +] +const direct = createGatedCallCollector(BLOCKING_FAMILIES, 'main blocking helper') + +export function collectDirectBlockingSites(sources) { + const sites = new Map() + for (const [file, contents] of sources) { + const found = [ + ...direct.collectUses(file, contents).sites.map(({ name, position }) => ({ + position, + reaches: `${name} in ${file}` + })), + ...collectSqliteCallSites(file, contents).map((position) => ({ + position, + reaches: `SQLite in ${file}` + })) + ] + if (found.length > 0) { + sites.set(file, found) + } + } + return sites +} + +export async function collectMainBlockingHelperUses(root, depth) { + const sources = await readEventLoopSources(root, ['src/main', 'src/shared', 'src/preload']) + return collectBlockingHelperUses(sources, collectDirectBlockingSites(sources), { depth }).uses +} + +export async function main(root = process.cwd(), arg = undefined) { + const uses = await collectMainBlockingHelperUses(root, HELPER_DEPTH) + const counts = new Map([...uses].map(([file, { count }]) => [file, count])) + return runCountRatchet( + { + name: 'main-blocking-helper', + baselinePath: BASELINE_PATH, + header: [ + '# References to functions that make a synchronous fs, child_process or SQLite call, or call such a', + '# function, per file, in event-loop code (Electron main, orcad, daemon, preload; worker-only modules excluded).', + '# This is a RATCHET: counts may only go DOWN.', + '# Prune: node config/scripts/static-analysis/ratchets/runtime-lifecycle/check-main-blocking-helper-ratchet.mjs --prune' + ], + collect: () => counts, + detail: (file) => `Uses: ${uses.get(file)?.reaches.join(', ')}.`, + pruneCommand: + 'node config/scripts/static-analysis/ratchets/runtime-lifecycle/check-main-blocking-helper-ratchet.mjs --prune', + unit: 'blocking helper reference(s)', + fix: [ + `Each listed helper makes a synchronous fs, child_process or SQLite call, or calls one that does. ${OFF_MAIN_ADVICE}`, + 'If a helper itself just became blocking, fix it there: every file that calls it is charged.', + "Names match file-wide: a local or parameter that reuses an imported helper's name is counted; rename it.", + `A one-shot startup or shutdown call may raise the file's row in ${BASELINE_PATH} with reviewer sign-off and a trailing "# why" note.` + ] + }, + root, + arg + ) +} + +if (process.argv[1] && import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href) { + process.exitCode = await main(process.cwd(), process.argv[2]) +} diff --git a/config/scripts/static-analysis/ratchets/runtime-lifecycle/check-main-sync-fs-ratchet.mjs b/config/scripts/static-analysis/ratchets/runtime-lifecycle/check-main-sync-fs-ratchet.mjs index fccba49b072..68f2e4d7c48 100644 --- a/config/scripts/static-analysis/ratchets/runtime-lifecycle/check-main-sync-fs-ratchet.mjs +++ b/config/scripts/static-analysis/ratchets/runtime-lifecycle/check-main-sync-fs-ratchet.mjs @@ -1,9 +1,8 @@ import process from 'node:process' import { pathToFileURL } from 'node:url' import { createGatedCallCollector } from '../../process-boundaries/gated-call-use-collector.mjs' -import { readTrackedSources, runCountRatchet } from '../../ratchet-baseline/ratchet-baseline.mjs' -import { isMainBlockingSource } from '../../process-boundaries/main-blocking-source-paths.mjs' -import { isTestOnlySourcePath } from '../../process-boundaries/test-only-source-path.mjs' +import { runCountRatchet } from '../../ratchet-baseline/ratchet-baseline.mjs' +import { readEventLoopSources } from '../../process-boundaries/main-blocking-import-graph.mjs' // Sync fs on Electron main stalls every window (and in the daemon/orcad, every terminal); per-spawn/RPC/focus stat and read sweeps were a recurring lag source (#39805, #35967, #38481). @@ -69,22 +68,13 @@ const collector = createGatedCallCollector( 'main sync-fs' ) -function isScannedPath(rel) { - return ( - isMainBlockingSource(rel) && - /\.[cm]?[jt]sx?$/.test(rel) && - !rel.endsWith('.d.ts') && - !isTestOnlySourcePath(rel) - ) -} - export function countSyncFsCalls(rel, source) { return collector.collectUses(rel, source).count } -export function collectMainSyncFsCounts(root = process.cwd()) { +export async function collectMainSyncFsCounts(root = process.cwd()) { const counts = new Map() - for (const [rel, source] of readTrackedSources(root, SCAN_ROOTS, isScannedPath)) { + for (const [rel, source] of await readEventLoopSources(root, SCAN_ROOTS)) { const count = countSyncFsCalls(rel, source) if (count > 0) { counts.set(rel, count) @@ -93,18 +83,20 @@ export function collectMainSyncFsCounts(root = process.cwd()) { return counts } -export function main(root = process.cwd(), arg = undefined) { +export async function main(root = process.cwd(), arg = undefined) { + const counts = await collectMainSyncFsCounts(root) return runCountRatchet( { name: 'main-sync-fs', baselinePath: BASELINE_PATH, header: [ - '# Synchronous node:fs calls (every *Sync export) in production src/main and src/shared, per file.', + '# Synchronous node:fs calls (every *Sync export) in production src/main and src/shared, per file;', + '# modules imported only by worker/utility entries are excluded.', '# Startup-only or one-shot uses are fine to keep; per-RPC, per-spawn, per-focus or per-poll uses are the target.', '# This is a RATCHET: counts may only go DOWN.', '# Prune after removing calls: pnpm check:main-sync-fs-ratchet --prune' ], - collect: collectMainSyncFsCounts, + collect: () => counts, unit: 'sync fs call(s)', fix: [ `Sync fs blocks the thread it runs on: Electron main (every window) or the daemon/orcad loop (every terminal). ${ADVICE}.`, @@ -117,5 +109,5 @@ export function main(root = process.cwd(), arg = undefined) { } if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) { - process.exit(main(process.cwd(), process.argv[2])) + process.exitCode = await main(process.cwd(), process.argv[2]) } diff --git a/package.json b/package.json index 8ed2dae9dbe..f53b653c433 100644 --- a/package.json +++ b/package.json @@ -218,6 +218,7 @@ "check:process-host-imports": "node config/scripts/static-analysis/process-boundaries/check-process-host-imports.mjs", "check:main-sync-spawn-ratchet": "node config/scripts/static-analysis/process-boundaries/check-main-sync-spawn-ratchet.mjs", "check:main-sync-fs-ratchet": "node config/scripts/static-analysis/ratchets/runtime-lifecycle/check-main-sync-fs-ratchet.mjs", + "check:main-blocking-helper-ratchet": "node config/scripts/static-analysis/ratchets/runtime-lifecycle/check-main-blocking-helper-ratchet.mjs", "check:recurring-timer-ratchet": "node config/scripts/static-analysis/ratchets/runtime-lifecycle/check-recurring-timer-ratchet.mjs", "check:compat-boundary-imports": "node config/scripts/static-analysis/process-boundaries/check-compat-boundary-imports.mjs", "check:import-boundaries": "bun config/scripts/static-analysis/process-boundaries/check-import-boundaries.mjs"