Skip to content

fix(mobile): enable Grok native chat in folder workspaces - #11751

Closed
brennanb2025 wants to merge 2 commits into
mainfrom
brennanb2025/mobile-native-chat-rough-edges-audit
Closed

brennanb2025 wants to merge 2 commits into
mainfrom
brennanb2025/mobile-native-chat-rough-edges-audit

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Mobile now resolves folder:<id> native-chat readability through the existing read-only folder-workspace catalog. This lets a supported Grok session in a local or runtime-owned folder become readable once mobile has a valid session entry carrying both the folder route and real provider session ID.

The change is deliberately narrow: it does not create or refresh mobile session.tabs snapshots, change session identity, add providers, alter transcript parsing/rendering/sending, or broaden SSH eligibility. Malformed, ambiguous, unavailable, and unsupported cases remain fail-closed.

Before / after

Before: Mobile treated the synthetic folder:<id> route as a repository ID and searched repo.list. Folder workspaces are not repositories, so their connection authority could not resolve and native-chat readability stayed false.

After: Folder routes request folderWorkspace.list, match the underlying folder ID exactly once, and use that record's explicit connectionId. Local (null) and runtime-owned (runtime-ssh-*) authorities satisfy the existing readability rule. Direct Model-A SSH folders, blank or unknown routes, duplicate IDs, missing or malformed authority metadata, rejected requests, and unsuccessful responses remain unavailable. Repository workspaces continue to use repo.list unchanged.

Screenshots

No valid native-chat acceptance screenshot was captured or published. /tmp/pr11751-folder-session-loading.png is explicitly excluded: it showed the Terminal route stuck on Loading tabs, and its deep link incorrectly placed a folder:<id> value in the session-ID segment. It is not evidence for this PR.

There is no visual-design change in the diff.

Native QA gap

Exact-head setup was proven on iPad simulator C589AF84-2F0C-4978-952B-748933DE6804: the installed Release app contains an embedded JavaScript bundle built from a89846e9e26d29a7423e8c93998d24d9b2f021cb (SHA-256 6e9b6f16b30c076b828a1a1c134d385a28f28491a424a89c3cecf4e4cb554af3). The isolated helper remains on port 3100.

Backend/runtime fixture proof also succeeded. A read-only runtime catalog query returned the live Grok terminal for folder route folder:2573f8cc-8e3a-4e16-bf2b-95f8bae2eb1d, real provider session ID 019fb802-68c6-7400-a38e-6afcc8d2690e, and a transcript containing FOLDER-GROK-READY.

Native acceptance is blocked upstream of this PR's readability hook: after bounded foreground, reconnect, relaunch, and catalog-refresh attempts, the paired mobile host never surfaced the folder or a corresponding folder session.tabs snapshot. Therefore no supported agent-history/resume entry could supply both worktreeId=folder:2573f8cc-8e3a-4e16-bf2b-95f8bae2eb1d and the real provider session ID. Native chat never rendered.

Accordingly, this QA does not claim transcript rendering/readability, keyboard or dictation, composer/send, unsent-draft retention, scrolling, drawer/navigation, switching away/back, reconnect, or foreground recovery. Those remain pending behind the separate folder catalog/session-entry rough edge. Runtime-owned relay/direct-host behavior, direct-SSH exclusion, physical iOS devices, and Android also remain unverified natively.

Testing

  • Baseline proof at f936e7fc9c7defebc40398a1ddf2ce50e93c7dfc: the folder-workspace regression test failed with expected false to be true because the hook requested repo.list.
  • Fail-closed mutation proof: temporarily restoring first-match catalog selection, blank-route requests, and omitted-authority-to-local fallback made the malformed-route and duplicate-ID tests fail with expected true to be false; the hardened implementation was restored before commit.
  • cd mobile && node_modules/.bin/vitest run src/session/use-mobile-native-chat-readability.test.ts src/session/mobile-native-chat-eligibility.test.ts — 2 files, 19 tests passed.
  • cd mobile && node_modules/.bin/vitest run — 375 files passed; 2,782 tests passed and 3 skipped.
  • cd mobile && node_modules/.bin/tsc --noEmit — passed.
  • cd mobile && node_modules/.bin/oxlint — passed.
  • cd mobile && node_modules/.bin/oxfmt --check . — passed.
  • git diff --check — passed.
  • Fresh merge-tree at exact head a89846e9e26d29a7423e8c93998d24d9b2f021cb against fetched origin/main fdb58695e9d08738c1cc16fd1c0b1f0e7937ca18 — clean.
  • GitHub CI at the exact head — 42 successful checks, including Mobile verify, static analysis, typecheck, Git compatibility, shell contracts, all Node 24/26 shards, Linux/Windows packaging, PR verify, and Greptile; path-filtered E2E was skipped. One unrelated activity-portal timing test failed in Node 26 shard 15/16 on its first attempt and passed unchanged on rerun.

AI Review Report

The requested direct recovery loop used fresh gpt-5.6-sol reviewers with xhigh reasoning. This was not a formal Orca orchestration dispatch, and no formal dispatch provenance is claimed.

The first reviewer found one fail-open boundary defect: duplicate folder IDs were order-dependent, and an omitted connectionId was treated as local. The follow-up commit requires one exact match and explicit null or string authority, adds blank-route and malformed-catalog coverage, and leaves legacy repository compatibility unchanged. A fresh same-model/xhigh reviewer then returned CLEAN at a89846e9e26d29a7423e8c93998d24d9b2f021cb.

The final static review covered stale async responses, duplicate IDs in both orders, local/runtime/direct-SSH authority, direct and relay transport, folder workspaces versus git worktrees, unsupported agents, request volume, payload exposure, and adjacent native-chat eligibility/readability. Effect cleanup and keyed state prevent a previous route result from leaking after tab, workspace, client, or host changes. Folder resolution remains one read-only catalog request per route resolution.

Security Audit

This uses an already registered, authenticated, end-to-end-encrypted, read-only RPC method. The existing response contains the folder catalog, but this hook reads only id and connectionId; it does not log or persist catalog paths, credentials, linked items, or other metadata.

Blank routes, unknown IDs, duplicate matches, omitted or non-string authority, rejected requests, and unsuccessful responses fail closed. Local null and runtime-owned runtime-ssh-* values remain readable; direct SSH values remain blocked. No command execution, filesystem access, auth change, secret handling, dependency, persistence, or new IPC/RPC surface was added.

Notes

The missing mobile folder session.tabs snapshot is preserved as a separate confirmed folder catalog/session-entry rough edge; it is not expanded into PR #11751. Irreversible long-response clipping is also a separate finding and remains out of scope.

No simulator helper was stopped. Native QA remains pending, and the iPad lane is ready for coordinator release after the other lane finishes. This PR must not be merged as part of this review.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The chat readability hook now supports folder: workspaces. It selects folderWorkspace.list for folder workspaces and repo.list for repository workspaces. It resolves the matching workspace before evaluating transcript readability. The effect refreshes when the workspace category changes. Tests cover local, runtime-owned, and Model-A folder workspaces, plus missing and rejected folder catalog lookups.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title clearly identifies the mobile change that enables Grok native chat in folder workspaces.
Description check ✅ Passed The description is detailed and covers the template sections, including scope, testing, QA limits, review findings, security, and notes.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@greptile-apps

greptile-apps Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

Greptile Summary

This PR extends useMobileNativeChatReadability to support folder workspaces so that Grok native chat can be enabled for users in local or runtime-owned folder workspaces. Previously, folder:<id> routes were searched in repo.list, which never matched, keeping readability permanently false.

  • A new resolveFolderWorkspaceSummary helper fetches folderWorkspace.list for folder:-prefixed routes, matches by exact folder ID, rejects duplicates and entries with missing connectionId, and applies the same isMobileNativeChatTranscriptReadable rule already used for repository workspaces.
  • Repository routes, floating workspaces, the active/stale-request guard, and all existing RPC error handling are unchanged. Empty folder IDs, RPC failures, unresolved routes, and direct SSH folders all fail closed.

Confidence Score: 5/5

Safe to merge. The change is tightly scoped to catalog dispatch and ID matching, all failure modes are handled fail-closed, and the new logic is exercised by comprehensive tests.

The new code path follows the same defensive patterns already established for repo workspaces — stale-request cancellation via the active flag, a double-keyed guard at the return site, and explicit fail-closed returns for every exceptional condition.

Files Needing Attention: No files require special attention.

Important Files Changed

Filename Overview
mobile/src/session/use-mobile-native-chat-readability.ts Adds folder-workspace readability branch: routes folder: to folderWorkspace.list, validates via resolveFolderWorkspaceSummary, and applies the existing eligibility rule. Existing repo and floating workspace paths are unmodified.
mobile/src/session/use-mobile-native-chat-readability.test.ts Adds six new test cases for folder workspace readability, covering local/runtime/SSH admission, missing catalog entries, RPC rejection, empty route IDs, duplicate catalog entries, and missing connectionId.

Reviews (2): Last reviewed commit: "fix(mobile): fail closed on ambiguous fo..." | Re-trigger Greptile

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Folder chat lookup and Grok phone chat support are now on main, including #27212. This earlier folder-only patch can be closed.

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