Skip to content

fix(workspace): preserve consumer-owned state - #30

Merged
altaywtf merged 2 commits into
mainfrom
fix/preserve-consumer-state
Sep 4, 2026
Merged

fix(workspace): preserve consumer-owned state#30
altaywtf merged 2 commits into
mainfrom
fix/preserve-consumer-state

Conversation

@altaywtf

@altaywtf altaywtf commented Sep 4, 2026

Copy link
Copy Markdown
Member

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

  • Require matching ownership records before replacing a remote skill directory; stop before mutations on conflicts.
  • Keep forbidden-path policy with the consumer.
  • Preserve existing memory settings on init reruns and reject conflicting options before scaffolding.
  • Isolate Git version queries from inherited repository settings.

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.

Copilot AI lite review requested due to automatic review settings September 4, 2026 20:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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 initWorkspace preserve existing memory configuration (including legacy dailyLogs/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.

Comment thread test/init.test.ts Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-04T20:37:12.919524Z cf01a44 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@slopzapper slopzapper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✨ CLEAN

Init now follows existing workspace.json memory, skill sync refuses unmanaged remote destinations before mutation, and version resolution ignores a foreign GIT_DIR. Forbidden paths are consumer policy again, matching the updated convention.

@altaywtf
altaywtf merged commit 8925d81 into main Sep 4, 2026
3 checks passed
@altaywtf
altaywtf deleted the fix/preserve-consumer-state branch September 4, 2026 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants