Fix OpenCode ownership and restart recovery#336
Merged
Conversation
added 30 commits
May 6, 2026 00:10
OpenCode CLI's TUI enables mouse tracking for click-handling, which caused the fallbackToCursorKeysWhenAltScreenMouseCapture policy to intercept scroll events and send up/down arrow keys instead. The CLI doesn't interpret arrow keys as scroll commands, so scrolling broke. Change scrollInputPolicy to 'native' so xterm.js passes mouse scroll SGR sequences through to the CLI, letting it handle them natively.
…creen - Skip term.scrollLines() in alt screen for touch scrolling (it's a no-op since alternate buffer has no scrollback) - Update opencode scroll/touch test fixtures and assertions to match the new native policy: OpenCode no longer translates scroll events to cursor keys
# Conflicts: # server/coding-cli/codex-app-server/launch-planner.ts # server/coding-cli/codex-app-server/runtime.ts # server/index.ts # test/unit/server/coding-cli/codex-app-server/launch-planner.test.ts # test/unit/server/coding-cli/codex-app-server/runtime.test.ts
added 6 commits
May 16, 2026 16:12
9324c5b to
6b7b4fb
Compare
added 14 commits
May 18, 2026 00:46
…ain-parity-20260518-004614
…ain-parity-20260518-004614
…ain-parity-20260518-004614
…ain-parity-20260518-004614
…ain-parity-20260518-004614
…ain-parity-20260518-004614
…ain-parity-20260518-004614
…ain-parity-20260518-004614
…ain-parity-20260518-004614
…ain-parity-20260518-004614 # Conflicts: # server/ws-handler.ts # src/components/agent-chat/AgentChatView.tsx
…ain-parity-20260518-004614 # Conflicts: # docs/lab-notes/2026-04-20-coding-cli-session-contract.md # server/coding-cli/opencode-activity-tracker.ts # server/coding-cli/opencode-activity-wiring.ts # server/coding-cli/opencode-session-controller.ts # server/coding-cli/providers/opencode.ts # server/index.ts # server/mcp/freshell-tool.ts # server/session-observability.ts # server/terminal-registry.ts # server/ws-handler.ts # src/components/TerminalView.tsx # src/store/paneTypes.ts # src/store/selectors/paneTerminalSelectors.ts # test/e2e/codex-refresh-rehydrate-flow.test.tsx # test/e2e/terminal-restart-recovery.test.tsx # test/server/session-association.test.ts # test/unit/client/components/TerminalView.lifecycle.test.tsx # test/unit/server/coding-cli/opencode-activity-tracker.test.ts # test/unit/server/coding-cli/opencode-activity-wiring.test.ts # test/unit/server/coding-cli/opencode-provider.test.ts # test/unit/server/coding-cli/opencode-session-controller.test.ts
This was referenced May 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/session/status,session.createdhandling, reducer fixes, and stricter ambiguous-warning emission.Dev Parity
This PR now carries or supersedes the dev-only restart recovery commits:
ef3f07ae->af8d07cbdocs: capture opencode restart postmortem2ec8316a->25f4e419docs: add opencode restart resilience handoff2b4c4241->56f97ab3fix: wire opencode root resolver in production7b2d431b->8cac280cfix: restore opencode sessions across restartsfab3305a->3d382483fix: preserve extension registry during restart refreshIt also still includes the earlier OpenCode ownership-control-plane commits already present on this PR branch.
Root Cause
Two commits (29dc693, c1f76b1) introduced an ownership reducer with
ambiguousstate. Child sessions appear as separate busy sessions in/session/statusbut were not being filtered. Thesession.createdSSE path was also dead code due to a schema mismatch with the SDK.The later restart work fixed the production root-resolver wiring and client/server restore flow so OpenCode panes can recover after stale terminal handles disappear during a server restart.
Changes
server/coding-cli/providers/opencode.ts- expose root resolution and database/WAL watching behavior.server/coding-cli/opencode-ownership-reducer.ts- fix UNION behavior, ambiguous-to-known transitions, and strictwarnAmbiguousemission.server/coding-cli/opencode-activity-tracker.tsand wiring - filter children via DB resync/SSE and pass the production root resolver.server/terminal-registry.ts,server/ws-handler.ts, and client restore paths - recover OpenCode panes after restart and keep restore fallback diagnostics explicit.