Skip to content

Single-writer protection for ACP-held OMP sessions (resume guards, AI Vault ownership) #83

Open

Description

@44madfire

Summary

An OMP session created by an ACP chat is an ordinary OMP session on disk. Make every Orca-initiated legacy writer refuse it while a chat holds it, and point AI Vault at the chat, so one conversation never has two writers.

Context

  • 44madfire/orca#20 reliability: one writer per live provider session; fail-closed process ownership. Split out of v2's Post-cutover migration: adopt existing legacy OMP sessions into ACP chat #69 because it gates cutover: new chats need it, adoption does not.

  • OMP has no open-time cross-process lock. It detects size-mismatched writes (packages/coding-agent/src/session/session-storage.ts:638 @53f253f) and folds foreign entries into side branches (packages/coding-agent/src/session/session-manager.ts:1127), so two writers fork the conversation.

  • Orca's resume guards exist at:

    • AI Vault resume (src/main/ipc/ai-vault-resume.ts:30, src/main/runtime/rpc/methods/ai-vault.ts:124 @76d1b7b)
    • Session-tab launch commands (src/main/runtime/rpc/methods/session-tabs.ts:54)
    • Terminal sends (src/main/runtime/rpc/methods/terminal/terminal-send-method.ts:41-46)

    All of them recognize only Claude/Codex resume argv and vault rows (src/main/ai-vault/structured-session-ownership.ts:96,135).

  • Refusal vocabulary already exists (agent_session_conflict / agent_session_ownership_unknown, src/main/native-chat/structured-agent-session-history-adoption.ts:102-111).

Scope

  • Extend resume-argv parsing to omp --resume <path|id> and omp -r (path or id; Windows and POSIX quoting).
  • Extend vault ownership projection to OMP sessions held by an ACP chat: rows open the owning chat instead of a terminal resume.
  • Refuse with the existing vocabulary. A live or unverifiable owner is never treated as gone (SSH-boundary verdicts).
  • Legacy OMP sessions not held by a chat: AI Vault and terminal resume behave exactly as today.

Non-goals

Depends on

Parity rows owned

  • P-VAUL-01.

Acceptance criteria

  • While an ACP chat holds an OMP session, AI Vault resume, session-tab launch commands and terminal sends that would resume it are refused with the existing conflict message.
  • AI Vault shows such sessions as owned by their chat and opens the chat.
  • Legacy OMP sessions resume from AI Vault exactly as today.
  • After the chat is closed and its child proven gone, terminal resume is allowed again.

Required tests

  • Argv matrix: omp --resume <abs path>, omp --resume <id>, omp -r, quoted Windows paths, a prefixed env assignment.
  • Chat live / chat closed / owner unverifiable (paired host unreachable).
  • Concurrent vault resume and chat reattach → one writer.
  • Legacy vault resume snapshot unchanged.

Base branch

acp-migration (44madfire/orca).

Metadata

Metadata

Assignees

No one assigned

    Labels

    acp-migrationOMP Native Chat ACP migrationphase-BPhase B parity completion

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions