fix(discovery): keep imported Codex copies out of project origins - #244
Merged
Merged
Conversation
Rollouts the ChatGPT desktop app imported from Claude Code transcripts (turn ids external-import-turn-N) no longer give a folder a Codex host, a Desktop origin or a project row. Discovery counts them as importedExcluded, and the count reaches the Projects section. The one marker constant moves to a leaf module used by the usage parser, usage origin and discovery, so no import cycle is added. The payload counts move into a small helper so resolveProjectCatalog stays under the complexity warning. Failing first: tests/kit/project-sources-imports.test.mjs failed with ERR_MODULE_NOT_FOUND for src/lib/codex-import-marker.mjs; passing after: 9/9, and 204/204 across the focused footprint, census and usage files.
…t aside Failing first: the new system-summary test failed on the missing sentence (the note ended at "60 are git repos."); passing after: 9/9 in tests/kit/system-summary.test.mjs. An old snapshot without importedExcluded, or a zero, renders exactly as before.
ADR-0052 and ADR-0060 get Updated lines, and ADR-0060's implementation status now says that section 3 is implemented for discovery. The DDD machine-footprint, DASHBOARD, MAINTENANCE and TRANSCRIPTS docs describe the exclusion and the importedExcluded count as current state. The marker move shifted usage-parsers.mjs lines, so three file:line citations are re-pointed at their subjects: USAGE-SCORECARD-METRICS.md (1185 to 1174, and 1008-1013 to 1021-1025 in both places) and TRANSCRIPTS.md (758-763 to 770-773). Before this commit tests/kit/doc-citations.test.mjs failed 2 of 8 on that drift. After it, doc-citations and ga-surface-guard pass 8/8 and markdownlint-cli2 reports 0 issues.
…opy's folder A folder that only an imported Codex copy names has no Claude Code transcript, and discovery drops it from everSeen. The KPI note and the DDD doc now say the copies are not counted and the original Claude Code session is counted where its transcript still exists; the note agrees in number for one copy.
…e transcript usageSessionOrigin is also called with 'claude'. A Claude head whose line carries payload.turn_id external-import-turn-1 keeps its declared claude-desktop origin; removing the host === 'codex' guard now fails this test.
A footprint snapshot written before discovery set imported Codex copies aside keeps their false Codex host and Desktop origin on project rows, and the Maintenance session-origin facet reads those rows until a manual deep scan. The schema advances to v8 so a v7 snapshot reads as unmeasured instead of being shown under the new rule; UPGRADING says to run Full scan.
…R-0050) ADR-0050 mapped the Codex Desktop originator to the Desktop origin without exception; discovery now skips imported copies, so the rule says so.
The status, the ADR index blurb and the glossary header still read as if nothing were implemented. The acceptance decision stays with the maintainer, so the status names the implemented part without saying Accepted. The consequence now gives the re-measured 32 folders.
…R-0060) The Intelligence census line, the System Projects liner and the ak system text output show the reduced project counts without saying why.
The Branch 1 plan cited the Intelligence census for the Maintenance Session origin facet; the facet reads footprint snapshot rows, so it is correct only after a Full scan.
The Maintenance and Project Intelligence models still said every exact Desktop declaration adds an origin membership or picker suffix.
Six of 924 imported rollouts hold a later turn with real token usage that whole-rollout exclusion drops. ADR-0052 records it as not done and ADR-0060 lists the counting question for acceptance.
The audit still stated the 23-folder Desktop-origin problem as current and listed the discovery exclusion as follow-on work. It now has a Branch 1 entry with the re-measured 924 imports and 32 folders, and open items for the Full scan, the three views without the count and the six rollouts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When the ChatGPT desktop app imports a Claude Code transcript, it writes a Codex rollout whose turns are marked
external-import-turn-*. Usage already ignored these copies (ADR-0052), but project discovery did not. Folders therefore showed a Codex host and a Desktop origin they never had. On the reference machine that was 32 folders, from 924 imported copies.importedExcluded. The check is one shared marker (src/lib/codex-import-marker.mjs), used by the usage parser, discovery and usage session origins.ak system --deep) once. UPGRADING says so.Decisions recorded in the audit record:
Verification
.cjssuites pass. UI: 493/0 and 10/10.importedExcluded= 924, which matches the import ledger and the usage cache.Refs #239 · ADR-0060 §3 · remediation program Branch 1
🤖 Generated with Claude Code