Skip to content

Retire automatic profile JSON snapshots with safe recovery and downgrade - #23262

Merged
nwparker merged 923 commits into
mainfrom
OrcaWin/np-retire-json-compatibility-snapshots
Oct 5, 2026
Merged

nwparker merged 923 commits into
mainfrom
OrcaWin/np-retire-json-compatibility-snapshots

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 1031 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​77881 $\color{#cf222e}{\Huge{\mathbf{−}}}$​21912 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​55969
Prod 1969 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​77579 $\color{#cf222e}{\Huge{\mathbf{−}}}$​47432 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​30147

The merged change is commit d518d4a: 79 files, +1,648 / -988 lines against its actual main parent. The PR page's +581,696 / -164,954 counter compares the refreshed branch to the old 668fa719 base and includes intervening main history; those lines were already on main.

ELI5

Orca saves profiles in SQLite. Quitting, updating and switching profiles now checkpoint SQLite without also serializing the whole profile into JSON. Older JSON files remain available for import and explicit recovery.

What Changed

  • Remove automatic compatibility exports from Store, writer-worker requests, shutdown, updates, headless shutdown and profile maintenance. Keep durable-save acknowledgements and failure handling.
  • Establish a small profile-state.db.authority marker before SQLite writes. Missing SQLite fails closed instead of reviving stale JSON or empty defaults; explicit JSON recovery archives and removes the marker.
  • Add orca profile state rollback --latest-json [--profile-id <id>]. With Orca stopped, export the latest committed SQLite state and select it for a JSON-only runtime. The profile selector also works with other recovery modes and export listing, without changing the active profile or its HTTP compatibility marker.
  • Refuse pinned and local builds below v1.4.214, the first stable SQLite release, before configuring their update feed. A JSON-only downgrade requires explicit conversion of each profile and manual installation.
  • Preserve main's newer --current-sqlite recovery option using an explicit, crash-safe JSON acceptance operation. Routine saves cannot reach it. Keep --current-json, immutable recovery exports, initial migration exports, old backup import and SQLite backups.

Why

Automatic JSON mirrors add whole-profile serialization and file writes to lifecycle operations without making crash-time downgrade reliable. SQLite stays authoritative; explicit conversion defines the downgrade transition. The authority marker protects missing-database recovery without another state snapshot. The release floor and profile selector resolve the original updater and multi-profile merge blockers.

Linked Issue

Requested follow-up to #22612, #22635 and #23202.

Visual Proof

N/A — no layout changes. Hidden Electron tests verify rendered terminal output after legacy migration/relaunch and exercise explicit rollback and corrupt-database refusal. Native build-picker rejection uses the existing updater error presentation.

Testing

  • Automated coverage: 1,436 tests passed, four skips, across 145 passed test files and two skipped files. Includes persistence, profile transfers, recovery/crash boundaries, Store lifecycle, CLI selectors and updater admission.
  • Hidden Electron upgrade/recovery suite: three passed, two old-packaged-build cases skipped because that executable is not provided locally.
  • All Node/CLI/renderer typechecks, CLI build, changed-code quality and reliability manifest checks passed on macOS ARM64. E2E rebuilt the Electron app in e2e mode.

Commands: ORCA_BACKGROUND_LAUNCH=1 pnpm test src/main/persistence/profile-state src/main/persistence/loading-store src/main/orca-profiles plus the changed CLI/startup/updater tests; pnpm tc; pnpm run build:cli; pnpm run check:code-quality:changed; pnpm run check:reliability-gates; ORCA_BACKGROUND_LAUNCH=1 pnpm exec playwright test tests/e2e/persisted-session-production-upgrade.spec.ts --config tests/playwright.config.ts --project electron-headless --workers=1.

  • Four additional hidden Electron SQL restart/profile-switch/project-transfer/abrupt-termination journeys passed. Two retained-worker restart journeys also passed.
  • Update installation now requires a full SQL checkpoint; getter mutations survive and checkpoint failure still aborts installation.

Review

Updated stale JSON assertions in the restart suite and headless rollback instructions. Resolved conflicts against current main while preserving its current-SQLite recovery, backup-byte equality and crash-fixture protections. Reviewed authority admission, artifact preservation, interrupted recovery, profile isolation, worker export failure and final-save failure handling. The previously identified updater and multi-profile blockers are now implemented and covered by production-entry-point tests.

Agent skill upstream boundary

  • Not applicable; no skill-installer material copied or translated.

Notes

Reliability invariant: durable SQLite checkpoints preserve session state without automatic JSON publication; missing authority never revives stale state. The experimental gate is profile-storage.sqlite-authority-without-automatic-json. Its oracle checks unchanged JSON, explicit conversion, inactive-profile isolation and zero incompatible updater feed calls. Diagnostics retain recovery artifacts and surface existing typed startup/CLI/updater failures.

Native macOS persistence and hidden Electron restart are covered. Windows/Linux updater policy is exercised through mocked platform entry points; physical installers and cross-platform persistence CI remain required. Local/daemon terminal restoration is covered by Electron. SSH/WSL/paired runtimes retain host-owned storage and unchanged wire contracts; physical remote-host upgrades and packaged-old-build journeys remain untested locally. No new polling, provider inventory or subprocess is added to ordinary persistence.

Directly installing a JSON-only build outside Orca cannot be intercepted. Quit Orca and run the current bundled CLI's orca profile state rollback --latest-json --profile-id <id> for each profile first. Keep full profile directories during restore/transfer. After interrupted conversion, inspect retained exports and use --revision if SQLite has already been removed.

Checklist

  • Focused on automatic JSON retirement and the recovery/downgrade protections it requires.
  • Explained behavior, mechanism and alternatives.
  • Local tests, types, lint, builds and hidden Electron checks passed.
  • Cross-platform, host ownership, folder/worktree and compatibility implications reviewed.
  • Physical Windows/Linux, old packaged build and live remote-host qualification; CI handles broader platform coverage.

@coderabbitai

coderabbitai Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: e8ae451b-f076-4505-8e02-67ccac15eeaa

📥 Commits

Reviewing files that changed from the base of the PR and between 668fa71 and 90ab10b.

📒 Files selected for processing (68)
  • config/tsconfig.cli.json
  • src/cli/handlers/profile-state-recovery-admission.test.ts
  • src/cli/handlers/profile-state.test.ts
  • src/cli/handlers/profile-state.ts
  • src/cli/runtime/profile-state-recovery-launch.test.ts
  • src/cli/specs/profile-state.test.ts
  • src/cli/specs/profile-state.ts
  • src/main/ipc/orca-profiles-switch-persistence.test.ts
  • src/main/orca-profiles/profile-index-store.test.ts
  • src/main/orca-profiles/profile-index-store.ts
  • src/main/orca-profiles/profile-project-domain-state.ts
  • src/main/orca-profiles/profile-project-state-file.ts
  • src/main/orcad/orcad-entry.test.ts
  • src/main/orcad/orcad-lifecycle.ts
  • src/main/persistence/loading-store/profile-state-authority.ts
  • src/main/persistence/loading-store/profile-state-checkpoints.test.ts
  • src/main/persistence/loading-store/profile-state-delayed-authority-fixture.ts
  • src/main/persistence/loading-store/profile-state-maintenance-compatibility.test.ts
  • src/main/persistence/loading-store/profile-state-maintenance-final-failure.test.ts
  • src/main/persistence/loading-store/profile-state-maintenance.ts
  • src/main/persistence/loading-store/profile-state-sqlite-authority.test.ts
  • src/main/persistence/loading-store/profile-state-store-backups.test.ts
  • src/main/persistence/loading-store/profile-state-update-quit.test.ts
  • src/main/persistence/loading-store/store.ts
  • src/main/persistence/loading-store/write-flush-barriers.ts
  • src/main/persistence/profile-state/legacy-json/README.md
  • src/main/persistence/profile-state/legacy-json/profile-state-authority-exports.ts
  • src/main/persistence/profile-state/legacy-json/profile-state-json-acceptance.ts
  • src/main/persistence/profile-state/legacy-json/profile-state-recovery.ts
  • src/main/persistence/profile-state/legacy-json/profile-state-versioned-export.ts
  • src/main/persistence/profile-state/profile-state-authority-bootstrap.ts
  • src/main/persistence/profile-state/profile-state-authority-export-fencing.test.ts
  • src/main/persistence/profile-state/profile-state-authority-marker-writes.test.ts
  • src/main/persistence/profile-state/profile-state-authority-marker.test.ts
  • src/main/persistence/profile-state/profile-state-authority-marker.ts
  • src/main/persistence/profile-state/profile-state-database-recovery.test.ts
  • src/main/persistence/profile-state/profile-state-database-recovery.ts
  • src/main/persistence/profile-state/profile-state-database-rollback-export.test.ts
  • src/main/persistence/profile-state/profile-state-database.ts
  • src/main/persistence/profile-state/profile-state-documents.ts
  • src/main/persistence/profile-state/profile-state-json-compatibility-recovery.test.ts
  • src/main/persistence/profile-state/profile-state-live-store-factory.test.ts
  • src/main/persistence/profile-state/profile-state-migration.ts
  • src/main/persistence/profile-state/profile-state-offline-settings.test.ts
  • src/main/persistence/profile-state/profile-state-offline-settings.ts
  • src/main/persistence/profile-state/profile-state-recovery-command.ts
  • src/main/persistence/profile-state/profile-state-recovery-crash-boundaries.test.ts
  • src/main/persistence/profile-state/profile-state-recovery-crash-process.ts
  • src/main/persistence/profile-state/profile-state-recovery-required.ts
  • src/main/persistence/profile-state/profile-state-sqlite-authority.ts
  • src/main/persistence/profile-state/profile-state-worker-authority.ts
  • src/main/persistence/profile-state/profile-state-worker-export-failures.test.ts
  • src/main/persistence/profile-state/profile-state-writer-protocol-faults.test.ts
  • src/main/persistence/profile-state/profile-state-writer-protocol.ts
  • src/main/persistence/profile-state/profile-state-writer-request.ts
  • src/main/persistence/profile-state/profile-state-writer-worker-client.ts
  • src/main/persistence/profile-state/profile-state-writer-worker-entry.ts
  • src/main/persistence/profile-state/profile-state-writer-worker.test.ts
  • src/main/startup/configure-process.ts
  • src/main/startup/http1-compatibility-profile-state.test.ts
  • src/main/startup/http1-compatibility-profile-state.ts
  • src/main/startup/main-process-quit.ts
  • src/main/startup/main-window-core-services.test.ts
  • src/main/startup/main-window-core-services.ts
  • src/shared/cli-argument-boundary.ts
  • src/shared/profile-state-recovery-command.test.ts
  • src/shared/profile-state-recovery-command.ts
  • tests/e2e/persisted-session-production-upgrade.spec.ts
💤 Files with no reviewable changes (9)
  • src/main/persistence/loading-store/profile-state-delayed-authority-fixture.ts
  • src/main/persistence/loading-store/profile-state-sqlite-authority.test.ts
  • src/main/persistence/profile-state/profile-state-writer-worker-client.ts
  • src/main/persistence/profile-state/profile-state-documents.ts
  • src/main/persistence/loading-store/store.ts
  • src/main/persistence/loading-store/profile-state-maintenance.ts
  • src/main/persistence/profile-state/profile-state-worker-authority.ts
  • src/main/persistence/profile-state/profile-state-writer-worker-entry.ts
  • src/main/persistence/loading-store/profile-state-authority.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.


📝 Walkthrough

Walkthrough

The change adds a durable marker for established SQLite profile state and checks that marker during database admission and recovery. It adds --latest-json to explicitly export the current SQLite state for JSON rollback. Shutdown, update, and maintenance flushes no longer publish JSON compatibility snapshots, and the corresponding compatibility-export APIs and worker command are removed.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 90ab1

The downgrade handoff is still marked incomplete. Confirm the supported release floor and a path for every profile before merging.

Security Architecture Review

Security architecture risk: 🟠 High · up to 90ab1

The SQLite authority safeguards are substantial, but downgrade is not yet a complete handoff. The PR description says the in-app build picker can install an older JSON-only build without conversion, and the new command converts only the active profile. Either route can leave an older build using stale profile state.

Retained concerns

  • High · reliability · inferred: The PR description reports that the in-app build picker can install a JSON-only build without first converting SQLite state. With automatic JSON refresh removed, that route can hand the older build stale state. The picker path itself was not independently verified.
  • Medium · reliability · observed: The new latest-JSON command converts the active profile, not every profile that an older JSON-only build may subsequently open. Other profiles therefore lack an explicit handoff under the proposed downgrade workflow.
Security review details

Security Blast Radius

  • inferred — The demonstrated scope is local profile state, including profiles not selected by the active-profile command. The evidence does not establish a remote entrypoint, cross-tenant reachability, or an expanded privilege boundary.

Trust Boundaries and Controls

  • observed — Marker-presence checks fail closed on filesystem errors, and marked SQLite paths cannot silently create a replacement database. Marker publication precedes retention of a writable authority handle.

Resilience and Maintainability Implications

  • inferred — The marker and recovery ordering address interruption and repeat attempts when authority artifacts survive. Simultaneous startup and recovery cleanup was not established by the inspected evidence, and complete loss of every authority artifact cannot be distinguished from a fresh profile by the marker alone.

Hardening Proposals

  • proposed — Before removing the downgrade warning, enforce a supported rollback release floor or require a safe conversion handoff in the in-app picker, and define conversion for each profile an older build can open.
🚥 Pre-merge checks | ✅ 3 | ❌ 1 | ❓ 1

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description fills the required sections and gives detailed testing and platform limitations, but it claims an updater release floor and profile-specific downgrade support that conflict with the su… Align the description with the actual changes and unresolved merge gates. Either include the updater release-floor and profile-specific downgrade changes and their tests, or remove those claims and state clearly which gates remain unresolve…
Docstring Coverage ❓ Inconclusive Docstring coverage is 34.88% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 43 functions across 50 files. (9 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: retiring automatic profile JSON snapshots while adding recovery and downgrade support.
Full details: Docstring Coverage

Explanation

Docstring coverage is 34.88% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 43 functions across 50 files. (9 skipped: 2 unsupported, 7 over the file limit.)

Full details: Description check

Explanation

The description fills the required sections and gives detailed testing and platform limitations, but it claims an updater release floor and profile-specific downgrade support that conflict with the supplied objectives and are not reflected in the change summary.

Resolution

Align the description with the actual changes and unresolved merge gates. Either include the updater release-floor and profile-specific downgrade changes and their tests, or remove those claims and state clearly which gates remain unresolved. Confirm that the Linked Issue section identifies an actual issue this PR addresses, as required by the template.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@OrcaWin
OrcaWin marked this pull request as draft September 26, 2026 20:27
@OrcaWin
OrcaWin marked this pull request as ready for review September 26, 2026 20:54
@OrcaWin

OrcaWin commented Sep 26, 2026

Copy link
Copy Markdown
Collaborator Author

Will merge after a bit

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — two design observations and a couple of stale comments. The author's declared merge gates (updater downgrade, active-profile-only --latest-json) remain open and are not re-flagged here.

Reviewed changes

Full review of the 68-file diff at 90ab10b (three commits): the retirement of automatic JSON compatibility snapshots, the new profile-state.db.authority marker, the --latest-json downgrade path, and the update-quit flush change.

  • Automatic compatibility snapshots removed — shutdown, update quit, maintenance, and transfer no longer publish orca-data.json; the corresponding Store/authority/worker methods and the worker export-compatibility command are deleted, with no dangling references repo-wide.
  • Durable authority marker added — <db>.authority is established before admitted SQLite writes and gates missing-database recovery; openProfileStateDatabase now passes fileMustExist so an established database is never recreated empty.
  • Explicit downgrade added — orca profile state rollback --latest-json exports the latest SQLite revision, archives the database family and recovery artifacts, then selects that JSON for an older build.
  • Update-quit path changed — onBeforeUpdateQuit now performs a strict pending flush instead of the removed compatibility export.

ℹ️ Marker is established after the database is published

The marker is this PR's central missing-database safeguard, but both database-creation paths publish the database durably and only then write the marker. A crash between those steps leaves a written database with no .authority evidence, so if the database family is then lost before a successful startup, the profile classifies as neither/json-only and startup can create an empty profile or re-adopt JSON.

Technical details
# Marker published after the database

## Affected sites
- `src/main/persistence/profile-state/profile-state-authority-bootstrap.ts:121` — publishes the empty temp database; the caller's `ensureProfileStateAuthorityMarker` runs later at `:91`.
- `src/main/persistence/profile-state/profile-state-migration.ts:51` — publishes the imported temp database (`published = true`); `ensureProfileStateAuthorityMarker` runs at `:57`.

## Required outcome
- Confirm the ordering is a deliberate tradeoff (ensuring the marker before publish would instead leave a marker without a database when `publishProfileStateDatabase` fails).

## Open questions for the human
- `profile-state-authority-marker.test.ts:107-132` already codifies the unmarked-database state as recoverable on retry. Is that the intended contract, or should the marker be durable before the database becomes visible?

ℹ️ Update-quit abort gate now covers only a pending flush

onBeforeUpdateQuit now calls flushPendingOrThrowAsync(), which issues a selective write (fullCheckpoint: false). The removed compatibility export forced a full write (dirtyProfileStateDomains = null) before the update could proceed. The full checkpoint still happens at will-quit, where its failure is logged and swallowed rather than aborting the install.

Technical details
# Update-quit abort gate no longer covers a full checkpoint

## Affected sites
- `src/main/startup/main-window-core-services.ts:131` — new `store.flushPendingOrThrowAsync()`.
- `src/main/persistence/loading-store/write-flush-barriers.ts:125-137` — `flushPendingOrThrowAsync` runs with `fullCheckpoint = final = false`.
- `src/main/startup/main-process-quit.ts:209` — `flushFinalOrThrowAsync()` failure is caught and logged, not fatal.

## Required outcome
- Decide whether a failed full checkpoint must still abort the update, or whether the `will-quit` checkpoint is sufficient. The getter-only-edit case is covered only by the `will-quit` full checkpoint.

## Suggested approach (optional)
- If strictness is wanted on the pre-update path, expose a full-checkpoint option on `flushPendingOrThrowAsync` rather than relying on the best-effort `will-quit` flush.

ℹ️ Nitpicks

  • src/main/persistence/loading-store/store-runtime-state.ts:69 still reads "Reclaim compatibility-export temps left by a process killed during rename"; those temps now come from explicit exports only.
  • src/main/persistence/loading-store/store.ts:180 JSDoc still says "explicit rollback/compatibility export" after the compatibility export was removed.

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

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Two E2E assertions still expect the automatic JSON snapshot this PR removes, so they will fail, and the headless-server rollback docs describe the same removed behavior. Both live in files this PR did not touch, so there is nothing to anchor an inline comment to.

Reviewed changes

Reviewed the complete 68-file diff against main at 90ab10bc.

  • Automatic JSON snapshots removed — writeJsonCompatibilityExport*, the export-compatibility worker command, the maintenance export, and the { exportJsonCompatibility } flush option are gone; quit, update quit, and profile maintenance now persist SQLite only.
  • Durable authority marker added — profile-state.db.authority is established before SQLite writes are admitted, gates openProfileStateDatabase's fileMustExist, and is archived/removed only by explicit JSON recovery.
  • Explicit downgrade selector added — orca profile state rollback --latest-json exports the latest committed SQLite revision with all prior exports retained, then hands authority to JSON.
  • Recovery/transfer paths updated — bootstrap, migration, database-backup restore, offline settings, and project transfer establish the marker; missing-SQLite guards now treat the marker as retained authority.

⚠️ Removed snapshots leave two E2E assertions expecting JSON that is no longer written

tests/e2e/profile-state-terminal-restart-persistence.spec.ts was not updated. At :133-137 the first test closes the app and asserts the profile's orca-data.json contains an automation created at runtime; that was true only because will-quit called flushFinalOrThrowAsync({ exportJsonCompatibility: true }). At :295-296 the switch test asserts the target profile's orca-data.json exists after switching away, which only happened via the maintenance compatibility export. Both now fail, and the PR's own unit tests assert the opposite (orca-profiles-switch-persistence.test.ts:113 and profile-state-checkpoints.test.ts:139 expect the file to be absent).

Technical details
# E2E specs still assert the removed compatibility JSON refresh

## Affected sites
- `tests/e2e/profile-state-terminal-restart-persistence.spec.ts:133-137` — after `session.close(firstApp)`, asserts `profiles/<id>/orca-data.json` contains the runtime-created automation. The canonical JSON is only the onboarding copy seeded by `createRestartSession` (`tests/e2e/helpers/orca-restart.ts:150-153`) and copied at startup; nothing refreshes it now.
- `tests/e2e/profile-state-terminal-restart-persistence.spec.ts:295-296` — asserts `existsSync(targetJson)).toBe(true)` with the comment "Clean maintenance refreshes compatibility JSON before releasing the profile." The target profile is never legacy-copied (`profile-index-store.ts:211-217`) and SQLite bootstrap does not write canonical JSON.
- `tests/e2e/profile-state-terminal-restart-persistence.spec.ts:452` — same stale premise in a comment ("Switching away refreshes the target export").

## Required outcome
- These specs must stop asserting a refreshed canonical `orca-data.json`, or seed/export it explicitly before asserting on it.
- `:133-137` should assert the automation through SQLite (or an explicit export) rather than the stale canonical JSON.
- `:295-296` should assert the target's SQLite database (already asserted at `:280`) or assert JSON absence.

## Suggested approach
- Mirror the pattern this PR already applied in `tests/e2e/persisted-session-production-upgrade.spec.ts:340`: snapshot the JSON artifacts before quit, then assert byte-equality or absence instead of expecting refreshed content.

ℹ️ Headless-server rollback docs still describe canonical JSON being rewritten

docs/reference/headless-linux-server.md:458-460, :699-703, and :901-903 state that a newer build rewrites orca-data.json in the current schema, and the rollback steps rest on that premise. After this PR the only writers are explicit exports to <dataFile>.sqlite-export.N.json, so canonical orca-data.json stays the stale legacy copy. Because the doc's rollback procedure is safety-relevant, it should be updated to the new --latest-json handoff.

Technical details
# Rollback docs describe a canonical JSON rewrite that no longer happens

## Affected sites
- `docs/reference/headless-linux-server.md:458-460` — "Orca loads older `orca-data.json` state into the current schema and writes it back in the current shape."
- `docs/reference/headless-linux-server.md:699-703` — "Once a newer build has started, it can rewrite `orca-data.json` in the current schema."
- `docs/reference/headless-linux-server.md:901-903` — "swapping only the binary leaves the newer `orca-data.json` in place."

## Required outcome
- Document that the newer build no longer rewrites canonical `orca-data.json`; migration and explicit exports write `<dataFile>.sqlite-export.N.json`.
- Point downgrade instructions at `orca profile state rollback --latest-json`, including the active-profile caveat the PR documents.

## Open questions for the human (optional)
- Is the canonical-JSON/`.bak.*` rollback narrative still meant to cover SQLite-capable older builds, or is the JSON-only handoff now the only supported downgrade path?

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

nwparker and others added 24 commits October 2, 2026 22:06
A restored pane waits for the initial status replay before subscribing to
PTY output. This fixture never settled that replay, so fish printed its
mode-2031 arm before the renderer connected. Its PTY API also omitted the
reset-input listener required by the serializer, aborting attachment.

Settle and dispose the existing startup-snapshot registration and provide
the same reset-listener mock used by the other PTY tests. The real fish
child-stdin assertions and timeouts remain unchanged. No production change.
Restack the original focused change onto current main, preserving every owned source and test blob and the merged CI contract and journal cleanup fixes.

Original-commit: f707cde
fix(shortcuts): defer TUI editing chords in terminal-first mode

Original-commit: 0c6348e
docs(shortcuts): describe deferred preview terminal chords

Original-commit: be62c1b
Align worktree history shortcut metadata with terminal conflict policy

Restacked-from: be62c1b
Restacked-onto: f7b1f9d
* Add Qoder session history and search with real CLI coverage

* Allow the real Qoder marker file to end with a newline

* Keep Qoder tool output out of history previews and search

* Keep Qoder search pages readable by older clients

* Verify persisted Qoder history after a real generated and resumed task

* Negotiate Qoder filters before searching an older execution host

* Combine search client imports for the CI plugin gate

* Keep the relay search oracle aligned with legacy agent filtering

* Register supervised Qoder China and Qwen lifecycle integration

* Cover Qoder China mobile assets and mixed-host resume gates

* Verify Qoder provider tags against the older released wire parser

* Verify China and Qwen keep independent Windows hook scripts

* Verify Qoder registrations against the installed older Windows release

* test(qoder): align search capability contracts and pin old-host fencing

* fix(qoder): rank exact picker identities and command aliases first

* test(qoder): preserve the regional CLI shared icon expectation

Keep the full bundled-asset and no-remote-image checks, with an explicit
shared-logo basename for Qoder China. The map also works with older
catalog type unions.

* fix(qoder): align China catalog entry with fallback order

---------

Co-authored-by: Orca Integration Recovery <[email protected]>
…24951)

* Select lookup automatically for the measured hosted root-install profile

* Record hosted automatic-mode cold cache publication proof
…4692)

* feat(antigravity): bridge IDE history into new CLI conversations

* fix(antigravity): preserve fresh-launch model and environment for IDE references

* fix(antigravity): forward IDE history opt-in through desktop IPC

* fix(antigravity): rebuild remote IDE reference startup on its host

* fix(antigravity): register IDE continuation action labels

* fix(antigravity): confine IDE references and bound metadata reads

* fix(antigravity): localize IDE continuation badges

* Preserve scanner service cache assertions and refresh Antigravity opening metadata

* Preserve Antigravity opening joins and target folder runtime authority
Preserve bounded retry behavior and the current-main status-envelope fields.

Original-PR: #24124
Reviewed-source: 103144f

Co-authored-by: Justas Brazauskas <[email protected]>
…24615)

