feat: [v1.18.10] merge upstream OpenCode v1.17.9 → v1.18.10 (grafted 3-way)
PINEAPPLE
Summary
Merges upstream OpenCode v1.17.9 → v1.18.10 (~1,055 upstream commits, 1,937 changed files) into the fork.
Freeze-lift note: the 2026-07-18 harness decision set a 90-day freeze at the v1.17.9 base (security/provider cherry-picks only). This merge lifts that freeze at the user's explicit request — reviewer should confirm this is the intended posture change.
Merge mechanics (new this time)
- True 3-way merge, not an overlay. The fork's tree has no git ancestor with upstream (the v1.4.0 bridge was a tree overlay), so two local, namespaced
git replace --graftrefs gavegit merge v1.18.10a real base (= v1.17.9). Fork changes — marked and unmarked — survived automatically unless upstream touched the same lines; this eliminates the overwrite class that produced v1.4.0's 16 regressions. Grafts were deleted after the merge; history flattened back to single-parent per fork convention. - Merge tooling hardened first (Codex plan review caught 4 blockers):
skipFilesvsauditExcludesplit (the old config would have deleted 904 live files including the fork test suites), delete-only-newly-introduced guard,package.jsonimportsmap preservation, regex-escaped root-domain branding rule, provider identity headers documented inpreservePatterns.
Adopted from upstream
- Code Mode (experimental, flag-gated) + new
packages/codemode; MCP resources (3 new tools + real file attachments with size/MIME guards); durable events (superseded 2 fork patches, dropped in upstream's favor). - Provider layer: adaptive thinking for current Claude models (Sonnet 5 / Opus 5 / Opus 4.5),
reasoning_options+experimental.modes, family/release-date small-model selection, Vertex regional endpoints for Claude, unified prompt-cache keys,forceReasoning, Gemini sampling allowlists, Kimi/Moonshot detection, ~11 new bundled SDK mappings. - Session pipeline (ported into fork architecture):
providerExecutedforwarding (closes a #964 follow-up), per-attachment media support (Bedrock images-not-PDFs in tool results), header-timeout/stream-error retryable mapping, 2 new compaction plugin hooks. - Infra: new
packages/protocol+packages/schemaworkspaces, LayerNode graph redesign (fork's lazy-deps re-added asLayerNode.lazy()), Effect beta.74→beta.83, turbo 2.10.2, SSE bounded queues + heartbeats, shared XSS-escaped OAuth pages, opentui 0.4.5 (build embedding ported — old embedding crashed every compiled TUI at startup).
Fork preserved (verified per-file by 5 review agents + guard suites)
Imperative session core (processor/prompt/llm/message-v2 with all ~15 marked safety/telemetry behaviors), 100+ altimate tools + skill ops, warehouse drivers, validator dispatch, tracing, per-location SSE filtering (now with proper location middleware on the event group), permission split-brain guard (143/143 regression tests), DDL safety denials, brand surfaces, DE tips, yolo/line-streaming, calm mode, Anthropic BUILTIN plugin (restored — dropped in resolution), Snowflake Cortex/Databricks/Altimate auth plugins, tail-preserving compaction, SessionSummary.diff workaround, qwen.txt safety-guardrail prompt.
upstream_fix reconciliation (pre-merge audit: 3 carried)
tools.tsmodel-id re-brand → dropped (upstream ships the identical fix viaModelV2.ID.make)session/index.tspermission column,system.tsdate-outside-cache → carried (upstream has no equivalent)- 2
core/event.tsreplay fixes + 2 share-nextcatchCauseguards → dropped (upstream's durable-events/scoped-fork designs supersede them)
Known issue (follow-up filed in-source)
- AI-7519 phase labels: the TUI busy fallback ("Thinking...") works, but mapped labels ("Discovering tools...") no longer render — publish wiring and TUI store handler verified intact; the event stops somewhere in publish→GlobalBus→RPC→sync. The dev-only, CI-skipped e2e stays red locally as the signal. Schema manifest gap already fixed here.
Deferred (documented .todos + in-source markers, not regressions)
Upstream's Effect-native processor/prompt/message-v2 rewrites; setAgentModel session persistence; core ProviderPlugins header pipeline (NVIDIA billing headers); deeper plugin-config→provider registration; RuntimeFlags DI for the legacy alpha-model filter.
Test Plan
-
bunx turbo typecheck— 16/16 packages -
analyze.ts --branding --strict— 0 leaks;--require-markers --strict— pass; marker guard per CI policy - Suites: core 1102/1102 · tui 203 (0 fail) · server 306/306 · provider 741 (0 fail) · mcp/code-mode 281/281 · permission 143/143 · guard/meta 315/315; full opencode suite re-run post-remediation (see final CI)
- Upgrade path: new binary booted 3× against a copy of the real 1,194-session DB (XDG-isolated) — integrity ok, 0 rows lost, migration journal stable
- Real-binary TUI smoke via pty: brand title + live render, no errors (caught + fixed the opentui 0.4.5 packaging crash that all code gates missed)
- Bridge-guard audit categories (split-brain, fixtures, brand strings, logo, behavior patches, dropped files, script wrappers) covered via guard suites + agent review reports
Checklist
- Tests added/updated
- Documentation updated (merge runbook note on the graft technique to follow)
- CHANGELOG updated (deferred to release PR)
Summary by cubic
Merges upstream OpenCode v1.17.9 → v1.18.10 into the fork with a true 3‑way graft to preserve local changes. Adds Code Mode, provider and session upgrades, a new CLI api command, and hardens SSE, CI build, and merge tooling; this lifts the v1.17.9 freeze.
-
New Features
- Code Mode (flag‑gated) via
packages/codemode, including OpenAPI‑derived tools and confined JS execution. - MCP resources: new tools and real file attachments with size/MIME guards.
- Durable events adopted; replaces prior fork patches.
- Provider layer updates: adaptive reasoning for Claude,
reasoning_options/experimental.modes, Vertex regional endpoints, unified prompt‑cache keys,forceReasoning, Gemini sampling allowlists, plus new SDK mappings. - Session pipeline:
providerExecutedforwarding, per‑attachment media support, retryable mapping, new compaction hooks. - CLI: new
apisubcommand to call server OpenAPI operations orMETHOD path, with headers and JSON body support. - Infra: adds
packages/protocolandpackages/schema; SSE bounded queues + heartbeats;turbo2.10.2.
- Code Mode (flag‑gated) via
-
Bug Fixes
- SSE event manifest now includes
session.status/idle/phase, fixing v2 SSE encode errors. - Merge tooling:
cleanupSkipFilesonly deletes newly introduced files and honors the base‑branch override end‑to‑end. - Code Mode registry: MCP server grouping uses
clientName; session‑level permission filtering restored so session‑denied tools don’t appear inexecute. - CI/build: GitHub Action sets Node 24 for
node-gyp; typecheck includespackages/codemode,packages/protocol, andpackages/schema. - Known issue: TUI phase labels still don’t render; follow‑up remains filed.
- SSE event manifest now includes