Migrate worktree mappings to session metadata#514
Conversation
Upgrade @opencode-ai/sdk to 1.15.13 so the UI can use the latest OpenCode client surface, including session metadata support. Preserve metadata returned by session list/create/children/fork flows and update the session diff type to SnapshotFileDiff after the SDK removed the older FileDiff export. Validated with npm run typecheck --workspace @codenomad/ui.
Add the project-local background process storage directory to the CodeNomad-managed .git/info/exclude entries so generated command output and process indexes stay local. This keeps the behavior aligned with the existing worktree metadata ignore setup and prevents accidental tracking in repositories without a root .gitignore entry for .codenomad/. Validated with npm run typecheck --workspace @neuralnomads/codenomad.
Move CodeNomad's parent-session worktree assignment out of .codenomad/worktreeMap.json and into OpenCode session metadata under the codenomad namespace. The UI now resolves worktrees from session metadata first, falls back to legacy mappings during migration, and writes future changes through a session metadata helper that fetches latest metadata before full replacement so unrelated metadata is preserved. Legacy map entries are migrated after sessions load, stale session IDs are pruned once the session list is known, and the server deletes worktreeMap.json when no parent-session mappings remain. Deleted worktrees also move affected sessions back to the root worktree metadata assignment. Session update events now preserve metadata in the local session store. Validated with npm run typecheck --workspace @codenomad/ui and npm run typecheck --workspace @neuralnomads/codenomad.
|
I want you to perform the gatekeeper checks for latest PR state check for regressions |
|
Gatekeeper review for latest PR state. Assumption: the request is for a ruthless review only, not for me to patch the PR in this webhook run. Findings:
Suggested fix: make the migration pass option-aware, or do a second explicit stale-prune pass after session hydration that is not coalesced behind the non-pruning migration.
Suggested fix: for deleted parent sessions, remove only the legacy mapping, or perform legacy cleanup in a
In Suggested fix: allow Quality notes:
Validation attempted:
Gatekeeper verdict: request changes before merge. The migration direction is good, but the coalesced migration options and cleanup ordering can leave legacy mappings stale and can fail the key non-root session creation path this PR is trying to make reliable. -- |
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/26721329112 Artifacts expire in 7 days.
|
Ensure the stale legacy mapping prune runs after session hydration even when an earlier non-pruning migration is already in flight. This prevents old worktreeMap.json entries for missing sessions from surviving after the full session list is known. Keep deleted-session legacy cleanup independent from metadata updates by pruning legacy map entries directly after session deletion. Also pass the known source worktree when tagging newly created sessions so non-root session metadata is written through the client that created the session. Validated with npm run typecheck --workspace @codenomad/ui and npm run typecheck --workspace @neuralnomads/codenomad.
|
Check again now |
|
Follow-up gatekeeper review for latest PR state ( Assumption: “Check again now” means re-review the updated PR and verify whether the prior gatekeeper findings were addressed. Findings: No blocking findings in the updated diff. Prior findings re-check:
Quality notes:
Validation attempted:
Gatekeeper verdict: the previously blocking issues are fixed. I do not see a reason to hold the PR based on this follow-up review, subject to CI/typecheck passing in a dependency-complete environment. -- |
Drop the stale removeParentSessionMapping import from the session API store after deleted-session cleanup moved to legacy-only map pruning. Validated with npm run typecheck --workspace @codenomad/ui.
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/26743926225 Artifacts expire in 7 days.
|
|
Now? |
|
Follow-up check for latest PR state ( Assumption: “Now?” means verify the newest push after the prior review note. Result: No new findings. What changed since my last review:
Validation attempted:
Residual note:
Gatekeeper verdict: clear from my review. I do not see a reason to hold the PR, subject to CI/typecheck passing in a dependency-complete environment. -- |
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/26744157185 Artifacts expire in 7 days.
|
Summary
@opencode-ai/sdkto1.15.13and adapt UI types for the current session/diff API surface..codenomad/worktreeMap.jsonintometadata.codenomad.worktreeSlug, with legacy fallback, stale-entry pruning, and server-side deletion of the legacy map once empty..codenomad/background_processes/to CodeNomad-managed.git/info/excludeentries.Details
metadata.codenomad.worktreeSlugparentSessionWorktreeSlug, thenroot.defaultWorktreeSlug; the fallback isroot.writeWorktreeMapdeletes.codenomad/worktreeMap.jsonserver-side when no legacy parent-session mappings remain.Validation
npm run typecheck --workspace @codenomad/uinpm run typecheck --workspace @neuralnomads/codenomad