Skip to content

fix(mobile): show setup settings from the computer you just selected - #31693

Merged
AmoabaKelvin merged 3 commits into
stablyai:mainfrom
nwparker:nwparker/mobile-monkey-workspace-runtime-owner
Oct 28, 2026
Merged

AmoabaKelvin merged 3 commits into
stablyai:mainfrom
nwparker:nwparker/mobile-monkey-workspace-runtime-owner

Conversation

@nwparker

@nwparker nwparker commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​64 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​59
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​52 $\color{#cf222e}{\Huge{\mathbf{−}}}$​13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​39

ELI5

Start creating a workspace on one computer, then switch to another. The form can still show the first computer's defaults and its approval to run setup scripts. This fix clears those old values and only uses settings returned by the computer currently selected.

What Changed

  • Clear the previous computer's workspace defaults and setup-script approvals when you switch.
  • Ignore settings replies and callbacks left over from the previous computer.
  • Keep an unanswered settings request from making old approvals appear valid.
  • The state is owned by the selected computer (desktop host plus picked relay server), not by the RpcClient object. A relay change on any other server rebuilds every scoped client, which would otherwise wipe the same computer's settings and approvals mid-form.
  • Each selection gets a fresh owner, so going A → B → A no longer revives the first A's in-flight Save callbacks.

Why

Approving a setup script on one computer should not make it look approved on another.

Linked Issue

Maintainer-discovered regression. Bounded GitHub symptom and exact-file searches found no exact duplicate. Execution-target detection from #31351 was excluded from this work.

Visual Proof

Captured with the visual-proof skill. Before uses base 15246eb4a45; after uses this PR's standalone commit 63d7dc9a02a. The scenario passed asserted capture runs 3 times per version before representative screenshots were selected. The captures were visually inspected.

Evidence scope: Explicitly labeled production-hook diagnostic browser harness, exact commits/dependencies. Pending host switch and retired publisher. Not native New Workspace UI, no real network.

runtime-before-1-host-pending.png runtime-after-1-host-pending.png
runtime-before-1-host-pending.png runtime-after-1-host-pending.png
runtime-before-1-retired-publisher.png runtime-after-1-retired-publisher.png
runtime-before-1-retired-publisher.png runtime-after-1-retired-publisher.png

The hook/transport boundary harnesses are labeled in the captures. These are browser evidence where stated; they do not establish native keyboard, gesture, permission dialog, safe-area or real-network behavior. Full code regressions cover additional cases described above.

Testing

After rebasing onto current main (head c0871058a1a), run serially on macOS:

  • use-new-workspace-runtime-context.test.ts: 11 passed. The new tests cover the case where the new computer hasn't answered yet (fails on main), the same computer's client being rebuilt (failed on the earlier client-keyed version), and A → B → A callback retirement (fails on main and on the earlier commit).
  • NewWorktreeModal.test.tsx: passed.
  • mobile/src/test-support/rpc-recording: 23 files, 1695 passed.
  • Changed-file oxlint and oxfmt are clean.
  • Not run: a native simulator pass. Switching computers here needs a desktop that relays to a second runtime server, and the in-flight Save race can't be driven deterministically from the UI. The hook tests and the browser harness captures below are the evidence.

Earlier evidence from Neil's combined checkout, kept for reference:

The combined review checkout aa6fe5dae109 contains this PR at 94b1cb122314 and the other mobile PRs reviewed together. Validation ran with ORCA_BACKGROUND_LAUNCH=1 on macOS.

  • Full mobile run: 11,493 passed, 2 failed, 6 skipped. Both failures were recording checks for the intentional new uncertain-paste warning. After updating only that golden, the affected two recording suites passed 1,197 tests, including both previously failing checks. This accounts for all 11,495 non-skipped tests; it is not a claim of a second clean full-suite invocation.
  • Production mobile typecheck and the test-typecheck ratchet passed (1,111 test files; 116 grandfathered).
  • Changed-code quality gate passed with zero new findings across eight code files, including React Doctor and design-system checks. Follow-up code formatting and lint checks passed.
  • Mobile web build and packaged asset verification passed. The package manager warned that its pre-script dependency refresh could not replace the shared node_modules symlink; the build and both asset verifiers nevertheless completed successfully.

An earlier attempt using the shared checkout’s newer Vitest crashed. The reported full run and recording recheck used the mobile package’s pinned Vitest 4.1.12 with four workers. These are combined-checkout results; separate CI must validate each PR against current main. Native-device coverage remains limited as described in Visual Proof and Review.

AI Disclosure

Review

Merge risk: Medium. This controls whether setup scripts are trusted, so approval behavior deserves extra care.

Previously reviewed by a separate agent team; this pass traced the production paths again and added failing-before regressions for the three newly reproduced defects.

Risk-reduction checks. Second pass: Traced settings reads and script-approval resets when switching desktops; old replies and old Save callbacks cannot affect the newly selected desktop.

Neil's reviewed head: 94b1cb122314. Combined review head: aa6fe5dae109.

Review-loop on the rebased branch: two rounds with Codex and Claude. Round 1 found the client-identity reset (fixed). Round 2 came back clean from both.

Agent skill upstream boundary

  • Not applicable; this change copies no upstream skill-installer implementation.

Notes

Existing RPC methods and wire compatibility are retained. Review considered desktop host changes, remote execution authority, folder workspaces, and native/web consumers. Native simulator follow-up was limited after the three owned simulators became stuck shutting down; no unrelated simulator/process was reset.

Checklist

  • Focused change with a root-cause explanation.
  • Automated regression coverage and independent review.
  • Before/after proof attached with exact evidence scope.
  • Cross-platform and remote compatibility considered.
  • Required PR CI checks have passed.

@nwparker nwparker changed the title fix(mobile): scope workspace setup permissions to the responding host fix(mobile): show setup settings from the computer you just selected Oct 22, 2026
@AmoabaKelvin
AmoabaKelvin force-pushed the nwparker/mobile-monkey-workspace-runtime-owner branch from 94b1cb1 to 00aa327 Compare October 28, 2026 19:45
@AmoabaKelvin
AmoabaKelvin marked this pull request as ready for review October 28, 2026 19:47
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

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: 607e0df5-f240-44d9-9f66-0f1aa8229209
Commits

Reviewing files that changed from the base of the PR and between c79c3a8 and 00aa327.

Files selected for processing: 3
  • mobile/src/components/NewWorktreeModal.tsx
  • mobile/src/components/use-new-workspace-runtime-context.test.ts
  • mobile/src/components/use-new-workspace-runtime-context.ts

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

Walkthrough

The runtime context hook now scopes settings, trusted hooks, and available providers to a host and server. It resets these values when the owner changes and ignores updates from callbacks tied to a previous owner. The modal passes the selected repository server to the hook. Tests cover host changes, client rebuilds for the same host, and callbacks from retired selections.

Priority: Normal

Merge Risk: Minimal · up to 00aa3

No actionable issue remains; the change is mergeable after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% 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. Documenta… 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 names the main user-visible fix: the mobile setup settings form should show settings from the newly selected computer. It matches the changeset, which scopes runtime defaults, setup-script a…
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.
Description check Passed The pull request description is complete and follows the repository template. It explains the user impact, changes, rationale, testing, visual evidence, review risk, compatibility considerations, and …
Full details: Title check

Explanation

The title names the main user-visible fix: the mobile setup settings form should show settings from the newly selected computer. It matches the changeset, which scopes runtime defaults, setup-script approvals, and providers to the selected host and server, and clears prior values on switch. The title is specific and concise, and it does not use vague terms.

Full details: Description check

Explanation

The pull request description is complete and follows the repository template. It explains the user impact, changes, rationale, testing, visual evidence, review risk, compatibility considerations, and limitations. The author also reports that required PR CI checks were not yet confirmed as passed, and native simulator testing was not run.

Full details: Docstring Coverage

Explanation

Docstring coverage is 33.33% 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 3 functions across 3 files.

Resolution

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

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

nwparker and others added 3 commits October 28, 2026 22:02
Changing hosts can expose the previous desktop runtime settings and setup approvals. Own published data and setters by host and client.
…hen the host is picked again

Ownership compared client and host id, so A -> B -> A made the first A's Save callbacks match again. Each selection now gets its own owner object.
…ject

Any server's relay change rebuilds every scoped client, which wiped the same host's settings and approvals.
@AmoabaKelvin
AmoabaKelvin force-pushed the nwparker/mobile-monkey-workspace-runtime-owner branch from 00aa327 to c087105 Compare October 28, 2026 22:02
@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

The workspace form now keeps defaults, setup-script approvals, and task providers tied to the selected desktop and server.

  • Workspace settings and setup approvals follow the selected computer.

No actionable issues found. Source and regression tests were inspected; tests and visual checks were not run during this review.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Selected desktop and server] --> B{Selection changed?}
  B -->|Yes| C[Create fresh owner and clear values]
  B -->|No| D[Keep current values]
  C --> E[Read selected computer settings]
  D --> E
  E --> F{Reply belongs to current owner?}
  F -->|Yes| G[Update form values]
  F -->|No| H[Ignore old reply]
Loading

Reviews (1) · Last reviewed commit: "fix(mobile): own the workspace runtime c..." · Reviewed by Greptile

@AmoabaKelvin
AmoabaKelvin merged commit f703896 into stablyai:main Oct 28, 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.

2 participants