Preserve the complete credential storage, migration, IPC, Settings and rate-limit refresh change alongside standalone GLM plans, current-main database diagnostics and the reviewed unknown-backend environment correction. Keep native discovery cancellation third and selected environment fourth.

Original-topic-commit: 7903f1c
Original-topic-commit: 588117b
Original-topic-commit: dedd4f8
Original-topic-commit: 6645dae
Original-topic-commit: a25b80c02c1af7830b0e6a65e72d965b3ad98276
Restacked-from: a25b80c02c1af7830b0e6a65e72d965b3ad98276
Restacked-onto: b032867

Co-authored-by: kespineira <[email protected]>
Co-authored-by: kevimux <[email protected]>
Reported-by: pullfrog
Reviewed-full-source: 849fe093073f4c1606bd65d79a0c725d955d0d1f
Native-helper-source: 80dbe23


Reviewed-full-current-source: 36acb57d44adb3d378c0289c8c15f7da0fda214c
)

An identical forced refresh previously returned an empty Zustand patch, creating a new root state and notifying every subscriber. It now returns the current state after renewing the existing freshness timestamp. Real row or metadata changes still publish once.
Reuse the existing pure recent rank once per actual entry tuple within each synchronous sort; discard the lookup after sorting.
* Skip impossible HTML matches when formatting docs search results

