v1.0.123
Patch release. Closes 2 community-reported issues (Pi/OMP misdetection, Bun ABI cache) and one Windows CI regression that surfaced on the v1.0.122 build of next itself. All three fixes follow the same shape: a verified ground-truth claim from the reporter, refs/-checked against upstream platform source, then 4 parallel ultrathink reviewers → TDD vertical slices. No LLM hallucinations, no scope drift, no drive-by refactors.
What broke
#542 — ctx_upgrade from Pi (oh-my-pi rebrand → OMP) misdetected as Cursor
The Pi project rebranded to OMP and now ships clientInfo.name = "omp-coding-agent" over MCP. src/adapters/client-map.ts only knew "Pi CLI" and "Pi Coding Agent" for the legacy installs. src/adapters/detect.ts config-dir cascade also had cursor (host IDE) listed before pi / kiro / agent-class adapters, so when a Pi user invoked ctx_upgrade the cascade fell through clientInfo → first match cursor → wrong adapter → wrong install path. Verified against refs/platforms/oh-my-pi/packages/coding-agent/src/cli.ts and the live upstream clientInfo literal.
Six commits, all closing #542:
client-map.ts: add"omp-coding-agent" → ompmapping (Pi/OMP are separate platforms per #473 data-isolation; explicitly NOT mapping omp-coding-agent back topi).detect.test.ts: verify omp-coding-agent clientInfo resolves to OMPAdapter.server.ts+cli.ts: thread MCP clientInfo throughctx_upgrade→upgrade(). Pure in-process pass (no spawn boundary — verified the MCP handler dispatchesctx_upgradeIN-PROCESS atsrc/server.ts:3018, soserver.server.getClientVersion()is reachable from the upgrade path).detect.ts: config-dir tier reordered. CLI agents (claude → pi/omp → kiro → qwen → gemini → codex) BEFORE host IDEs (cursor → vscode → jetbrains → zed). The reorder is principle-driven: agents have stronger identity signals (their own config dir) than host IDEs (which routinely sit alongside other agents).detect.ts: replace deadPI_PROJECT_DIRmarker with the live Pi runtime envs (PI_CONFIG_DIR,PI_CODING_AGENT_DIR,PI_SESSION_FILE) confirmed in upstream Pi source.detect-ambiguity-matrix.test.ts: all-pairs config-dir ambiguity matrix — every adapter-vs-adapter combination tested for the deterministic winner. Locks the cascade order so a future innocent-looking reorder can't silently regress detection.
#543 — better-sqlite3 ABI cache missing when CLI runs under Bun
Reporter saw: Native addon ABI cache missing warnings + a manual cp workaround that fixed it. Their diagnosis assumed probeNativeInChildProcess was throwing under Bun. Verification: not the throw — the mechanism is two early-returns.
hooks/ensure-deps.mjs:67-68—if (globalThis.Bun) returnbefore the install pathhooks/ensure-deps.mjs:115-116— sameglobalThis.Bungate before the rebuild path
Both short-circuits assumed Bun handles SQLite via bun:sqlite (correct, for sqlite access). They forgot that the same install also serves Node boots. When the user later runs node start.mjs, Node looks for build/Release/better_sqlite3.abi${process.versions.modules}.node and the file was never created because Bun never copied it from the source .node.
Fix: 30 LoC before the Bun early-return — copy build/Release/better_sqlite3.node → build/Release/better_sqlite3.abi${process.versions.modules}.node if the source exists and the destination doesn't. Wrapped in try/catch (cp failure must not block Bun's fast-path). Idempotent. Bun spoofs process.versions.modules = 137, matching Node 24 ABI, so the filename is correct for cross-runtime boots.
Adjacent claims (db-base.ts:265,269 and cli.ts:1029 Bun-unsafe) verified FALSE before scope expansion:
src/session/db-base.ts:218already hasif ((globalThis as any).Bun)routing toBunDatabaseFactory(usesbun:sqlite). The require() sites at 265,269 are insideelse if (process.platform === "linux")and the finalelse— unreachable under Bun.src/cli.ts:465doctor usesloadDatabase()which routes Bun →bun:sqlite.
Scope kept narrow to #543. 5 new tests in tests/core/cli.test.ts covering: seed-on-missing, no-op-on-missing-source, idempotent-when-cache-exists, no-op-when-nativeDir-missing, cross-platform-path-separators.
#531 fix-of-fix — postinstall mutating source-tracked plugin.json on contributor / CI installs
The v1.0.122 ship of #531 (.mcp.json architectural untrack + asymmetric-drift CI invariant) had a follow-up regression. CI run 25734987495 on Windows-latest failed npm run build because scripts/postinstall.mjs section 4 called normalizeHooksOnStartup, which rewrote ${CLAUDE_PLUGIN_ROOT} → an absolute Windows path in source-tracked .claude-plugin/plugin.json. The next build step (assert-asymmetric-drift) then detected the drift and failed.
The pre-existing TMPDIR_UPGRADE_RE guard only skipped /ctx-upgrade staging — not contributor / CI installs. Every npm install from a git clone was mutating source.
Fix: gate section 4 with isGlobalInstall() (same heuristic section -1 uses — npm_config_global=true AND no .git walking up). Test in tests/scripts/asymmetric-drift-assert.test.ts drives the exact contributor / CI scenario and locks the contract so the heal cannot silently regain mutation power.
Tests
- 3136 pass · 9 pre-existing baseline failures (8 OpenCodeAdapter opencode.test.ts + 1 cli-upgrade-verification marketplace-regex) — same baseline as v1.0.122, present on
origin/nextat v1.0.122, unrelated to this changeset. - 5 new Bun ABI cache tests (
tests/core/cli.test.ts) - 100-line all-pairs ambiguity matrix (
tests/adapters/detect-ambiguity-matrix.test.ts) - 81-line ctx_upgrade platform-threading test (
tests/util/ctx-upgrade-platform-threading.test.ts) - Detect-config-dir reorder test (
tests/adapters/detect-config-dir.test.ts) - Postinstall scope guard regression test in
tests/scripts/asymmetric-drift-assert.test.ts
Compatibility
15 adapters / 3 OS. No interface changes. The Pi → OMP rebrand keeps both Pi CLI and Pi Coding Agent legacy clientInfo mappings (→ pi) AND adds omp-coding-agent → omp (separate platforms per #473 data-isolation). Bun fix is additive — the cp-fallback only fires on the Bun codepath, leaving Node-side behavior unchanged.
Upgrade
npm install -g context-mode@latest
# inside Claude Code:
/ctx-upgrade
# restart your sessionBun users with a v1.0.122 install: the manual workaround from the #543 report (cp .../better_sqlite3.node .../better_sqlite3.abi137.node) is still valid — v1.0.123 just makes it automatic.
Thanks
@AurelienGoff for the Pi/OMP misdetection report (#542) with clientInfo.name = "omp-coding-agent" cited verbatim — the upstream-rename signal made the cascade-fix obvious. @dashanlkk for the staff-grade #543 report (verbatim error string, valid cp workaround, clean repro under Bun) — turning a 30-minute investigation into a 30-second one. Every report this cycle came with file:line citations or shell-ready repros; that's what makes mechanical fixes possible.