Skip to content

Require an account when a session id is in several accounts - #28

Merged
lr00rl merged 3 commits into
mainfrom
feature/20261024_session-copy-selection
Oct 24, 2026
Merged

lr00rl merged 3 commits into
mainfrom
feature/20261024_session-copy-selection

Conversation

@lr00rl

@lr00rl lr00rl commented Oct 24, 2026

Copy link
Copy Markdown
Owner

Summary

show, log, export and view <id> used to open the most recently used copy when a session id was in several accounts, with only a note on stderr. They now list the copies with the same columns as ccli sessions and exit with status 1 until you name an account (-a <account> or <account>:<id>). Follow-up commands printed by show and log carry the account, so they cannot be ambiguous again.

  • Side files (a subagent transcript, a sidecar) in another account no longer count as a copy; only main transcripts do.
  • The choices printed on stderr are full account:id references in table order.
  • With --json, the choice is its own object: error: "ambiguous", ref, id, choose (a full reference per copy) and sessions (the rows).

Test plan

  • go test ./..., go vet ./...
  • Two-account fixtures: every read command refuses a bare id, lists both copies, and opens the one named by -a or account:id
  • A side file in another account does not cause a conflict
  • Real index: ccli show 1087b979 lists talcum and default with their costs

A session id can exist in several accounts with different histories and usage.
Show the existing sessions table when a read is ambiguous, then require an
explicit account before opening a copy. Keep follow-up commands qualified.

Constraint: Account copies have independent transcripts and costs
Rejected: Pick the most recently used copy | can hide another account's history
Confidence: high
Scope-risk: moderate
Tested: go test ./...; go vet ./...; real duplicate-id show and view commands
Side files in another account are not alternate main transcripts. Resolve a
bare id to its sole main copy, and list full references in the same order as
the candidate table when several main copies exist.

Constraint: Session ids may also appear in sidecar and subagent files
Rejected: Offer every account with any matching file | some have no main transcript
Confidence: high
Scope-risk: narrow
Tested: go test ./...; go vet ./...; real side-file and duplicate-id sessions
With --json, a reference that names a session in several accounts printed a
sessions page with exit status 1, so a script could only tell the choice
from a real answer by the status. It now prints an object with "error":
"ambiguous", the reference as given, the id it matched, a full reference per
copy in table order, and the candidate rows. The shape is new on this branch,
so nothing depended on the page form.

Tested: go test ./...; go vet ./...
@lr00rl
lr00rl merged commit 0127f93 into main Oct 24, 2026
2 checks passed
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