Repository navigation
refactor(storage): consolidate external session source parsing #3625
Description
Activity
- addedenhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed
on Aug 23, 2026 Hi, I would like to take #3625.
I reviewed the current ForeignSession handoff and ExternalSession import paths. They independently perform source discovery, transcript selection, metadata extraction, bounded reading, and source-specific parsing, which has already caused their Codex and Claude behavior to diverge.
My proposed approach is:
- Base the work on the latest
main, while coordinating with feat(core,storage,cli): evidence pointers and staleness flags for foreign session handoff #1512 and fix(storage): import Codex item_completed messages #3520. - Introduce one package-private source catalog so both paths resolve the same source id, transcript candidate, title, cwd, and query policy.
- Keep one native parser per external source:
- Codex: preserve the
event_msgpresentation authority andresponse_itemtool authority, including the v0.149item_completedcases from fix(storage): import Codex item_completed messages #3520. - Claude: share lineage resolution for rewinds, compaction boundaries, duplicate records, and malformed records.
- Codex: preserve the
- Keep the two projections explicit and separate:
- safe handoff with redaction, hostile-data envelope, tool-output exclusion, staleness checks, and bounded reads;
- full Maka Session import with typed history, tool call/result pairing,
externalOrigin, atomic persistence, and replay.
- Add shared fixtures and parity tests, then remove the duplicated production code and tests.
I will not introduce a generic
ExternalMessagemodel or derive the handoff from importedStoredMessage[], since that would weaken the handoff trust boundary.One design point I would like to confirm before implementation is how the shared Claude parser should handle lineage when the handoff is restricted to a bounded tail window. If this direction looks reasonable, I can start with the catalog/parity-test seam and submit the work incrementally.
- Base the work on the latest
Assigned! btw the Codex session import failed because codex changed their session structure. Make sure to test the Codex session import route! @CxHsin
- added a commit that references this issue
on Aug 24, 2026 - removedenhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed
on Aug 29, 2026
Problem
Maka has two user-facing paths over the same Codex and Claude session stores:
ForeignSessioncreates a filtered, untrusted handoff for the current task.ExternalSessionimports a full typed transcript as a new Maka Session.Their outputs should remain different, but each path currently implements its own discovery, source identity, title and cwd selection, bounded reading, and source-specific parsing. The implementations have already drifted: Codex paths use different presentation records, while Claude handoff does not share the lineage resolution used by full import.
Desired outcome
Use one package-private source catalog and native parser per external source, followed by two explicit projections: safe handoff and full Session import.
The consolidation should:
externalOrigin, atomic persistence, and replay;ExternalMessagemodel.Coordinate with #1512 and #3520. Preserve #1512's staleness and hostile-path requirements, and reuse #3520's v0.149 fixture and record-selection fix.
Alternatives or workarounds
Keeping the parsers independent preserves the current duplication and allows source interpretation to drift further. Deriving safe handoff from imported
StoredMessage[]would also weaken the explicit trust boundary, so the two projections should remain separate after shared source resolution.AI-assisted analysis: Codex agents traced both consumers, their security boundaries, related pull requests, and checked-in fixtures. A human contributor must review the final design and implementation.