fix(workspace): preserve consumer-owned state - #30
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
A newly added init regression test asserts legacy memory fields from an in-memory object rather than re-reading workspace.json, so it may not actually verify the preservation behavior it intends to cover.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR hardens workspace-kit behaviors to avoid overwriting consumer-owned workspace state during skill sync and init reruns, and to make version resolution resilient to inherited Git repository environment/configuration.
Changes:
- Add skill sync “preflight” validation to stop before any filesystem mutation when remote destinations are occupied or ownership/provenance locks don’t match.
- Make
initWorkspacepreserve existing memory configuration (including legacydailyLogs/wiki) and reject conflicting explicit memory options before scaffolding. - Isolate Git version probing from inherited repository environment by stripping repository-local
GIT_*variables for Git subprocesses.
File summaries
| File | Description |
|---|---|
| test/skills.test.ts | Adds regression coverage for remote skill destination preflight, ownership lock matching, and safe update cases. |
| test/init.test.ts | Adds regression coverage for init reruns preserving memory configuration and rejecting conflicting migration options. |
| test/config-version-handoff.test.ts | Adds regression coverage for Git version isolation and updates forbidden-path expectations. |
| test/cli-commands.test.ts | Tightens init behavior expectation to error on a symlinked workspace.json. |
| src/version.ts | Runs Git subprocesses with a sanitized environment to avoid inherited repo settings affecting version resolution. |
| src/skills.ts | Preflights remote skill destinations and enforces dual-lock provenance matching before replacing managed copies. |
| src/init.ts | Loads existing config to preserve memory settings and rejects conflicting requested memory options early. |
| src/config.ts | Removes runtime-owned forbidden-path restrictions so forbidden paths remain consumer policy. |
| docs/convention.md | Updates docs to reflect preflight/ownership behavior in skill sync and init rerun memory preservation rules. |
Review details
- Files reviewed: 9/9 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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. |
Problem
Skill sync could overwrite an existing directory it did not own. Re-running init could also recreate a retired memory layout, while generic configuration was restricted by assumptions about an undeclared runtime. Source builds could derive their version from an inherited foreign Git repository.
Solution
Proof
Seven regression tests fail against the unchanged base source and pass with this patch. The skill-conflict fixtures verify that the delegated installer is never invoked and owner content remains intact.