Files
orca/config/scripts/vitest-node-runtime-files.mjs
T
Brennan Benson cb82f94267 OpenCode and Grok chats show the turns made outside them (#31616)
* feat(native-chat): OpenCode and Grok chats show the turns made outside them

When an OpenCode or Grok chat reopens its conversation, the agent replays its
saved history before it answers. Orca used to drop all of it. Now the turns in
it the chat never saw (made in the agent's own CLI, or anywhere else) are added
once, in the agent's order, after the chat's rows and behind the existing
"Continued outside this chat." divider.

Turns are matched by the agent's own ids: Grok's prompt id (Orca's own turns
carry the id Orca sent) and OpenCode's saved message ids, plus the rows of a
transcript the chat was adopted from. A send of the chat's own that failed
before any reply is matched by its text between the turns proven around it,
because OpenCode never tells a client the id it gives a person's message.

The import is translated by the same translator and assembler as a live turn
into an in-memory overlay, then written as one settlement: a stale or failed
import writes nothing, and it never fails the open. A turn imported part-way
gets the rest of what the agent saved on a later open.

* fix(native-chat): type the ACP catch-up staging and origin reads

* refactor(native-chat): share the catch-up open runner across agents

The Codex catch-up's agent-neutral parts move to one module: the open-time
envelope (its own deadline and cancellation, never gating the open), the
bounded staged batch, the single settlement commit that re-checks the
journal before writing, and the "Continued outside this chat." divider.
Codex keeps only how it reads its saved turns and what the chat already
holds. No behavior change; the other agents' catch-up builds on this
instead of copying it.

* fix(acp): bound final catch-up journal barrier

* chore: remove unrelated pnpm executable metadata

* refactor(native-chat): the catch-up runner reads the chat's view only when the agent asks

* refactor(acp): catch up through the shared history runner

The open envelope, budget, divider and one checked commit now come from the
shared catch-up runner; ACP keeps only how it reads the reopen replay and what
the chat already holds. The final-barrier deadline test moves with the barrier
to the runner.

* chore: remove regenerated pnpm executable metadata

* fix(native-chat): the catch-up deadline also bounds waiting for its commit to be written

A journal write barrier that never settled after the import was admitted held
the provider's open past the catch-up deadline. The wait now ends with the
deadline or the open's cancellation, like every other step.

* test: type the history catch-up sink fixture without assertions

* fix(acp): reconcile imported history snapshots without claiming live work

* fix(native-chat): bound and revoke history preparation

* feat(native-chat): validate expected saved items during history catch-up

* fix(acp): preserve user boundaries and visible catch-up dividers

* fix(acp): replay ordered messages within provider executions

* fix(acp): report replay overflow and refresh journal test reads

* test(rpc): explain partial runtime fixture boundary

* Bound ACP history reconciliation and rejected-copy projection work

* test: use typed calls for history scaling instrumentation

* test: account for history views and exit provenance work

* fix: type history scaling test fixtures explicitly

* test: route history probes to Node and bind replay sink before open

* test(acp): explain journal scaling timeouts
2026-10-25 11:37:08 -07:00

207 lines
13 KiB
JavaScript

import { findSqliteRuntimeTests } from './vitest-sqlite-runtime-scan.mjs'
// SQLite publication, native bindings, worker IPC, socket liveness, and V8 retention use Node.
const NODE_RUNTIME_INCLUDE = [
'src/main/runtime/structured-agent-cli-writers.test.ts',
'config/scripts/vitest-sqlite-runtime-boundary.test.ts',
'config/scripts/cloud-security-history-workflow.test.mjs',
'config/scripts/skill-recipe-shell.test.mjs',
'src/main/ssh/legacy-relay/ssh-relay-endpoint-incumbent-shell.integration.test.ts',
'src/main/ssh/ssh-remote-commands.test.ts',
'src/packages/process-host/src/run-process.test.ts',
'tests/e2e/cursor-quota-transport.unit.test.ts',
'tests/e2e/helpers/electron-process-shutdown.unit.test.ts',
'src/main/ai-vault-search/session-search-index-writer.test.ts',
'src/main/ai-vault/session-scanner-unlimited-dedup.test.ts',
// The parse cache persists through node:sqlite.
'src/main/ai-vault/session-parse-cache-antigravity-upgrade.test.ts',
'src/main/ai-vault/session-parse-cache-devin-upgrade.test.ts',
'src/main/ai-vault/session-parse-cache-large-scan.test.ts',
'src/main/ai-vault/session-parse-cache-metadata-checkpoint.test.ts',
'src/main/ai-vault/session-parse-cache-persistence.test.ts',
'src/main/ai-vault/session-scanner-scope-cwd-facts.test.ts',
'src/main/ai-vault/session-scanner-scope-walk.test.ts',
// Electron main bridges streams with Node's implementation.
'src/main/host/electron-http-client.test.ts',
'src/main/daemon/daemon-init-provider-installation.test.ts',
'src/main/orcad/orcad-daemon-teardown-linux.test.ts',
'src/renderer/src/components/terminal-pane/pty-input-write-queue.test.ts',
'src/renderer/src/lib/react-commit-cascade-observer.test.ts',
'src/renderer/src/lib/react-commit-cascade-telemetry.test.ts',
// These reach Node SQLite through a shared helper or a dynamic import, which the scan skips.
'src/main/claude/claude-transcript-catch-up.test.ts',
'src/main/claude/claude-transcript-duration.test.ts',
'tests/e2e/native-chat-startup-option-pickers.unit.test.ts',
'src/main/ai-vault/session-document-consumer-replacement.test.ts',
'src/main/ai-vault-search/session-search-dependent-transcripts.test.ts',
'src/main/ai-vault-search/session-search-list-reparse.test.ts',
'src/main/ai-vault-search/session-search-transcript-dependencies.test.ts',
'src/main/native-chat/structured-agent-cli-conversation-adoption.test.ts',
'src/main/runtime/orchestration-cli-subprocess.test.ts',
'src/main/runtime/orchestration-mailbox-delivery.test.ts',
'src/main/runtime/orchestration-mailbox-routing.test.ts',
'src/main/runtime/worker-terminal-archive-release.test.ts',
'src/main/runtime/worker-terminal-archive-screen.test.ts',
'src/main/runtime/worker-terminal-wrap-provenance.test.ts',
'tests/e2e/cross-version-wire/agent-session-clear-old-client.unit.test.ts',
'tests/e2e/cross-version-wire/agent-session-clear-old-tab-mirror.unit.test.ts',
'tests/e2e/cross-version-wire/host-model-catalog-released-phone.unit.test.ts',
'src/main/acp/acp-structured-host-live-listing.test.ts',
'src/main/acp/acp-structured-host-configured-default.test.ts',
'src/main/pi/rpc-session-adapter.test.ts',
'src/main/pi/rpc-session-startup.test.ts',
'src/main/acp/acp-structured-publish-at-spawn.test.ts',
'src/main/acp/acp-structured-omp-recordings.test.ts',
'src/main/acp/acp-text-stream-identity.test.ts',
'src/main/acp/acp-text-message-ownership.test.ts',
'src/main/native-chat/agent-session-wire/structured-agent-session-clear-queued-command.test.ts',
'src/main/acp/acp-structured-sign-in.test.ts',
'src/main/acp/acp-structured-auth.test.ts',
'src/main/acp/acp-structured-prompt-failure.test.ts',
'src/main/acp/acp-timeline-turn-failures.test.ts',
'src/main/acp/acp-structured-session-adapter.test.ts',
'src/main/acp/acp-structured-session-adapter-resume.test.ts',
// Counts real V8 Inspector coverage alongside delegated operation counters.
'src/main/acp/acp-history-scaling.test.ts',
'src/main/acp/acp-structured-host-start-aborts.test.ts',
'src/main/acp/acp-conversation-copy.test.ts',
'src/main/pi/rpc-turn-races.test.ts',
'src/main/acp/acp-structured-child-session-end.test.ts',
'src/main/acp/acp-structured-child-stop.test.ts',
'src/main/acp/acp-structured-child-work-admission.test.ts',
'src/main/acp/acp-structured-child-work.test.ts',
'src/main/acp/acp-structured-host-subagent-stop.test.ts',
'src/main/native-chat/agent-session-wire/structured-agent-session-background-stop-unreadable.test.ts',
'src/main/native-chat/agent-session-wire/structured-agent-session-exit-delivery.test.ts',
'src/main/native-chat/agent-session-wire/structured-agent-session-provider-open.test.ts',
'src/main/native-chat/agent-session-wire/structured-agent-session-ready-operation-order.test.ts',
'src/main/native-chat/agent-session-wire/structured-agent-session-message-choices.test.ts',
'src/main/native-chat/agent-session-wire/structured-agent-session-queued-messages.test.ts',
'src/main/native-chat/agent-session-wire/structured-agent-session-send.test.ts',
'src/main/orcad/serve-profile-ssh-targets.test.ts',
'src/main/runtime/orca-runtime.test.ts',
'src/main/runtime/worktree-agent-first-surface.test.ts',
'src/main/runtime/runtime-client-agent-launch-settings-durability.test.ts',
'tests/e2e/host-agent-launch-settings-hook-bookkeeping.unit.test.ts',
'src/cli/**/*.test.ts',
'src/main/persistence/**/*.test.ts',
'src/main/persistence*.test.ts',
'src/main/sqlite/**/*.test.ts',
'src/main/orca-profiles/**/*.test.ts',
'src/main/managed-data-accounts/**/*.test.ts',
'src/main/quit-path-durable-write-blocking.test.ts',
'src/main/automations/automation-worker-durability.test.ts',
'src/**/*.node-pty.test.ts',
'src/**/node-pty-*.test.ts',
'src/**/*.live-shell.test.ts',
'src/**/*real-pty*.test.ts',
'src/**/*-native.test.ts',
'src/**/*retention*.test.ts',
'src/**/*lifetime*.test.ts',
'src/**/*memory*.test.ts',
'src/**/*allocation*.test.ts',
'src/**/*expiry*.test.ts',
'src/renderer/src/lib/flatten-retained-slice.test.ts',
'src/shared/own-retained-string.test.ts',
// Times V8 string flattening, which is what Electron main runs.
'src/main/runtime/terminal-tail-redraw-wall-time.test.ts',
'src/main/agent-hooks/server-transport-interference.test.ts',
'src/main/plugins/plugin-worker-supervision.integration.test.ts',
// Reconciliation loads the real native Parcel watcher; Bun can abort on Linux ARM.
'src/main/plugins/plugin-service-reconciliation.test.ts',
'src/main/usage/usage-scan-worker-event-loop.test.ts',
// Asserts Node's spawn-failure close signal and that a dead worker closes its children's pipes.
'src/main/worker-thread-child-process/worker-thread-child-process.test.ts',
'src/main/git/command-runner/worker-exec-file.test.ts',
'src/main/git/worktree-removal-real-git.test.ts',
'src/main/git/worktree-list-paths.test.ts',
'src/main/git/worktree-sparse-checkout.test.ts',
'src/main/git/worktree-removal-large-tree.bench.test.ts',
'src/main/runtime/runtime-failed-local-worktree-removal.test.ts',
'src/main/runtime/runtime-interrupted-local-worktree-removal.test.ts',
'src/main/local-worktree-removal-recovery-live.test.ts',
'src/main/rate-limits/codex-rpc-worker-backpressure.test.ts',
'src/main/computer/macos-native-provider-client.test.ts',
'src/main/ai-vault-search/session-search-schema.test.ts',
'src/main/ai-vault-search/session-search-fts5-contract.test.ts',
'src/main/foreign-sqlite-readers/**/*.test.ts',
'src/main/browser/*cookie*.test.ts',
'src/main/browser/cookies/*cookie*.test.ts',
'src/main/browser/cookies/sources/browser-cookie-validation.test.ts',
'src/main/browser/cookies/sources/browser-cookie-decryption.test.ts',
'src/main/browser/cookies/sources/browser-cookie-import-undecryptable.test.ts',
'src/main/browser/cookies/sources/browser-cookie-source-partition.test.ts',
// Playwright's CDP transport needs Node's WebSocket implementation.
'src/main/browser/browser-popup-adapter-compatibility.electron.test.ts',
'src/main/browser/popup-origin-chrome.electron.test.ts',
'src/main/browser/browser-link-materialization.electron.test.ts',
'src/main/browser/browser-popup-compatibility.electron.test.ts',
'src/main/browser/browser-popup-native-compatibility.electron.test.ts',
'src/main/browser/browser-popup-background-compatibility.electron.test.ts',
'src/main/ai-vault/session-scanner-devin-db.test.ts',
'src/shared/workspace-session-salvage.test.ts',
'src/main/git/repo-detection.test.ts',
'src/renderer/src/components/browser-pane/annotate/browser-grab-toast-owner-cleanup.test.tsx',
'src/main/window/native-chat-paste-files.test.ts',
'src/main/computer/desktop-script-serve-channel.test.ts',
'src/main/providers/local-pty-child-process-verdict.test.ts',
'src/main/providers/working-directory-validation.test.ts',
'src/main/pty/posix-pty-process-groups.integration.test.ts',
'src/shared/ephemeral-vm-recipe-output-capture.test.ts',
'src/main/gitlab/gitlab-known-host-retirement.test.ts',
'src/main/window/main-window-updater-deferred-setup.test.ts',
'src/renderer/src/lib/pane-manager/pane-dom-focus-class-sync-lifecycle.test.ts',
'src/renderer/src/components/terminal-pane/terminal-pane-host-state-memo.test.ts',
'src/renderer/src/components/automations/use-automation-runs-dashboard-payload.test.tsx',
'src/renderer/src/components/right-sidebar/parent-pr-checks-projection-selector.test.ts',
'src/renderer/src/store/github/cache-persistence.test.ts',
'src/main/native-chat/agent-session-journal/**/*.test.ts',
'src/main/native-chat/agent-session-wire/structured-agent-session-status-feed.test.ts',
'src/main/native-chat/agent-session-wire/structured-agent-session-status-feed-conversation-name.test.ts',
'src/main/native-chat/agent-session-wire/structured-agent-session-status-first-input-identity.test.ts',
'src/main/native-chat/structured-chat-naming.test.ts',
'src/main/native-chat/agent-session-wire/structured-agent-session-outgrown-child.test.ts',
'src/main/native-chat/agent-session-wire/structured-agent-session-permission-mode.test.ts',
'src/main/native-chat/agent-session-wire/structured-agent-session-queued-legacy-import.test.ts',
'src/main/runtime/agent-session-conversation-name-store.test.ts',
'src/main/runtime/structured-session-mail-redrive-wiring.test.ts',
'src/main/runtime/rpc/ws-transport.test.ts',
'src/main/runtime/rpc/dispatcher-transport-parity.test.ts',
'src/main/runtime/rpc/methods/structured-agent-session-visual.test.ts',
// Bun resolves 'ws' to its built-in client, which bypasses the patched package.
'src/main/runtime/rpc/ws-empty-payload-frame-write.test.ts',
'src/shared/remote-runtime-client.test.ts',
'src/shared/remote-runtime/remote-runtime-connect-bound.test.ts',
// Bun's built-in ws client ignores maxPayload; the product opener only runs on Node.
'src/shared/remote-runtime/requests/remote-runtime-request-websocket.test.ts',
'src/shared/remote-runtime/requests/remote-runtime-subscription-connect-bound.test.ts',
'src/main/codex/codex-shared-server-probe.test.ts',
'src/main/opencode/opencode-launch-model-context-supervision.test.ts',
'src/main/hermes/hermes-config-remote-adapter.test.ts',
'src/main/ipc/orca-profiles-switch-persistence.test.ts',
'src/main/ipc/settings-delayed-response.test.ts',
'src/main/ipc/session-window-view-save.test.ts',
'src/main/ipc/renderer-shutdown-checkpoint-sleep-records.test.ts',
'src/main/runtime/structured-agent-session-startup-tab-restore.test.ts',
'src/main/runtime/structured-agent-session-windowless-layout-host.test.ts',
'src/shared/remote-runtime/control/remote-runtime-shared-control-connection.test.ts',
'src/main/runtime/mobile-cloud-relay/relay-control-client.test.ts',
'src/main/ipc/filesystem/watchers/filesystem-watcher-ignore-real.test.ts',
'src/main/ipc/runtime-environments/runtime-environment-preference.test.ts',
// Real fs.watch file bindings; Bun's watcher is not the one Electron runs.
'src/main/ipc/rebinding-file-watch.test.ts',
'src/main/ipc/parcel-watcher-shallow-file-subscription.test.ts',
'src/main/ipc/runtime-environments/runtime-environment-transport-routing-tailscale-hint.test.ts',
'src/renderer/src/components/emulator-pane/emulator-device-frame-visibility.test.tsx',
'src/main/claude/claude-agent-sdk-contract-pins.test.ts',
'config/scripts/profile-state-worker-smoke.test.mjs',
'config/scripts/process-host-dev-rebuild.test.ts',
'config/scripts/vitest-node-runtime-boundary.test.ts',
'config/scripts/vitest-node-runtime-pool.test.ts'
]
/** `filters` limits the SQLite import scan to the tests a filtered CLI run can select. */
export function getNodeRuntimeInclude({ filters } = {}) {
return [...NODE_RUNTIME_INCLUDE, ...findSqliteRuntimeTests({ filters })]
}