Skip to content

External session import: Codex project-scope discovery can truncate at the 2000-file scan ceiling #720

Description

@arul28

Context

Shipped in PR #712 (external CLI session import — docs/features/terminals-and-sessions/external-session-import.md).

For project-scoped discovery, most providers filter to the current project cheaply via the path-encoded cwd (Claude/Cursor/Droid slug dirs; OpenCode is already cwd-scoped). Codex rollout files are date-organized and carry cwd only in each file's session_meta first line, so scope filtering requires reading that line per candidate. To bound the work, Codex project-scope discovery scans up to a 2000-file ceiling and, if it may have truncated, logs external_sessions.codex_project_scope_scan_truncated.

The gap

A user with more than ~2000 Codex sessions newer than their oldest in-project ones (across all repos) could still have older in-project Codex sessions fall outside the scan window and not appear under "This project only." The ceiling makes this rare and it fails safe (logs, never wrong data), but it is a real upper bound.

Options

  • Maintain a small cwd index for Codex rollouts (like Claude/Codex session_index.jsonl already does for titles) so scope filtering is O(in-scope) instead of scanning by recency.
  • Or page the scan (raise the ceiling adaptively) until enough in-project rows survive, with a hard wall-clock budget.
  • Or surface a "showing recent sessions — older ones may be hidden" hint in the import browser when the truncation log fires.

Repro / signal

Watch for external_sessions.codex_project_scope_scan_truncated in logs when a heavy Codex user opens the import browser with "This project only".

Pointers

  • apps/desktop/src/main/services/externalSessions/discoverCodex.ts (session_meta cwd read + ceiling)
  • apps/desktop/src/main/services/externalSessions/externalSessionsService.ts (project scope orchestration)

Priority: low — robustness ceiling for power users, not a correctness bug.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions