GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(core): attribute V1 global sessions during import by rekram1-node · Pull Request #56322 · anomalyco/opencode

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Oct 17, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Issue for this PR

Fixes #49827 for future V1→V2 imports only.

Related: #50551, #50800, #50999, #51176, #52919, #53450, #56030, #56312.

Earlier related reports: #50521, #51283, #52844, #53709, #54521, #54640, #54679, #54774, #54815, #55069, #55081, #55142, #55253, #55275, #55381, #55596, #55633, #55663, #55671.

Type of change

  • Bug fix

What does this PR do?

V1 put non-git sessions under global; V2 gives those directories their own projects. The importer now discovers the V2 owner of each legacy global/local directory and writes both its project ID and relative path ('' at the root).

Only newly copied V1 global/local rows are reassigned, including V1 sessions whose project row is missing. Discovery is cached per directory, writes nothing, and does not trigger runtime session adoption. Each missing project is inserted once, in the same transaction as its first session, with its recency taken from that V1 session instead of the import time. Existing destination ownership/path, project metadata, and original session timestamps are preserved. Empty, relative, missing, inaccessible, and non-directory paths retain the existing fallback. Explicit workspaces are unchanged.

Each directory lookup gets 5 seconds. A lookup that times out or crashes keeps the session under global, and after the first timeout (say a dead network mount) the rest of the run skips lookups, so the migration can't get stuck on the filesystem.

Completed imports are not rerun or repaired. This only changes imports that have not completed, not the previous-V2 database importer.

How did you verify your code works?

  • bun run check passes.
  • New regression test covering plain and nested non-git directories, a subdirectory of a Git repo, a missing directory, an orphaned session, and an already-imported session; it asserts the imported owner matches runtime Project.resolve and fails against the current importer.
  • v1-migration and project suites pass with --rerun-each 5.

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Related: #51144, #49412

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
opencode-agent[bot]
opencode-agent Bot reviewed Oct 17, 2026
View reviewed changes

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I recommend merging. I reproduced the bug on the base, and with this change V1 global sessions in non-git directories are imported under the same project and path the V2 session picker filters on.

How I checked: a temporary migration test with V1 sessions in a real directory, a nested subdirectory and a missing path.

  • Base: all three stayed on global with path = NULL.
  • This PR: the two real directories each got their own project with path = ''. The missing path kept the global fallback.

v1-migration tests, project tests, server tests and the core/server typechecks all pass.

Reusing Project.resolve with persist: false gives the migration the same project ID the app computes for that directory, without the adoption side effects.

Public API: unchanged. ResolveOptions and the optional persist argument on Project.resolve are internal to core.

One request: the PR has no test for the new behaviour, since the integration cases in the description were temporary. Please add one small case to v1-migration.test.ts: a global session in a real temp directory imports with that directory's project ID and path = '', and a missing directory keeps the global fallback. That would keep this from silently regressing.

Related: #51144, #49412

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rekram1-node
rekram1-node force-pushed the global-session-recovery branch from 7fbee42 to 328dd74 Compare October 17, 2026 19:32
@opencode-agent opencode-agent Bot mentioned this pull request Oct 18, 2026
Migrated non-git sessions stay under project_id 'global', so the V2 TUI shows 0 sessions while the desktop app lists them #56760
Closed
@kiwols59 kiwols59 mentioned this pull request Oct 21, 2026
migrate-v1: non-git sessions in "global" project hidden after V1→V2 upgrade #49827
Open
@opencode-agent opencode-agent Bot mentioned this pull request Oct 21, 2026
sessions: pre-project-row sessions stranded in global project are hidden from session lists #57629
Closed
@rekram1-node
rekram1-node force-pushed the global-session-recovery branch from 328dd74 to 56faabb Compare October 22, 2026 23:06
opencode-agent[bot]
opencode-agent Bot reviewed Oct 22, 2026
View reviewed changes

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I recommend merging. My earlier point is addressed: the new regression test is short and checks the fixed behaviour. It covers plain and nested non-git folders, a git subfolder, a missing folder, a session whose project row is missing, and an already-imported session, and compares the result with runtime Project.resolve. It fails on the base and passes here.

The follow-up changes look right to me:

  • sessions already in the V2 table are skipped;
  • relative ACP directories keep the existing fallback;
  • a new project's last-active time comes from the V1 session;
  • each new project is marked as known only after its transaction commits.

On this PR, the v1-migration and project tests, the server test suite, and the core and server type checks all pass.

Public API: unchanged.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@github-actions github-actions Bot mentioned this pull request Oct 22, 2026
📊 AI CLI 工具社区动态日报 2026-10-23 litang9/big_model_radar#591
Open
@rekram1-node
fix(core): attribute V1 global sessions during import
69d1180
@rekram1-node
rekram1-node force-pushed the global-session-recovery branch from 56faabb to 69d1180 Compare October 22, 2026 23:26
opencode-agent[bot]
opencode-agent Bot reviewed Oct 22, 2026
View reviewed changes

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I recommend merging. No earlier review threads were open.

The new timeout works as described. In a temporary test where every folder lookup hangs, the import finished in about 5 seconds and made one lookup before skipping the rest. Both sessions stayed under global.

A lookup that crashes is caught and logged, and its session stays under global. A lookup that times out is stopped in the background, so it can't stall the migration.

On this PR, the v1-migration and project tests pass, and the core and server type checks are clean.

Public API: unchanged.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rekram1-node
rekram1-node merged commit 5f8c158 into dev Oct 22, 2026
14 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@rekram1-node
rekram1-node deleted the global-session-recovery branch October 22, 2026 23:37
@opencode-agent opencode-agent Bot mentioned this pull request Oct 23, 2026
fix(core): preserve 1.19 API messages during migration #58549
Closed
3 of 6 tasks
@rekram1-node rekram1-node mentioned this pull request Oct 25, 2026
fix(core): repair V1 global sessions left by completed imports #58846
Closed
3 tasks done
@opencodejr opencodejr Bot mentioned this pull request Oct 27, 2026
tui: selecting a migrated v1 session does not open it #52924
Open
@jimicze jimicze mentioned this pull request Nov 6, 2026
server: V1 sessions created after migration.v1-v2 completes are never imported #50130
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@opencode-agent opencode-agent[bot] opencode-agent[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

migrate-v1: non-git sessions in "global" project hidden after V1→V2 upgrade

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@rekram1-node
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.