Skip to content

OPE-147 Detect server API protocol (v1/v2) - #161

Merged
ivanfenenko merged 3 commits into
feature/ope-146-server-api-v2from
feature/ope-147-p0-detect-server-api-protocol
Aug 12, 2026
Merged

ivanfenenko merged 3 commits into
feature/ope-146-server-api-v2from
feature/ope-147-p0-detect-server-api-protocol

Conversation

@ivanfenenko

@ivanfenenko ivanfenenko commented Aug 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Dual-probe /global/health then /api/health on iOS and Android (desktop-compatible classification) and cache ServerProtocol on the active connection.
  • Expose ServerCapabilities (e.g. supportsSessionMessageDiff) for later capability gates without forking Screen Models.
  • Add protocol matrix unit tests on both platforms so v1-only, v2-only, dual, transitional, and failure paths are covered.

Docs

  • docs/features/server-api-v2/
  • docs/features/server-connection/research-opencode-api-v2.md

Checks

  • Android: ServerProtocolClassifierTest, ConnectionProbeServiceTest, ActiveConnectionManagerProtocolTest passed
  • iOS: ServerProtocolClassifierTests, ConnectionProbeServiceTests, ConnectionSetupViewModelTests passed

Linear

  • OPE-147 (parent epic OPE-146)

Test plan

  • Test Connection against a v1 server still succeeds
  • Test Connection against a v2-only server (/api/health with pid) succeeds
  • Diagnostic logs show protocol=v1 or protocol=v2 after probe
  • Home probe after save refreshes/caches protocol on the active connection
  • Unreachable / bad auth still fails Test Connection (does not default to v2)

Risks / Follow-ups

  • P0 only: remotes still call v1 paths for product APIs; P1+ (OPE-148+) routes repositories for v2.
  • Connection probe intentionally does not default to v2 when both health endpoints fail (safer than desktop detect-only default).

Made with Cursor


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.

Dual-probe /global/health and /api/health on iOS and Android, cache the
protocol on the active connection, and cover both generations with unit tests.

Co-authored-by: Cursor <[email protected]>
@linear-code

linear-code Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
OPE-147 P0: Detect server API protocol

Parent

OPE-146 — Server API v2 Compatibility

What to build

Foundation for dual-stack protocol support on iOS and Android:

  • ServerProtocol = v1 | v2
  • Detect like desktop: probe GET /global/health, then GET /api/health (prefer pid for v2)
  • Cache protocol on active ServerConnection / DI (not UI state)
  • ServerCapabilities derived from protocol (e.g. supportsSessionMessageDiff)
  • Dual health so Test Connection / home probe works against either server
  • Diagnostic logs include protocol=

Exit: connect/save against a v2-only server succeeds; v1 still works; UI unchanged.

Remaining:

  • ☑ ServerProtocol + detection in ConnectionProbeService (both platforms)
  • ☑ Cache on active connection / DI
  • ☑ ServerCapabilities surface
  • ☑ Dual health path for connection setup + home probe
  • ☑ Protocol in diagnostic logs

Docs: docs/features/server-api-v2/

Branch: feature/ope-147-p0-detect-server-api-protocol

Review in Linear

@ivanfenenko

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4b250c3. Configure here.

@ivanfenenko
ivanfenenko changed the base branch from main to feature/ope-146-server-api-v2 August 12, 2026 15:44
Phase PRs target feature/ope-146-server-api-v2; merge to main only when the epic is ready.

Co-authored-by: Cursor <[email protected]>
@ivanfenenko

Copy link
Copy Markdown
Collaborator Author

Retargeted this PR onto the epic integration branch feature/ope-146-server-api-v2 (not main).

Subsequent OPE-148…OPE-153 PRs should also use base feature/ope-146-server-api-v2. The integration branch merges to main once when the whole migration is ready.

Keep 401/403 ahead of later 404s in dual-probe failure ranking, surface
healthy:false bodies as unhealthy, and update Android protocol under the
ActiveConnectionManager mutex.

Co-authored-by: Cursor <[email protected]>
@ivanfenenko
ivanfenenko merged commit 9aefae6 into feature/ope-146-server-api-v2 Aug 12, 2026
7 checks passed
@ivanfenenko
ivanfenenko deleted the feature/ope-147-p0-detect-server-api-protocol branch August 12, 2026 17:30
ivanfenenko added a commit that referenced this pull request Aug 13, 2026
* OPE-147 Detect server API protocol (v1/v2) (#161)

* OPE-147 Detect v1/v2 server API protocol on connect.

Dual-probe /global/health and /api/health on iOS and Android, cache the
protocol on the active connection, and cover both generations with unit tests.

Co-authored-by: Cursor <[email protected]>

* OPE-147 Document stacking Server API v2 PRs on the epic branch.

Phase PRs target feature/ope-146-server-api-v2; merge to main only when the epic is ready.

Co-authored-by: Cursor <[email protected]>

* OPE-147 Prefer auth/unhealthy probe errors and lock protocol cache.

Keep 401/403 ahead of later 404s in dual-probe failure ranking, surface
healthy:false bodies as unhealthy, and update Android protocol under the
ActiveConnectionManager mutex.

Co-authored-by: Cursor <[email protected]>

---------

Co-authored-by: Cursor <[email protected]>

* OPE-148 Route read-only home onto v2 session APIs (#162)

* OPE-148 Route home session and project APIs for v1 and v2.

Keep Screen Models on domain types by dual-stacking remotes behind the
session and project repositories so a v2 server can list and open sessions.

Co-authored-by: Cursor <[email protected]>

* OPE-148 Probe before v2 home routing and follow session list cursors.

Keep disk-first home from hitting unprefixed remotes before protocol
detection, and collect every v2 session page instead of the first 50.

Co-authored-by: Cursor <[email protected]>

---------

Co-authored-by: Cursor <[email protected]>

* OPE-149 Project v2 session messages into domain chat history (#163)

* OPE-149 Project v2 session messages into domain chat history.

Co-authored-by: Cursor <[email protected]>

* OPE-149 Carry switched agent and model onto v2 assistant history.

Co-authored-by: Cursor <[email protected]>

---------

Co-authored-by: Cursor <[email protected]>

* OPE-150 Route v2 live events and prompt send through domain adapters (#164)

* OPE-150 Route v2 live events and prompt send through domain adapters

Co-authored-by: Cursor <[email protected]>

* OPE-150 Surface v2 step failure text in session.error

Co-authored-by: Cursor <[email protected]>

---------

Co-authored-by: Cursor <[email protected]>

* OPE-151 Route v2 permissions, questions, and catalogs through existing repositories (#165)

Keep Screen Models on today's domain types so permission/question docks, stop, slash commands, and the model picker work on v2 without protocol forks.

Co-authored-by: Cursor <[email protected]>

* OPE-152 Route v2 compact, revert, todos, VCS, and add-project through existing repositories (#166)

* OPE-152 Route v2 compact, revert, todos, VCS, and add-project through existing repositories

Keep Screen Models on today's domain types while dual-mapping secondary session and filesystem APIs so compact, undo/redo, Changes, and Add Project work on v2-only servers.

Co-authored-by: Cursor <[email protected]>

* OPE-152 Keep event-seeded v2 todos when REST snapshot is missing

Throw on the missing v2 todo route instead of returning an empty list so reconnect does not wipe todos already filled from events.

Co-authored-by: Cursor <[email protected]>

---------

Co-authored-by: Cursor <[email protected]>

* OPE-153 Hide last-turn review on v2 via ServerCapabilities (#167)

* OPE-153 Hide last-turn review on v2 via ServerCapabilities

v2 has no session message-diff twin, so Changes and chat should keep working-tree diffs and skip last-turn instead of calling the v1 path.

Co-authored-by: Cursor <[email protected]>

* OPE-153 Seed v2 Changes sources from capabilities before the git probe

Co-authored-by: Cursor <[email protected]>

---------

Co-authored-by: Cursor <[email protected]>

* OPE-155 Isolate v1/v2 HTTP remotes behind repository ports (#168)

* OPE-155 Isolate v1/v2 HTTP remotes behind repository ports

Centralize protocol-or-probe on the active connection and hide dialect dispatch inside Session and Message remotes so Screen Models stay on product language.

Co-authored-by: Cursor <[email protected]>

* OPE-155 Do not cache a probe result on a replaced connection.

A disconnect or profile switch during an in-flight protocol probe could stamp the old server's dialect onto the new connection and keep remotes on the wrong HTTP API.

Co-authored-by: Cursor <[email protected]>

---------

Co-authored-by: Cursor <[email protected]>

* OPE-146 Allow Firebase App Distribution from a chosen ref (#169)

* OPE-146 Allow Firebase App Distribution from a chosen ref

Keep automatic deploys on main and add a manual dispatch input so testers can get a signed build without merging.

Co-authored-by: Cursor <[email protected]>

* OPE-146 Pass App Distribution source_ref through env

Avoid interpolating the dispatch input inside a run script so a crafted ref cannot inject into the signing jobs.

Co-authored-by: Cursor <[email protected]>

---------

Co-authored-by: Cursor <[email protected]>

* OPE-146 Run App Distribution when dispatched from a feature branch (#170)

The job no longer skips workflow_dispatch just because the ref is not main, so a 146 tester build can use that branch's workflow file.

Co-authored-by: Cursor <[email protected]>

* OPE-146 Run Android CI on fedora-box instead of Blacksmith (#171)

Blacksmith is not picking up App Distribution jobs. Point remaining Android workflows at the online fedora-box runner; iOS already uses the Mac mini.

Co-authored-by: Cursor <[email protected]>

* OPE-146 Probe protocol before SSE and keep v2 HTTP errors typed.

Cold-start streaming and Changes were still using a cached v1 snapshot, and v2 empty-body helpers threw IllegalStateException so failures looked like transport errors instead of HTTP.

Co-authored-by: Cursor <[email protected]>

---------

Co-authored-by: Cursor <[email protected]>
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