Repository navigation
Post-cutover migration: adopt existing legacy OMP sessions into ACP chat #69
Copy link
Copy link
Open
Labels
acp-migrationOMP Native Chat ACP migrationOMP Native Chat ACP migrationphase-CPhase C extensionsPhase C extensions
Description
Summary
Post-cutover migration feature: let a user move an existing legacy OMP conversation into an ACP chat under the same OMP session id. History is imported with the legacy OMP decoder. Unadoptable sessions stay on the legacy path with a named reason.
Context
44madfire/orca#20session identity: preserve the conversation, load the same session, never fabricate a new one, fall back explicitly. v3 rule: "v1 does not change transport ownership for an already-existing legacy OMP session. Existing sessions stay legacy; new supported sessions use ACP. Legacy→ACP adoption is a separate migration feature." So this is not on the cutover path; legacy sessions are not regressed meanwhile.session/loadalone renders a blank chat. Frames inside the load window only update usage (src/main/acp/acp-timeline-translator.ts:161-164,src/main/acp/acp-context-usage.ts:35@76d1b7b).- Existing pattern: Claude/Codex adoption imports the provider transcript into a fresh journal epoch (
src/main/native-chat/structured-agent-session-history-adoption.ts:124,src/main/native-chat/agent-session-wire/structured-agent-session-adopted-import.ts:16@76d1b7b). The importer already maps OMP (src/main/native-chat/agent-session-journal/journal-legacy-import.ts:152), refuses sources over 16 MiB (:50) and rebuilds epochs (:8-11). Non-Claude/Codex adoption is blocked atsrc/main/runtime/orca-runtime-get-structured-agent-session-create-support.ts:219-221. - OMP rejects a load/resume whose cwd differs from the recorded cwd, case-sensitively on Windows (
packages/coding-agent/src/session/agent-session.ts:11307-11308@53f253f). It answers unknown ids with-32603(acp-agent.ts:1249,1264). It sends no usage after load/resume. All three are fixed by ACP reopen of adopted sessions: Windows cwd normalization, resource-not-found, usage after load/resume oh-my-pi#12. - Store identity (
docs/plans/omp-acp-migration/v2/risk-findings/account-home.md): OMP's store follows profile/agent-dir/config-root/session-dir variables and a launch-cwd.env.OMP_CODING_AGENT_DIRis an Orca-only read override (src/main/ai-vault/omp-session-root.ts:46-47).PI_CODING_AGENT_SESSION_DIRwrites a flat layout thatresolveOmpSessionFile(src/main/native-chat/session-file-resolver.ts:315) does not walk.
Scope
- Provider-neutral: generalize adoption from
'claude' | 'codex'to registered agents with a transcript importer; lift the create-support guard for them. - OMP adoption:
- Lookup order: the hook-reported exact
transcriptPathfirst, then the id scan. The resolver learns the flat session-dir layout. - Import into a fresh epoch. Record an
adoptedhandle with the OMP session id. - Acquire with the recorded cwd when it lies inside the workspace root; otherwise refuse with
custom-start-directory. - Ring on reopen comes from ACP reopen of adopted sessions: Windows cwd normalization, resource-not-found, usage after load/resume oh-my-pi#12's post-load/resume
usage_update.
- Lookup order: the hook-reported exact
- Entry points: an explicit "Open in ACP chat" on legacy OMP chats and AI Vault rows. Never automatic.
- Adoption refuses conversations held by another chat or by a live/unverifiable terminal agent (Single-writer protection for ACP-held OMP sessions (resume guards, AI Vault ownership) #83 vocabulary).
- Unadoptable cases (missing transcript, over 16 MiB, cwd outside root, load/resume failure) keep the legacy path with a named reason. Never
session/newfor an adoption.
Non-goals
- Not required for cutover.
- No Terminal↔ACP handoff (Post-cutover migration: persisted ACP↔Terminal handoff for OMP chats #84).
- No replay-derived history.
- No change to OMP's storage format.
Depends on
- New OMP chats default to ACP when the provider satisfies orca-native-chat-v1 #74
- ACP reopen of adopted sessions: Windows cwd normalization, resource-not-found, usage after load/resume oh-my-pi#12
Parity rows owned
- P-DISC-01, P-DISC-02 (post-cutover; not regressed meanwhile because legacy sessions stay legacy).
Acceptance criteria
- An adopted conversation shows the same rows, in the same order, as legacy chat shows for that transcript, and the next prompt appends to the same OMP session file.
- The context ring shows the last usage immediately after adoption.
- No adoption path ever creates a new OMP session. Every refusal names its reason and leaves the legacy chat usable.
- Adoption works for a named profile, a relocated agent dir, a relocated config root and a session-dir override. It also works on Windows when the drive-letter case differs, and in folder workspaces.
- A user with
OMP_CODING_AGENT_DIRpointing elsewhere still adopts from their real store.
Required tests
- Fixture transcripts (compaction, aborted turn, bash/python cells, custom display true/false, fileMention, abandoned branch): imported rows equal the legacy decode.
- Concurrent adoption of one conversation → one owner, one refusal. Adopting while a terminal PTY is live → refused; after proven exit → succeeds; an unverifiable owner is never treated as exited.
- Recorded cwd inside the root but ≠ the workspace path → used. Outside the root → refused. Over 16 MiB → refused with a reason.
-32002vs-32603classification on load failure (with ACP reopen of adopted sessions: Windows cwd normalization, resource-not-found, usage after load/resume oh-my-pi#12). Flat session-dir layout lookup.
Base branch
acp-migration (44madfire/orca).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
acp-migrationOMP Native Chat ACP migrationOMP Native Chat ACP migrationphase-CPhase C extensionsPhase C extensions
Activity
[-]Adopt legacy OMP sessions; replay history exactly once[/-][+]Adopt existing OMP conversations into ACP chat, persisted Terminal↔Chat handoff, single-writer guards[/+][-]Adopt existing OMP conversations into ACP chat, persisted Terminal↔Chat handoff, single-writer guards[/-][+]Post-cutover migration: adopt existing legacy OMP sessions into ACP chat[/+]