Repository navigation
Single-writer protection for ACP-held OMP sessions (resume guards, AI Vault ownership) #83
Description
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#20reliability: 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). - AI Vault resume (
-
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>andomp -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
- No adoption (Post-cutover migration: adopt existing legacy OMP sessions into ACP chat #69).
- No handoff (Post-cutover migration: persisted ACP↔Terminal handoff for OMP chats #84).
- No control over a person typing
omp --resumeinto a plain shell (D1).
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).
Activity