Skip to content

feat(android): stability, long-prompt preservation, and OpenCode v2 compatibility - #218

Open
meramsey wants to merge 7 commits into
dzianisv:mainfrom
meramsey:fix/android-stability-opencode2-compat
Open

meramsey wants to merge 7 commits into
dzianisv:mainfrom
meramsey:fix/android-stability-opencode2-compat

Conversation

@meramsey

Copy link
Copy Markdown

Summary

This PR builds on top of PR #216 and adds:

  • SSE lifecycle management: background/foreground recovery, idle connection detection, and proper reconnection with state reconciliation
  • Encrypted per-session draft persistence: drafts survive backgrounding and process recreation
  • Long-prompt preservation: removed the 10k character composer limit; prompts up to 100k characters are preserved exactly
  • Session-state reconciliation: after reconnect, the app fetches authoritative status and reconciles pending permissions/questions
  • OpenCode v2 API compatibility: v2 transport with v1 fallback, PermissionV2 event/reply handling
  • Authentication diagnostics: distinguish missing credentials from rejected credentials
  • Documentation: upstream integration ledger and compatibility/lifecycle documentation

Test plan

  • npm run typecheck passes
  • All 395 unit tests pass
  • npm run check:versions passes
  • git diff --check passes
  • Android release build succeeds
  • Physical Android device testing (no device available)
  • Live OpenCode v2 server interoperability testing

Dependencies

This PR depends on #216 being merged first. The base commit is 6b153be (PR #216 head).

🤖 Generated with Claude Code

xtiang7c0 and others added 7 commits October 5, 2026 08:02
…screens

Two issues found while testing against OpenCode 1.18.34:

1. Permission prompts never appeared for tool calls. The server emits
   permission.v2.asked events with {id, sessionID, action, resources},
   but the SSE handler only matched the legacy permission.asked format.
   Added a normalization layer (src/lib/permissions.ts) that converts
   both protocol generations into a single internal model, and updated
   the event handler to process v2 asked/replied events. Pending
   permissions are also reconciled on SSE reconnect and app foreground
   so a missed event doesn't leave the session stuck.

2. Keyboard covered input fields on the connection add/edit screens.
   The chat screen already used KeyboardAvoidingView with
   behavior="padding", but the connection screens used a bare ScrollView.
   On Android 15+ edge-to-edge, adjustResize is a no-op so the keyboard
   stays on top of the content. Wrapped both connection screens in the
   same KeyboardAvoidingView pattern.

Includes PR dzianisv#210 (IME insets) which was already open.
…ired) from rejected credentials

The health probe only sends Authorization when a password is filled in.
A 401/403 in that state says nothing about the saved password — the user
may simply not have typed it yet — but classify() reported it as
"the server rejected your credentials", sending people re-typing a
perfectly good password (seen live against a self-hosted server that
protects /global/health).

- ProbeAttempt gains authProvided, set by probeConnection from the auth it sent
- classify(): 401/403 + !authProvided -> new auth-required classification
  with an "enter the password" message instead of "rejected your credentials"
- sentry-noise: auth-required joins the auth-failed drop family (user config)
- tests for all four combinations
…ompatibility

- Add SSE lifecycle management with background/foreground recovery
- Add encrypted per-session draft persistence
- Remove composer character limit; preserve long prompts exactly
- Add session-state reconciliation after reconnect
- Add pending permission/question reconciliation
- Improve authentication diagnostics (distinguish missing vs rejected creds)
- Add OpenCode v2 API compatibility with v1 fallback
- Add upstream integration ledger and compatibility documentation
- Set applicationId to cc.agentlabs.opencode.test for side-by-side installs

This branch has not been deployed

No deployments
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.

3 participants