Skip to content

fix(opencode): support server.info discovery without breaking earlier V2 - #697

Merged
pascalandr merged 1 commit into
NeuralNomadsAI:devfrom
pascalandr:fix/opencode-info-discovery
Sep 17, 2026
Merged

pascalandr merged 1 commit into
NeuralNomadsAI:devfrom
pascalandr:fix/opencode-info-discovery

Conversation

@pascalandr

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #695: restore connections to OpenCode 2.0.7, whose authenticated service metadata endpoint is /api/info. Built directly on current dev (aa51cbb9).

  • Probe /api/status, then /api/health, then /api/info, advancing only on HTTP 404.
  • Preserve credentials, the absolute deadline, bounded/validated responses, and reject redirects.
  • Record the discovered route and adapt the pinned client's GET server.status() call to /api/info.
  • Preserve OpenAPI contract negotiation for unknown releases; no 2.0.7 special case or new minimum version.

OpenCode 2.0.0 remains supported by the existing health path. Its real isolated daemon passes the connection and native location regression fixture with this change.

This PR contains only the service discovery/transport fix and its tests/docs. Worktree catalogue performance/cache changes remain in #649 and are not dependencies of this fix.

Evidence

Comparing all 132 generated-client HTTP method/path pairs against the installed 2.0.7 OpenAPI schema found 131 unchanged pairs and the status/info difference fixed here. Experimental routes were already covered by #695; no additional experimental-route migration is needed.

Validation

  • 44 focused host/WSL lifecycle, shared-service, transport and negotiation tests
  • Server TypeScript check
  • Real isolated OpenCode 2.0.0: production health discovery, canonical client.server.status(), legacy location identity, Forms, Shell/PTY scoping, SSE, foreign cursor/session refusal and exact move rollback
  • Real isolated OpenCode 2.0.7: production info discovery, canonical client.server.status(), modern worktree location and obsolete-selector rejection
  • Staged whitespace check

Native fixtures use dedicated temporary databases/configuration and do not target the shared user daemon. These checks establish discovery and targeted contract behavior, not an exhaustive certification of all runtime features.

Signed commit: 16d10fcd.

OpenCode 2.0.7 exposes /api/info instead of /api/status or /api/health. Extend authenticated host and WSL lifecycle discovery with an info probe only after both earlier routes return 404. Preserve the shared deadline, response bounds, schema validation and credential handling, and reject redirects. Older V2 services continue to connect through health without a new minimum-version gate.

Record the discovered route on the connection and translate the pinned client's GET server.status call to info. Keep structural OpenAPI negotiation for unknown runtimes, and do not retry failed API operations or translate mutations.

Add host/WSL discovery, malformed-response, cancellation/deadline and generated-client regressions. Exercise production lifecycle probes in the isolated native location fixture. All 44 focused tests and server typecheck pass; real isolated OpenCode 2.0.0 and 2.0.7 pass discovery, canonical status and their native location scenarios. Update integration references and record the route audit and validation boundaries. This follow-up to NeuralNomadsAI#695 is independent of NeuralNomadsAI#649 worktree catalogue changes.
@pascalandr
pascalandr merged commit e47e01c into NeuralNomadsAI:dev Sep 17, 2026
15 checks passed
@github-actions

Copy link
Copy Markdown

PR builds are available as GitHub Actions artifacts:

https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/35269200137

Artifacts expire in 7 days.
Artifacts:

  • pr-697-16d10fcd09ed9d32f140b0b751f2cf17a579a8bb-electron-macos
  • pr-697-16d10fcd09ed9d32f140b0b751f2cf17a579a8bb-tauri-linux
  • pr-697-16d10fcd09ed9d32f140b0b751f2cf17a579a8bb-tauri-windows
  • pr-697-16d10fcd09ed9d32f140b0b751f2cf17a579a8bb-tauri-macos
  • pr-697-16d10fcd09ed9d32f140b0b751f2cf17a579a8bb-electron-windows
  • pr-697-16d10fcd09ed9d32f140b0b751f2cf17a579a8bb-tauri-macos-arm64
  • pr-697-16d10fcd09ed9d32f140b0b751f2cf17a579a8bb-electron-linux
  • session-pruning-plugin-ubuntu-latest
  • session-pruning-plugin-macos-latest
  • session-pruning-plugin-windows-latest

pascalandr added a commit that referenced this pull request Sep 17, 2026
## Summary

Manage complete session families across the opened local repository's
native OpenCode worktrees. This supersedes #642 with the V2
implementation and addresses #319.

- OpenCode owns `worktree.refresh/list/create/remove`; CodeNomad
supplies the default directory, named-branch policy, local repository
scope and verified family transactions.
- A project is the opened local checkout and its registered worktrees,
identified through the physical Git common directory. Independent clones
sharing an OpenCode project ID stay separate.
- Session rows, composer selection, search and the Git panel follow
native `SessionInfo.location.directory`. Durable metadata is preserved,
but old `worktreeSlug` metadata does not override native placement.
- Creation uses the selected checkout's revision and the main local
checkout's `.codenomad/worktrees` parent. Uncommitted edits stay in the
source checkout. External registered worktrees remain discoverable.
- Keep copy/open/delete actions in the accessible selector, remove the
redundant action bar, hide root-workspace badges, and explain “Create
and use” in all ten locales.

## Current base and native contract

This branch includes merged `dev@e47e01c`, including #697's separately
reviewed discovery/status compatibility fix. UI/server pin
`@opencode/client@2.0.4`; the independently managed daemon has no
exact-version startup gate.

- Complete bounded inventories use opaque native cursors; continuations
send only the cursor.
- Moves are serialized across complete families, block active sessions,
verify authoritative native locations and roll back partial failures.
- Native move events refresh placement and the catalogue without
speculative cross-project transfers.
- Opaque worktree identifiers are separate from mutable branch labels.
The main checkout cannot be removed.
- Native detached creation is followed by ordinary Git branch selection,
preserving Git's refusal to reuse a checked-out branch;
branch-attachment failure cleans up through the native API.
- Agent placement instructions distinguish creating a checkout, one-off
commands and moving the conversation's execution context. Explicit
attachment choices are preserved.

## Deletion safety

- Physical checkout reservations cover published and in-flight logical
workspaces.
- Project serialization and deletion fences cover all family
source/destination checkouts.
- Complete inventories and cross-project checks run inside the deletion
fence, including nested workspaces and owned Shell/PTY resources.
- Canonical path, filesystem identity, registration, branch, HEAD and
active sessions are rechecked before removal. Replacement checkouts fail
closed; rollback requires the original identity.

## Recovery and Git-panel corrections

Validation on the real repository exposed serial enumeration of 162
worktrees and concurrent ownership misses launching overlapping
inventories. Git annotations now run with bounded concurrency, pending
catalogue reads are shared, and negative ownership results are
snapshot-cached. A regression exercises 40 concurrent misses.

The Git panel now treats its complete local staged/unstaged inventory as
authoritative instead of resurrecting native-only stale rows. It also
rechecks the selected worktree/request after waiting for native VCS
status.

## Validation

Latest integration validation:

- Isolated official **OpenCode 2.0.0 and 2.0.7**: production
discovery/status, native worktree discovery/create/remove, selected
HEAD/default parent/named branches, independent-clone scope, stable IDs,
nested paths, checked-out/dirty guards, complete family moves and
rollback.
- Real Solid selector browser tests: mouse, keyboard, touch, actions
without session movement, creation source and returned stable ID.
- Targeted server ownership/cache/manager/proxy/route/location tests; UI
session projection/request-authority/lifecycle tests; family
evacuation/rollback and Git model regressions.
- UI/server typechecks and production server build including the UI.
- Installed Windows Tauri application on the actual repository:
dedicated session creation/use, native location and row/composer badges,
Git marker visibility, move back, and agent `session_move` reflected in
both badges.
- Rebuilt UI/server resources installed; full Developer Mode restart
restored the original conversation. Disposable sessions, marker,
worktrees and branches cleaned up. The original conversation remained
attached to `pr649-final`.
- `git diff --check`.

An immediate post-restart desktop run exceeded a 30-second
refresh-button wait; the subsequent completed run passed. These checks
validate the workflows, not a startup latency bound or exhaustive
compatibility of every OpenCode payload.

Earlier branch validation also covered Electron/Tauri native actions,
packaging and desktop parity; those results remain in the PR's
historical validation comments. Detailed contract and latest evidence:
`dev-docs/WORKTREE_SESSION_PLACEMENT.md`.

## Residual limit

OpenCode and Git expose no shared snapshot/CAS transaction. CodeNomad
narrows races with reservations, locks, fences and repeated
authoritative checks; unrelated processes can still mutate state outside
those controls.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant