Skip to content

Resume agent sessions from mobile history#6969

Merged
brennanb2025 merged 16 commits into
brennanb2025/add-agents-to-mobilefrom
brennanb2025/Agent-Session-History-resume-PR2
Jul 3, 2026
Merged

Resume agent sessions from mobile history#6969
brennanb2025 merged 16 commits into
brennanb2025/add-agents-to-mobilefrom
brennanb2025/Agent-Session-History-resume-PR2

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds Resume to mobile Agent Session History. Tapping Resume resolves the session worktree first, falls back to the active route worktree when desktop would, guards unsupported targets, creates a fresh terminal in the resolved worktree, sends the shared AI Vault resume command with Enter, and navigates mobile to that session.

This PR is intentionally stacked on brennanb2025/add-agents-to-mobile (PR1). It does not add desktop's copy/open/jump overflow actions to mobile; this PR is scoped to user-initiated resume.

Follow-up parity fix: mobile worktree ordering now matches desktop ordering semantics for smart/Agent activity, recent, name, manual, repo collation, pinned overlay behavior, and no-grouping All section behavior.

Design Approach

The implementation follows design-docs/mobile-agent-session-history-resume-pr2.md and desktop's right-sidebar AI Vault resume behavior. Mobile now reuses the shared AI Vault command builder and startup planning path, including command overrides, default args/env, Windows shell family handling, Codex home handling, and POSIX command construction for SSH execution hosts.

For ordering parity, mobile consumes the host/runtime summary fields that desktop owns (sortOrder, manualOrder, lastActivityAt, createdAt, isMainWorktree, hasHostSidebarActivity, status metadata) instead of locally inventing different mobile-only ranking rules.

Review And Completeness

Design-review outcome: the earlier PR2 design ambiguity was resolved in favor of current desktop parity: local and SSH targets are resumable, while runtime/unknown targets are blocked.
Implementation deviations: mobile now fetches settings.get at resume time so command overrides/default launch settings are honored; worktree.ps exposes hostId, terminalPlatform, ordering, and sidebar-activity fields; mobile RPC allows folderWorkspace.list and projectGroup.list for folder workspace target guards.
Completeness verification: headline resume behavior is implemented for local and SSH worktrees; runtime-hosted and unknown workspaces remain intentionally blocked with an explanatory message. Headline ordering behavior is implemented for the data mobile receives from the host; mobile does not independently recompute desktop smart attention from live renderer pane state.
Broad app consistency: compared desktop AI Vault Resume, mobile history browse/preview, mobile terminal launch flows, SSH worktree behavior, folder workspace metadata, desktop sidebar sort comparators, pinned overlay behavior, and grouped/ungrouped workspace sections.

Risks And Non-goals

Non-goals: Copy Resume Command, Copy Session ID, open/reveal/jump actions, and other desktop overflow affordances are not added here.
Accepted risk: mobile depends on the host runtime's tab state after session.tabs.createTerminal, matching existing mobile launch flows.
Accepted gap update: Android emulator QA was refreshed on sdk_gphone64_arm64; the mobile Resume tap-through created a fresh Terminal 2 in demo-project/main and sent the shared-builder Codex resume command, but the seeded disposable fixture used a noncanonical session id so Codex returned No saved session found. A follow-up attempt with a canonical disposable session was blocked by an Android app ANR while selecting Agent Session History from the long-press worktree action sheet, so a fully successful live Codex resume remains unproven.
Ordering caveat: smart/Agent activity parity uses desktop's persisted host sortOrder snapshot. If mobile must recompute live smart attention without that desktop/host snapshot, the runtime contract would need to carry live tab/pane attention inputs that are not part of this PR.

Performance

Perf audit result: the resume hot path only does extra metadata fetches after explicit Resume intent, so history browsing/search remains unchanged. Session-worktree and target resolution are pure in-memory scans over already-loaded worktree/repo summaries. Ordering parity keeps sorting in-memory over the existing mobile list and uses deterministic comparators covered by unit tests.

Validation

Docker recovery: docker info initially reported no daemon while stale Docker Desktop backend PID 67939 was present. I opened Docker, tried bounded docker version/info/status/start/stop probes, interrupted my own stuck docker desktop stop, killed only stale Docker backend PID 67939 with SIGKILL, reopened Docker Desktop, and confirmed docker info reached Server 29.2.1.

SSH/runtime validation: ORCA_E2E_SSH_DOCKER=1 pnpm exec playwright test tests/e2e/ssh-docker-relay-perf.spec.ts --config tests/playwright.config.ts --project electron-headless --workers=1 --grep "keeps an SSH workspace terminal usable" passed. This created a real Linux Docker SSH target, connected Orca to it, added a remote repo/worktree, created an SSH terminal, verified remote output before and after disconnect/reconnect, built the relay bundle, and cleaned up the container.

Android emulator QA follow-up (2026-07-01):

  • Device: emulator-5554, model sdk_gphone64_arm64, boot completed, package com.stably.orca.mobile installed.
  • App loaded and paired to the exact PR worktree desktop: /tmp/orca-pr2-android-1782942367/android-loaded-clean.png, /tmp/orca-pr2-android-1782942367/android-connected-after-pair.png.
  • Real mobile path reached Agent Session History via the worktree long-press action sheet: /tmp/orca-pr2-android-1782942367/android-main-longpress-actions.png, prior ready screen /tmp/orca-pr2-android-1782942367/android-agent-history-ready.png.
  • Tapping Resume opened demo-project/main, created Terminal 2, and sent cd '/Users/thebr/source/repos/Stably/demo-project' && CODEX_HOME=... codex resume ...: /tmp/orca-pr2-android-1782942367/android-after-resume.png, settled command/error screenshot /tmp/orca-pr2-android-1782942367/android-after-resume-settled.png.
  • Backing runtime proof: session.tabs.list showed two terminals for the demo worktree, with Terminal 2 active and launchAgent: codex.
  • Residual gap: canonical-session retest did not complete; after clean app reset/re-pair, selecting Agent Session History from the same long-press action sheet produced Android Orca isn't responding: /tmp/orca-pr2-android-1782942367/android-agent-history-selected-second-tap.png, /tmp/orca-pr2-android-1782942367/android-after-anr-wait.png.

Focused checks run:

  • pnpm --dir mobile test -- src/worktree/workspace-list-sections.test.ts src/worktree/mobile-workspace-lineage.test.ts src/worktree/worktree-list-snapshot.test.ts
  • pnpm --dir mobile test -- src/worktree/workspace-list-sections.test.ts
  • pnpm exec vitest run src/main/runtime/orca-runtime.test.ts -t "builds a compact worktree summary from persisted and live runtime state"
  • pnpm --dir mobile exec vitest run src/session/session-panel-host.test.ts src/agent-history/agent-history-session-card.test.ts src/agent-history/agent-history-resume-target.test.ts
  • pnpm --dir mobile exec tsc --noEmit
  • pnpm run typecheck:node
  • pnpm --dir mobile lint
  • git diff --check

Earlier focused checks:

  • cd mobile && pnpm exec vitest run src/agent-history src/session/ai-vault-resume-launch.test.ts (5 files, 49 tests)
  • pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/orca-runtime.test.ts (515 tests)
  • pnpm exec oxlint <touched files>
  • pnpm run typecheck
  • cd mobile && pnpm exec tsc --noEmit -p tsconfig.json
  • pnpm exec oxfmt --check <touched files>

Post-PR Stabilization

After the latest push (d46d908a08cd872502202adbed1bc33f11614cad), both GitHub verify checks pass. No CodeRabbit issue or review comments were present in the PR review-comment API at the final sweep; the only PR issue comment is Stage's generated chapter summary.

@stage-review

stage-review Bot commented Jul 1, 2026

Copy link
Copy Markdown

brennanb2025 and others added 15 commits July 1, 2026 18:10
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Orca <help@stably.ai>
@brennanb2025 brennanb2025 merged commit 1a2b64b into brennanb2025/add-agents-to-mobile Jul 3, 2026
2 checks passed
@brennanb2025 brennanb2025 deleted the brennanb2025/Agent-Session-History-resume-PR2 branch July 3, 2026 02:20
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