Files
orca/config/scripts/vitest-sqlite-database-runtime-files.mjs
T
Brennan Benson 0bdcaf36ed fix(claude): start a Claude chat with its saved options and send the first message at once (#25152)
* fix(claude): end a Claude start that never answers initialize after 120 s

* Read the Claude startup deadline inside startup; fix a stale test comment

* fix(claude): start a Claude chat on its initialize answer, not on a frame only a SessionStart hook sends

Startup waited for system/init or a SessionStart hook frame as well as the initialize answer.
Before the first turn only a SessionStart hook sends one, and Orca adds that hook only through
its optional status hooks, so with them off the first message was held forever. Startup now
lands on the initialize answer; a start frame already seen is still checked, and one naming
another session ends a started session. The deadline drops to 90 s so it fires inside the
host's 120 s start wait.

* fix(claude): time the Claude start by silence, and fail it at once on another session's frame

Claude answers initialize only after its SessionStart hooks finish, so a total-time deadline
would fail every start behind a slow hook. Each start frame now restarts the clock. A frame
naming another session fails a start still waiting on initialize at once, as before.

* test(claude): a real Claude chat starts and answers with every hook disabled

* Say what the start-frame re-arm covers, and check only start frames in the hook-less real test

* fix(native-chat): a Claude chat starts with its saved options and takes its first message at once

Saved model, effort, Fast and permission mode are passed as launch options, checked against the
account's cached model catalog, instead of restored by control requests after initialize. With
nothing left to restore, the host no longer holds a message until the CLI answers initialize, and
the 90 s startup deadline is gone. A Stop on a start that never answers ends the child and settles
what it was handed as stopped. A failed result that repeats the turn's own API error reply writes
no second row.

* fix(native-chat): a host stop of a Claude start fails the message it was handed, with one row

With no start-hold the delivery loop no longer sees a host stop of a start it waited on. The
child's end now rejects what it handed over with the host-stopped words and writes the one row,
as an exit of its own would; an idle start the host stops still goes quietly.

* test(native-chat): a Claude chat's first message is written before initialize answers

Rewrites the tests that encoded the start-hold, the startup deadline and the option restore to
the new contract, and adds: saved options at launch (catalog checks, bypass, fresh-session Fast),
a message written before initialize answers (adapter and runtime), Stop on a start that never
answers (stopped, child closed, nothing working), and an API error said once.

* revert(native-chat): keep a failed Claude turn's error row

The shared turn fold already shows a failed turn's error once after it settles, as an error;
dropping the row left the CLI's synthetic reply looking like something Claude said.

* fix(native-chat): pass saved Claude options unchecked, heal a retired model on the CLI's word, and never leave an unrun message in doubt

- Saved model, effort and Fast are launched as picked; only values no Claude can parse are left
  out. The pre-spawn cache check is gone.
- A saved Fast on for a new conversation is applied once the settings readback shows no
  per-session opt-in (dropped when there is one, or when the model is listed without Fast), with
  nothing waiting on it; the record keeps the pick.
- Under an Agent Permissions bypass, a saved narrower mode launches with the allow flag so bypass
  stays reachable.
- A turn whose reply is the CLI's model_not_found for the launched model drops that model from
  the record; the launch's own row for it is kept out of the account model cache.
- A child that ends before it answered initialize, for any reason, settles every message it was
  handed as not sent (cancelled for a Stop).
- A launched effort the CLI reports only as `applied.effort` is confirmed from there.
- The untimed-initialize comment is back to main's text.
- A real-CLI test for a message written before initialize answers, under saved options.

* fix(native-chat): type the close's ended event and the start-exit test fixtures

The close's ended event is typed as the adapter event so its optional startupUnanswered spread
fits exactOptionalPropertyTypes; two tests guard the fixture's optional generation, and the
hung-start fixture records initialize on the fake connection it holds.

* fix(native-chat): a Claude model heal keeps a later pick, a refused Fast is dropped, no allow flag

- `options-skipped` carries the retired value; the record drops it only while it still holds it.
- `started` carries the values a heal retired, and the record does not take them back from the
  CLI's report of the same value.
- A saved Fast on a new conversation is applied before `started`: a refusal drops it and records
  it skipped, as main's refused restore did; silence keeps it wanted and unconfirmed.
- A saved narrower mode under an Agent Permissions bypass launches without any bypass flag again:
  the allow flag is one older CLIs reject at start. Kept as a known limit.
- The real-CLI test asserts the message was written before initialize answered.
- The fake reports a launch effort only under `applied`, and a misplaced doc comment moves back.

* fix(native-chat): a new Claude chat reports started before its saved Fast is applied

The Fast apply on a new conversation now runs after `started`, so a Stop interrupts a running
first turn and an option write is not refused while the round trip is out. A refusal drops the
pick through `options-skipped`, in order after `started`; silence keeps it unconfirmed. The
launch's unreachable skipped-model branch is gone.

* fix(native-chat): a healed Claude chat goes back to the default model live; comments match the no-hold design

When the CLI says the launched model does not exist, the live child is also put back on the CLI's
own default (set_model with no model, fire-and-forget), so later messages in the same chat run; a
user's pick sent after it wins, and a refused or unanswered reset only logs. Comments that still
described the start-hold or the option restore now describe the launch options and the
handed-over, never-echoed rule.

* fix(native-chat): a message handed to a Claude start that never answered is kept as main keeps an unsent one

A child that ended before it answered initialize ran nothing it was handed, the same fact as a
send accepted and never handed over. Its end now settles those sends exactly as the chat settles
a queued send for that end: a quit keeps a person's message as a held card (restart words), a
close keeps it as a held card (closed words), a person's Stop withdraws it as cancelled, and a host
stop fails the start with one row.

* fix(native-chat): a quit during a Claude start that never answered offers no resume for the message it keeps as a card

The restart snapshot now reads the same never-answered fact the exit does, so a message handed
to such a start counts as queued work, not as work to resume. The retired-model reset comment
names the default it really applies.

* refactor(native-chat): the saved permission-mode launch helpers live with the spawn options that use them

Keeps claude-structured-launch-resolution.ts within max-lines once merged with main, and names
the hung-start test envelope's field type.

* fix(native-chat): a Claude chat's saved options take precedence over the agent Arguments' own flags

Main now passes the saved agent Arguments to the Claude child, and the SDK writes them after its
own options. An Arguments --model or --effort therefore reached the CLI as a second flag after the
chat's saved pick (a commander CLI keeps the last), and a saved Fast's launch settings replaced an
Arguments --settings file outright. The saved model and effort now stand in for the Arguments'
flags, and a saved Fast beside an Arguments --settings is applied by the start instead of at
launch.

* test(native-chat): the hand-built Claude session in the options test carries fastModeAtStart

* test(native-chat): the queued rig's start spy carries a named Mock type

An unannotated vi.fn() inferred @vitest/spy's internal Procedure, which CI's typecheck cannot
name in the factories' inferred return types (TS2883).

* fix(ci): run the PR's SQLite-backed tests in the Node runtime project

Lists the hung-start Stop test, renames the send-during-startup entry from its old name, and
carries main's own two entries from #26010 so the boundary test passes before the next merge.
2026-10-06 19:19:47 -07:00

201 lines
14 KiB
JavaScript

// Database opening and lifecycle fixtures exercise Node SQLite behavior.
export const SQLITE_DATABASE_RUNTIME_INCLUDE = [
'src/main/ai-vault-search/session-search-file-write.test.ts',
'src/main/ai-vault-search/session-search-live-transcript.test.ts',
'src/main/ai-vault/session-scanner-devin-contention.test.ts',
'src/main/ai-vault/session-scanner-opencode-native-worker.test.ts',
'src/main/ai-vault/session-scanner-opencode-sqlite-bounds.test.ts',
'src/main/ai-vault/session-scanner-opencode-sqlite-coexistence.test.ts',
'src/main/ai-vault/session-scanner-opencode-sqlite-open.test.ts',
'src/main/ai-vault/session-scanner-opencode-sqlite-process.test.ts',
'src/main/ai-vault/session-scanner-opencode-sqlite.test.ts',
'src/main/ai-vault/session-scanner-opencode2-sqlite.test.ts',
'src/main/ai-vault/session-scanner-zcode.test.ts',
'src/main/codex/codex-account-session-bridge.test.ts',
'src/main/codex/codex-index-heal-binary-contract.test.ts',
'src/main/codex/codex-state-db.test.ts',
'src/main/native-chat/agent-session-wire/structured-agent-session-queued-stop-row.test.ts',
'src/main/native-chat/transcript-opencode-semantic-fidelity.test.ts',
'src/main/native-chat/transcript-opencode-sqlite-query.test.ts',
'src/main/native-chat/transcript-opencode-subscribe.test.ts',
'src/main/native-chat/transcript-opencode2-sqlite.test.ts',
'src/main/opencode-usage/cache-read-reproduction.test.ts',
'src/main/opencode-usage/opencode2-session-usage.test.ts',
'src/main/opencode-usage/scanner-windows-data-directory.test.ts',
'src/main/opencode-usage/scanner.test.ts',
'src/main/rate-limits/opencode-go-api-key-source.test.ts',
'src/main/rate-limits/opencode-go-managed-account-source.test.ts',
'src/main/runtime/agent-session-record-store-slot.test.ts',
'src/main/runtime/claude-structured-exit-mid-response.test.ts',
'src/main/runtime/claude-structured-failed-start-resume.test.ts',
'src/main/runtime/claude-structured-resumed-start-failure.test.ts',
'src/main/runtime/claude-structured-send-during-startup.test.ts',
'src/main/runtime/claude-structured-send-restart-dies-before-dispatch.test.ts',
'src/main/runtime/claude-structured-session-integration.test.ts',
'src/main/runtime/claude-structured-startup-fault-is-not-an-exit.test.ts',
'src/main/runtime/exit-provenance-audit.test.ts',
'src/main/runtime/orchestration-cli-subprocess.test.ts',
'src/main/runtime/orchestration-dispatch-mailbox-delivery.test.ts',
'src/main/runtime/orchestration-mailbox-crash-recovery.test.ts',
'src/main/runtime/orchestration-mailbox-notification-consistency.test.ts',
'src/main/runtime/orchestration-message-delivery-identity.test.ts',
'src/main/runtime/orchestration-messages-fake-parity.test.ts',
'src/main/runtime/orchestration/agent-facing-parity.test.ts',
'src/main/runtime/orchestration/coordinator-decision-gates.test.ts',
'src/main/runtime/orchestration/coordinator-dispatch-unobserved-prompt.test.ts',
'src/main/runtime/orchestration/coordinator-drift-probe-coalescing.test.ts',
'src/main/runtime/orchestration/coordinator-escalation-triage.test.ts',
'src/main/runtime/orchestration/coordinator-terminal-census-unavailable.test.ts',
'src/main/runtime/orchestration/coordinator.test.ts',
'src/main/runtime/orchestration/db-empty-dispatch-shortcircuit.benchmark.test.ts',
'src/main/runtime/orchestration/db-heartbeat-straggler-guard.test.ts',
'src/main/runtime/orchestration/db-message-timestamp.test.ts',
'src/main/runtime/orchestration/db-messages.test.ts',
'src/main/runtime/orchestration/db-stopping-worker-task-guard.test.ts',
'src/main/runtime/orchestration/db-task-create-readiness.test.ts',
'src/main/runtime/orchestration/db-task-dispatch-invariant.test.ts',
'src/main/runtime/orchestration/db-task-dispatch-lifecycle-guards.test.ts',
'src/main/runtime/orchestration/db-task-dispatch-races.test.ts',
'src/main/runtime/orchestration/db-task-promotion-projection.test.ts',
'src/main/runtime/orchestration/db-undelivered-mailboxes.test.ts',
'src/main/runtime/orchestration/db.test.ts',
'src/main/runtime/orchestration/db/attempt-outcome-projection.test.ts',
'src/main/runtime/orchestration/db/decision-gate-lifecycle.test.ts',
'src/main/runtime/orchestration/db/dispatch-depth.test.ts',
'src/main/runtime/orchestration/db/dispatch-mailbox-consumer-fencing.test.ts',
'src/main/runtime/orchestration/db/federation/federated-dispatch-observation-fence.test.ts',
'src/main/runtime/orchestration/db/federation/remote-dispatch-attachment-release.test.ts',
'src/main/runtime/orchestration/db/hot-path-statement-compilation.test.ts',
'src/main/runtime/orchestration/db/lifecycle-transition.test.ts',
'src/main/runtime/orchestration/db/messages/mailbox-consumer-lifecycle-fencing.test.ts',
'src/main/runtime/orchestration/db/remaining-dispatch-statement-compilation.test.ts',
'src/main/runtime/orchestration/db/row-column-lists.test.ts',
'src/main/runtime/orchestration/db/runs/run-coordinator-orca-session-binding.test.ts',
'src/main/runtime/orchestration/db/schema/derived-delivery-migration.test.ts',
'src/main/runtime/orchestration/db/schema/federated-home-run-migration.test.ts',
'src/main/runtime/orchestration/db/schema/structured-pointer-schema-migration.test.ts',
'src/main/runtime/orchestration/db/schema/structured-worker-orca-session-backfill.test.ts',
'src/main/runtime/orchestration/db/worker-dispatch/worker-dispatch-abandon.test.ts',
'src/main/runtime/orchestration/db/worker-dispatch/worker-dispatch-assignee-orca-session.test.ts',
'src/main/runtime/orchestration/db/writer-run-required.test.ts',
'src/main/runtime/orchestration/dispatch-consumer-generation-migration.test.ts',
'src/main/runtime/orchestration/dispatch-creator-identity-migration.test.ts',
'src/main/runtime/orchestration/dispatch-failure-idempotency.test.ts',
'src/main/runtime/orchestration/federation-acknowledgment-integrity.test.ts',
'src/main/runtime/orchestration/federation-acknowledgment-migration.test.ts',
'src/main/runtime/orchestration/federation-sync.test.ts',
'src/main/runtime/orchestration/lifecycle-caller-edges.test.ts',
'src/main/runtime/orchestration/lifecycle-reconciliation.test.ts',
'src/main/runtime/orchestration/lightweight-run-worker-exit-escalation.test.ts',
'src/main/runtime/orchestration/mailbox-pointer-eligibility.test.ts',
'src/main/runtime/orchestration/mailbox-pointer-release-query.test.ts',
'src/main/runtime/orchestration/mailbox-pointer-stage.test.ts',
'src/main/runtime/orchestration/mailbox-pointer-submit.test.ts',
'src/main/runtime/orchestration/message-batch-atomicity.test.ts',
'src/main/runtime/orchestration/mutation-receipt-capacity.test.ts',
'src/main/runtime/orchestration/nested-worker-depth-migration.test.ts',
'src/main/runtime/orchestration/orchestration-adopted-run-binding.test.ts',
'src/main/runtime/orchestration/orchestration-all-start-versions-migration.test.ts',
'src/main/runtime/orchestration/orchestration-creator-authority-performance.test.ts',
'src/main/runtime/orchestration/orchestration-db-permissions.test.ts',
'src/main/runtime/orchestration/orchestration-delivery-consumption.test.ts',
'src/main/runtime/orchestration/orchestration-derived-delivery.test.ts',
'src/main/runtime/orchestration/orchestration-federated-legacy-probe.test.ts',
'src/main/runtime/orchestration/orchestration-legacy-coordinator-authority-db.test.ts',
'src/main/runtime/orchestration/orchestration-legacy-question-migration-db.test.ts',
'src/main/runtime/orchestration/orchestration-legacy-storage-db.test.ts',
'src/main/runtime/orchestration/orchestration-mutation-question-db.test.ts',
'src/main/runtime/orchestration/orchestration-orca-session-column-migration.test.ts',
'src/main/runtime/orchestration/orchestration-party-location.test.ts',
'src/main/runtime/orchestration/orchestration-reset-db.test.ts',
'src/main/runtime/orchestration/orchestration-run-delivery-db.test.ts',
'src/main/runtime/orchestration/orchestration-run-list-compatibility.test.ts',
'src/main/runtime/orchestration/orchestration-version-skew-migration.test.ts',
'src/main/runtime/orchestration/orchestration-worker-dispatch-db.test.ts',
'src/main/runtime/orchestration/r1-identity-migration.test.ts',
'src/main/runtime/orchestration/run-coordinator-handle-migration.test.ts',
'src/main/runtime/orchestration/run-coordinator-orca-session-address.test.ts',
'src/main/runtime/orchestration/settled-question-threads-migration.test.ts',
'src/main/runtime/orchestration/worker-dispatch-repair-safety.test.ts',
'src/main/runtime/orchestration/worker-dispatch-settlement.test.ts',
'src/main/runtime/orchestration/worker-start-unobserved-prompt-settlement.test.ts',
'src/main/runtime/rpc/methods/agent-launch-instant-tab.test.ts',
'src/main/runtime/rpc/methods/agent-launch-restart-replay.test.ts',
'src/main/runtime/rpc/methods/native-chat-opencode-semantic-pages.test.ts',
'src/main/runtime/rpc/methods/native-chat-opencode-wire-page-budget.test.ts',
'src/main/runtime/rpc/methods/orchestration-dispatch-error-codes.test.ts',
'src/main/runtime/rpc/methods/orchestration-structured-worker-redrive.test.ts',
'src/main/runtime/rpc/methods/orchestration-worker-mode-opacity.test.ts',
'src/main/runtime/rpc/methods/orchestration-worker-release-incarnation-fallback.test.ts',
'src/main/runtime/rpc/methods/orchestration-worker-start-mode-selection.test.ts',
'src/main/runtime/rpc/methods/orchestration/federation/federated-message-targeting.test.ts',
'src/main/runtime/rpc/methods/orchestration/federation/federated-release-safety.test.ts',
'src/main/runtime/rpc/methods/orchestration/federation/federated-worker-start-receipt.test.ts',
'src/main/runtime/rpc/methods/orchestration/federation/federation-agent-launch.test.ts',
'src/main/runtime/rpc/methods/orchestration/federation/federation-control-mail.test.ts',
'src/main/runtime/rpc/methods/orchestration/federation/federation-folder-placement.test.ts',
'src/main/runtime/rpc/methods/orchestration/federation/federation-launched-agent-readiness.test.ts',
'src/main/runtime/rpc/methods/orchestration/federation/federation-lifecycle-settlement.test.ts',
'src/main/runtime/rpc/methods/orchestration/federation/federation-liveness-verdict.test.ts',
'src/main/runtime/rpc/methods/orchestration/federation/federation-output.test.ts',
'src/main/runtime/rpc/methods/orchestration/federation/federation-setup.test.ts',
'src/main/runtime/rpc/methods/orchestration/federation/federation-start-prompt-budget.test.ts',
'src/main/runtime/rpc/methods/orchestration/federation/federation-worker-brief-agent-in-front.test.ts',
'src/main/runtime/rpc/methods/orchestration/federation/federation.test.ts',
'src/main/runtime/rpc/methods/orchestration/messaging/check-worker-federated-attachment.test.ts',
'src/main/runtime/rpc/methods/orchestration/runs/migration-behavior.test.ts',
'src/main/runtime/rpc/methods/orchestration/worker/agent-status-producer-census.test.ts',
'src/main/runtime/rpc/methods/orchestration/worker/manual-dispatch-observation.test.ts',
'src/main/runtime/rpc/methods/orchestration/worker/manual-dispatch-release.test.ts',
'src/main/runtime/rpc/methods/orchestration/worker/worker-abandon-caller.test.ts',
'src/main/runtime/rpc/methods/orchestration/worker/worker-interactive-wait.test.ts',
'src/main/runtime/rpc/methods/orchestration/worker/worker-list-pagination.test.ts',
'src/main/runtime/rpc/methods/orchestration/worker/worker-release-recovery.test.ts',
'src/main/runtime/rpc/methods/orchestration/worker/worker-start-prompt-contract.test.ts',
'src/main/runtime/rpc/methods/orchestration/worker/worker-stop-liveness-verdict.test.ts',
'src/main/runtime/rpc/methods/orchestration/worker/worker-terminal-custody-at-creation.test.ts',
'src/main/runtime/rpc/methods/orchestration/worker/workers-new-worktree.test.ts',
'src/main/runtime/rpc/methods/orchestration/worker/workers-recovery.test.ts',
'src/main/runtime/rpc/methods/structured-worker-stop-receipt.test.ts',
'src/main/runtime/rpc/orchestration-11745-regression-verification.test.ts',
'src/main/runtime/rpc/orchestration-commit-notify-characterization.test.ts',
'src/main/runtime/rpc/orchestration-contract-fence.test.ts',
'src/main/runtime/rpc/orchestration-legacy-coordinator-race.test.ts',
'src/main/runtime/rpc/orchestration-legacy-question-takeover.test.ts',
'src/main/runtime/rpc/orchestration-legacy-takeover-delivery.test.ts',
'src/main/runtime/rpc/orchestration-legacy-takeover-dispatcher.test.ts',
'src/main/runtime/rpc/orchestration-mutation-executor.test.ts',
'src/main/runtime/rpc/orchestration-mutation-ledger.test.ts',
'src/main/runtime/rpc/orchestration-mutation-request-show.test.ts',
'src/main/runtime/rpc/orchestration-runtime-update-settlement.test.ts',
'src/main/runtime/rpc/orchestration-task-dispatch-invariant.test.ts',
'src/main/runtime/rpc/terminal-prompt-delivery-receipt.test.ts',
'src/main/runtime/runtime-orchestration-sender-names.test.ts',
'src/main/runtime/runtime-rpc-long-poll-transport.test.ts',
'src/main/runtime/runtime-orchestration-sender-names.test.ts',
'src/main/runtime/runtime-rpc-orchestration-db-migration.test.ts',
'src/main/runtime/runtime-rpc-request-authorization.test.ts',
'src/main/runtime/runtime-rpc-websocket-long-poll-caps.test.ts',
'src/main/runtime/settled-worker-process-replacement.test.ts',
'src/main/runtime/structured-agent-launch-args-wiring.test.ts',
'src/main/runtime/structured-agent-session-codex-compact-exit.test.ts',
'src/main/runtime/structured-agent-session-codex-stopped-send-order.test.ts',
'src/main/runtime/structured-agent-session-codex-turn-end-settlement.test.ts',
'src/main/runtime/structured-agent-session-failure-logging.test.ts',
'src/main/runtime/structured-agent-session-held-signal.test.ts',
'src/main/runtime/structured-agent-session-host-refusal.test.ts',
'src/main/runtime/structured-agent-session-install-failure.test.ts',
'src/main/runtime/structured-agent-session-legacy-send-behind-command.test.ts',
'src/main/runtime/structured-agent-session-mobile-restore.test.ts',
'src/main/runtime/structured-agent-session-runtime-exit.test.ts',
'src/main/runtime/structured-agent-session-runtime-provider-started.test.ts',
'src/main/runtime/structured-agent-session-runtime.test.ts',
'src/main/runtime/structured-child-records-switch.test.ts',
'src/main/runtime/structured-claude-auth-policy-wiring.test.ts',
'src/main/runtime/structured-codex-child-work-runtime.test.ts',
'src/main/runtime/structured-worker-at-rest.test.ts',
'src/main/ssh/ssh-remote-orca-cli.test.ts',
'src/main/ssh/ssh-remote-orchestration-compatibility.test.ts',
'tests/e2e/completed-worker-retirement-resume.unit.test.ts'
]