Skip to content

fix: canonicalize codex and opencode install payloads - #2406

Closed
austinmao wants to merge 1 commit into
affaan-m:mainfrom
austinmao:fix/opencode-install-targets
Closed

austinmao wants to merge 1 commit into
affaan-m:mainfrom
austinmao:fix/opencode-install-targets

Conversation

@austinmao

Copy link
Copy Markdown

Summary

  • Keep Codex install planning on canonical .codex payloads without pulling in foreign platform files
  • Keep OpenCode install planning on canonical .opencode payloads while avoiding .opencode/commands duplication
  • Add regression coverage for both payload planners
  • Add changelog entry under Unreleased

Verification

  • node tests/lib/install-targets.test.js
  • node tests/scripts/doctor.test.js
  • npm test → 2939 passed, 0 failed

Notes

  • The repo still reports 2.0.0 in package.json and VERSION, so the gstack version-bump helper could not parse the base version as a 4-part release. I left the version unchanged and documented the change in CHANGELOG.md instead.

@austinmao
austinmao requested a review from affaan-m as a code owner June 30, 2026 19:39
@ecc-tools

ecc-tools Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 41ddbcc4-1ad0-44a7-b8dd-ed3d7d23a236

📥 Commits

Reviewing files that changed from the base of the PR and between 81af407 and cb2f17f.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • scripts/lib/install-targets/codex-home.js
  • scripts/lib/install-targets/opencode-home.js
  • tests/lib/install-targets.test.js

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved install planning so native Codex and OpenCode content stays in its expected location without duplicating overlapping files.
    • Prevented extra command files from being copied into the OpenCode home setup and kept the Codex-specific agent file unique.
  • Tests
    • Added regression coverage for Codex and OpenCode install behavior to confirm the correct files are synced and duplicates are avoided.
  • Documentation
    • Updated the changelog with the latest install behavior changes.

Walkthrough

This PR adds planOperations functions to the codex-home and opencode-home install target adapters. The codex planner excludes AGENTS.md for the agents-core module, while the opencode planner natively syncs .opencode contents while skipping the commands subdirectory. Two regression tests and a changelog entry were added.

Changes

Install Planning Canonicalization

Layer / File(s) Summary
Codex-home planning excludes AGENTS.md
scripts/lib/install-targets/codex-home.js, tests/lib/install-targets.test.js
Adds planOperations that filters foreign-platform paths and excludes agents-core's AGENTS.md from scaffold operations; test verifies .codex sync uses sync-root-children strategy without generic AGENTS.md.
OpenCode-home native sync without commands duplication
scripts/lib/install-targets/opencode-home.js, tests/lib/install-targets.test.js
Adds listRelativeFiles and createOpencodeNativeOperations helpers plus planOperations to copy .opencode payload directly while skipping commands; test verifies README maps to home destination without duplicating shared command docs.
Changelog entry
CHANGELOG.md
Documents the canonicalization behavior under Unreleased → Changed.

Sequence Diagram(s)

sequenceDiagram
  participant Installer
  participant planOperations
  participant createOpencodeNativeOperations
  participant FileSystem

  Installer->>planOperations: provide modules and target paths
  planOperations->>planOperations: filter foreign-platform paths
  alt path equals .opencode
    planOperations->>createOpencodeNativeOperations: build native operations
    createOpencodeNativeOperations->>FileSystem: list files, skip commands dir
    createOpencodeNativeOperations-->>planOperations: copy-file operations
  else other paths
    planOperations->>planOperations: adapter.createScaffoldOperation()
  end
  planOperations-->>Installer: flattened operation list
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related PRs

  • affaan-m/ECC#2041: Both PRs modify scripts/lib/install-targets/opencode-home.js's adapter behavior and test coverage.

Suggested reviewers

  • affaan-m

Two adapters, one mission clear:
No more AGENTS.md duplicate near.
Commands stay put, not copied twice,
Native sync — clean and precise. 🛠️
Tests confirm it, changelog too —
Canonical paths, nothing askew.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@austinmao

Copy link
Copy Markdown
Author

Closing because this change was shipped against the wrong repository.

@austinmao austinmao closed this Jun 30, 2026
@austinmao
austinmao deleted the fix/opencode-install-targets branch June 30, 2026 19:40
@greptile-apps

greptile-apps Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR canonicalizes Codex and OpenCode install planning. The main changes are:

  • Codex skips the generic root AGENTS.md while keeping native .codex payloads.
  • OpenCode expands native .opencode payloads and avoids newly duplicating .opencode/commands.
  • Tests cover the new Codex and OpenCode planning behavior.
  • The changelog documents the install-planning change.

Confidence Score: 4/5

The OpenCode install planning path should be fixed before merging.

  • The Codex planner keeps the native .codex operation shape.
  • The OpenCode planner changes .opencode from a native-root sync into per-file copies.
  • Removed or previously duplicated OpenCode files can remain installed after an update or repair.

scripts/lib/install-targets/opencode-home.js

Important Files Changed

Filename Overview
scripts/lib/install-targets/codex-home.js Adds a custom Codex planner that filters foreign platform paths and skips the generic agents-core/AGENTS.md path.
scripts/lib/install-targets/opencode-home.js Adds custom OpenCode native payload planning, but the .opencode special case can leave stale native files behind.
tests/lib/install-targets.test.js Adds tests for Codex AGENTS.md filtering and OpenCode native payload planning.
CHANGELOG.md Adds an Unreleased changelog entry for the install payload canonicalization.

Fix All in Claude Code Fix All in Codex

Reviews (1): Last reviewed commit: "fix: canonicalize codex and opencode ins..." | Re-trigger Greptile

.filter(p => !isForeignPlatformPath(p, adapter.target))
.flatMap(sourceRelativePath => {
if (sourceRelativePath === '.opencode') {
return createOpencodeNativeOperations(module.id, input.repoRoot, targetRoot);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Native Sync Cleanup Is Lost

When .opencode is planned here, the adapter no longer emits the native-root sync-root-children operation and instead records only the files that currently exist, while skipping .opencode/commands. On upgrade or repair, previously installed native files that were removed from the repo, including older duplicated command files under ~/.opencode/commands, have no current managed operation covering them, so they can stay in ~/.opencode and continue to be loaded.

Rule Used: Treat CLI inputs, URLs, file paths, and subprocess... (source)

Fix in Claude Code Fix in Codex

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