Skip to content

Add Even Realities G2 smart-glasses companion app (even-g2/) - #19178

Open
naokiupa wants to merge 6 commits into
stablyai:mainfrom
naokiupa:naokiupa/even-g2
Open

naokiupa wants to merge 6 commits into
stablyai:mainfrom
naokiupa:naokiupa/even-g2

Conversation

@naokiupa

@naokiupa naokiupa commented Sep 7, 2026

Copy link
Copy Markdown

Orca for Even Realities G2 — smart‑glasses companion

Adds even-g2/, a new standalone web app that brings Orca's mobile companion experience to Even Realities G2 smart glasses, reinterpreted for a glanceable heads‑up display. There was no G2 app in this repo before; this is a greenfield addition and does not touch the desktop or mobile/ builds.

Why a web app (and not raw BLE)

The G2's official, app‑store‑distributable path is the Even Hub SDK: your app is a web app served to the phone's Even App, which renders firmware "containers" (text/list) on the glasses and relays tap/scroll/double‑tap input back over BLE. even-g2/ follows that model and talks to an Orca desktop over Orca's existing end‑to‑end‑encrypted WebSocket JSON‑RPC protocol, reusing the src/shared/* wire types. Zero wire changes; it advertises an empty client‑capability set and version‑gates via status.get.

What it does on the HUD

  • Agent status dashboard — per‑worktree agent state (working / needs‑input / done / idle), urgent (needs‑input) rows first, a glanceable ▲ N need you · x/y header.
  • Permission‑ask quick actions (the killer feature) — when an agent blocks on a permission prompt, it surfaces on the glasses; the wearer scrolls to an option and clicks to answer, with explicit Sending… / Sent — checking… / Not sent — click to retry feedback.
  • Host & worktree navigation, terminal tail (paginated, follow‑latest), pairing, and a version‑mismatch hard‑block screen.
  • Out of scope for a 576×288 mono HUD (kept on desktop/mobile): full interactive terminal input, PR/diff review, browser mirroring.

How it was built & reviewed

Planned with a design spec (docs/superpowers/specs/2026-09-05-even-g2-app-design.md), implemented in modular units, then put through two adversarial code‑review passes — a general correctness/wire‑compat pass and a real‑wear usability + bug pass — with all CRITICAL and HIGH findings fixed and regression‑tested. Notably fixed during review:

  • Ask keystrokes now target the correct terminal: resolve the worktree's unique terminal whose terminal.agentStatus.status === 'permission' (the real RuntimeTerminalAgentStatus contract) and fail closed on zero/multiple/unverifiable matches — never desktop focus, never a guess. Prompt identity is carried through and re‑validated after async resolution so an expired ask can't answer a later prompt; the send is host+prompt‑scoped and latched against double‑sends.
  • Binary terminal‑stream capability is requested (real hosts otherwise send JSON → blank tail); a post‑auth liveness watchdog recycles a silently‑dropped socket; QR sideload no longer mistakes a dev build for the simulator.

Testing

  • 445 unit + integration tests (even-g2 is self‑contained with its own lockfile, mirroring how mobile/ is isolated).
  • Fully exercisable without hardware or a live desktop via an in‑browser 576×288 canvas simulator + an in‑memory mock Orca server that performs the real E2EE handshake. pnpm sim opens the simulator; pnpm dev + pnpm qr sideloads onto the Even App for real‑device QA.
  • pnpm tc, pnpm build, and oxlint are all green.

Known limitations / follow‑ups (documented, not blocking)

  • Structured option text for permission prompts is not yet rendered — the interim shows the host's notification summary + honest key labels (1 2 3 Enter Esc) and fails closed when the terminal can't be resolved. Rendering exact option text via native-chat-ask is the v2 upgrade (no wire change needed).
  • Relay transport is out of scope for v1 (direct LAN/Tailscale only); adopting relay later requires implementing the E2EE v2 handshake, because the desktop sets requireV2 on relay.
  • Native firmware lists can still reset selection on a status‑glyph rebuild (mitigated by stable ordering; a fully app‑owned text‑list cursor is a future refinement). The worktreeList screen is currently unreachable now that the dashboard serves as the navigable list — to be formally removed or given an entry point in a follow‑up.
  • Real‑hardware BLE/latency and the .ehpk network whitelist remain a hardware‑QA gate before store submission.

🤖 Generated with Claude Code

naokiupa and others added 5 commits September 5, 2026 17:09
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
New standalone web app (Even Hub SDK path) that mirrors orca-mobile's core
flows on the G2 HUD: agent/session status dashboard, permission-ask quick
actions, host/worktree lists, and terminal tail. Reuses Orca's E2EE wire
protocol and src/shared wire types; fully testable via an in-browser canvas
simulator + in-memory mock Orca server (no hardware needed).

267 unit + integration tests, typecheck + Vite build green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ifecycle)

Fixes from an adversarial codex review of the initial implementation:

CRITICAL
- ask quick-actions resolve the host's authoritative terminal (terminal.resolveActive)
  and fail closed instead of guessing the newest-output terminal
- host-scoped effects require session.hostId === effect.hostId and clear host-scoped
  state on switch, so a stale ask can't cross the SSH/remote boundary
- terminal tail requests capabilities.terminalBinaryStream:1 (real hosts send JSON
  otherwise) and degrades to an explicit 'unavailable' instead of a blank tail

HIGH/MEDIUM
- SnapshotStart JSON metadata no longer rendered as terminal text
- terminal.send result (send.accepted) + rpc failures keep the ask actionable
- feature RPCs gated behind the compat verdict; blocked -> hard-block screen
- socket connect/handshake timeouts; no connected-listener double-send; e2ee decode
  size-bound + error containment
- notification permission-ask reclassification race + getMissedSince backfill
- lastOutputAt null handling; render-queue validates every page + spends startup latch
  on throw; force-rebuild after exit-dialog cancel; dashboard cursor/page split;
  worktree-list pagination; device token no longer in DOM attributes
- mock server + integration tests now exercise the real wire contract

267 -> 348 tests; typecheck + Vite build + oxlint all green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Addresses a critical wear-the-glasses UX+bug review:

Ask flow (flagship): resolve the UNIQUE waiting/blocked terminal via
terminal.agentStatus (never desktop focus) and fail closed; synchronous
per-prompt latch prevents double-sends / sends after expiry; phase-driven
footer (Sending… / Sent — checking… / Not sent — click to retry /
Delivery unknown); bounded confirmation poll; dedup + retire + synthesize
current-ask from worktree permission state; one selector for header+click.

Screens/nav: connecting/loading/stale/empty dashboard states; urgent
(needs-input) rows first with a glanceable '▲ N need you · x/y' header;
one stable cursor across dashboard pages (scroll=select/click=open, no
mode flip); middle-ellipsized names keep distinguishing suffixes; stable
worktree ordering avoids selection-resetting flicker; terminal tail states
(loading/unavailable/empty) and follow-latest paging with click=latest;
single-line header/footer budgets.

Transport/robustness: request the binary terminal stream capability;
post-auth liveness watchdog recycles a silently-dropped socket; QR
sideload no longer treats a dev build as the simulator; bounded terminal
decoder retention.

Codex CLI upgraded to 0.153.4 to run gpt-6-astra. 422 tests; tc + build + oxlint green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…(re-review)

Addresses regressions found by the codex gpt-6-astra re-review:

- CRITICAL: ask-target resolver read a fictional agentStatus shape
  (state: waiting/blocked); the real contract is
  RuntimeTerminalAgentStatus.status === 'permission'. Resolver + mock now
  import and use @orca-shared/runtime-terminal-contracts so drift is a
  compile error; fail closed on zero/multiple/unverifiable probes.
- Prompt identity (notificationId) now threaded through sendAskAnswer and
  re-validated after async terminal resolution — an expired ask can no
  longer answer a later prompt.
- askInteraction scoped by host+notificationId; success AND failure
  callbacks guarded by session/host identity; no cross-host/prompt leak.
- Notification retirement tombstones preserved across redelivery; permission
  episodes tracked so an old completion isn't promoted to a new ask.
- Long ask bodies wrap/reserve control space so the option strip is never
  truncated away while send stays enabled.
- Confirmation poll: single non-overlapping awaited loop with a wall-clock
  deadline + late reconcile (stalled→answered).
- Terminal tail: frozen browsing window (history no longer jumps on new
  output), empty→'No output yet', resolving vs no-active-terminal states,
  wide lines wrapped so they can't overflow the body region.

445 tests; tc + build + oxlint green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

Too many files changed for review (131 files, 100 file limit).

Bypass the limit by tagging @greptile-apps to review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

The terminal-tail feature cannot work against a real desktop: it resolves the terminal via terminal.resolveActive, which is not in the mobile RPC allowlist. Details inline.

Reviewed changes

A greenfield standalone web app (even-g2/) that brings Orca's companion experience to Even Realities G2 glasses — an E2EE WebSocket client speaking the existing mobile wire protocol, an in-memory mock server + canvas simulator, and a phone-side pairing/settings page. It ships with 445 tests and does not touch mobile/ or the desktop build.

  • E2EE transport — browser port of src/shared/e2ee-crypto.ts (tweetnacl, atob/btoa framing) plus a reimplementation of mobile's DirectRpcClient (handshake, request/subscription registries, reconnect backoff, post-auth liveness probe).
  • Ask-answer quick actions — resolves the worktree's unique waiting terminal via terminal.list + terminal.agentStatus (fail-closed on zero/ambiguous/unverifiable), re-validates prompt identity across async gaps, and latches against double-sends.
  • HUD rendering — page spec/validator/differ, serialized render queue, text pagination, and navigation state machine over firmware text/list containers.
  • Simulator + tests — MockOrcaServer performing the real E2EE handshake, GlassesBridge canvas preview, and unit/integration coverage of the ask/exit/terminal flows.

ℹ️ The client never sends a client field, so mobile terminal semantics don't engage

The even-g2 client pairs as a mobile-scoped device, but its terminal.subscribe / terminal.send requests omit client ({ type: 'mobile', id }). On the host, terminal-subscribe-method.ts keys isMobile off params.client?.type === 'mobile', so even-g2 is treated as a legacy/clientless client: handleMobileSubscribe is skipped and the requested viewport: { cols: 60, rows: 20 } is silently ignored (output streams at native PTY width). terminal.send still works via the legacy "missing client = unlocked" fallback in terminal-input-delivery.ts, and binary streaming is unaffected (it keys off capabilities.terminalBinaryStream + sendBinary, not client). Worth confirming this is the intended posture rather than a missed field — if you want the host to auto-fit to the HUD viewport, terminal.subscribe needs a client id.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a standalone even-g2 Even Realities G2 companion app for Orca. The app includes pairing and host-profile storage, an E2EE WebSocket transport, compatibility checks, HUD rendering, navigation, notifications, terminal tails, ask quick actions, and exit handling. It provides real and mock glasses bridges, a mock Orca server, an in-browser simulator, package configuration, and extensive unit and integration tests.

Merge Risk: 🟡 Moderate · up to 7b3e3

Connection changes can produce stale simulator responses, transient terminal lookup failures can break navigation, and host restarts can duplicate inbox notifications. These should be addressed before merge.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description provides substantial context about the app, its scope, rationale, features, limitations, and testing. However, it omits required template sections, including Linked Issue, Visual Proof… Add every required template section. Include a valid Linked Issue entry with Fixes #<issue>. Add before-and-after visual proof, or write N/A with a reason if no visual or interaction change applies. Complete the Testing checkboxes and d…
Docstring Coverage ⚠️ Warning Docstring coverage is 31.95% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 169 functions across 72 files. (2 skipped… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: adding the standalone Even Realities G2 companion app.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description provides substantial context about the app, its scope, rationale, features, limitations, and testing. However, it omits required template sections, including Linked Issue, Visual Proof, Review, Agent skill upstream boundary, Notes, and Checklist. It also does not include the required issue reference or visual proof statement, and its test count conflicts with the PR objectives.

Resolution

Add every required template section. Include a valid Linked Issue entry with Fixes #&lt;issue&gt;. Add before-and-after visual proof, or write N/A with a reason if no visual or interaction change applies. Complete the Testing checkboxes and document platforms tested. Add Review, Agent skill upstream boundary, Notes, and Checklist sections. Reconcile the reported test count of 445 with the objectives' count of 472.

Full details: Docstring Coverage

Explanation

Docstring coverage is 31.95% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 169 functions across 72 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 14

🧹 Nitpick comments (1)
even-g2/package.json (1)

21-21: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Pin @evenrealities/evenhub-cli to 0.1.14.

The lockfile resolves latest to 0.1.14, while the manifest still permits a future lockfile refresh to select another CLI version. The qr and pack scripts execute this CLI directly.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 1784b94f-7778-48df-9b02-9602b230481f

📥 Commits

Reviewing files that changed from the base of the PR and between 1e301ab and 050d1c5.

⛔ Files ignored due to path filters (2)
  • even-g2/assets/icon-24.png is excluded by !**/*.png
  • even-g2/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (124)
  • docs/superpowers/specs/2026-09-05-even-g2-app-design.md
  • even-g2/.gitignore
  • even-g2/app.json
  • even-g2/assets/README.md
  • even-g2/index.html
  • even-g2/package.json
  • even-g2/pnpm-workspace.yaml
  • even-g2/sim.html
  • even-g2/src/app-boot.integration.test.ts
  • even-g2/src/app/agent-terminal-resolution.test.ts
  • even-g2/src/app/agent-terminal-resolution.ts
  • even-g2/src/app/app-shell.test.ts
  • even-g2/src/app/app-shell.ts
  • even-g2/src/app/ask-interaction-tracking.ts
  • even-g2/src/app/bridge-detection.test.ts
  • even-g2/src/app/bridge-detection.ts
  • even-g2/src/app/host-session-manager.test.ts
  • even-g2/src/app/host-session-manager.ts
  • even-g2/src/app/nav-context.test.ts
  • even-g2/src/app/nav-context.ts
  • even-g2/src/app/nav-ports.test.ts
  • even-g2/src/app/nav-ports.ts
  • even-g2/src/app/orca-handshake-test-server.ts
  • even-g2/src/app/phone-page-mount.ts
  • even-g2/src/app/profile-controller.test.ts
  • even-g2/src/app/profile-controller.ts
  • even-g2/src/app/terminal-tail-frame-patch.ts
  • even-g2/src/ask-flow.integration.test.ts
  • even-g2/src/exit-flow.integration.test.ts
  • even-g2/src/glasses/even-hub-bridge.test.ts
  • even-g2/src/glasses/even-hub-bridge.ts
  • even-g2/src/glasses/glasses-bridge.ts
  • even-g2/src/glasses/glasses-event-normalization.test.ts
  • even-g2/src/glasses/glasses-event-normalization.ts
  • even-g2/src/glasses/glasses-storage-cache.test.ts
  • even-g2/src/glasses/glasses-storage-cache.ts
  • even-g2/src/hud/hud-glyphs.test.ts
  • even-g2/src/hud/hud-glyphs.ts
  • even-g2/src/hud/hud-page-differ.test.ts
  • even-g2/src/hud/hud-page-differ.ts
  • even-g2/src/hud/hud-page-spec.test.ts
  • even-g2/src/hud/hud-page-spec.ts
  • even-g2/src/hud/hud-page-validator.test.ts
  • even-g2/src/hud/hud-page-validator.ts
  • even-g2/src/hud/hud-render-queue.test.ts
  • even-g2/src/hud/hud-render-queue.ts
  • even-g2/src/hud/hud-text-pagination.test.ts
  • even-g2/src/hud/hud-text-pagination.ts
  • even-g2/src/main.ts
  • even-g2/src/navigation/ask-quick-action.test.ts
  • even-g2/src/navigation/ask-quick-action.ts
  • even-g2/src/navigation/hud-input-router.test.ts
  • even-g2/src/navigation/hud-input-router.ts
  • even-g2/src/navigation/hud-navigation-dashboard.test.ts
  • even-g2/src/navigation/hud-navigation-dashboard.ts
  • even-g2/src/navigation/hud-navigation-frames.ts
  • even-g2/src/navigation/hud-navigation-list-select.test.ts
  • even-g2/src/navigation/hud-navigation-list-select.ts
  • even-g2/src/navigation/hud-navigation.test.ts
  • even-g2/src/navigation/hud-navigation.ts
  • even-g2/src/navigation/nav-contract.ts
  • even-g2/src/phone-page/phone-settings-page.test.ts
  • even-g2/src/phone-page/phone-settings-page.ts
  • even-g2/src/screens/ask-screen.test.ts
  • even-g2/src/screens/ask-screen.ts
  • even-g2/src/screens/blocked-compat-screen.ts
  • even-g2/src/screens/dashboard-screen.test.ts
  • even-g2/src/screens/dashboard-screen.ts
  • even-g2/src/screens/host-list-screen.test.ts
  • even-g2/src/screens/host-list-screen.ts
  • even-g2/src/screens/pairing-screen.test.ts
  • even-g2/src/screens/pairing-screen.ts
  • even-g2/src/screens/screen-view-model.test.ts
  • even-g2/src/screens/screen-view-model.ts
  • even-g2/src/screens/terminal-tail-screen.test.ts
  • even-g2/src/screens/terminal-tail-screen.ts
  • even-g2/src/screens/worktree-list-screen.test.ts
  • even-g2/src/screens/worktree-list-screen.ts
  • even-g2/src/sim/glasses-canvas-preview.ts
  • even-g2/src/sim/memory-socket-pair.test.ts
  • even-g2/src/sim/memory-socket-pair.ts
  • even-g2/src/sim/memory-socket-web-socket-adapter.ts
  • even-g2/src/sim/mock-glasses-bridge.test.ts
  • even-g2/src/sim/mock-glasses-bridge.ts
  • even-g2/src/sim/mock-orca-connection-state.ts
  • even-g2/src/sim/mock-orca-fixtures.ts
  • even-g2/src/sim/mock-orca-server-encryption.ts
  • even-g2/src/sim/mock-orca-server.test.ts
  • even-g2/src/sim/mock-orca-server.ts
  • even-g2/src/sim/mock-orca-terminal-methods.ts
  • even-g2/src/sim/mock-terminal-registry.ts
  • even-g2/src/sim/mock-terminal-stream-frames.ts
  • even-g2/src/sim/sim-entry.ts
  • even-g2/src/state/connection-status-state.test.ts
  • even-g2/src/state/connection-status-state.ts
  • even-g2/src/state/hud-store.test.ts
  • even-g2/src/state/hud-store.ts
  • even-g2/src/state/notification-inbox-state.test.ts
  • even-g2/src/state/notification-inbox-state.ts
  • even-g2/src/state/terminal-tail-state.test.ts
  • even-g2/src/state/terminal-tail-state.ts
  • even-g2/src/state/worktree-dashboard-state.test.ts
  • even-g2/src/state/worktree-dashboard-state.ts
  • even-g2/src/terminal-tail.integration.test.ts
  • even-g2/src/transport/glasses-e2ee.test.ts
  • even-g2/src/transport/glasses-e2ee.ts
  • even-g2/src/transport/host-profile-store.test.ts
  • even-g2/src/transport/host-profile-store.ts
  • even-g2/src/transport/orca-connection-stage-timer.ts
  • even-g2/src/transport/orca-reconnect-scheduler.ts
  • even-g2/src/transport/orca-request-registry.ts
  • even-g2/src/transport/orca-rpc-wire.ts
  • even-g2/src/transport/orca-socket-client.test.ts
  • even-g2/src/transport/orca-socket-client.ts
  • even-g2/src/transport/orca-socket-frames.ts
  • even-g2/src/transport/orca-socket-handshake.ts
  • even-g2/src/transport/orca-subscription-registry.ts
  • even-g2/src/transport/pairing-code-decode.test.ts
  • even-g2/src/transport/pairing-code-decode.ts
  • even-g2/src/transport/terminal-tail-decoder.test.ts
  • even-g2/src/transport/terminal-tail-decoder.ts
  • even-g2/tsconfig.json
  • even-g2/vite.config.ts
  • even-g2/vitest.config.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Comment thread even-g2/app.json Resolved
Comment thread even-g2/src/app/host-session-manager.ts Resolved
Comment thread even-g2/src/hud/hud-render-queue.ts Resolved
Comment thread even-g2/src/sim/memory-socket-pair.ts Resolved
Comment thread even-g2/vite.config.ts Resolved
- CRITICAL: terminal.resolveActive is not in the mobile RPC allowlist, so
  it 403s on a real desktop and the tail never opens. Replace it with an
  allowlisted terminal.list-based viewer resolver. All RPC methods used are
  now allowlisted.
- Security: limit Vite server.fs.allow to project + ../src/shared (CWE-200);
  don't latch reconnects on an unauthenticated plaintext e2ee_error (CWE-345).
- Correctness: reset connection/dashboard/inbox slices on session close;
  invalidate compat probes on every connection transition + teardown; reset
  the notification watermark seq when the epoch changes; keep the list-source
  input fallback when metadata is absent.
- Stability: catch rejected rebuildPage()/upgradeText(); force-reconnect (and
  close the socket) when the handshake can't start.
- app.json: mark the network whitelist dev-only (not portal-submission-ready).
- Simulator: dedupe peer close, guard base64 decode, deliver notification
  backlog to the subscriber only, preserve subscribe response-before-frame
  order under delayMs, clear the canvas when no HUD page exists.

472 tests; tc + build + oxlint green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@naokiupa

naokiupa commented Sep 7, 2026

Copy link
Copy Markdown
Author

Thanks @coderabbitai and @pullfrog — all suggestions addressed in the latest commit. Summary:

Critical / Major

  • terminal.resolveActive not in the mobile RPC allowlist (pullfrog): correct and important — it would 403 on a real desktop and the terminal tail would never open. Replaced the tail-open path with an allowlisted terminal.list-based viewer resolver (resolveViewableTerminalHandle: prefer agentIdentity, tie-break by newest lastOutputAt). Verified every RPC the app calls is in the allowlist (status.get, worktree.ps, terminal.list, terminal.agentStatus, terminal.send, terminal.subscribe, terminal.unsubscribe, notifications.subscribe, notifications.getMissedSince, runtime.clientCapabilities.update).
  • Vite server.fs.allow too broad (CWE-200): scoped to the project root + ../src/shared only; spec §2 updated.
  • connection-status stale compat probes: probeSeq now invalidates on every non-connected transition and on teardown.
  • Notification watermark across epochs: lastSeenSeq resets when notificationEpoch changes, so getMissedSince can't skip a new epoch's low sequence numbers.
  • app.json portal manifest: network whitelist marked dev-only; not represented as portal-submission-ready.

Correctness / Stability / Security

  • HostSessionManager.close() now resets the connection/dashboard/inbox slices.
  • glasses-event-normalization: list-source events without metadata now map to listSelect (not a swallowed generic click).
  • hud-render-queue: rejected rebuildPage()/upgradeText() are caught → onRenderError + retry/rebuild recovery.
  • orca-socket-client: handshake-start failure now force-reconnects (and closes the socket).
  • orca-socket-handshake: an unauthenticated plaintext e2ee_error is treated as transient (reconnect); only authenticated rejections latch (CWE-345).

Simulator/mock

  • memory-socket-pair: no duplicate peer onclose.
  • mock-orca-server-encryption: base64 decode fails closed.
  • mock-orca-server: initial notification backlog delivered to the subscribing socket only; terminal.subscribe response now precedes its binary frames under delayMs.
  • sim-entry: canvas cleared when there's no HUD page.

Each change has colocated tests. Full suite: 472 tests, pnpm tc / pnpm build / oxlint all green.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

One fix commit landed since the prior pullfrog review (7b3e356), addressing the earlier terminal.resolveActive allowlist finding plus a set of hardening items.

  • Terminal-tail resolution (finding #1) — replaced the non-allowlisted terminal.resolveActive with terminal.list, now a documented best-candidate heuristic (agentIdentity-preferred, newest lastOutputAt tie-break) plus tests asserting terminal.resolveActive is never emitted.
  • Render-queue error handling (finding #5) — a rejecting rebuildPage/upgradeText bridge call is caught, retried once, and reported rather than surfacing as an unhandled rejection.
  • Event normalization (finding #4) — a source: 'list' click with neither metadata field maps to listSelect(-1) instead of a no-op generic click.
  • Session teardown (finding #3) — close() now resets the host-scoped connection/dashboard/inbox slices, not just terminalTail.
  • Probe/watermark correctness (findings #6, #7) — in-flight compat probes are invalidated on disconnect/dispose, and the notification watermark resets on a new notificationEpoch.
  • Socket lifecycle (findings #8, #9) — a pre-auth plaintext e2ee_error now reconnects instead of latching (CWE-345), and the socket closes when beginE2eeHandshake throws.
  • Dev-server/manifest scoping — Vite fs.allow is scoped to the project root + ../src/shared (no longer ..), and the network.whitelist placeholder is emptied.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

Since the prior review, commit 7b3e356 addressed every open finding, each with a colocated regression test:

  • Terminal-tail resolution moved off terminal.resolveActive — the tail-open path now uses resolveViewableTerminalHandle, resolving via the allowlisted terminal.list (prefers an agentIdentity row, tie-broken by newest lastOutputAt) instead of the mobile-forbidden terminal.resolveActive.
  • Vite dev fs.allow scoped — narrowed from the whole repo ('..') to the project root + ../src/shared, closing the /@fs/ exposure while keeping the project's own files servable.
  • Handshake hardening (CWE-345) — a plaintext pre-auth e2ee_error is now transient (reconnect) rather than a latched rejection, since it carries no proof of origin; only an authenticated, decrypted rejection latches.
  • Connection/inbox lifecycle fixes — HostSessionManager.close() now resets the connection/dashboard/inbox slices; probeSeq invalidation covers every non-connected transition and teardown; the notification watermark resets on a new epoch.
  • Mock/simulator fidelity — no duplicate peer onclose; terminal.subscribe response ordered before its binary frames under delayMs; the initial notification backlog goes only to the subscribing socket; the canvas clears when there's no HUD page.
  • Render-queue error recovery — rejecting rebuildPage()/upgradeText() calls are caught and routed through onRenderError + retry/rebuild instead of escaping as unhandled rejections.

I verified the RPC surface against MOBILE_RPC_METHOD_ALLOWLIST: terminal.list, terminal.agentStatus, terminal.send, terminal.subscribe, terminal.unsubscribe, notifications.subscribe, notifications.getMissedSince, runtime.clientCapabilities.update, status.get, and worktree.ps are all present, and terminal.resolveActive is (correctly) absent — no client path emits it.

Non-blocking leftover from the swap: nav-ports.test.ts still declares the now-dead resolveActiveResult knob (and its terminal.resolveActive fake branch), and the comment above openTerminalTail still reads "in-flight resolveActive round-trip". Harmless, removable in a follow-up.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 61062343-9fff-47f7-9ea7-2c41447bc3d5

📥 Commits

Reviewing files that changed from the base of the PR and between 050d1c5 and 7b3e356.

📒 Files selected for processing (33)
  • docs/superpowers/specs/2026-09-05-even-g2-app-design.md
  • even-g2/app.json
  • even-g2/src/app/agent-terminal-resolution.test.ts
  • even-g2/src/app/agent-terminal-resolution.ts
  • even-g2/src/app/host-session-manager.test.ts
  • even-g2/src/app/host-session-manager.ts
  • even-g2/src/app/nav-ports.ts
  • even-g2/src/glasses/glasses-event-normalization.test.ts
  • even-g2/src/glasses/glasses-event-normalization.ts
  • even-g2/src/hud/hud-render-queue.test.ts
  • even-g2/src/hud/hud-render-queue.ts
  • even-g2/src/sim/glasses-canvas-preview.test.ts
  • even-g2/src/sim/glasses-canvas-preview.ts
  • even-g2/src/sim/memory-socket-pair.test.ts
  • even-g2/src/sim/memory-socket-pair.ts
  • even-g2/src/sim/mock-orca-server-encryption.test.ts
  • even-g2/src/sim/mock-orca-server-encryption.ts
  • even-g2/src/sim/mock-orca-server-handshake.ts
  • even-g2/src/sim/mock-orca-server-send-queue.ts
  • even-g2/src/sim/mock-orca-server.test.ts
  • even-g2/src/sim/mock-orca-server.ts
  • even-g2/src/sim/mock-orca-terminal-methods.ts
  • even-g2/src/sim/sim-entry.test.ts
  • even-g2/src/sim/sim-entry.ts
  • even-g2/src/state/connection-status-state.test.ts
  • even-g2/src/state/connection-status-state.ts
  • even-g2/src/state/notification-inbox-state.test.ts
  • even-g2/src/state/notification-inbox-state.ts
  • even-g2/src/terminal-tail.integration.test.ts
  • even-g2/src/transport/orca-socket-client.test.ts
  • even-g2/src/transport/orca-socket-client.ts
  • even-g2/src/transport/orca-socket-handshake.ts
  • even-g2/vite.config.ts
🚧 Files skipped from review as they are similar to previous changes (12)
  • even-g2/src/app/host-session-manager.ts
  • even-g2/vite.config.ts
  • even-g2/src/glasses/glasses-event-normalization.test.ts
  • even-g2/app.json
  • even-g2/src/glasses/glasses-event-normalization.ts
  • even-g2/src/app/host-session-manager.test.ts
  • even-g2/src/sim/mock-orca-server-encryption.ts
  • even-g2/src/sim/memory-socket-pair.ts
  • even-g2/src/hud/hud-render-queue.test.ts
  • even-g2/src/sim/memory-socket-pair.test.ts
  • even-g2/src/hud/hud-render-queue.ts
  • even-g2/src/sim/mock-orca-server.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

port: RpcPort,
worktreeId: string
): Promise<string | null> {
const response = await port.sendRequest('terminal.list', { worktree: `id:${worktreeId}` })

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Handle rejected terminal.list requests.

RpcPort.sendRequest rejects on timeout and authentication failure. Line 34 lets that rejection escape this resolver. openTerminalTail awaits the resolver without a catch, so a transient request failure rejects navigation instead of returning null and leaving the terminal-tail state unchanged.

Catch the request rejection and return null. Add a rejection test.


/** Drops the queue tail for a closed/detached socket. */
forget(socket: MemorySocketLike): void {
this.tails.delete(socket)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Invalidate queued sends when detaching a socket.

If MockOrcaServer.attach() detaches an still-open socket, PerSocketSendQueue.forget() only removes the queue entry. An existing setTimeout callback can still run, pass the OPEN check in respond(), and deliver a stale response to the client. Invalidate queued work per socket and check the token before calling run().

})

port.sendRequestQueue.push(okMissedResponse([], 'epoch-2'))
port.onData?.({ type: 'ready', epoch: 'epoch-2' }) // resubscribe after reconnect

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Reset the watermark when reconnect ready changes epoch.

handleReady() updates lastSeenEpoch only on cold start. If the host emits a new epoch before any notification, backfillMissed() can send the old epoch and lastSeenSeq. MobileNotificationReplayBuffer.getMissedSince() can then return the full retained buffer, while toEntry() gives entries without notificationId new local-* IDs and appends duplicates. Adopt the new epoch and reset lastSeenSeq before backfill. Add a ready-first regression case.

serverPublicKeyB64: harness.serverPublicKeyB64,
socketFactory: harness.socketFactory
})
await flushMicrotasks()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Inject the plaintext error before authentication completes.

The initial flushMicrotasks() completes the fake handshake before the test sends e2ee_error. Remove that flush so the test covers the pre-authentication regression path. Production already reconnects without entering auth-failed; the current ordering only leaves that behavior without direct coverage.

Proposed fix
-    await flushMicrotasks()
-
     // An on-path attacker (or a confused host) sends a plaintext e2ee_error BEFORE
     // authentication — it carries no cryptographic proof of origin, unlike the encrypted
     // rejection the "latches auth-failed" test above exercises.
     harness.servers[0]!.socket.send(JSON.stringify({ type: 'e2ee_error' }))
     await flushMicrotasks()

@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

@naokiupa Thanks for the detailed update. The changes address the reported compatibility, security, lifecycle, and simulator issues. The added colocated tests and the reported 472 passing tests provide good coverage for the fixes.

🐇 ✅


✏️ Learnings added
Learnt from: naokiupa
URL: https://github.com/stablyai/orca/pull/19178

Timestamp: 2026-09-07T04:52:21.408Z
Learning: For `even-g2`, application RPC calls must remain within the mobile RPC allowlist: `status.get`, `worktree.ps`, `terminal.list`, `terminal.agentStatus`, `terminal.send`, `terminal.subscribe`, `terminal.unsubscribe`, `notifications.subscribe`, `notifications.getMissedSince`, and `runtime.clientCapabilities.update`. Do not use `terminal.resolveActive`; resolve a viewable terminal through `terminal.list`.

Learnt from: naokiupa
URL: https://github.com/stablyai/orca/pull/19178

Timestamp: 2026-09-07T04:52:21.409Z
Learning: In `even-g2` E2EE handshake handling, an unauthenticated plaintext `e2ee_error` does not prove server origin and must cause transient reconnect behavior. Only an authenticated rejection may latch the `auth-failed` state.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

You are interacting with an AI system.

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.

1 participant