Skip to content

feat(import): warn when importing agent history while logged out - #1774

Merged
karthik-rameshkumar merged 4 commits into
mainfrom
fix/1773-warn-logged-out-import
Jul 17, 2026
Merged

feat(import): warn when importing agent history while logged out#1774
karthik-rameshkumar merged 4 commits into
mainfrom
fix/1773-warn-logged-out-import

Conversation

@karthik-rameshkumar

@karthik-rameshkumar karthik-rameshkumar commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

https://entire.io/gh/entireio/cli/trails/873

Summary

Part of #1773 — this is fix 1 (the UX guard). The sync-trigger for already-imported, commit-less checkpoints is the larger design item and stays tracked on that issue, so this PR does not close it.

Importing agent history (via entire import or the entire enable offer) writes read-only checkpoints to the local entire/checkpoints/v1 store and never syncs on its own — sync happens later via the git pre-push hook, only once logged in. So an import run while logged out succeeds locally but silently never reaches the dashboard, and re-importing after login is a no-op (idempotent on local existence). Users hit an empty dashboard with no explanation.

Change

After a logged-out import that wrote local history, print a notice that it's local-only and to log in before importing so it syncs:

Note: you're not logged in, so this history was imported locally only and won't appear in your Entire dashboard.
Log in with 'entire login' before importing to have your history synced.
  • No-op when logged in, or when nothing was imported (dry runs write nothing, so they're skipped too).
  • Login detection is local-onlyENTIRE_TOKEN or a current stored context via auth.Contexts(); no network call on the import path.
  • The existing Imported N turn(s) line is unchanged (so integration tests and Vogon prompt parsing are unaffected).

Files

  • cmd/entire/cli/import_sync_notice.go — new: importLoggedIn seam + warnIfImportNotSynced.
  • cmd/entire/cli/import_cmd.go, cmd/entire/cli/setup_import.go — call the notice after import.
  • cmd/entire/cli/import_sync_notice_test.go — unit test (logged-out+imported warns; logged-in / nothing-imported don't).

Verification

  • mise run fmt clean, mise run lint → 0 issues
  • go test ./cmd/entire/cli/ (unit) ✓
  • go test -tags integration ./cmd/entire/cli/integration_test/ -run 'Import|Enable'

🤖 Generated with Claude Code

Importing (via `entire import` or the `entire enable` offer) writes read-only
checkpoints to the local entire/checkpoints/v1 store and never syncs on its own
— sync happens later via the git pre-push hook, only once logged in. So an
import run while logged out succeeds locally but silently never reaches the
dashboard, and re-importing after login is a no-op (idempotent on local
existence).

Surface this: after a logged-out import that wrote local history, print a notice
that it's local-only and to log in before importing so it syncs. No-op when
logged in or when nothing was imported. Login detection is local-only (ENTIRE_TOKEN
or a current stored context) — no network on the import path. The existing
"Imported N turn(s)" line is unchanged.

This is fix #1 (the UX guard) for #1773; the sync-trigger for already-imported,
commit-less checkpoints is tracked separately there.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 16, 2026 11:05
@karthik-rameshkumar
karthik-rameshkumar requested a review from a team as a code owner July 16, 2026 11:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a UX guard to the import flow so users who import agent history while logged out are explicitly told that the history was imported locally only and will not sync to the Entire dashboard until they log in (addressing the “empty dashboard after import” confusion described in #1773).

Changes:

  • Introduces a small “logged-in” detection seam and a post-import sync notice helper.
  • Emits the notice after entire import (non-dry-run) and after the entire enable import offer flow, but only when something was actually imported/skipped locally and the user is not logged in.
  • Adds unit test coverage for the notice behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
cmd/entire/cli/setup_import.go Tracks whether any local history was imported/skipped during enable-time imports and emits the “not synced” notice once after the batch.
cmd/entire/cli/import_sync_notice.go New helper to detect local login state and print a sync notice when importing while logged out.
cmd/entire/cli/import_sync_notice_test.go Unit tests for notice emission logic (logged out + imported warns; logged in / nothing imported does not).
cmd/entire/cli/import_cmd.go Emits the “not synced” notice after a real (non-dry-run) import when local history was imported/skipped and user is not logged in.

Comment thread cmd/entire/cli/import_sync_notice.go
…n check

Addresses Copilot's review on #1774: a contexts.json entry can exist without a
usable credential (partially-removed context, missing keychain token), which
made importLoggedIn suppress the sync notice even though the import can't sync.
Now the current context must also yield a stored token (local read via
auth.LoginTokenForContext — no network).

This stays a presence check, not a liveness check: LoginTokenForContext returns
a present-but-expired token without error, and verifying usability needs a
network refresh we deliberately avoid on the import path. That narrow residual
false-negative (expired token) is accepted to keep the check local and
prompt-free; the common broken case is now handled. Adds a test for the
context-present-but-token-missing case.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
gtrrz-victor
gtrrz-victor previously approved these changes Jul 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread cmd/entire/cli/import_sync_notice.go

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread cmd/entire/cli/import_cmd.go
Comment thread cmd/entire/cli/setup_import.go
Comment thread cmd/entire/cli/import_sync_notice.go
@karthik-rameshkumar
karthik-rameshkumar force-pushed the fix/1773-warn-logged-out-import branch from 72ce3f9 to d76186d Compare July 16, 2026 12:55
@karthik-rameshkumar

Copy link
Copy Markdown
Contributor Author

@gtrrz-victor I reset this branch back to fbf2abf2f, the state you approved, and re-merged latest main on top.

The three "Potential fix for pull request finding" commits from the Copilot review were going in circles, so I dropped them (after going on a journey of discovery with them) . The import files (import_cmd.go, import_sync_notice.go, setup_import.go) are now byte-identical to what you already reviewed; the only new content is the main merge to keep the branch current.

Mind re-approving when you get a chance? (Force-push likely dismissed the prior approval, but the content is unchanged from your review.

@karthik-rameshkumar
karthik-rameshkumar merged commit 6e06e26 into main Jul 17, 2026
10 checks passed
@karthik-rameshkumar
karthik-rameshkumar deleted the fix/1773-warn-logged-out-import branch July 17, 2026 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants