| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Hey! Your PR title Fix v2 session migrate by setting correct seq and prevent dedupe project id doesn't follow conventional commit format. Please update it to start with one of:
Where scope is the package name (e.g., app, desktop, opencode). See CONTRIBUTING.md for details. |
Sorry, something went wrong.
There was a problem hiding this comment.
Note
Copilot was unable to run its full agentic suite in this review.
This PR improves project ID/worktree deduplication and makes the session_message.seq migration resilient when durable event rows are missing.
Changes:
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file| File | Description |
|---|---|
| packages/opencode/test/project/project.test.ts | Adds a live test asserting worktree-based project ID migration also rewrites project_directory. |
| packages/opencode/src/project/project.ts | Adds runtime worktree dedupe migration logic and migrates project_directory rows during project ID migration. |
| packages/core/test/database-migration.test.ts | Updates projection-order migration test semantics and adds coverage for worktree dedupe migration. |
| packages/core/src/database/migration/20260604120000_dedupe_project_worktrees.ts | Introduces a migration to canonicalize duplicate worktree projects and rewire dependent rows. |
| packages/core/src/database/migration/20260603040000_session_message_projection_order.ts | Changes backfill strategy to use durable event seq when available, otherwise derive an order from projections. |
| packages/core/src/database/migration.gen.ts | Registers the new dedupe-worktrees migration. |
| packages/core/migration/20260604120000_dedupe_project_worktrees/migration.sql | SQL artifact for the new worktree dedupe migration. |
| packages/core/migration/20260603040000_session_message_projection_order/migration.sql | Updates SQL artifact for the new seq backfill behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
| ALTER TABLE `session_message` ADD `seq` integer NOT NULL;--> statement-breakpoint | ||
| UPDATE `session_message` | ||
| SET `seq` = COALESCE( | ||
| (SELECT `seq` FROM `event` WHERE `event`.`id` = `session_message`.`id`), | ||
| ( | ||
| SELECT COUNT(*) - 1 | ||
| FROM `session_message` AS `ordered` | ||
| WHERE `ordered`.`session_id` = `session_message`.`session_id` | ||
| AND ( | ||
| `ordered`.`time_created` < `session_message`.`time_created` | ||
| OR ( | ||
| `ordered`.`time_created` = `session_message`.`time_created` | ||
| AND `ordered`.`id` <= `session_message`.`id` | ||
| ) | ||
| ) | ||
| ) | ||
| );--> statement-breakpoint |
| `UPDATE \`session_message\` | ||
| SET \`seq\` = COALESCE( | ||
| (SELECT \`seq\` FROM \`event\` WHERE \`event\`.\`id\` = \`session_message\`.\`id\`), | ||
| ( | ||
| SELECT COUNT(*) - 1 | ||
| FROM \`session_message\` AS \`ordered\` | ||
| WHERE \`ordered\`.\`session_id\` = \`session_message\`.\`session_id\` | ||
| AND ( | ||
| \`ordered\`.\`time_created\` < \`session_message\`.\`time_created\` | ||
| OR ( | ||
| \`ordered\`.\`time_created\` = \`session_message\`.\`time_created\` | ||
| AND \`ordered\`.\`id\` <= \`session_message\`.\`id\` | ||
| ) | ||
| ) | ||
| ) | ||
| );`, |
| yield* d.run(sql` | ||
| INSERT OR IGNORE INTO project_directory (project_id, directory, type, time_created) | ||
| SELECT | ||
| ${newID}, | ||
| directory, | ||
| type, | ||
| time_created | ||
| FROM project_directory | ||
| WHERE project_id = ${oldID} | ||
| `) |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Issue for this PR
Closes #30701, for #30632
Type of change
What does this PR do?
Find back the dedupe project id, after https://github.com/ShamirSecret/auto-code-machine/commit/534842dc78f049d1a15f1b851c910a33cecc65eb
How did you verify your code works?
It works on my Mac!
Checklist