feat(import): show imported sessions in entire session list#1699
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: 01KX49J5WC1AG5KBYG7D9SZ8G6
Kind-gated (KindImported), never sets BaseCommit (no HEAD pin), uses real transcript timestamps — keeps a future commit-SHA link additive. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: 01KX49MZY55PJYNTEPSMG6VF9G
…cleanup Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: 01KX49T0BNT7NAW9TJXFE7DSYB
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: 01KX49VPTETHKDW2GD7PGCMMKY
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: 01KX49WZ0AZJ8SXK6ES8YVQ7XZ
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: 01KX4A7FWMRWXSXX2D10WTVEYH
…y-run) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: 01KX4AC6WT3Q13C5AZW284CR85
entire session list (Track A)entire session list
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes sessions imported via entire import visible in entire session list by writing a local session.State for each imported transcript and ensuring imported states aren’t removed by existing staleness/orphan-cleanup paths.
Changes:
- Write
session.Stateentries for imported transcripts (Kind: imported,Phase: ended) so they appear in session listing. - Exempt imported sessions from staleness deletion and from orphan cleanup/cleaner discovery.
- Exclude imported sessions from the resume picker (imports remain read-only).
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| cmd/entire/cli/strategy/manual_commit_session.go | Keeps imported session states during shadow-branch orphan cleanup. |
| cmd/entire/cli/strategy/manual_commit_session_test.go | Adds regression test ensuring imported states are not purged by listing cleanup. |
| cmd/entire/cli/strategy/cleanup.go | Prevents imported sessions from being offered as orphaned cleanup items. |
| cmd/entire/cli/strategy/cleanup_imported_test.go | Adds test confirming imported sessions are skipped by orphan cleanup listing. |
| cmd/entire/cli/session/state.go | Exempts imported sessions from IsStale() auto-purge behavior. |
| cmd/entire/cli/session/state_test.go | Tests IsStale() behavior for imported vs non-imported sessions. |
| cmd/entire/cli/resume_picker.go | Filters imported sessions out of the resumable-session picker. |
| cmd/entire/cli/resume_picker_test.go | Tests that imported sessions are excluded from resumable sessions. |
| cmd/entire/cli/agentimport/agentimport.go | Writes imported session.State best-effort after importing checkpoints; adds token aggregation + state writer. |
| cmd/entire/cli/agentimport/session_state_test.go | Adds unit tests for imported session state creation and Run wiring (including --dry-run). |
Imported sessions are read-only (not resumable/rewindable). Label them so users don't mistake unsupported writes for breakage: - session list card shows "imported (read-only)" - session info text adds a read-only note; --json/list --json expose kind + read_only - resume picker explains when the only sessions present are imports Rewind already refuses imported checkpoints (refuseIfImportedCheckpoint). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: 01KX4B7QPKJ5NFBCE8C0XMW0QM
Trail 813 finding: LastPrompt is documented as the most recent user prompt and rendered as such for every session kind; imported sessions were showing the opening prompt instead. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: 01KX4C5TK0RKT5CZAVBY9KC1DV
Addresses the PR review point that imported sessions stored an un-collapsed, un-truncated prompt in the LastPrompt display field (bloating state JSON and diverging from every other session kind). The full prompt remains in the transcript, which is unchanged and still stored complete per checkpoint. Moves the shared formatter to session.TruncatePromptForStorage (colocated with State.LastPrompt) so imports and live sessions format it identically, avoiding an agentimport->strategy dependency. Simplifies the import session-state tests with shared helpers and readable session IDs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: 01KX4D9VZ10V46ER1P01XHNS0V
- Merge the two strategy cleanup tests into one TestImportedSessions_SurviveCleanup with a shared saveImportedState helper. - Merge the list/info read-only tests into one TestImportedSession_MarkedReadOnly with a run helper. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: 01KX4DTCMV8EMWKYCKMBASNVBA
- Add Kind.IsImported() alongside IsReview/IsInvestigate and route all imported special-cases (staleness, orphan cleanup, resume filter, list/info labels, JSON field) through it, killing the scattered string-literal checks. - Add types.AddTokenUsage (canonical, nil-safe, recursive) and use it in the importer instead of a hand-rolled fold. - Drop the single-use pluralizeImportedSessions helper and a redundant local. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: 01KX4F2HAMHPF9FYCTD17VN18R
pfleidi
approved these changes
Jul 9, 2026
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.
https://entire.io/gh/entireio/cli/trails/813
What
Makes sessions brought in by
entire importappear inentire session list. Todayimportwrites only read-only, commit-less checkpoints, socheckpoint listshows imported work butsession listreturns "No sessions." — the gap behind #1697 (and the read-only-import request in #1336).Now each imported session also gets a local
session.State, taggedKind: imported, and is clearly marked read-only wherever it surfaces.How
entire importwrites onesession.Stateper imported session (agentimport.writeSessionState): reuses the transcriptSessionID, aggregates real transcript timestamps + tokens, setsPhase: ended.State.IsStale()exemptsKindImported(historical timestamps would otherwise auto-purge imports on the firstsession list).KindImportedso a commit-less, shadow-branch-less imported state isn't deleted:listAllSessionStatesorphan cleanup andListOrphanedSessionStates(entire clean).Read-only UX (so unsupported writes don't look like breakage)
Imported sessions are read-only — not resumable or rewindable. This is now surfaced instead of failing silently or cryptically:
session listcard showsimported (read-only)session infotext adds a read-only note;session info --jsonandsession list --jsonexposekind+read_onlyrefuseIfImportedCheckpoint)Forward-compat
Imported checkpoints are still local-only and not yet linked to commits or shown in the web UI. This PR is deliberately constrained so that a future change which links imports to commit SHAs (and pushes them for web-UI visibility) is purely additive:
SessionIDas the join keyKind, never on commit-presenceBaseCommit(no HEAD pin, unlikeentire attach)Kindexemption, not faked recency)entire/imports/v1ref and push semantics — this PR writes only local.git/entire-sessions/*.jsonOut of scope (intentionally)
Pushing imports / web-UI visibility, commit-SHA capture from transcripts (no importer parses one today),
entire attachbehavior, making imports rewindable.Tests
IsStaleimported exemption (+ control)writeSessionState: field mapping, no-clobber of a live session, 30-day-old import survivesstrategy.ListSessionStatesRunwiring: writes state on real import, skips on--dry-runlistAllSessionStateskeeps imported;ListOrphanedSessionStatesskips importedFull suite green (
mise run lint+mise run test).Refs #1697, #1336
🤖 Generated with Claude Code