{"record":{"id":"d55924517acd05a1","repo":"can1357/oh-my-pi","slug":"from-source-requires-session-persistence","errorCode":null,"errorMessage":"--from-${source} requires session persistence","messagePattern":"--from-(.+?) requires session persistence","errorType":"exception","errorClass":"SessionResolutionError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/main.ts","lineNumber":678,"sourceCode":"export class SessionResolutionError extends Error {\n\treadonly hint?: string;\n\tconstructor(message: string, hint?: string) {\n\t\tsuper(message);\n\t\tthis.name = \"SessionResolutionError\";\n\t\tthis.hint = hint;\n\t}\n}\n\nfunction resolveForeignSessionSource(\n\tparsed: Pick<Args, \"continue\" | \"fork\" | \"fromClaude\" | \"fromCodex\" | \"noSession\" | \"resume\">,\n): ForeignSessionSource | undefined {\n\tif (parsed.fromClaude && parsed.fromCodex) {\n\t\tthrow new SessionResolutionError(\"--from-claude and --from-codex cannot be used together\");\n\t}\n\tconst source = parsed.fromClaude ? \"claude\" : parsed.fromCodex ? \"codex\" : undefined;\n\tif (!source) return undefined;\n\tif (parsed.noSession) {\n\t\tthrow new SessionResolutionError(`--from-${source} requires session persistence`);\n\t}\n\tif (parsed.continue || parsed.resume || parsed.fork) {\n\t\tthrow new SessionResolutionError(`--from-${source} cannot be combined with --continue, --resume, or --fork`);\n\t}\n\treturn source;\n}\n\nfunction isForeignSessionImport(parsed: Pick<Args, \"fromClaude\" | \"fromCodex\">): boolean {\n\treturn parsed.fromClaude === true || parsed.fromCodex === true;\n}\n\ntype MissingCwdMoveResult =\n\t| { status: \"not-needed\" }\n\t| { status: \"declined\" }\n\t| { status: \"moved\"; manager: SessionManager };\n\nasync function moveMissingCwdSessionIfNeeded(\n\tsessionArg: string,","sourceCodeStart":660,"sourceCodeEnd":696,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/main.ts#L660-L696","documentation":"Foreign session imports (--from-claude / --from-codex) create a session in the current project, which requires session persistence to be enabled. Passing --no-session alongside either flag throws this SessionResolutionError, since there would be nowhere to write the imported session.","triggerScenarios":"Running e.g. `omp --from-claude --no-session` — resolveForeignSessionSource sees source set and parsed.noSession true.","commonSituations":"Habitual --no-session users (one-off throwaway runs) trying a foreign import; scripts that always append --no-session for CI runs.","solutions":["Remove --no-session from the command.","If you truly need no persistence, browse the foreign tool's session files directly instead of importing (e.g. Claude's projects directory)."],"exampleFix":"// before\nomp --from-codex --no-session\n// after\nomp --from-codex","handlingStrategy":"validation","validationCode":"if ((process.argv.includes(\"--from-claude\") || process.argv.includes(\"--from-codex\")) && process.argv.includes(\"--no-session\"))\n  throw new Error(\"--from-* imports need session persistence; drop --no-session\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never blanket-append --no-session in wrapper scripts that also support imports.","Treat import flags as persistence-requiring features.","Document in team runbooks that imports always create local sessions."],"tags":["cli","flag-conflict","session-persistence"],"backgroundTag":"flag-requires-session-persistence","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}