fix: apply upstream OpenCode fixes from v1.15.11-v1.15.13#29
Conversation
Backports critical bug fixes and improvements from OpenCode releases
v1.15.11 through v1.15.13 that affect the Codeplane codebase.
- fix(provider): tag SSE read timeout error as ResponseStreamError
for retry logic (upstream #29769)
- fix(codex): use endsWith("/responses") instead of includes to
support custom OpenAI-compatible base URLs without /v1/ prefix
(upstream #29636)
- fix(editor): add cwd parameter to Editor.open() and guard against
worktree="/" for non-git projects (upstream #29180)
- fix(tui): add InlineToolRow wrapper with dynamic margin detection
and click-to-expand error display for failed inline tools
(upstream #28664)
- feat(tui): show reasoning spinner while assistant is still
thinking, with title from first line of reasoning text
(upstream #29765)
- feat(tui): surface subagent retry status in Task component with
error coloring and attempt count (upstream #29591)
- fix(tui): pass project directory as cwd to external editor
in prompt and session export flows
- chore(deps): bump @lydell/node-pty from 1.2.0-beta.10 to
beta.12 and remove now-unnecessary @ts-expect-error
(upstream #29803)
- chore(sdk): regenerate SDK types and OpenAPI spec to include
session metadata in GlobalSession and SyncEventSessionUpdated
Verification:
- bun turbo typecheck: all 8 packages pass
- bun lint: 0 errors (2909 warnings, unchanged)
- bun test: 13 pre-existing failures unrelated to these changes
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Backports upstream OpenCode fixes (v1.15.11–v1.15.13) into Codeplane, spanning provider/SSE behavior, TUI UX improvements, and regenerated SDK/OpenAPI artifacts.
Changes:
- Improve provider + SDK streaming behavior (timeout error tagging; SSE normalization/backoff changes).
- TUI improvements for external editor
cwd, reasoning display, and inline tool error/retry UX. - Update SDK/OpenAPI + generated types (new
/global/auth/verify,metadatafields) and bump@lydell/node-ptyto1.2.0-beta.12.
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/sdk/openapi.json | OpenAPI version bump; adds /global/auth/verify; adds metadata fields to session schemas. |
| packages/sdk/js/src/gen/types.gen.ts | Regenerated v1 SDK types to include metadata + global auth verify types. |
| packages/sdk/js/src/gen/sdk.gen.ts | Regenerated v1 SDK client, adding global.auth.verify and wiring metadata into session create/update. |
| packages/sdk/js/src/gen/core/serverSentEvents.gen.ts | SSE parsing tweaks (buffer normalization) and deterministic backoff. |
| packages/sdk/js/src/v2/gen/types.gen.ts | Regenerated v2 SDK types to include metadata + global auth verify types. |
| packages/sdk/js/src/v2/gen/sdk.gen.ts | Regenerated v2 SDK client, adding global.auth.verify and wiring metadata into session create/update. |
| packages/sdk/js/src/v2/gen/core/serverSentEvents.gen.ts | Same SSE parsing/backoff changes for v2 generator output. |
| packages/codeplane/src/tui/util/editor.ts | Add optional cwd to Editor.open() for temp file placement. |
| packages/codeplane/src/tui/component/prompt/index.tsx | Pass project-derived cwd into external editor flow. |
| packages/codeplane/src/tui/routes/session/index.tsx | Session export uses cwd; reasoning spinner/title; inline tool row wrapper + error expansion; task retry status display. |
| packages/codeplane/src/tui/feature-plugins/system/session-v2.tsx | Reasoning spinner/title behavior aligned with session view. |
| packages/codeplane/src/provider/provider.ts | Tag SSE read timeout with name: "ResponseStreamError" for downstream handling. |
| packages/codeplane/src/plugin/codex.ts | More flexible URL rewrite detection using endsWith("/responses"). |
| packages/codeplane/src/pty/pty.node.ts | Remove obsolete @ts-expect-error after node-pty type improvements. |
| packages/codeplane/package.json | Bump @lydell/node-pty to 1.2.0-beta.12. |
| package.json | Bump root @lydell/node-pty override to 1.2.0-beta.12. |
| bun.lock | Lockfile updates for version bumps and dependency changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| setMargin( | ||
| previous?.id.startsWith("text-") || | ||
| previous?.id.startsWith("tool-block-") || | ||
| props.separateAfter?.(previous?.id) | ||
| ? 1 |
| "description": "Exchange a valid Basic Auth password plus a TOTP code for a short-lived second-factor session token. Returns 401 if the password is wrong, 400 if TOTP is not enabled, and 401 with { totp: true } if the code is invalid.", | ||
| "responses": { | ||
| "200": { | ||
| "description": "Second-factor session token", | ||
| "content": { | ||
| "application/json": { | ||
| "schema": { | ||
| "type": "object", | ||
| "properties": { | ||
| "token": { | ||
| "type": "string" | ||
| }, | ||
| "expiresAt": { | ||
| "type": "number" | ||
| } | ||
| }, | ||
| "required": ["token", "expiresAt"] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }, |
- desktop: remove preventDefault/callback on HTTP basic auth so Electron surfaces the native credential dialog (auth_basic connections were permanently broken) - app: guard event-reducer against undefined event.properties to prevent web UI freeze on malformed SSE events - tui: normalize error objects safely in v2 session plugin InlineTool/BlockTool to prevent TextNodeRenderable crashes when error.message is missing or non-string - tui: add optional chaining on ToolPart.state in v1 session route to prevent crashes on malformed tool parts - app: add keyCode === 229 IME guard in server URL dialog to prevent premature CJK character commit - build: replace Unix-only rm/mkdir shell commands with cross-platform fs.rmSync/fs.mkdirSync so local builds work on Windows Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-Authored-By: codeplane-agent[bot] <287208015+codeplane-agent[bot]@users.noreply.github.com>
Triage — Keep OpenConfirmed real defects in this PR. Copilot review already flagged them; no past agent commentary here. Defects found
Why not closeBoth are user-impacting bugs — one can crash TUI rendering, the other produces an incomplete SDK contract. This PR should remain open until these are fixed or explicitly deferred. |
Review: apply upstream OpenCode fixes from v1.15.11-v1.15.13Status: Merge candidate All CI checks are green. Substantial upstream sync bringing critical fixes: SSE timeout naming, Codex API path routing, Editor cwd, InlineToolRow, reasoning spinner, subagent retry status, IME guard, cross-platform build script, node-pty bump to beta.12. Merging first as a foundation since other PRs touch some of the same files. |
Summary
Backports critical bug fixes and improvements from OpenCode releases v1.15.11 through v1.15.13 that affect the Codeplane codebase. Each fix was verified for applicability by checking the upstream diff against Codeplane's existing code.
Changes
Core fixes
packages/codeplane/src/provider/provider.ts:55— Tag SSE read timeout errors withname: "ResponseStreamError"so retry logic can distinguish timeouts from other errorspackages/codeplane/src/plugin/codex.ts:530— UseendsWith("/responses")instead ofincludes("/v1/responses")to support custom OpenAI-compatible base URLs without a/v1/path prefixTUI fixes
packages/codeplane/src/tui/util/editor.ts:9— Addcwdparameter toEditor.open()so temp files are created in the project directory when possiblepackages/codeplane/src/tui/routes/session/index.tsx:1222-1242— Guard againstworktree === "/"(non-git projects) when computingcwdfor external editor callspackages/codeplane/src/tui/component/prompt/index.tsx:692— Pass projectcwdto external editor in prompt flowpackages/codeplane/src/tui/routes/session/index.tsx:1995— AddInlineToolRowwrapper with dynamicrenderBeforemargin detection and click-to-expand error display for failed inline toolspackages/codeplane/src/tui/routes/session/index.tsx:1786— Show reasoning spinner while assistant is still thinking; render "Thought" when completepackages/codeplane/src/tui/feature-plugins/system/session-v2.tsx:372— Same reasoning spinner fix for v2 session pluginpackages/codeplane/src/tui/routes/session/index.tsx:2418— Surface subagent retry status in Task component with error coloring and retry attempt countAdditional user-impacting bug fixes
packages/desktop/src/main/main.ts— Removedevent.preventDefault()andcallback()from the HTTP Basic Authloginhandler. The previous code suppressed Electron's native credential dialog, permanently breakingauth_basicconnections for desktop users.packages/app/src/context/global-sync/event-reducer.ts— Addedundefinedguard forevent.propertiesbefore accessing.partin themessage.part.updatedhandler, preventing web UI freezes from malformed SSE events.packages/codeplane/src/tui/feature-plugins/system/session-v2.tsx— Defensively normalize error values inInlineToolandBlockToolwith optional chaining and type coercion, preventing TUI crashes when tool error payloads lack a string.message.packages/codeplane/src/tui/routes/session/index.tsx— Added optional chaining onToolPart.statein the v1 session route to prevent crashes on sessions containing malformed tool parts.packages/app/src/components/dialog-select-server.tsx— Addedevent.keyCode === 229IME composition guard alongsideevent.isComposingin the server URL dialog, preventing premature character commit for CJK users.packages/codeplane/script/build.ts— Replaced Unix-onlyrm -rfandmkdir -pshell commands with cross-platformfs.rmSync/fs.mkdirSyncso local builds work on Windows.Dependencies
package.json,packages/codeplane/package.json— Bump@lydell/node-ptyfrom1.2.0-beta.10to1.2.0-beta.12packages/codeplane/src/pty/pty.node.ts:1— Remove now-unnecessary@ts-expect-error(beta.12 ships proper types)SDK regeneration
packages/sdk/js/src/gen/types.gen.ts,packages/sdk/js/src/v2/gen/types.gen.ts— Regenerated to includemetadatafield inGlobalSessionandSyncEventSessionUpdatedtypesVerification
bun turbo typecheck— all 8 packages passbun lint— 0 errors (warnings unchanged)