Skip to content
This repository was archived by the owner on Jun 1, 2026. It is now read-only.

fix: apply upstream OpenCode fixes from v1.15.11-v1.15.13#29

Merged
devinoldenburg merged 2 commits into
mainfrom
fix/upstream-sync-v1.15.13
Jun 1, 2026
Merged

fix: apply upstream OpenCode fixes from v1.15.11-v1.15.13#29
devinoldenburg merged 2 commits into
mainfrom
fix/upstream-sync-v1.15.13

Conversation

@devinoldenburg
Copy link
Copy Markdown
Collaborator

@devinoldenburg devinoldenburg commented Jun 1, 2026

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 with name: "ResponseStreamError" so retry logic can distinguish timeouts from other errors
  • packages/codeplane/src/plugin/codex.ts:530 — Use endsWith("/responses") instead of includes("/v1/responses") to support custom OpenAI-compatible base URLs without a /v1/ path prefix

TUI fixes

  • packages/codeplane/src/tui/util/editor.ts:9 — Add cwd parameter to Editor.open() so temp files are created in the project directory when possible
  • packages/codeplane/src/tui/routes/session/index.tsx:1222-1242 — Guard against worktree === "/" (non-git projects) when computing cwd for external editor calls
  • packages/codeplane/src/tui/component/prompt/index.tsx:692 — Pass project cwd to external editor in prompt flow
  • packages/codeplane/src/tui/routes/session/index.tsx:1995 — Add InlineToolRow wrapper with dynamic renderBefore margin detection and click-to-expand error display for failed inline tools
  • packages/codeplane/src/tui/routes/session/index.tsx:1786 — Show reasoning spinner while assistant is still thinking; render "Thought" when complete
  • packages/codeplane/src/tui/feature-plugins/system/session-v2.tsx:372 — Same reasoning spinner fix for v2 session plugin
  • packages/codeplane/src/tui/routes/session/index.tsx:2418 — Surface subagent retry status in Task component with error coloring and retry attempt count

Additional user-impacting bug fixes

  • packages/desktop/src/main/main.ts — Removed event.preventDefault() and callback() from the HTTP Basic Auth login handler. The previous code suppressed Electron's native credential dialog, permanently breaking auth_basic connections for desktop users.
  • packages/app/src/context/global-sync/event-reducer.ts — Added undefined guard for event.properties before accessing .part in the message.part.updated handler, preventing web UI freezes from malformed SSE events.
  • packages/codeplane/src/tui/feature-plugins/system/session-v2.tsx — Defensively normalize error values in InlineTool and BlockTool with 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 on ToolPart.state in the v1 session route to prevent crashes on sessions containing malformed tool parts.
  • packages/app/src/components/dialog-select-server.tsx — Added event.keyCode === 229 IME composition guard alongside event.isComposing in the server URL dialog, preventing premature character commit for CJK users.
  • packages/codeplane/script/build.ts — Replaced Unix-only rm -rf and mkdir -p shell commands with cross-platform fs.rmSync / fs.mkdirSync so local builds work on Windows.

Dependencies

  • package.json, packages/codeplane/package.json — Bump @lydell/node-pty from 1.2.0-beta.10 to 1.2.0-beta.12
  • packages/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 include metadata field in GlobalSession and SyncEventSessionUpdated types

Verification

  • Typecheck: bun turbo typecheck — all 8 packages pass
  • Lint: bun lint — 0 errors (warnings unchanged)

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>
Copilot AI review requested due to automatic review settings June 1, 2026 04:26
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, metadata fields) and bump @lydell/node-pty to 1.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.

Comment on lines +2146 to +2150
setMargin(
previous?.id.startsWith("text-") ||
previous?.id.startsWith("tool-block-") ||
props.separateAfter?.(previous?.id)
? 1
Comment thread packages/sdk/openapi.json
Comment on lines +685 to +706
"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>
@devinoldenburg
Copy link
Copy Markdown
Collaborator Author

Triage — Keep Open

Confirmed real defects in this PR. Copilot review already flagged them; no past agent commentary here.

Defects found

  1. Potential crash in InlineToolRow margin calc (src/tui/routes/session/index.tsx): previous?.id.startsWith(...) throws when previous?.id is undefined. Needs previous?.id?.startsWith(...).
  2. OpenAPI spec gap (sdk/openapi.json): /global/auth/verify only declares 200, but implementation returns 400/401/429. Generated SDK will miss error payloads.

Why not close

Both 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.

@devinoldenburg
Copy link
Copy Markdown
Collaborator Author

Review: apply upstream OpenCode fixes from v1.15.11-v1.15.13

Status: 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.

@devinoldenburg devinoldenburg merged commit 5e9d6c0 into main Jun 1, 2026
11 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants