Repository navigation
🤖 fix: fence removal of legacy id-less workspace rows across backends - #4919
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 27c7d5e654
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Readiness (final head
Generated with |
Summary
The cross-process removal fence (#4776/#4908) now covers upgraded workspaces whose config row has no id yet. A removal persists the legacy row's id before it claims its
pendingRemovalmarker. A task creation whose parent resolved only through session metadata finds that row again by its stable identity (config project key + workspace path) inside its config commit. If the row is gone or marked, the commit refuses.Fixes #4914
Background
Every step of the fence found the row by id:
claimPendingRemovalwrote no marker whenfindWorkspaceEntrymissed,Config.removeWorkspacedid not deregister the row, andassertParentAdmitsChildcould not see a marker or the row's absence (#4908 exempted id-less parents so that creation under them kept working). So another backend could create a child under such a workspace while it was being removed, or after it was removed.Implementation
WorkspaceService.removeUnlocked, after the mutation gate and before the marker claim): if the row is not found by id butConfig.findWorkspaceresolves it (a legacy row), it callsConfig.getWorkspaceMetadataById, which persists the read-time id migration that workspace listing already persists. Then the claim, the release and the deregistration find the row by id as usual. If the row still has no id (the best-effort migration write failed), the removal refuses before any effect: it could not be fenced. This is the fail-closed choice.createManyplans and bothcreatecommits): when the parent row has no id in the preparation snapshot, the plan recordsLegacyParentRowfromConfig.findWorkspace.assertParentAdmitsChildfalls back to the id-less row at that path and requires a row by id or by path, so a removed legacy parent refuses the child the same way a removed parent with an id does. A parent that resolves nowhere (e.g. the existing "no config row by id" test that fakes a parent id) keeps today's behavior.Scope stayed small (3 files); no new persisted fields:
LegacyParentRowis an in-memory plan field.Validation
New tests in
workspaceService.pendingRemoval.test.ts(two backends, real service stacks, a real id-less row with its id insessions/<basename>/metadata.json) fail onorigin/mainand pass with this change:Each production hunk has its own red test: without the removal change the first test fails (no marker on the row), and without the task-creation change the second fails (the batch commits under the removed parent). A third test checks that a batch creation under a live legacy parent still commits.
Risks
Low. The new paths run only for rows without an id, which the read-time migration normally fixes at the first workspace listing. The removal of such a row now performs that migration write first, and refuses if the write fails.
Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high