Skip to content

chore: fix pre-existing main breakages blocking clean overlay composition (#821) - #832

Merged
aarontrowbridge merged 3 commits into
mainfrom
chore/main-composition-fixes
Sep 6, 2026
Merged

aarontrowbridge merged 3 commits into
mainfrom
chore/main-composition-fixes

Conversation

@aarontrowbridge

Copy link
Copy Markdown
Member

Closes #821. Fixes the two pre-existing breakages that red every overlay composition check on pristine origin/main, verified on a fresh origin/main (6afdb9d) worktree and materialized tree before and after.

Breakage 1 — server-session.ts(497) diff_version type clash

Repro: materialize (canonical v1.18.29 + overlay) → tsgo -b in packages/app:
error TS2741: Property 'diff_version' is missing ... but required in type 'SessionCache'.

Root cause: canonical's server-session.ts builds its store literal without diff_version (v1.18.29 and current upstream HEAD) and passes that draft to dropSessionCaches, which the overlay types with diff_version required. The field is an overlay-only cache-invalidation counter — there is no canonical wire shape to match — so the reconciliation widens the parameter type: diff_version becomes optional on SessionCache and the delete is guarded. The overlay's own global store type (global-sync/types.ts State) still declares it required; only dropSessionCaches' parameter widens.

Verification: the materialized typecheck error set on the fixed branch is byte-identical to the base set minus exactly this one error (19 → 18; the remaining 18 are the known overlay-vs-v1.18.29 API drift on surfaces PR #819 re-homes — out of scope here, no drive-bys).

Breakage 2 — i18n parity failure

Repro: bun test packages/app/src/i18n/parity.test.ts in the materialized tree fails with missing: ["session.exportTrace"] (en.ts has the key — added at the fork pin — none of the 17 non-English app locale dicts do; the ui and desktop domains are clean).

On the issue's 'am' attribution: it traces to PR #819's review notes and does not reproduce — the overlay carries no am dict and its parity test checks the 17 locales it owns; the materialized tree's only parity failure is this missing key across all 17. Restored the key in all 17, following each table's own terminology (br is pt-BR upstream). Inventing overlay am dicts was rejected deliberately: in the composed tree they would overwrite canonical's complete Amharic tables with a smaller fork-era keyset — the opposite of restoring keys.

Also (third pre-existing main breakage, surfaced by the repo's own tooling)

refresh_manifest.mjs / drift_gate.mjs revealed that the committed manifest lags the overlay by the three #774 session-ui files (diff-gutter-extension.ts, editable-diff-view-core.ts, editable-diff-view.tsx — in overlay/, absent from manifest.files), so the drift gate fails on pristine main with "stray files". Commit 1 adopts them via the canonical repair path (refresh_manifest.mjs against the v1.18.29 upstream tree). Flagging it here since it's adjacent to #821's scope but not named by it — happy to split it out if reviewers prefer.

Commits (each green, drift gate PASS at each)

Commit Behavior
948ca66 manifest refresh — adopt the three #774 session-ui overlay files
dc08246 reconcile SessionCache with canonical server-session shape (optional diff_version)
872a521 restore session.exportTrace in the 17 non-English app locales

Verification summary

  • Drift gate: PASS at every commit (579 files, overlay and manifest in sync).
  • Materialized tree (fresh, from this branch): server-session.ts(497) error gone; parity test 4/4 pass.
  • global-sync unit tests: 37 pass, unchanged from base (the 2 bun-test Solid-server module errors are identical on pristine main — environment artifacts, not touched).
  • No collision with sibling PR Re-home the session & device lifecycle base contract onto the app overlay (canonical v1.18.29) #819 (it touches session-list-state/snapshot code on its own branch; this branch touches session-cache.ts, i18n tables, manifest.json only).

… overlay files

The committed manifest lagged the overlay by three files added in #774
(packages/session-ui/src/v2/components/{diff-gutter-extension,
editable-diff-view-core,editable-diff-view}.ts): present in overlay/, absent
from manifest.files — the drift gate fails on pristine main with 'stray files
in overlay/ not in the manifest'. Repair path per #796: recompute the manifest
from the committed overlay against the v1.18.29 upstream tree
(scripts/refresh_manifest.mjs).
… shape

Canonical's server-session.ts builds its store literal without diff_version
(v1.18.29 and current upstream HEAD alike) and passes that draft to
dropSessionCaches — which the overlay types with diff_version REQUIRED, so the
materialized tree fails typecheck at server-session.ts(497):

  error TS2741: Property 'diff_version' is missing ... but required in type 'SessionCache'

The field is an overlay-only cache-invalidation counter (no canonical wire
shape to match), so the reconciliation is to widen the parameter type:
diff_version becomes optional on SessionCache and the delete is guarded.
The overlay's own global store type (global-sync/types.ts State) still
declares diff_version required — only dropSessionCaches' parameter widens.
…ocales

The overlay's i18n parity test fails on pristine main: en.ts carries
"session.exportTrace" (added at the fork pin) but none of the 17 non-English
app locale dicts do — the parity test aborts on the first locale (ar) with
missing: ["session.exportTrace"]. The ui and desktop domains are clean.

Issue #821 attributes this to the 'am' locale; that attribution traces to
PR #819's review notes and does not reproduce: the overlay carries no am
dict and its parity test checks the 17 locales it owns. The reproducible
failure is the missing key across all 17, restored here following each
table's own terminology (br is pt-BR upstream).
@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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.

@aarontrowbridge
aarontrowbridge marked this pull request as ready for review September 6, 2026 17:27
@aarontrowbridge
aarontrowbridge merged commit faac5bd into main Sep 6, 2026
9 checks passed
jeonghun-jj-lee added a commit that referenced this pull request Sep 12, 2026
The overlay sync in earlier commits wiped amicode-side patches (#929, #832,
#987, OAuth bridge, titlebar interactions) because the fork's local/amicode
branch doesn't carry them yet. Restore the full overlay from main; the
proper sync happens after the fork PR merges into local/amicode.
jeonghun-jj-lee added a commit that referenced this pull request Sep 12, 2026
…) (#1028)

* feat(#1026): Slice 1 — VS Code theme extraction + bridge

Add syntax_theme_bridge.ts: resolves the active VS Code color theme to
either a Shiki built-in name (fast path, ~30 popular themes) or a full
TextMate theme object extracted from the contributing extension's
filesystem. Handles include chains (max depth 5, cycle detection) and
merges editor.tokenColorCustomizations user overrides.

Wire into ChatPanel: postSyntaxTheme() fires on theme change, on
workbench.colorTheme change, and on tokenColorCustomizations change.
Add 'syntax-theme' to both Lane 2 relay allowlists so the message
reaches the framed app.

8 tests covering: built-in matching, custom extraction, include chains,
cycle detection, user override merging, and fallback behavior.

* chore: sync overlay to opencode a9c4bc736a (Shiki syntax highlighting, #1026)

Overlay promotion from opencode fork branch with Slices 2-5:
- shiki-theme-state.ts: reactive theme state for the webview
- shiki-highlight-worker.ts: dedicated Shiki tokenization Web Worker
- shiki-highlight-plugin.ts: CM6 ViewPlugin with Shiki decorations
- editor-core.ts: wired Shiki extension + language-data fallback
- preview-editor.tsx + editable-diff-view: pass lang to baseExtensions
- markdown-shiki.worker.ts: theme-update support
- pierre/worker.ts: active theme for @pierre/diffs pools
- app.tsx: syntax-theme message handler

Plus opencode fork upstream changes included in the full promotion.

* fix(#1026): correct Shiki decoration bugs + sync overlay

Three bugs fixed in the fork:
1. Empty fallback theme: worker init now uses the actual OpenCodeTheme
   (30+ TextMate scope rules) instead of an empty stub
2. Worker URL: uses Vite ?worker&url import pattern matching existing
   markdown-shiki and @pierre/diffs workers
3. Test compat: extracted pure decoration logic to shiki-highlight-
   decorations.ts; editor-core.ts lazy-imports the plugin module

New integration test verifies Shiki produces colored tokens + valid
CM6 decorations for Julia, TypeScript, Python, Rust, Go, YAML, and
Shell (16 tests, all green).

* chore: clean overlay sync from correct upstream base (afc0f1c26a vs 6fa55b660a)

Previous incremental syncs used intermediate fork commits as the base,
causing new Shiki files to be missing from the overlay. Redo as a
full fork-vs-upstream-base delta to get all 18 files correctly.

Fixes: shiki-highlight-plugin.ts, shiki-highlight-worker.ts,
shiki-highlight-decorations.ts, shiki-theme-state.ts and tests now
present in the overlay. The binary was already built from the correct
fork commit (afc0f1c26a) — this fixes only the overlay tracking copy.

* fix(#1026): deliver VS Code syntax theme after iframe boot

The extension previously posted syntax-theme only after a later VS Code
theme/configuration change. A newly opened Preview tab therefore stayed
on the OpenCode fallback palette forever.

Post the resolved syntax theme on the existing app-ready handshake,
when the iframe listener is guaranteed to exist. Restore live refreshes
for colorTheme and tokenColorCustomizations changes, and admit the
message through both Lane 2 relay render paths.

Add regression coverage proving a fresh panel receives dark-plus after
app-ready and both relays contain syntax-theme.

* chore: restore overlay from main — sync deferred to post-fork-merge

The overlay sync in earlier commits wiped amicode-side patches (#929, #832,
#987, OAuth bridge, titlebar interactions) because the fork's local/amicode
branch doesn't carry them yet. Restore the full overlay from main; the
proper sync happens after the fork PR merges into local/amicode.

* chore: restore app-bundle manifest from main

The sync:apply rewrote the manifest to point at the Shiki feature branch
(afc0f1c26a) instead of local/amicode. Restore main's manifest so the
drift gate passes against local/amicode as-is.

* chore: remove leftover Shiki overlay files — overlay now matches main exactly
jeonghun-jj-lee pushed a commit that referenced this pull request Sep 23, 2026
jeonghun-jj-lee added a commit that referenced this pull request Sep 23, 2026
* fix(packaging): enforce known fixes before CI advisory

* fix(app): #1466 restore parent Files Changed invalidation

* test(app): cover all #1466 file edit events

* fix(app): #1467 bound mirror and session warming

* fix(packaging): migrate #832 shared-state guard

* fix(app): guard session warm scheduler keys

* fix(app): repair #1466 review findings

---------

Co-authored-by: amicode-ci <ci@amicode.local>
jeonghun-jj-lee added a commit that referenced this pull request Sep 24, 2026
…MPDIR self-pollution fix) (#1520)

* fix: recover session reliability regressions (#1472)

* fix(packaging): enforce known fixes before CI advisory

* fix(app): #1466 restore parent Files Changed invalidation

* test(app): cover all #1466 file edit events

* fix(app): #1467 bound mirror and session warming

* fix(packaging): migrate #832 shared-state guard

* fix(app): guard session warm scheduler keys

* fix(app): repair #1466 review findings

---------

Co-authored-by: amicode-ci <ci@amicode.local>

* ci: publish release VSIXes to Open VSX Registry (#1490)

* ci: publish release VSIXes to Open VSX Registry

* ci: decouple Open VSX publish from Marketplace step outcome

* fix(app): #1458 — the empty-workspace landing's titlebar portals crash every real boot (current-main slice, manifest-clean) (#1473)

* fix(app): #1458 — the empty-workspace landing's titlebar portals rendered SessionChatsDropdown/StatusPopoverV2 (per-directory sync-context readers) at the "/" route, which never sits inside a SyncProvider; at real-boot timing the no-directory window renders the landing briefly on EVERY boot and the useSync() throw killed the whole route tree — including the reactive landing effect, so no draft was ever created and the app stayed frozen at "/". Portals removed, content kept; a guard test pins the landing module free of directory-scoped context components (the unit-suite trap: mocked contexts pass while the real boot crashes — caught live by the e2e rig). Manifest: files + classification updated (drift gate PASS).

* fix(app): #1458 follow-up — the guard test matched raw text and tripped on the fix's own explanatory comment (which names the removed components); assert the import graph instead. All green: 2 pass, drift gate PASS.

* fix(app): render empty landing without directory context

---------

Co-authored-by: amicode-ci <ci@amicode.local>

* fix(app): retrying dynamic imports — the tunnel-truncation class (#1459b, current-main slice) (#1474)

* fix(app): #1459b — retrying dynamic imports, the tunnel-truncation class (current-main slice). The fleet's ssh tunnel restarts on network transitions (launchd KeepAlive) and kills every in-flight tunneled response MID-STREAM; a lazily-imported chunk crossing a restart gets a cleanly-truncated body (observed live: 2,884 of 28,497 bytes) and Chromium's module map caches the failure FOR THE DOCUMENT'S LIFE — every later import of the same URL throws 'Failed to fetch dynamically imported module' WITHOUT a network request: the new-session launch frozen in the loading hold forever (live-verified root cause of the stuck-loading arc; the rig has no tunnel so it never sees the class). retryImport parses the failing URL, re-imports it cache-busted (fresh module-map key) with backoff 1s→2s→4s→8s→16s (~31s of transport-storm ride-out; observed watchdog windows last minutes — a single immediate retry drowned in the storm's first beat); chained busts strip the previous query. Wired at all 8 dynamic-import sites. Transient-only: real errors rethrow. 7 contract tests (importer injected — the engine's import() never runs in the suite). Manifest: files + classification registered, drift gate PASS.

* fix(app): bound dynamic import retries

---------

Co-authored-by: amicode-ci <ci@amicode.local>

* fix: follow up on compaction review findings (#1463)

* fix: preserve interrupted compaction output

* fix(app): localize compaction failure toast

* fix(core): surface compaction runner errors

* fix(engine): send final-step directive as user input

* test(engine): cover manual compaction runner request

* chore(app-bundle): refresh overlay manifest

* fix(server): map compact runner failures

---------

Co-authored-by: amicode-ci <ci@amicode.local>

* fix(app): recover deferred session mirror pruning (#1502)

Co-authored-by: amicode-ci <ci@amicode.local>

* fix: bound and isolate background session warming (#1501)

* fix: bound background session warming

* test: cover prewarmer batch scheduling

* refactor: share session prewarmer batching

* test: cover multi-row prewarmer batches

* fix: parallelize bulk lineage warming

* fix: release warm slots after prefetch

---------

Co-authored-by: amicode-ci <ci@amicode.local>

* fix(test): stop instruction.test.ts leaking AGENTS.md into $TMPDIR

The 'does not walk past a secondary directory' test wrote AGENTS.md to
path.dirname(tmpdirScoped()) === os.tmpdir(), an UNSCOPED file in the shared
$TMPDIR root that (a) was never cleaned up and (b) poisoned every sibling test
nesting tmp dirs under $TMPDIR — the loader walks up and finds it. Nest the
secondary under its own scoped parent so the 'above' AGENTS.md lands in an
auto-cleaned dir. findUp for a secondary dir stops at the dir itself (stop=dir),
so no git root is needed. Fixes 2 instruction.test.ts failures.

---------

Co-authored-by: amicode-ci <ci@amicode.local>
Co-authored-by: Jack Champagne <43344745+jack-champagne@users.noreply.github.com>
Co-authored-by: Aaron Trowbridge <47730232+aarontrowbridge@users.noreply.github.com>
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.

chore: fix pre-existing main breakages blocking clean overlay composition (server-session diff_version type clash; i18n 'am' locale parity)

1 participant