Skip to content

[codex] Make adapter sync non-destructive#1888

Open
chiehwangs wants to merge 2 commits into
jackwener:mainfrom
chiehwangs:codex/non-destructive-adapter-sync
Open

[codex] Make adapter sync non-destructive#1888
chiehwangs wants to merge 2 commits into
jackwener:mainfrom
chiehwangs:codex/non-destructive-adapter-sync

Conversation

@chiehwangs
Copy link
Copy Markdown

@chiehwangs chiehwangs commented Jun 7, 2026

Summary

  • Preserve local adapter overrides during install-time adapter sync instead of deleting changed official-site overrides.
  • Convert stale adapter files, legacy shim files, and stale tmp lock files from automatic cleanup to detection-only warnings.
  • Add an install-time safety regression test to prevent recursive or direct deletion APIs from returning to scripts/fetch-adapters.js.
  • Make shell completion fast path validate manifest JSON before using it, so corrupt manifests fall back to full discovery instead of returning empty completions.

Root Cause

scripts/fetch-adapters.js ran during global install or explicit adapter sync and used recursive forced deletion plus direct file deletion against ~/.opencli. That could remove user adapter directories or files without an explicit per-item confirmation step.

A second issue was in hasAllManifests: it only checked that manifest files existed. If cli-manifest.json existed but contained invalid JSON, the fast completion path still ran and returned empty completions instead of falling back to full discovery.

Validation

  • HOME="$PWD/.local-home" npx vitest run --project unit src/install-safety.test.ts
  • HOME="$PWD/.local-home" npx vitest run --project unit src/completion-fast.test.ts
  • HOME="$PWD/.local-home" npx vitest run --project unit
  • HOME="$PWD/.local-home" npm run typecheck
  • node --check scripts/fetch-adapters.js
  • HOME="$PWD/.local-home" OPENCLI_FETCH=1 node scripts/fetch-adapters.js
  • HOME="$PWD/.local-home" node dist/src/main.js hackernews top --limit 1 -f json

@chiehwangs chiehwangs marked this pull request as ready for review June 7, 2026 15:28
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.

1 participant