Absorb the opencode fork into amicode — overlay-based binary build (#1091) - #1114
Conversation
Add packages/opencode/ to the overlay scope — the engine's 125 patched files from the fork now have a tracking copy in amicode. - Update all 5 hardcoded scope sites (overlay-promotion.mjs, extract_overlay.mjs, manifest.json) - Extract fork delta into packages/app-bundle/overlay/packages/opencode/ - Verify materialized tree matches fork for all 7 packages
Add build:binary — compiles the engine from the overlay-materialized monorepo instead of downloading from the fork release. - Materialize stock upstream + overlay → full opencode monorepo - Build via script/build.ts with --single --skip-install --skip-embed-web-ui - Copy binary to vendor/ with sha256 + overlay-provenance sidecars - Wire as pnpm --filter amicode run build:binary
feat(extension): local binary build from materialized tree (#1094)
Redesign 5 systems that assumed a live fork checkout: - Rebuild: uses build:binary from overlay tree (single mode, bun required) - repo-sync: retire --fork mode, remove fork access check, add overlay health - Doctor: staleness via anomalyco/opencode releases, not fork tags - Upgrade: amicode repo git discipline + build:binary, not fork checkout - VSIX build: remove AMICODE_OPENCODE_SRC, use build:binary Key changes: - SurfaceContext.rootRepoFork is now optional (deprecated for S6 migration) - SurfaceContext.upstreamVersion replaces fork-tag-based staleness - queryUpstreamVersion() queries gh api repos/anomalyco/opencode/releases/latest - serverBinaryVerb operates on rootRepoAmicode, not rootRepoFork - Fixture constants updated: FUTURE_BUILD/PAST_BUILD use meaningful versions Part of fork-absorption campaign #1091.
feat: redesign fork-dependent systems for overlay-build world (#1097)
Replace fork-download binary provisioning with overlay-build in CI: - Add build-binary job; consumers use needs + download-artifact - release.yml builds from overlay, not fork release - Delete prepare-release-candidate.yml and overlay-promotion-bot.yml - Add .buildinfo sidecar for channel assertion - Update package script to use build:binary - build_binary.mjs gains --platform flag for cross-compilation - assert_ui_gate.sh reads .buildinfo for channel verification - app-bundle-gate verifies provenance via lock.version + upstream_base_sha Secret removal (OPENCODE_FETCH_TOKEN, REPO_ACCESS_TOKEN) is deferred to after alpha validation — a separate manual step. Part of fork-absorption campaign #1091. Answers #843.
feat(ci): build binary from overlay, retire fork workflows (#1096)
Retire dead fork infrastructure and restructure opencode.lock.json: - Delete overlay-sync, overlay-promotion, extract_overlay, opencode_dev - Strip drift_gate to committed-overlay-only check - Restructure lock: drop repo/tag/ref/platforms, add base_commit/overlay_hash - Migrate all lock consumers to new schema - Remove AMICODE_OPENCODE_SRC and DEFAULT_OPENCODE_PATH from functional code - Update i18n placeholders and manifest hashes - Update test fixtures for the new world Part of fork-absorption campaign #1091.
Replace fork workflow documentation with overlay-build workflow: - AGENTS.md: 7 sections updated (~90 lines rewritten) - Overlay is the source of truth, not a tracking copy - Engine patches: edit overlay directly, run build:binary - Fork archival steps documented as HITL checklist - Updated agents_md.test.ts: overlay-prohibition → overlay-as-source-of-truth Part of fork-absorption campaign #1091.
feat: infrastructure retirement and lock restructure (#1098)
docs: update documentation for fork-absorption (#1099)
|
Important Review skippedToo many files! This PR contains 219 files, which is 119 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (219)
You can disable this status message by setting the 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. Comment |
…+ skills-lint #1121 # Conflicts: # packages/app-bundle/manifest.json
…ion-lineage engine) Brings packages/opencode in the absorbed overlay from 517921ee to fork HEAD 8608dcc1, transferring the session-lineage engine (lineage, mutation, receipt, receipt-privacy, rollout, evidence, business-record, user-mutation + tests) — 20 files, +6002/-0. Without this, merging PR #1114 would regress the ~6k-line engine that main currently ships via the vendored fork binary. - overlay/packages/opencode: 20 files written verbatim from fork@8608dcc1 - manifest: fork_sha 517921ee->8608dcc1, fork_tag ->v1.18.29-amicode.30-67-g8608dcc1fe; refresh_manifest recompute; exceptions collision reconciled (23 amicode-only legacy modules kept as exceptions, not files{}, mirroring main's partition) Gates (director-run, command-derived): - drift_gate: PASS (807 fork-owned + 23 exceptions = 830 overlay files in sync) - materialize verify: 807 overlay files at exact hashes - engine byte-exact to fork@8608: 830/830 packages/opencode files, 0 mismatch/missing/stray - app-scope == main@8608 except 19 intentional de-fork repairs (opencodePath placeholder) - import-resolution: 8 engine modules present; no dangling cross-package imports - full binary build -> CI build-binary job (campaign division) Refs #1129, #1091
Delete the two fork-era rebuild scripts that predate fork absorption (#1091) and have no in-tree callers: - scripts/rebuild_amicode_locally.sh (built the fork binary with bun from a local opencode fork checkout) - scripts/rebuild_amicode_remotely.sh (downloaded the pinned fork release binary) The in-app Rebuild surface (S8) is the supported dev path; these fork-clone / fork-release-download flows have no analog in the overlay-build world. Also correct the one rebuild coordinator docstring line that still claimed the shell scripts call it. Coordinator logic and the fork-mode comments (S10, #1117) are untouched. Refs #1116, part of #1091.
…es (#1117) Fork absorption left an orphaned 'rebuild from main' path in the extension rebuild coordinator. Remove the runRebuild orchestrator and the rebuildFromMain resolver (only tests exercised them), relocating the shared exec type aliases (ExecResult, ExecFn) they defined to a dedicated exec_types module first so the live dependency-resolver and deployBuild path keep them. - new src/rebuild/exec_types.ts holds ExecResult + ExecFn - coordinator.ts: drop runRebuild + RebuildCoordinatorOpts/RebuildMode + dead imports and dead result fields; keep deployBuild fully intact; import exec types from ./exec_types; correct the fork-mode docstring header - dependency_resolver.ts: import ExecResult from ./exec_types - remove main_source_resolver.ts and its test entirely - rebuild_coordinator.test.ts: drop the runRebuild cases, keep deployBuild cases - dependency_resolver.test.ts: add exec-type provenance assertions - fetch_opencode.d.mts: stop naming the removed resolver module Fixes the integration-branch tsc error 'Property pendingPromotion does not exist on type RebuildResult'. tsc --noEmit now green. Part of #1091.
Merge S9+S10 (coupled coordinator cleanup) into the absorption integration branch. S10 removes the orphaned runRebuild main-path (clearing the pre-existing pendingPromotion typecheck red); S9 retires the fork rebuild scripts. CI green on ed76304 (fast/build-binary/vsix-gate/boot-smoke/schema-roundtrip).
#1115) Restore two distinct Rebuild semantics and retire the fork-era wiring left behind by fork absorption (#1091): - Standardize the rebuild request mode on `local | main` end to end (UI → controller → payload → handler → tests). `local` builds the working tree as-is (no git checkout/pull); `main` fetches + checks out main + ff-only pulls before building. The handler now HONORS the mode via two pure helpers (resolveRebuildMode, rebuildGitCommand) — the git step is the one place the two buttons diverge. The retired `remote` value coerces to the safe `local`. - Remove the dead "opencode repo path" field: the UI row, the controller getter/setter/commit + payloads, the settings-context type/default/getter/ setter, and the opencodePath row key from all 18 locale files. - Retire the binary live-swap: drop the two path-fed opencodeBinary writes in the dev-tools-update handler and delete the deprecated appBundleBuildCommand / mainOverlayVerificationCommand shims. The general opencodeBinary override is preserved (boot/health consumer) and still cleared on toggle-off. - ADR 0018 records the two-button model + live-swap retirement; CONTEXT.md gains the Rebuild (local) / Rebuild (from main) / binary live-swap (retired) glossary terms. Tests: extend the chat-bridge and i18n suites (reuse-first) — mode/git-command helper assertions, binary-override lifecycle, and a locale key-removal guard. Rebased onto integration @4966b2d4 (engine-sync 8608dcc1). Refresh manifest for this slice's overlay edits (18 i18n + developer-tools controller/view + settings + rebuild-label-rename.test) so the overlay stays drift-clean against the 8608 manifest; exceptions bucket reconciled (23 amicode-only modules kept as exceptions, mirroring main). drift_gate PASS; tsc shows only the pre-existing coordinator pendingPromotion red (cleared by S10).
Merge S8 (rebuild-surface repair for the overlay-build world) into the absorption integration branch, rebased onto ddbb998 (post S9+S10) so the coordinator typecheck is clean. Includes the overlay manifest refresh so the branch stays drift-clean. CI green on 9eef760 (fast/build-binary/vsix-gate/boot-smoke/schema-roundtrip).
The fork-absorption (#1114) moved the opencode engine into the overlay but left it with NO CI test/typecheck coverage: packages/app-bundle/overlay/ packages/opencode is not a pnpm workspace member (pnpm-workspace.yaml globs packages/* non-recursively), so the `fast` job's `pnpm -r run typecheck` skips it. The fork ran `bun turbo typecheck`/`bun turbo test`; the cutover (S4 #1111) never ported them. Engine type regressions have merged unseen. This restores the engine typecheck as a standalone `engine-tests` CI job (materialize the full tree -> bun install -> opencode typecheck), the fork's typecheck.yml scoped to the engine. Green-up (pre-existing errors on dev the gate caught): - src/session/lineage.ts: `.filter((id): id is string ...)` must narrow to `id is SessionID` (the branded column type); 4 cascading errors cleared. - test/session/prompt.test.ts: MCP mock omitted `remove`, now required by the overlaid MCP.Interface — add `remove: () => Effect.void`. - test/provider/transform.test.ts: cast content elements `as any` before reading `.type` (matches this file's own convention at :3138) — the Part-union widening from a recent dev merge left these two assertions behind. Three remaining typecheck errors are a base-pin drift (manifest upstream_base_sha=7fe9938 predates the base the overlay was authored against): allowlisted in the gate script by file+rule, tracked in #1229. New errors outside the allowlist fail CI (verified: injected error reds; allowlisted-only passes). The gate is fail-closed (reds if tsgo did not execute). Also: `pnpm test:engine` local entrypoint + AGENTS.md verification-gates row. manifest.json refreshed for the overlay edits (drift_gate PASS). Deferred, tracked: - #1229 base-pin bump -> unlocks full-monorepo typecheck (ui/app also drift). - #1233 engine unit-TEST lane (bun turbo test + test:httpapi) -> blocked on real amicode test fixes (amicode-connections.test.ts failures + hook-timeout slowness). Refs #1228
…1233, #1239) The clean-CI run of the unit-test lane surfaced 3 pre-existing failures (untouched by this change, never CI-gated since #1114): session legacy-parent aggregation (test/session/session.test.ts), SSE chunkTimeout (test/provider/header-timeout.test.ts), and TUI attention notify (test/cli/cmd/tui/attention.test.ts, an uncaught throw). Exclude them at the file level in engine_test_gate.sh so the lane enforces no-new failures on the remaining ~271 files / 3750+ tests now; tracked for fix + re-inclusion in #1239 (base-drift llm-native-recorded stays excluded per #1229). Refs #1233, #1239
The fork-absorption (#1114) moved the opencode engine into the overlay but left it with NO CI test/typecheck coverage: packages/app-bundle/overlay/ packages/opencode is not a pnpm workspace member (pnpm-workspace.yaml globs packages/* non-recursively), so the `fast` job's `pnpm -r run typecheck` skips it. The fork ran `bun turbo typecheck`/`bun turbo test`; the cutover (S4 #1111) never ported them. Engine type regressions have merged unseen. This restores the engine typecheck as a standalone `engine-tests` CI job (materialize the full tree -> bun install -> opencode typecheck), the fork's typecheck.yml scoped to the engine. Green-up (pre-existing errors on dev the gate caught): - src/session/lineage.ts: `.filter((id): id is string ...)` must narrow to `id is SessionID` (the branded column type); 4 cascading errors cleared. - test/session/prompt.test.ts: MCP mock omitted `remove`, now required by the overlaid MCP.Interface — add `remove: () => Effect.void`. - test/provider/transform.test.ts: cast content elements `as any` before reading `.type` (matches this file's own convention at :3138) — the Part-union widening from a recent dev merge left these two assertions behind. Three remaining typecheck errors are a base-pin drift (manifest upstream_base_sha=7fe9938 predates the base the overlay was authored against): allowlisted in the gate script by file+rule, tracked in #1229. New errors outside the allowlist fail CI (verified: injected error reds; allowlisted-only passes). The gate is fail-closed (reds if tsgo did not execute). Also: `pnpm test:engine` local entrypoint + AGENTS.md verification-gates row. manifest.json refreshed for the overlay edits (drift_gate PASS). Deferred, tracked: - #1229 base-pin bump -> unlocks full-monorepo typecheck (ui/app also drift). - #1233 engine unit-TEST lane (bun turbo test + test:httpapi) -> blocked on real amicode test fixes (amicode-connections.test.ts failures + hook-timeout slowness). Refs #1228
The fork-absorption (#1114) moved the opencode engine into the overlay but left it with NO CI test/typecheck coverage: packages/app-bundle/overlay/ packages/opencode is not a pnpm workspace member (pnpm-workspace.yaml globs packages/* non-recursively), so the `fast` job's `pnpm -r run typecheck` skips it. The fork ran `bun turbo typecheck`/`bun turbo test`; the cutover (S4 #1111) never ported them. Engine type regressions have merged unseen. This restores the engine typecheck as a standalone `engine-tests` CI job (materialize the full tree -> bun install -> opencode typecheck), the fork's typecheck.yml scoped to the engine. Green-up (pre-existing errors on dev the gate caught): - src/session/lineage.ts: `.filter((id): id is string ...)` must narrow to `id is SessionID` (the branded column type); 4 cascading errors cleared. - test/session/prompt.test.ts: MCP mock omitted `remove`, now required by the overlaid MCP.Interface — add `remove: () => Effect.void`. - test/provider/transform.test.ts: cast content elements `as any` before reading `.type` (matches this file's own convention at :3138) — the Part-union widening from a recent dev merge left these two assertions behind. Three remaining typecheck errors are a base-pin drift (manifest upstream_base_sha=7fe9938 predates the base the overlay was authored against): allowlisted in the gate script by file+rule, tracked in #1229. New errors outside the allowlist fail CI (verified: injected error reds; allowlisted-only passes). The gate is fail-closed (reds if tsgo did not execute). Also: `pnpm test:engine` local entrypoint + AGENTS.md verification-gates row. manifest.json refreshed for the overlay edits (drift_gate PASS). Deferred, tracked: - #1229 base-pin bump -> unlocks full-monorepo typecheck (ui/app also drift). - #1233 engine unit-TEST lane (bun turbo test + test:httpapi) -> blocked on real amicode test fixes (amicode-connections.test.ts failures + hook-timeout slowness). Refs #1228
Campaign summary
Absorbs the
harmoniqs/opencodefork into amicode's overlay system. After this merges, amicode is the single repo to maintain — engine patches are edited in the overlay directly, binaries are compiled from the materialized tree, and CI no longer touches the fork.The 6 slices (all merged into this branch)
overlay/packages/opencode/build:binary— compiles the engine from the overlay treebuild-binaryjob + artifact sharing; 2 fork workflows deletedopencode.lock.jsonBy the numbers
build-binaryjob (~70s) replaces 7 independent fork-downloadsskills_integrityvault-aaronvpath error on main)New developer workflow
HITL actions after merge
release.ymlOPENCODE_FETCH_TOKEN+REPO_ACCESS_TOKEN(after alpha validates)harmoniqs/opencodeRollback
Every slice was merged individually with full CI verification. The integration branch can be reverted as one commit. Secret removal is sequenced AFTER alpha validation precisely because it's non-revertable.
Closes #1091. Answers #843.