After the existing link-removal phase, skip the unchanged HTML regex only when the current string has no closing delimiter.

* Skip impossible link and tag matches in docs search results

Skip the five unchanged link regexes when their protected-code input lacks ]; skip the unchanged HTML regex when its post-link input lacks >.
Decode each single owned Buffer synchronously; preserve concatenation for multipart records and remove a redundant tail array copy.
Call the existing idle timer cleanup when private current-worker state is cleared; keep current-worker guards, transcript/error order, deliberate warmth and stop deadline unchanged.
Memoize the existing pure excerpt renderer by complete raw text for the current result array, retaining original rendering as a miss fallback.
Append each message reference to its private call-local scope list; retain the final merge and existing ordering.
Reuse the existing timer clear block immediately after the fetch generation advances; preserve live retries and all state publications.
Skip the visible path array only for keyboard replacement selection; the existing replacement branch never reads that order.
Use schema-complete session columns to enable the existing bounded statement cache without caching result rows.
Iterate the existing live visited Set in FIFO discovery order instead of maintaining a second shifted queue; both actual callers own untouched esbuild JSON metadata.
…24941)

Use the existing mobile density budget only for mobile view; pass the existing constant to the existing assembler for web/default mode, where that argument is discarded. No cache, policy, request or native path changes.
Move the unchanged pure render-limit calculation after both existing generation and section-token rejection fences.
Reuse the existing mounted-owner ref at the toast presentation entry while preserving all admitted extraction/screenshot and clipboard completion.
Use the existing native filter traversal to populate a fresh waiting array, keeping the original predicate, policy, projection and output ordering while classifying each actual private slot once.
Guard only the existing open pruning branch when both its private selected Set and nullable anchor are empty; retain all original pre-guard projections and nonempty/anchor-only/public-helper behavior.
…24532)

Verified selection plans previously validated each selected filename with a scan of all discovered files. One per-call Set now handles membership checks. Exact source/discovery checks, nonempty selection, fallback to all tests, shard balancing and manifests remain intact.
nwparker and others added 23 commits October 5, 2026 01:29
* fix: move worktree script checks out of creation dialog

* fix: retain creation host across background preparation
…ipt scrolls (#22871)

* fix(mobile): stop Android from selecting words while the chat transcript scrolls

On Android every paragraph, heading, quote, code block and table cell in
the native chat transcript was a selectable TextView. Android starts a
word selection, with the magnifier, on a double tap or a long press, and
two flicks in the same spot while scrolling a FlatList register as a
double tap, so scrolling the chat kept selecting words. iOS is unaffected:
its UITextView path arbitrates scroll against selection itself.

Android now renders transcript text without inline selection: one gate in
MarkdownText covers every selectable span, and the user bubble follows
it. A long press on a message opens a sheet with "Copy message" and
"Select text", the latter a screen whose only content is one selectable
Text, so a selection can only start where the user asked for it. The
message row owns that sheet and mounts it only while open. iOS and web
keep their inline selection and get no long-press handler.

Verified on a Pixel 10 Pro Fold (Android 17): an adb double tap on the
transcript selects nothing, the same double tap inside "Select text"
selects a word, tool rows inside the bubble still expand on tap, and the
long press opens the sheet.

* fix(mobile): scope the Android selection gate to the transcript and route span long presses

Review follow-ups on #22871:

- The gate now applies only where `rangeSelectable` is passed (the chat
  transcript). Task comments and file previews keep their selectable text
  on Android as before.
- On the Android transcript, spans that take taps (links, file paths)
  also take the row's long press, so a link under the finger no longer
  swallows the copy/select sheet.
- Copied text keeps its whitespace; only whitespace-only blocks are dropped.
- The Android markdown test compares `String(node.type)` instead of a
  type assertion, which the changed-code quality gate rejects.

* fix(mobile): route long presses on Markdown images to the row on Android

An image block is a Pressable of its own, so on the Android transcript it
now carries the row's onLongPress like tappable spans do; a long press on
an image opens the copy/select sheet instead of being swallowed. Test
extended with an image block.

* test(mobile): pin the Android long press from a chat row to its actions sheet

The existing row suite runs as iOS, where the bubble has no long press.
This one runs as Android: the bubble's long press mounts the actions
sheet with the message, the markdown receives the same handler, closing
unmounts the sheet, and the user bubble carries no inline selection.

* fix(mobile): preserve Android message selection while replies stream

---------

Co-authored-by: Neil <[email protected]>
…5485)

fix(codex): restart account switches without blanking or repinning the pane

Integrate the atomic pane replacement from #24350 and adapt the explicit
conversation resume from #14877. Keep terminal protocol replies flowing
while account notices block user input. Ordinary restores retain provenance.

