Skip to content

fix(discovery): keep imported Codex copies out of project origins - #244

Merged
pacphi merged 15 commits into
mainfrom
fix/imported-rollout-origins
Sep 27, 2026
Merged

pacphi merged 15 commits into
mainfrom
fix/imported-rollout-origins

Conversation

@pacphi

@pacphi pacphi commented Sep 27, 2026

Copy link
Copy Markdown
Owner

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.

  • Discovery: an imported rollout no longer names a project, a Codex host or a session origin. Discovery counts the copies it sets aside in importedExcluded. The check is one shared marker (src/lib/codex-import-marker.mjs), used by the usage parser, discovery and usage session origins.
  • System: the Projects note says how many imported copies were set aside, without claiming a Claude Code transcript names every such folder.
  • Snapshot: the footprint snapshot schema moves from v7 to v8, so a snapshot that still holds the false origins is not shown. After upgrading, run Full scan (or ak system --deep) once. UPGRADING says so.
  • Docs: ADR-0050, ADR-0052 and ADR-0060 (§3 implemented for discovery; the ADR stays Proposed), the DDD docs, DASHBOARD, MAINTENANCE, TRANSCRIPTS, and the audit record with maintainer decisions 11 and 12.

Decisions recorded in the audit record:

  • 11: the 5 folders named only by imported copies leave the project count.
  • 12: later turns of real work inside imported copies (6 of 924) will be counted per turn in the usage-capture branch (Branch 8).

Verification

  • Node 26.4: 5,119 pass / 0 fail. Node 22.22.3: 5,118 pass / 0 fail. Seven .cjs suites pass. UI: 493/0 and 10/10.
  • Coverage: 92.98 / 82.31 / 92.36. tsc, eslint (0 errors), complexity ceiling, markdownlint, build-check, doc-citations and ga-surface-guard: all clean.
  • Real user state was fingerprinted before and after each full run and was unchanged, apart from the live statusline tee of the orchestrating session.
  • Read-only real-data pass: 32 folders had a Desktop origin only from imports, now 0. importedExcluded = 924, which matches the import ledger and the usage cache.

Refs #239 · ADR-0060 §3 · remediation program Branch 1

🤖 Generated with Claude Code

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.
@pacphi
pacphi merged commit 5f5ca17 into main Sep 27, 2026
16 checks passed
@pacphi
pacphi deleted the fix/imported-rollout-origins branch September 27, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant