Skip to content

fix(mobile): wait for runtime readiness before option picks - #37626

Merged
AmoabaKelvin merged 2 commits into
mainfrom
phone-option-readiness
Nov 3, 2026
Merged

AmoabaKelvin merged 2 commits into
mainfrom
phone-option-readiness

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​100 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​96
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​20 $\color{#cf222e}{\Huge{\mathbf{−}}}$​15 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​5

ELI5

Phone model choices stay visible while a chat loads, but become selectable only when a pick can apply.

What Changed

The phone offered catalog choices before its session had a runtime fence, then silently rejected the pick in the mutation wrapper. One readiness value now drives the shared option writer and desktop's existing snapshot lock, including snapshots returned after a pick settles. Model, effort, and permission picks follow the same rule.

Why

This matches desktop's documented behavior without adding a queue. Catalog discovery still runs early, and options remain usable during a pending or failing options read once a runtime fence exists.

Linked Issue

Fixes STA-13340.

Visual Proof

Isolated production phone controls and hooks rendered in headless Chromium at 390 × 720, with a scripted host catalog arriving before the fence. These are component-fixture captures, not a native device session.

Before: offered while loading After: locked while loading
Before After

Before interaction: the loading-state tap is refused with zero writes. After interaction: controls wait for readiness, then the model pick applies with one fenced write. Light and dark rendering checked.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

On macOS, 82 focused mobile tests across 10 files pass, covering the first frame, option lifetimes, permissions, chat return, and runtime restart. The new regression uses the real mutation wrapper, fails against baseline on the selectable null-fence descriptor, and passes with the fix. It also checks the arriving fence in the write envelope and current locked snapshots after disabling during an in-flight pick.

All 15 selected pnpm check:changed --maxWorkers=2 checks pass, along with changed-file oxlint/oxfmt, changed-code quality, React Doctor, and git diff --check. Every test listed by test-dependents.sh passed. Scripted rendered interactions are shown above; native iOS/Android, Windows/Linux, and live SSH were not run locally. CI covers broad platform and mobile verification.

Risk

Level: Low. The main risk is leaving controls locked after readiness changes; the regression covers unlocking on fence arrival and locking after disabling. No protocol, host routing, or persisted data format changes. A plain revert restores prior behavior.

AI Disclosure

Review

Exactly two independent Codex/Claude review rounds on the three-file diff, pinned to HEAD and merge-base dbd0c2448e17209cf8d65e42d4ce4b4e74293824. Round 1 had no findings. Round 2 identified a low-priority test gap around the writer readiness gate; the regression was strengthened to require zero requests from locked picks, so a rejected premature attempt cannot hide behind the mutation wrapper. No unresolved P0/P1 findings. Removing only the writer gate makes the strengthened test fail with 5 requests instead of 2; the complete fix passes. Final test-audit and simplification checks retain one behavioral regression and the existing shared lock/write owner. The first Mobile verify run caught an inferred RPC mock response type in the new test; a test-only follow-up supplies the real transport signature, with focused test/lint/format checks passing.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

The readiness rule is client-side and applies equally to local/remote hosts and folder/git workspaces. Existing legacy-host permission handling and catalog fallback remain intact. No paths, shortcuts, native modules, or host capabilities change.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

The options hook locks option snapshots unless a client, session, enabled state, and non-null runtime fence are present. After a write, the option surface returns the latest snapshot. The test checks option locking, a request with runtime fence 3, and locking after options are disabled.

Merge Risk: Minimal · up to aa1ae

The readiness changes preserve locked and unlocked option behavior without an identified merge-blocking risk.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: mobile option picks now wait for runtime readiness.
Description check Passed The description is complete and focused. It includes the required explanation, change summary, rationale, linked issue, visual proof, testing results, risk assessment, review notes, compatibility cons…
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 is complete and focused. It includes the required explanation, change summary, rationale, linked issue, visual proof, testing results, risk assessment, review notes, compatibility considerations, and checklist status. The unchecked manual-testing item is explained by the reported automated and CI coverage.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 3 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

ast-grep (0.51.1)

ast-grep could not parse rule config: /ast-grep-rules/ast-grep-essentials/rules/ruby/security/ruby-mysql2-hardcoded-secret-ruby.yml

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

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

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e5588cb2-a058-4bd2-bc9c-99949d2a7b52
Commits

Reviewing files that changed from the base of the PR and between b62aaa1 and aa1ae12.

Files selected for processing: 1
  • mobile/src/session/use-mobile-structured-agent-options.first-frame.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

@AmoabaKelvin
AmoabaKelvin merged commit ebc55db into main Nov 3, 2026
26 checks passed
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