Co-authored-by: Brennan Benson <[email protected]>
Co-authored-by: itisvincent <[email protected]>
Co-authored-by: rayim <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>
…gin (#25428)

* fix(opencode): submit initial prompts for reviewed 2.0.12

Route the reported release through the existing native startup intent.
Retain conservative behavior for other unreviewed versions.

* Wait for OpenCode startup fixture file reads in the hydration test

---------

Co-authored-by: nwparker <[email protected]>
… or anyone (#24376)

* feat(jira): pick the assignee when creating an issue — Automatic, me, or anyone

The new-issue dialog gains an Assignee picker: Automatic (Jira applies the
project's default assignee), one-click "Assign to me" resolved from the
target site's stored identity, or any user via search. The selection resets
with the custom field values on project/type switches, since account ids
are site-scoped.

Creates now also send userFieldKeys, so the host shapes user-typed values
into the {accountId}/{name} refs Jira requires — previously the dialog
never passed them and user create fields were sent as bare strings. Keys
are only named when a value is present, keeping older remote hosts without
the user-fields capability working for assignee-less creates.

Co-Authored-By: Claude Fable 5 <[email protected]>

* fix(jira): address assignee review — project-scoped assignable search, per-site picker remount, keep assignee across type changes

- Search the create dialog's assignee picker against /user/assignable/search?project=…
  (new listAssignableUsersForProject, IPC split into jira-user-search.ts for the
  max-lines budget); remote environment targets fall back to the existing
  site-wide search since older hosts have no such RPC
- Remount the picker per target project so cached results from the previous
  project or site cannot be selected after a switch
- Reset the picked assignee on project selection (account ids are site-scoped)
  instead of on every create-fields reload, so issue-type changes keep it
- Hide the assignee field and omit it from the payload when the target create
  screen does not accept an assignee — Jira rejects fields absent from the screen

Co-Authored-By: Claude Fable 5 <[email protected]>

* fix(jira): scope create assignee to the effective project and provider

* fix(jira): isolate assignee search candidates across provider changes

* fix(jira): search assignable users with Server-compatible project keys

* fix(jira): refresh assignee identity with provider connection status

* fix: distinguish hook confirmation from browser confirm

---------

Co-authored-by: Claude Fable 5 <[email protected]>
Co-authored-by: Neil <[email protected]>
Name the local hook confirmation function to avoid misclassifying internal selectors as dialog text.
Keep IME confirmation out of text-field submission and command selection. Reuse shared gesture ownership, preserve marked-release redispatch, guard overlay Escape capture, and retain Markdown save shortcuts.

Verified with independent adversarial reviews, 891 tests across 71 files, six hidden Electron tests, project typecheck, full lint, the changed-code quality gate, and all final-head CI checks.

Fixes #25035.

Co-authored-by: kambarakun <[email protected]>
…ith a boundary check (#25329)

* refactor(terminal): move the topology revision and leaf-lookup helpers into terminal-topology

advanceTerminalTopologyRevision, findTerminalTabIdForLeaf and
hasHostAuthoritativeTerminalMembership move verbatim from the renderer-save
membership rebase into persistence/terminal-topology, the home of the commit
boundary. Importers are repointed; no behavior change.

* test(terminal): test-only guard for topology writes outside the commit boundary

The three session sinks now publish through one commitWorkspaceSessionPartition
helper, which hands the prior and published partition to the topology write
guard. Production never arms the guard, so each sink pays one global lookup.

The unit suite arms it in report mode: a sink write that changes class-(a)
topology (membership, root, bindings, titles, incarnations, sleeping records,
remote session ids, tombstones, default-applied, revision) outside a commit
scope is attributed to its writer's file by stack, and fails the test unless
the writer is on the unrouted-writers allowlist that later routing PRs shrink.
Renderer saves and test seeding are exempt. Deep-freeze is available but stays
off suite-wide until the in-place writers return new sessions.

* refactor(terminal): add the topology commit module with bindLeaf, closeLeaf and closeTab

terminal-topology-commit.ts is the boundary for class-(a) terminal topology.
bindLeaf forwards to persistPtyBinding, whose write now runs in a commit
scope; the spawn commits and the relay reattach bind through it. closeLeaf and
closeTab wrap the existing close mutation in a commit scope and one
persistence.terminal-topology span (kind, outcome, refusal reason; no ids),
and the runtime close goes through them. Session output is unchanged: tests
compare it byte for byte with the old writers for local, ssh: and folder
workspaces.

* chore(terminal): drop an unused lint suppression from the topology write guard

* fix(terminal): attribute topology guard writers relative to the repo root

The guard read a frame's file through its last /src/ segment, so a test under
tests/ (folder-upgrade-identity-persistence.unit.test.ts) had no source frame
and failed as an unknown writer. Frames are now taken relative to the repo
root the setup passes in, tests/ counts as test seeding, Windows backslashes
are normalized before the node_modules skip, and nested src/ paths keep their
full path. The two runtime funnel files skip only their funnel function, so
another writer in them still shows. The R9 allowlist key names the file whose
frame actually writes. The class-(a) diff and the attribution move into their
own files; the stack limit is restored in a finally.

* refactor(terminal): drop bindLeaf until binding reaches a sink; add the boundary ratchet

bindLeaf and the commit scope inside persistPtyBinding changed nothing: the
binding write never reaches a session sink, and a scope inside the Store method
would have admitted every direct caller once it did. Both return in B1-4; the
spawn commits and the relay reattach call persistPtyBinding directly again.

The runtime close now calls one closeLeafOrTab entry, so its callbacks keep
their contextual types. A census test is the primary enforcement: only
persistence/terminal-topology and the callers it lists may call
persistPtyBinding, the session setters or the three sinks, and every
unrouted-writer allowlist entry must name an existing file.

* fix(test): resolve the topology guard's repo root without the global URL

Under happy-dom the global URL is not Node's, so fileURLToPath(new URL(...))
threw in the setup file and failed every happy-dom test file.

* refactor(terminal): drop the runtime topology write guard; the boundary ratchet enforces

The AST boundary ratchet is the enforcement for B1. The stack-attributed
runtime guard, its class-(a) diff, the unrouted-writer allowlist, the vitest
setup and the freeze option are removed; it saw two writers in the whole unit
suite and its real value starts only once binding reaches a sink (B1-4).

Also: one closeLeafOrTab wraps the close in the span (no per-kind copies or
narrowed types), the span has one finish like persistence.pty-binding, the
sink helper is publishWorkspaceSessionPartition (it publishes; the commit
boundary is the module), the ratchet drops the private publishSession row and
checks that every listed caller file exists, and the close comparison keeps
its two meaningful cases with span cases chosen by name.

* refactor(terminal): trim the B1-1 commit module and ratchet to what they enforce

- Point the acknowledged-tab-retirement audit fixture at the moved
  advanceTerminalTopologyRevision; its old import no longer resolved.
- Drop publishWorkspaceSessionPartition: it was the removed guard's
  interception point, so the three session sinks return to origin/main.
- One traced(kind, mutate) wrapper in the commit file replaces the span
  factory; closeLeafOrTab is one call.
- The ratchet walks src/main with the shared scanSourceTree, drops the
  loading-store-internal rows and the redundant file-exists test; exact-set
  equality already fails on a missing file.
- The commit test is a pure unit test of the span outcomes: no Store
  harness, electron mock or self-comparing close.

* refactor(terminal): census the runtime session controller's write and drop stage ids from comments

The controller's setter was named set, which the boundary census could not
list without matching every Map.set, so a new OrcaRuntime mixin could write
sessions through it unseen. Rename it setForWorktree and census it.
Comments now describe state instead of citing plan stage ids.

* refactor(terminal): census writer references and trace refusals by callback

- traced() takes refusalOf instead of assuming an Error refusal, and only
  mutate() sits in the try, so a span outcome of threw means the write threw.
- The boundary ratchet counts references, not just direct calls: non-null
  calls, bracket keys, aliases, destructures, .call/.bind and parenthesized
  callees all count; declared names and type positions do not.
- Census terminalSurfaceCloseMutation (boundary-only) and the partition sinks
  setLocalWorkspaceSession / setHostWorkspaceSession.

* test(terminal): count writer uses in extends clauses and instantiations, skip type-only imports and local declarations

The census skipped ExpressionWithTypeArguments as a type, which also holds
`extends f(x)` and `x<T>` value expressions. Type-only import/export
specifiers and declared names (variables, parameters, accessors, enum
members) no longer count as uses. The audit fixture is listed in the table
instead of a separate exemption.

* test(terminal): count quoted and assignment-pattern destructures of layout writers

* test(terminal): count every mention of a layout writer except its definition

Telling definitions from uses per syntax kind kept missing nested and
for-of destructures. Exempt only the writer's own function or class-member
definition; any other mention (including object-literal keys) counts, so the
census errs toward a loud false alarm rather than a silent miss. Quoted names
count only in member-name position.

* test(terminal): count every string literal naming a layout writer

Member-name positions missed wrapped keys like store[('name')] and
store['name' as const]. Counting every string literal outside types is
shorter and errs toward a loud false alarm.

* test(terminal): exempt only class members and functions as writer definitions

Object-literal methods and accessors were exempt while equivalent arrow
properties counted; all object-literal keys now count alike.

* test(terminal): parse files with unicode escapes in the writer census

A name spelled with a \u escape never appears verbatim, so the text
prefilter skipped it.

* test(terminal): parse any file with an escape in the writer census

\x, identity and line-continuation escapes also decode to a writer name
without it appearing verbatim.
)

* fix(native-chat): a Stop binds only the turn it actually stopped

A Stop pressed before any turn showed used to claim, at end-write time,
whatever turn the stopped send later opened, even when the Stop stopped
nothing. A turn that then died on its own read as "Interrupted" (your
cancellation) instead of "Failed".

Now a person's Stop that named no turn binds, in memory only, every turn
that ends while the Stop settles, and afterwards only the turn its
interrupt took. The settle ends a still-running stopped turn once. A
relaunch finds nothing in memory, so an unsettled turnless Stop binds no
turn. A Codex Stop whose answered turn does not open within its wait, or
whose send's answer was lost, now answers refused, so the host ends the
child and the turn can never run.

* fix(native-chat): keep the person's queue pause and close binding after a Stop settles

A host stop or eviction with no turn running now defers to a person's
Stop while its queue pause still holds with nothing sent since, read from
rows, so a held card is not handed off on reopen after a Stop that did
nothing or whose kill failed.

A person's close that named no turn opens a settle around its child's
end, so a turn that end cuts reads as theirs.

A press opens its settle only when the latest Stop event is its own or
the one in force it repeats: a late Stop, a card's interrupt or a lost
event row reopens no earlier Stop.

A Codex Stop that cannot reach a turn still able to open says the Stop is
unconfirmed rather than that no turn ran, and a second Stop still reaches
a turn an earlier wait left unopened.

Also drops the unused openedBy plumbing and the unreachable "a written
cancellation stays one" rule, and pins a relaunch after a named Stop.

* fix(native-chat): a Codex Stop agrees on both presses when a turn is still owed, and pin the close's settle

A Codex Stop that waited for a turn Codex answered a send into now answers
"may still open" whenever that turn neither opened nor ended and its send
is still owed, however the wait ended (it ran out, or the thread went
idle). Before, a first press after an idle thread said no turn was
running and kept Codex, while an identical second press ended it.

Adds a test that a person's close the conversation outlives (as /clear
does) closes its settle, so a later turn that ends on its own reads as a
failure.

* test(native-chat): a Stop whose event row failed binds no turn to an earlier Stop

With one ordered journal writer the Stop's event is in the fold when its
write returns, so the press reads whether it owns the latest Stop from the
fold instead of awaiting the write. Pins the case the read must refuse.

* test(native-chat): name the settle, not a stream drain, in the Stop's own-end test

* test(native-chat): a Codex Stop answered before Codex ends the turn reads interrupted throughout

Codex answers an interrupt it took before it sends turn/completed (interrupted):
on TurnAborted the app-server answers pending interrupts, then ends the turn, on
one channel. The test fake did the reverse. It now answers first and ends the
turn on a later read, and the tests that read the turn's end right after a Stop
wait for it.

New end-to-end test through the shipped host, journal and Codex adapter: with
the real order, every end row of the stopped turn reads interrupted by the Stop
(named, unnamed, and a Stop pressed while turn/start was in flight). Breaking the
settle window turns the in-flight case red: the Stop's own end row then has no
verdict, which reads as failed until Codex's end lands.

* fix(native-chat): a Codex Stop interrupts a turn Codex answered but has not opened at once

A Stop that named no turn, made after Codex answered a send but before the turn
opened, used to wait up to 5 s for the turn to open before interrupting, and
ended the Codex process when it didn't. The stated reason, that Codex refuses an
interrupt until it opens the turn, holds only part of the time: with no turn
active, Codex takes an interrupt once its thread runs (turn_interrupt_inner),
and refuses it with -32600 "no active turn to interrupt" before that or once
the turn has ended.

The Stop now sends the interrupt at once. Only on that refusal, while the turn
has neither opened nor ended, does it wait for the turn to open (bounded at
5 s) and send it once more. A turn that ended meanwhile was nothing to stop. One
that never opens, or that an earlier wait already gave up on, fails the Stop,
and the host ends the child as before. Sends still wait for the turn to open
before steering into it.

The test fake models Codex taking an interrupt once the thread runs (run()).

* fix(native-chat): every Codex Stop waits for an answered turn to start, as the first did

A Stop whose interrupt Codex refused as finding no active turn skipped the wait
when an earlier wait, a Stop's or a send's, had already given up on that turn.
Every press now waits its own bound and retries once if the turn starts, so a
turn that opens during a later press is still stopped. Both presses still reach
the same verdict when it never starts.

* fix(native-chat): a Codex Stop that ends the child before any turn opened withdraws its send

A Stop on a Codex turn that was answered but never opened ends the Codex
process. That end settled the send as in doubt (unknown, recovered), and the
client's outbox holds every later send behind a send in doubt until the person
presses Retry, which re-sends the very message they stopped. The chat looked
stuck.

Codex records a prompt only once its turn has started, so a send whose turn
never opened never ran. When the Stop's refusal says so (turnMayOpen), the child
end now settles the unanswered sends as withdrawn, the verdict Codex's own
interrupted-turn end already gives an unechoed send. The flag rides on the owed
wind-down, so a retry after a failed child end withdraws them too. Claude's
child end still leaves its unanswered send in doubt.

* fix(native-chat): derive the withdrawal of a Codex send whose turn never opened

Replaces the flag the Stop carried to the child's end, and its copy on the owed
wind-down, with a reading of the journal at the settlement that lands. A Codex
child's unanswered send is withdrawn when a person's Stop is in force since it
was sent and no turn row ran, or was written, after it; any other end (a turn
that opened, a host's close, a crash, Claude) still leaves it in doubt. A
retried wind-down reads the same rows, so it withdraws the same sends.

* fix(native-chat): keep a send in doubt when a turn was open for it

The derived withdrawal read a turn as open for a send only if it still ran or
was written after the send. A send steered into a running Codex turn whose
interrupt failed met neither once the adapter's end settled that turn ahead of
the host's settle, so it read withdrawn, though Codex drains a steer into the
running turn and may hold it. A turn that ended after the send was handed over
was open for it too: such a send stays in doubt, as before.

Pins that case, and that a send made after the Stop, to a child that then dies
before its turn opens, stays in doubt.

* fix(native-chat): withdraw a Codex send by whether it started its own turn, not by timing

Whether a turn was open for a send was read from end times: a turn that ended
after the send's handover counted. A send made while a Stop ended the turn is
handed over once that turn reads ended, yet Codex's own end for it can arrive
later, so such a send whose own turn never opened read in doubt again, and the
chat's queue held behind it.

The handover already records where the send went: its message joins the turn
running then (a steer) or belongs to no turn (it starts its own). Only a send
that started its own turn, with none opened since, is withdrawn; one that
joined a running turn, or has no recorded place, stays in doubt.

The Codex test fake takes an answered interrupt as Codex does, dropping the
turn before its end arrives.

* fix(native-chat): leave no Stop row when the Stop took back a send that never ran

A Stop on a Codex send whose turn never opened ends the child, and the child's end
takes the send back into the composer. The Stop still wrote "Cancellation
requested." at the conversation level, so with the send gone it sat under the
previous finished turn and read as if that turn had been stopped. A Stop that found
no turn running and whose child end took back every send it found now writes no
row; a Stop of a running turn, or one that leaves a send in doubt, still does.

* fix(native-chat): count a send whose answer was lost when a Stop takes it back

The no-row rule counted only pending sends, but the child's end also takes back a send this process left in doubt when Codex's turn/start answer was lost. That case still wrote "Cancellation requested." under the previous turn. Both now read one predicate, so they cannot drift apart.

* test(native-chat): pin which sends a Stop's child end can take back

A send an earlier process left in doubt is never withdrawn and never holds the row back, and a queued card's send is never counted.

* test(native-chat): read the outbox reconcile from where main moved it
…corded on its tab, not its workspace id (#25081)

* test(native-chat): a mirrored paired chat carries its host, so a workspace-id collision no longer hides its owner

* fix(native-chat): a chat's finished-turn alerts come from the host stamped on its tab, not its workspace id

* fix(native-chat): the attention bridge reads a chat's owner from the same rule as the chat pane
…t load says why once (#24576)

* fix(native-chat): an older Orca keeps a chat with newer content read-only, and an unreadable annotation costs only itself

A body or lifecycle mutation of a kind this build does not know, inside a row of a known kind,
now latches the chat read-only with every row kept, as a newer row kind or version already does.
It used to read as damage, and the open deleted the journal from that row on.

Each optional field of a body schema now declares what an unparseable value means:
- droppable (an annotation): removed from the row in memory; the chat stays writable;
- must-understand (a prompt's questions, a plan approval's plan, a turn's lifecycle, a goal
  change): the row is unreadable and the chat latches read-only.
Only a required field that fails is damage, repaired as before. A test holds every optional
field reachable from a body schema to a policy; the known body kinds are read off the schema.

Prompt options and questions no longer reject a key this build does not know, which deleted the
journal from that row on. The context-usage drop is now one case of the droppable rule.

* feat(native-chat): a chat an older Orca keeps read-only says so before a send is refused

A chat a newer Orca wrote opens read-only, and until now nothing said so: the person found out
when a send failed with "Chats were saved by a newer Orca". The host now names the reason on
every whole history page it serves (`page.readOnly: 'written-by-newer-orca'`: hydration, history
and catch-up resets), the shared client reducer keeps it from the latest whole page, and the
desktop status strip and the phone's composer area say "This chat was saved by a newer Orca, so
it's read-only here. Update Orca to continue this chat."

Every read-only latch the host has is a newer Orca's (its database, a row version, a row kind, a
body kind or must-understand fact), so the reason is derived from the journal's latch, not stored.
The field is optional: older clients ignore it (cross-version test against the newest release's
reducer), and older hosts never send it, so a new client against one says nothing, as today. A
reason this client does not know shows nothing rather than words that may be wrong.

The window-merge helpers move out of the client reducer into their own module.

* fix(native-chat): only a newer build's value goes read-only; damage repairs as before

An older Orca keeps a chat read-only only on evidence a newer build wrote it: a value outside a
closed set this build knows (a body kind, a nested discriminant or literal, a mutation kind), read
off zod's issues. That evidence wins over damage beside it. Anything else that fails (a wrong type,
a missing field, a bad optional value) is damage, repaired as before, so damage no longer freezes
a chat behind an "update Orca" it cannot fix. Drops the per-field droppable/must-understand
policy. A lifecycle mutation's kind is decided before its item id, so a newer kind without one is
kept. The context-usage drop is unchanged from main.

* fix(native-chat): a read-only chat locks its composer and says why there

Removes the separate read-only line (desktop status strip, phone notice component). The host's
`readOnly` on whole pages now feeds the existing composer lock instead: desktop disables the
composer with "Saved by a newer Orca. Update Orca to continue this chat." as its placeholder, and
the phone adds a 'read-only' input-lock reason with the same words. A read-only chat shows no
prompt card it would refuse; the draft stays in the composer. The phone's send-failure line is
back exactly as on main.

* fix(native-chat): a read-only chat pages back through its history

A read-only journal answered every history request with a reset, so a chat this PR now keeps
read-only more often could show only its newest page. Backward reads now serve the snapshot the
open folded, as the first page already does; a forward read of rows still resets.

* test(native-chat): an unknown key in a question entry is read and kept

* test(mobile): the read-only overlay test typechecks

* chore(native-chat): satisfy the changed-code gate in admission and the read-only overlay test

* fix(native-chat): a new value inside a known block or goal arm reads as a newer build's

The open fallback arm of the block and goal unions now aborts, so zod reports the known arm's own
failure instead of only the fallback's; a future closed set there reads unreadable, damage there
still repairs. The schema headers name the context-usage exception and say a new open-string
value must be safe for every older build (rewind keeps only known states; pages carry no row
version).

* fix(native-chat): a read-only chat reconnects for a whole page, so an updated host unlocks it

The client keeps `readOnly` until a whole page replaces it, but reconnected at its cursor and got
only batches, so a desktop attached to a host updated in place stayed locked with "Update Orca".
While it holds the latch it now subscribes without a cursor; the snapshot re-derives the state on
any host version. The phone already subscribes without one.

* fix(native-chat): every desktop write control follows the one read-only fact

The structured session's transport state derives one fact from the page's `readOnly`: the words
for why the host refuses writes. Every write control reads it. While it holds, the chat has no
turn and no work, as the host projects it, so the working row and Stop go away; a pending prompt
stays shown above the composer with its card disabled; queued cards' Send now, Delete and Edit,
the queue's Resume, the goal banner's actions, the model and option pickers, dictation and
background-task Stop are disabled or withheld. The composer placeholder stays the one place the
reason is said. `lockReason` now locks the composer by itself.

* fix(mobile): every phone write control follows the one read-only fact

The phone session derives one fact from the page's `readOnly`, the words for why the host refuses
writes, and every write control reads it: no turn or work while it holds, so no Stop; the pending
prompt stays shown with its card disabled; queued cards and Resume are inert; the model and option
pickers stay shut; the composer field is not editable, so its placeholder keeps saying why, and the
lock applies at once instead of after the transport lock's settle.

* test(native-chat): the newest release hydrates a read-only chat and scrolls back through it

* test(native-chat): a read-only chat reads idle even with a send its provider never answered

* test(native-chat): composer lock test without type assertions

* fix(native-chat): round-3 read-only fixes

- An old /model or option request no longer reopens its picker when a read-only chat unlocks: the
  menu is keyed by the request alone, and a lock only keeps it from mounting open.
- A disabled question card still steps through its questions; only answering is locked.
- A failed send's notice in a read-only chat says only that the message was not sent, with no
  Retry: the composer already says why, and no retry can land. Its wiring moves into
  useStructuredAgentSessionDeliveryNotices.
- The host's background-task stop flags stand; the client no longer overrides them.
- The view reads the read-only fact through one local flag.
- The schema header says what an older build's rewind does with each open string.

* test(native-chat): count picker mounts without an effect

* fix(native-chat): read-only keeps other failures' words and shuts open option menus

- In a read-only chat, only a send the newer-Orca refusal stopped is shortened to "Your message
  was not sent."; any other saved failure keeps its own words, and none offers a Retry.
- A model or option menu open when the lock lands has its items disabled, so it cannot send a
  change the host would refuse.

* test(native-chat): lock-lands picker test uses a typed surface

* fix(native-chat): a locked composer draws its reason

The editor's placeholder used the default that draws nothing while the editor is not editable, so
a read-only chat's composer was empty and its reason lived only in the aria-label. The placeholder
now draws while disabled, and its words are empty unless the composer is locked with a reason, so
every other disabled composer (a pending prompt, no terminal) looks as before.

* fix(native-chat): sync the locked-placeholder flag in an effect, not during render

* fix(native-chat): a read-only chat is not offered for resume or counted as failed to resume

After a relaunch, a chat whose journal this build keeps read-only (a newer Orca's) was listed in
"Resume interrupted chats?", failed with "Orca couldn't resume this chat. Open it to continue
manually.", and left a status-bar "N chats failed to resume" that never cleared, since nothing can
continue a chat this build cannot write. The resume set now skips such a chat after the checks
that end an offer (fork, moved on), so the offer is kept, not spent, and an updated Orca offers it
again; the failure ledger keeps an already-filed failure for it but does not show it. Both read
the chat's open journal, which listing and acting open first.

* fix(native-chat): a refused resume continuation keeps the refusal's reason

A send refused while continuing a chat after a restart was filed with its code alone, so a newer
Orca's refusal lost its `journalWrittenByNewerOrca` reason. The continuation now carries the whole
refusal, as a refusal from the agent's start already did, so the filed failure keeps it.

* fix(native-chat): a newer Orca's chat keeps its resume offer however it is met

- A newer Orca's whole database counts as read-only for resume, so a chat whose journal cannot
  be opened at all (a table the newer schema changed) is not offered, run or counted either.
- The checks made right before sending no longer skip read-only chats: turning one away there was
  read as the user having moved on and deleted the offer. Its send is refused instead.
- Settling a resume files nothing for a newer Orca's refusal; the existing rollback reopens the
  offer for an updated Orca.
- The continuation records the refusal as a reference, without the wire prose.

* chore(native-chat): one import of the session wire types in the continuation

* docs(native-chat): resume and read-only comments match the current rule

* test(native-chat): a closed set of a journal row cannot change without the row version

The test walks the body schema and the row and mutation kind tables, collects every closed set (a
row kind, a mutation kind, each enum, literal or discriminant), and compares them with a snapshot
recorded beside the row version. A new value makes older builds go read-only, so it fails until
the reader ships first or `v` is bumped and the snapshot updated. Tags a catch-all arm accepts as
any string (block types, goal states) are listed apart: older builds read a new one as-is.

* feat(native-chat): a body or plan subject of a newer kind is kept and the chat stays writable

An item body kind and an approval subject kind this build does not know now read through the
same catch-all blocks and goal states use (`openDiscriminatedUnion`), instead of making the chat
read-only. The item is kept, drawn by nobody, and ignored by everything that reads items (turns,
prompts, status); a rewind carries it as it was, kept by its place like every other row. An
approval whose subject this build cannot draw shows its `detail`, which Orca's writers fill with
the subject's text. A sent message of a kind this build does not know stays a newer build's.

* fix(native-chat): rewind narrows a retained body by its kind before normalizing it

* fix(native-chat): one chat that cannot open no longer stops the startup restore of the rest

* fix(native-chat): a damaged chat fails to load and nothing is deleted

A row this build cannot parse, a gap, or an epoch without its first row used to
be repaired on open: every row from the damage on was deleted and a rebuild from
the provider transcript was attempted. The open now fails through one refusal
(failLoadOnJournalDamage, journalCorrupt), every row stays, and a damaged
per-chat file is kept whole and never copied. A newer build's row still wins
and keeps the chat read-only. The body classifier for closed-set values, the
repair marker and disclosure, and journal recovery from the transcript go.

* chore(native-chat): no reset or adapter left on the open's fixtures

* feat(native-chat): an approval of a newer Orca's subject kind can only be cancelled

Desktop and phone show its detail and the line "This request needs a newer
version of Orca.", disable every answer, and keep the card's cancel, which ends
the turn. The chat stays writable.

* test(native-chat): the closed-set guard says a missed version bump fails older builds' load

* test(native-chat): the closed-set guard names what a missed version bump does

* fix(native-chat): a row the reader rejects is never written, and a chat that cannot load keeps its tab

Every journal insert reads its serialized row back with the reader inside the
write's transaction and refuses one it rejects, so Orca's own writer can no
longer leave a chat that fails to load. A restored chat whose open fails keeps
its tab and says why when opened. An epoch named with no rows is founded afresh
again, deleting nothing. The at-rest test now expects a damaged chat to be
refused; the replay gate keeps its 2026-09-11 evidence as it was run.

* fix(native-chat): a newer Orca's approval subject is carried as it was, and its card cancels with or without a turn

The approval subject's type is open, so code that reads a plan narrows first; the
host's prompt bounding carries an unknown subject instead of rebuilding it as a
plan, which threw in every start's stale settlement. A Codex rewind keeps a
newer Orca's item in its place. A whitespace-only tag is damage. The card's
cancel reaches the host without a running turn on hosts that take that. A
provider row the reader rejects ends its turn as interrupted and the next send
works. A guard fails if an approval subject kind is added before clients can be
gated (STA-9262).

* fix(native-chat): a card's cancel sends nothing without a turn again, and rewind keeps a newer row after any held row

The host's cancel request has to name a turn on every version, so the turnless
prompt cancel is reverted on desktop and phone. The rewind merge moves its anchor
for every row the provider still holds, so a newer Orca's row stays after one
whose kind this build does not know.

* fix(native-chat): a card this build cannot answer leaves the composer open, and a send starts a turn

An approval of a subject kind this build cannot draw, raised by a newer host's background agent
while no turn runs, left nothing to press: its answers are disabled, its cancel needs a turn, and
the desktop composer gave the card its slot. A send the host queues waits behind any pending
prompt, so even the phone's open composer only queued.

While every pending prompt is one this build cannot answer, the desktop composer stays open, and
desktop and phone send without asking to queue: the send starts a turn, and the card's cancel then
settles it. A chat a dead run left is unaffected: opening it already cancels those prompts.

* feat(native-chat): a chat a newer Orca saved fails to load and says to update, with nothing to send into

Opening a chat a newer Orca saved (a row kind, batch-change kind or sent-message kind this build does
not know, a newer row version, or a newer history store) used to open it read-only: the history
shown, the composer locked with a reason, every control greyed. Now it fails the load, like a
damaged chat, with its own words: "This chat was saved by a newer Orca. Update Orca to open it."
Every row is kept. The read is final, so the pane stops retrying; reopening the tab reads again.

A chat whose load failed for good (damaged, or a newer Orca's) offers no composer under the error,
on desktop and on the phone, so the failure is said once and no send can be refused a second time.

A restart offer for a newer Orca's chat is spent without a word: no failure filed, nothing counted.

Removed with the read-only mode: the journal's read-only latch and every check of it, the history
page's readOnly field (never released), the cursorless reconnect, read-only paging, the composer
lock and placeholder, the greyed controls, and the resume exclusion.

* test(native-chat): a newer Orca's records open no chat, and a status fake carries its submissions

* test(native-chat): the status fake's cast says what the feed reads

* fix(native-chat): a chat's read that failed for good takes the whole pane, over a loaded transcript too

* test(native-chat): the final-read-failure test names its reasons

* fix(native-chat): a newer Orca's chat keeps its restart offer, and its refused load is logged once

* refactor(native-chat): the newer-Orca chats a restart listing skips live beside the candidate reader

* fix(native-chat): a refused chat load keeps where it failed, so the log names it and a new reason logs again

* chore(native-chat): the reducer's window merge back where main has it, and comments say a newer Orca's chat fails to load

* test(agent-hooks): the rename test's journal fakes carry submissions, as a journal snapshot does

* test(agent-hooks): the rename test's journal fakes say what the status feed reads

* fix(native-chat): Dismiss all ends the restart offers this Orca lists, and keeps a newer Orca's hidden ones

* test(native-chat): a resend against a newer Orca's store answers unknown, and the phone says nothing beside the read's words

This build never opens a chat a newer Orca's database holds, so a resent send id there cannot be
answered from its journal: it answers "outcome unknown", never a refusal and never a made-up
record, with no second delivery and no write. On the phone, a send error left beside a read that
failed for good is not shown; the pane keeps only the read's words.
…#25421)

* fix(codex): stop prompting a Codex restart when only its home changed

A Codex terminal that outlived the move to ~/.codex was blocked behind "This
Codex session is using an outdated configuration" until the user restarted it,
which starts a fresh codex and ends the conversation. That terminal keeps
working on Orca's old Codex home, which is refreshed from ~/.codex, so the
change did not need the user's answer; the prompt also never appeared for
Codex in Git Bash terminals, whose process tree Orca cannot see through.

The restart prompt now covers only an account switch, which the user caused.
The pane record keeps its home route, which the retained-home refresh and the
shared-server check still read; only the prompt and the custom-home downgrade
that existed to keep it from guessing are gone.

* refactor(codex): drop what the home-route prompt left behind

- Record a pane's own CODEX_HOME override as-is. The filter that kept only
  overrides Orca could re-derive existed for the removed route comparison;
  its one remaining reader, the shared-server check, returns null for the
  shared-home route those panes record either way.
- Treat custom-home like shared-home in resolveCodexPaneHome: the removed
  downgrade only wrote it without an override, so it never named a home.
- Inline the restart notice key; its route/account prefix was its only job.
- Delete the two pane-local override tests, including a POSIX-only one that
  still expected custom-home and would have failed on Linux and macOS CI.
- Cover the account recheck branches the deleted route-recheck file was the
  last to exercise: main reporting a pane current, and main not answering.

* refactor(codex): retire custom-home and the last re-check helpers

- Read an older build's custom-home record as shared-home, which it always
  was, and drop custom-home from the route type and every check.
- Delete shellStartupCodexHomeOverrideMatches and its comparison helper;
  nothing re-checks a recorded override any more.
- Build the pane launch record in one return: the route is always set, and
  only a resumed launch differs, in how it picks the account.
- Drop the restart dialog's notice key; its focus effect now depends on the
  pane and both account labels directly.
- Give the account recheck test a typed window stub, so CI's type-assertion
  gate passes, and remove timing entries for deleted test files.

* fix(codex): drop the removed dialog strings main added to es.json

* refactor(codex): stop recording a pane's custom CODEX_HOME

The pane record kept a pane's CODEX_HOME override so the removed route
prompt could re-check it later. Its one other reader, the shared-server
check, only looked at it for a real-home pane, and a custom CODEX_HOME
always routes a pane to Orca's mirror, so it was never used.

Drop both record fields, their validators, equality checks and spawn
plumbing. getCustomCodexHomeOverrideForLaunch folds into the existing
hasCustomCodexHomeOverrideForLaunch, and real-home resolves to ~/.codex.
Records from older builds still parse; the parser keeps only known keys.

The fish test's decoy no longer sets CODEX_HOME, so the boolean check
still fails if the launch env XDG_CONFIG_HOME is ignored.

* test(codex): drop setup the yes/no CODEX_HOME checks no longer need

---------

Co-authored-by: Orca Worker <orca-worker@localhost>
* test: add legacy worker recovery persistence snapshot budget tests

Rollback requires the final stored state after processing all workers,
not intermediate snapshots after each candidate. This bounds the snapshot
count and preserves concurrent edits during the durable write.

* fix test

* clean up code
…25579)

The paired web client has no Jira preload, so window.api.jira.status()
resolves undefined from the fallback proxy. Since #24376 the first status
check stored that undefined and the sidebar crashed reading `.connected`.
Parse the status reply at the runtime-client boundary so every reader
gets a well-formed JiraConnectionStatus.
…hem after readiness (step 1 of 7) (#24257)

* feat(agent-launch): host-side prompt delivery for agent.launch

The host's agent.launch typed any launch prompt into the shell as part of the
launch command. A long or multi-line prompt then ran line by line in the
shell, and an agent that never showed readiness or crashed at startup had
nothing guarding where its text went.

agent.launch now carries a prompt on the typed line only when the line stays
one line, control-free and at most 512 bytes; otherwise the agent starts
clean and the host pastes the prompt once the agent's own ready signal fires
(bracketed paste plus its composer marker or a quiet render, read only after
the shell's last hand-off, never while the pane's own shell is proven in
front), with main's draft-paste bytes and an Enter 50 ms later. Orchestration
worker starts wait on tui-idle as before. A replay-safe launch admits and
claims its ledger row in one write, Qwen Code gets a second Enter, the
desktop and phone share one launch-refusal classifier, and hosts advertise
agent.launch.prompt-carry.v1.

Split out of #23748, which moves the desktop source-control buttons onto
this path.

* fix(agent-launch): keep a short-lined multi-line prompt on a local zsh launch line, as main did

#24257 moved every multi-line or over-512-byte prompt off the typed launch line and pasted it after readiness. The phone's AI buttons and review notes, whose multi-line prompts main typed whole into zsh, then reached Claude 0.5-3 s later and their RPC reply waited for the paste.

The host now names the shell a local macOS or Linux line is typed into, the way the spawn picks it, and a multi-line prompt rides a zsh line when every line is at most 512 bytes and the whole line at most 8 KB. A real-zsh test types such a line through Orca's own ready barrier and startup write, including when a slow user config makes the write land early. Elsewhere the measured unsafe cases keep the paste: bash 3.2 runs multi-line lines piecemeal, fish drops an early multi-line write, and any shell loses a line over 1 KB written early.

* test(agent-launch): keep the real-zsh launch-line test out of the Windows lane's gate scan

The Windows lane registration check read `const ZSH_PATH = process.platform === 'win32'` (the head of a multi-line ternary) as a Windows-true flag, so `describe.skipIf(!ZSH_PATH)` looked like a Windows-only suite. The file is POSIX-only; the zsh lookup is now a function.

* refactor(protocol): move the agent.launch capabilities into their own module

Main's protocol-version.ts sits at the 300-line cap, so the prompt-carry capability pushed it over. The four agent.launch capabilities and their doc move to agent-launch-runtime-capability.ts, re-exported by name and spread into RUNTIME_CAPABILITIES at the same position; the advertised lists and every export are unchanged.

* refactor(protocol): import the agent.launch capabilities from their own module

`export *` from protocol-version left the four names undefined under the mobile recording loader, which resolves a relative import through a Proxy with no own keys, so 37 phone recordings lost agent.launchReplay. Importers now name agent-launch-runtime-capability directly; protocol-version only spreads its list.

* refactor(agent-launch): drop the unshipped viewMode field and trusted local caller id

Both were inert in step 1 and existed only for step 2. agent.launch will become a
public plugin API, so every wire field is permanent once shipped; a top-level
viewMode reads as "choose terminal vs chat", which the host decides. Step 2
introduces placement and view intent under a placement object instead.

* fix(agent-launch): read Codex's provisional startup from the rule files' hold anchor

Main (#24375) moved Codex's provisional-header check into codex.json's
provisional_startup hold anchor and deleted codex-terminal-readiness.ts, so the
launch readiness hold now asks showsHoldAnchor, as main's own settled check does.

* fix(agent-launch): hold rule-file name titles to quiet for a launch, and census the zsh fixture

Main (#24375) answers a name-only title from each agent's rule file ahead of the
sustained-title lane, so gemini.json's name_title settled a launch readiness wait
on the shell's auto-title while Gemini was still booting. A launch now asks quiet
of every weak idle verdict, as that lane did.

Main's readiness census requires a recorder for every runtime fixture; the zsh
prompt recording is a non-agent control. Gemini's synthetic baseline is
regenerated for this PR's stated change: a bare gemini title is no longer its
rest mark, so name-only rows settle weak, and a fresh working or blocked status
is no longer overridden.

* fix(agent-launch): paste a launch prompt only when the launched agent is proven in front

A launch pasted its prompt unless a shell was proven in the terminal's
foreground, so any read that could not prove one let the prompt through. After
an agent exited at startup, its shell turned bracketed paste on at the next
prompt, readiness fired on it, and the prompt was typed into the shell:

- macOS: a pane runs its shell under login, so the process-group fence's root
  was never the shell's group and never proved it; the cached foreground name
  could also still name the exited process.
- Windows Git Bash and WSL: the shell-alone-in-its-job check never answers.

Now one fresh read of the terminal's foreground decides: agent, shell or
unknown. Only 'agent' lets a write through (paste, Enter, second Enter, reused
panes too); 'shell' still drops a ready signal. A Windows host never proves the
agent, so there the launch line carries the prompt at any size, as on main.

* test(agent-launch): cover the Windows QA stub, a grok override that exits at once

* fix(agent-launch): keep the local socket alive while a prompted launch waits for its agent

A launch with a prompt now waits up to 60 s for the terminal agent to be
ready before it writes the prompt, and reports not-delivered when the agent
never is. The local runtime socket closes a connection idle for 30 s unless
the request is a long poll, so a launch whose agent exited at startup lost its
reply and the caller saw 'runtime closed the connection' instead of
not-delivered. Classify a prompted agent.launch and agent.launchReplay as a
long poll, as orchestration.workerStart already is for the same wait.

* refactor(agent-launch): narrow the launch params by 'in' instead of a cast

* fix(agent-launch): find a launched agent behind a wrapper that leads its process group

A tcsh or nu launch line runs the agent from /bin/sh '<script>', and a
wrapper script that does not exec its agent does the same: the wrapper leads
the terminal's foreground process group and the agent is a member of it. The
fresh foreground read names the group's leader, sh, so a prompted launch was
refused or pasted late (M4Air tcsh: 2 of 4 not delivered, 2 pasted ~9 s late).

Before that read, take the host's process-group observation as positive proof
when it names the launched agent among the foreground group's members and is
younger than a ready signal's quiet window. It never proves a shell.

* fix(agent-launch): judge the foreground-group proof by when its capture began, not how long ps took

The age the host stamps on a process-group observation runs from the start
of its whole-machine ps, so on a loaded Mac a capture begun after the read
was asked for still read as older than 1 s and the proof was dropped. Count
an observation whose capture began after the read was asked for, less the
window a shared capture is reused across.

* test(agent-launch): keep the crash-guard live test out of the Windows lane's gate scan

The Windows-lane registration scan read the const assigned from a platform
check as a Windows-only gate, though the suite runs everywhere but Windows;
find zsh in a function instead, as the real-zsh typed-line test does.

Under load the fresh foreground scan can fail to answer, which lets the
shell's prompt settle readiness (2 of 4 paired runs). The guard still refuses
that write, so assert the refused write, the property that must always hold.

* perf(agent-launch): read a local pane's foreground from its own terminal, not the whole process table

The foreground read that gates every launch paste ran the daemon's
inspectProcess capture and then a fresh scan, each a whole-machine ps; the
fresh one also waits for any capture already running before it starts its own.
Measured here at load 5: 1.2 s a read (M4Air QA: 3.4-5.0 s, and worker starts
17.6-32 s against main's 9-12 s at load 25-84).

On a local macOS or Linux host, take the pane's root pid from the provider's
session inventory and run one ps limited to that pane's terminal. Its
foreground process group decides: the launched agent or any non-shell member
is the agent (a wrapper that did not exec its agent leads the group), a group
of shells alone is the shell. Same pane, same verdict: 2.7 ms a read. SSH hosts
keep the relay's observation and name.

* test(mobile): re-measure the web app's script sweep after agent.launch's capabilities moved out of protocol-version

The mobile web bundle check failed at 124 assets against a ceiling of 123. Main already sat
exactly on that ceiling: its sweep table read 69 scripts at 16 routes while the tree builds 73,
the whole margin of 4. This branch imports the agent.launch capabilities from their own module,
so protocol-version is no longer pulled into the root layout and four other routes. That moves
which routes share which modules, and the Qoder capability module, imported by protocol-version
and the AI-vault resume path, no longer shares an importer set with anything, so it gets a chunk
of its own: 74 scripts.

The fence says to re-derive the bound rather than raise it, so the sweep is re-measured on this
head (every prefix of the sorted route list). The worst route now adds 10 scripts (session), not
9, which moves the pinned shell crossing from 32 to 30 routes; main re-measured on its own lands
on the same crossing.

* fix(agent-launch): a worker's brief needs its agent found in front, and Grok's start answers on its composer

A paired-server worker start whose agent exited at startup typed its brief into the server's
shell, which ran it: the idle wait can settle on a shell back at its prompt, and the brief was
written with no foreground read. Both worker-start paths now check before each brief write, as a
launch prompt is checked: on a host that can find the agent in front it must be there; on one that
cannot (Windows) a shell proven in front still refuses, and anything else writes as before.

A Grok worker start waited ~10 s more than main: its only rest signal is its bare name, which a
launch holds to quiet output, and Grok animates its logo for ten seconds after its composer glyph.
A worker start for an agent whose rest signal is its bare name and whose composer draws a marker
(Grok, DSH, mimo-code) now also answers on that marker, whichever comes first.
…an expired resend no longer blocks that text (#25149)

* fix(mobile-chat): a returned message is appended to the draft, and an expired resend id is spent

* test(mobile-chat): leave the idempotent append to the shared rule's own test

* docs(native-chat): say a whitespace-only draft counts as empty

* docs(mobile-chat): don't overclaim where returned text survives
#22294)

* feat(native-chat): answer /context in chat view for Claude

Over a terminal-backed chat, Claude's /context paints a grid only the hidden
terminal sees and records nothing in the transcript, so the chat showed
nothing. The chat host now answers it itself: the transcript decoder keeps
each assistant response's API usage and model, and the composer replies with
the same estimate the CLI statusline shows (input + cache tokens against the
model's window) instead of typing the command into the PTY. The command is
also listed in the curated Claude catalog so the slash menu offers it.

* fix(native-chat): only state a /context window the host can establish

The /context answer sized the window from the transcript's model id, which
never carries the [1m] suffix, so a 1M session read as 200k (e.g. 450k / 200k,
225%). The window now comes from the session's tracked model resolved through
the host CLI's own model listing (the resolvedModel field the list_models probe
already returned), and only a [1m] id that matches the model the transcript
last answered with is sized; anything else reports the used figure alone.

Also:
- Offer /context only in the desktop terminal-backed composer; the shared
  catalog is mobile's too, and mobile cannot answer it.
- Answer a typed /context even with images attached, as the picker does, and
  keep the attachments armed instead of sending them to the terminal.
- Report nothing until a response lands after a /compact or /clear sent from
  the chat, instead of the pre-compaction size.

* test(native-chat): pin resolvedModel through Claude model discovery

* fix(native-chat): say /context is unavailable when the host never reports usage

A host that predates usage decoding, or a scraped view, decodes Claude's
replies without a model or usage, so the chat promised an answer after the
next response that would never come. Once the agent has answered and no
answer names its model, say usage is not available for this session.

* feat(native-chat): answer /context for OMP instead of Claude

Claude and Codex answer /context themselves in the structured chat lane, so
the terminal-backed Claude answer, its [1m] window rule, and the resolved-model
plumbing through the model listing go away.

OMP's /context only paints a panel inside its TUI. The OMP decoder now keeps
the provider, model and usage of each reply (none for aborted or errored
replies, which OMP's own gauge skips) and turns compaction rows into the
existing compaction boundary. The OMP model listing keeps each model's
context window, and the chat answers /context from the last reply's prompt
size against the window of the provider/model that served it.

* feat(native-chat): show OpenClaude's own /context report in chat

OpenClaude writes its /context grid to the transcript as a
<local-command-stdout> row, which the chat hid as harness noise. The live
message preparation now turns the stdout row that answers an opted-in command
(/context for OpenClaude) into command output with the ANSI colors stripped,
and the notice row renders command output in monospace so the grid keeps its
columns. Replies to other local commands stay hidden, and Claude is not opted
in. OpenClaude's slash menu now lists /context; Claude's does not.

* test(native-chat): pin OpenClaude /context output through live message preparation

* test(native-chat): pin the OMP context window through model discovery

* test(native-chat): pin monospace rendering of command output

* test(native-chat): restore the notice row suite the command-output test replaced

The previous commit rewrote NativeChatNoticeRow.test.tsx wholesale, deleting
main's compaction, tone, plan, provider-notice and old-reader coverage. Restore
it and pin monospace command output through the message row instead.

* fix(mobile): keep OpenClaude /context off mobile, which cannot show its report

The shared slash catalog now lists /context for OpenClaude because the desktop
chat surfaces its transcript reply. Mobile's transcript fold does not, so the
command did nothing there. Mobile now offers the catalog minus commands answered
only by a surfaced reply, which returns its OpenClaude menu and send
classification to main's behavior.

* refactor(native-chat): drop the unread estimated flag from context usage

Left from the earlier design; the answer text states the estimate itself.

* fix(native-chat): keep /model replies hidden after an OpenClaude /context

Skill surfacing ran first and rewrote non-catalog envelopes such as /model into
plain user text, so command-output pairing no longer saw them. A later /model
reply then paired with the earlier /context envelope and appeared in the chat.
Pair outputs against the raw envelopes before skill surfacing.

* fix(native-chat): word the OMP /context answer for a compacted session and show it as an aside

After a compaction the agent has already answered, so the unknown-usage
line now promises the next response instead. The host answer is one
sentence, so it draws as the muted line it replaces rather than a
monospace grid. The provider/model selector now comes from one helper
shared by the OMP listing parser and the answer, and new tests drive
real OpenClaude and OMP transcript lines through the decoders.

Co-Authored-By: Claude <[email protected]>

* refactor(native-chat): pair command replies by row link and declare /context replies on the catalog

A `<local-command-stdout>` row now answers the command row its `parentUuid`
names, carried on decoded messages as the optional `parentId`, instead of the
newest command row at or before its timestamp. A reply with no loaded linked
row (older host, command outside the tail window) stays hidden.

How each agent's `/context` is answered is declared once, as `reply` on its
catalog row (`composer` for OMP, `transcript` for OpenClaude). The slash menu,
the composer's answer, the transcript surfacing and the mobile catalog all
derive from it, and both send paths share one intercept. Mobile no longer lists
OMP `/context`, which did nothing there.

* perf(native-chat): skip command-output surfacing for agents that declare no transcript reply

Every Claude-format row now carries its parent link, so once a session holds any
local-command reply (/model, /compact) the surfacing pass built a map of every
message on each live update and changed nothing for agents like Claude. Agents
whose catalog declares no transcript reply now return before the scan.

---------

Co-authored-by: Claude <[email protected]>
…d stop is joined instead of held (#24862)

* fix(native-chat): a child's root exit is reported even during its close, and bookkeeping after it never reads as unproven

- Both connections report the root process's exit once, with `expected` set when a close had
  begun. A close that came back unproven and whose root exits later is finished by the adapter,
  and its end reaches the host like any other.
- A Claude close whose resume-point write fails after the exit was proven, and a Codex close whose
  terminal row is refused, now end the session and report the failure, instead of keeping a dead
  child indexed as if its exit were unproven.
- A Codex close whose forced tree kill can't prove the descendants gone but saw the root exit
  reports the descendants and counts the root exit.
- Every child exit with an identity, expected or not, is forwarded to the host.

* fix(native-chat): the exit ends the child's record; an unfinished stop is the child's own close, which everyone joins

- The host keeps no stored "stop still owed" record any more. A stop begins the child's close
  (`child.close`), which lives on the child and ends with it. A second Stop, the idle reaper,
  quit, a send and an option/answer/goal/rewind all join that close instead of retrying a
  separate obligation.
- A caller waits on the close only as long as the step deadline; the close itself is never
  abandoned. A proof that lands after every caller stopped waiting reaches the host as the
  adapter's report of that exit, which ends the record through the same handler.
- Once the exit is proven, draining, settling, the lease release and the adapter's
  acknowledgement are each attempted and reported on failure; none keeps the child on record.
  A start, and the handle's close, write a release that failed from this host's proof of that
  exit, so a failed write never refuses a send.
- A start that meets a close still unverifiable is refused with `previousExitUnverifiable`, so the
  queued message is rejected with a send-again reason; nothing is held and nothing starts beside
  the old process.
- The idle sweep goes back to idle reaping only.
- Removes #24333's retry entry points, the wait row and its hold rule, the ask/failure cursors on
  the stored record, and the stop's own wake.

Tests replace the #24333 unproven-stop test: a send joining an unproven close and an in-flight
one, a late proof past the caller's bound, a root exiting after its close gave up, a proven exit
whose resume-point write and lease release both failed, an unverifiable close rejecting the send
and refusing an option change, a surviving descendant, quit and the idle reaper; and Codex's
unverifiable, late-exit and joined-close cases.

* fix(native-chat): a message refused because the old process's exit is unverifiable says so, and to send again

The start failure for a refusal with reason `previousExitUnverifiable` reads "Orca couldn't
confirm Claude's previous process ended. Send your message to try again." instead of "Claude
couldn't restart." The status-row kind and the refusal reason stay in the shared lists for rows
and hosts that still carry them; the catalogs keep one sentence for both.

* fix(native-chat): a close's verdict is the root's exit alone, and what follows it is logged

- A Claude close resolves as soon as the root's exit is proven: the session ends and its `ended`
  report goes out then. Saving the resume point runs afterwards and a failure is logged, so a slow
  or hung write never reads as an unproven exit or keeps a dead child on record.
- A root that exits after its close came back unproven finishes that close through the same path
  as any close, so the session's child work is published as ended (background tasks and subagents
  no longer stay shown running for a dead agent), and a failure there is logged.
- Codex logs a refused final row, and reports a root exit whose forced tree kill could not prove
  the rest of the tree gone the way Claude does, so the host logs it and blocks nothing.
- Both adapters take the host's logger for this bookkeeping.

* fix(native-chat): one handler ends every child's exit, and a join waits on the adapter's own close

- One exit handler (`structured-agent-session-child-exit`) ends a child's record for an exit
  expected or not. `expected` only changes what the chat is told: the stop's cause, its end at the
  stop's ask, the settlement id, and no crash outcome row. The lease release keeps the exit's
  evidence; the handoff guard, lifecycle barrier, sink release and adapter acknowledgement apply to
  both. A Claude journal-sink failure ends in the same step as its stop, as Orca's own fault.
- Joining a close is asking the adapter, whose close is memoized while it runs and bounded by its
  own kill escalation; the host keeps no attempt of its own and no 10 s caller bound. An ask after
  a close came back unproven runs the stop again.
- A close's end is stamped where its stop was asked for (a repeated ask moves it), so the closed
  chat and failed start checks order a message accepted meanwhile after it.
- A start refused because the old exit is unverifiable rejects what was queued in the same step.
- The end of a close the host asked for no longer waits on the cross-session recovery chain.
- The kill no longer waits for the stop event's write; the journal writes rows in order.

* fix(native-chat): an exit's lease release lands whatever the length of its reason

A crash's reason can carry kilobytes of the provider's stderr, and a lease whose death detail is
over 512 characters fails the store's own check. The exit handler cut it, but the release a start
or the chat handle's close re-derives did not, so after a crash whose own release failed every
message was refused as not resumable until restart. The record's builder now cuts the detail to
the record's bound, so no writer can hand it one too long.

* fix(claude): a proven close waits at most 2 s for the output it already wrote

Once the root's exit is proven, the close still waited for the SDK's output reader to end. Something
outside the process tree that holds the output open would keep that close, and every send, Stop
and quit joining it, waiting with no bound. The wait is now bounded; past it the close resolves as
proven and the open output is logged.

* fix(codex): an exit reported inside Orca's close keeps the reason Orca closed it for

The connection reports the app-server's exit inside the close that ends it, so that report ended
every Codex close and replaced the close's own reason (for example, a provider frame that could not
be recorded) with the connection's stderr text in the ended record and the lease's exit evidence.
The session now records Orca's close with its reason, and the exit it ends keeps that reason. The
test connection reports its exit inside close the way the real one does.

* fix(native-chat): quit stops delivery before it drains exit recovery

Every exit now wakes delivery, and teardown drained exit recovery before it stopped delivery, so an
exit settled in that window could start a fresh agent that teardown then killed. Teardown stops
delivery first; queued messages wait for the next launch.

* docs(native-chat): the unverifiable-exit refusal no longer names a caller's wait

The caller's bounded wait was removed; the comment describes the close as it is now.

* fix(native-chat): a stop whose kill did not take is logged, and the next ask kills again

When a close's kill leaves the agent's root running, the host now logs it. Tests pin what a later
ask does: each connection runs its whole stop again (Codex sends SIGKILL a second time), refuses
input meanwhile, and proves the exit once the kill takes.

* fix(native-chat): a start refused over the old process says Orca couldn't stop it

The host reaches an unverifiable verdict only after its own kill left the agent's root running, on
the machine that runs the agent, so the sentence now says that: "Orca couldn't stop {agent}'s
previous process." The refusal reason, failure kind and wire shapes are unchanged. The host test
also checks the failed kill is logged.

* docs(native-chat): an unverifiable close verdict is a root that survived the kill

The host's close runs where the agent runs, so lost contact never yields this verdict; the comment no longer says it does.

* fix(native-chat): a kill that did not take is reported once, by whoever met it

The log added at the close fired beside a Stop's own failure report for the same event. A stop
still reports it through its failure; a send or option change refused over it now logs it at the
refusal, the only place it is otherwise invisible.

* test(native-chat): a second Stop joins a close the first could not prove and retries its kill

* fix(native-chat): say a start refused beside an unstopped process plainly

The rejection now reads "Couldn't stop {{agent}} from before. Send your message again to try once more."
This kind has its own send-again step; every other failure keeps "Send your message to try again."
…tay in the activity view (#25376)

* fix(sidebar): stop workspace reveals from leaving the activity view

Reveals are skipped while the activity view is showing, and activation no
longer lifts workspace-list filters there. Only explicit requests (Go to
workspace, reveal-current-workspace, Cmd+J project row, agent send target,
Cmd+1-9) switch to the workspace list via showSidebarWorkspaceList.

* test(sidebar): keep test harnesses out of the sidebarBody writer census

* feat(activity): workspace-origin filters and a matching options trigger

Activity view gains its own persisted Hide automation-created, Hide CLI-created
and Hide other-client agents toggles, applied through the existing activity
scope filter so the selected-row exemption and identity-preserving return keep
working. The options trigger now uses the workspace view's SlidersHorizontal
icon and shared numeric badge, counting every active activity filter, and Add
project stays visible so no header button shifts between views.

* feat(activity): right-click menu on activity rows

Open, Mark as read/unread, Go to workspace (real workspaces only), Copy (agent
title, plus branch and path for real workspaces), and Clear from list for
finished threads, reusing the row's existing actions and clearActivityThread.

* fix(sidebar): leave the activity view only once activation commits

Go to workspace and Cmd+1-9 switched the sidebar before activating, so a
blocked folder activation still left the activity view. Activation now owns
the switch via showWorkspaceList, applied after its failure gates. The
separate showSidebarWorkspaceList action and the one-line sidebar-body-reveal
module go away: setSidebarBody is the single writer, and the census pins its
callers.

* fix(activity): close the row preview when its right-click menu opens

* fix(activity): keep the row preview closed while its right-click menu is open

* fix(ui): give right-click menus the same solid surface as dropdowns

* fix(activity): match the agent row menu to the workspace row menu

* fix(activity): offer the same copy items as the workspace row menu
@nwparker nwparker changed the title Stop automatic profile JSON snapshots and provide explicit downgrade Retire automatic profile JSON snapshots with safe recovery and downgrade Oct 5, 2026
@nwparker
nwparker merged commit d518d4a into main Oct 5, 2026
8 of 10 checks passed
@nwparker nwparker mentioned this pull request Oct 5, 2026
14 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.