Skip to content

fix(mobile): keep generated commit messages in the workspace that requested them - #31709

Merged
nwparker merged 2 commits into
stablyai:mainfrom
nwparker:nwparker/mobile-monkey-commit-generation-owner
Oct 22, 2026
Merged

nwparker merged 2 commits into
stablyai:mainfrom
nwparker:nwparker/mobile-monkey-commit-generation-owner

Conversation

@nwparker

@nwparker nwparker commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Ask AI to write a commit message, then switch workspaces before it finishes. The result can appear in the wrong workspace. Quick repeated taps can also start the request twice. This fix ignores the old workspace's result and starts only one request at a time.

What Changed

  • Ignore generated text and errors after you switch to another workspace or computer.
  • Block a second tap immediately while a generation request is already running.
  • Keep text you typed yourself and continue respecting Cancel.

Why

Generated text should go into the commit you asked about, and one tap should start one request.

Linked Issue

Maintainer-discovered regression. Bounded GitHub symptom and exact-file searches found no exact duplicate. Related #30142 preserves typed text and canceled runs; this adds scope invalidation and synchronous request admission.

Visual Proof

Captured using the visual-proof skill. Before uses base 15246eb4a45; after uses updated PR commit 2f4e49cc9b4. The scenario passed three asserted capture runs per version, followed by a separately asserted recorded run. Screenshots were visually inspected.

Evidence scope: Explicitly labeled production-hook harness using actual useMobileCommitMessageGeneration. Composer and workspace-switch controls are fixture HTML. Hook harness, not native source-control screen/composer layout proof. Production generation hook, mutation operation and reply schema run; sendRequest is a fixture. Haptics are stubbed. Capture covers stale success after workspace change and current generation recovery; duplicate synchronous admission, stale error and cancellation rely on separate focused tests.

01-before.png 02-after.png
01-before.png 02-after.png
03-after-current-generation.png
03-after-current-generation.png

The host/storage operations remain asynchronous. The synchronization follow-up moves scope invalidation from render to a layout effect, before the committed UI paints. A suspended-transition regression fails with the previous implementation and passes with this change. These browser captures do not claim native gestures, keyboard, focus, safe-area or real-network verification.

Testing

  • Regression tests added or updated.
  • Full native device verification for every race.
ORCA_BACKGROUND_LAUNCH=1 pnpm --dir mobile test src/source-control/use-mobile-commit-message-generation.test.ts

The combined mobile change set passed 410 suites / 3,626 tests, production typecheck, the tests-typecheck ratchet, formatting, the changed-code quality gate, and the mobile-web build/asset verifier on macOS. These aggregate results are not a claim that the entire suite was rerun on this isolated branch. PR CI validates the branch against current main.

Review

Merge risk: Low. A small change to deciding which generation request can update the commit message; the AI request still runs in the background.

Previously reviewed by a separate agent team; reported issues were fixed and checked again.

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.

AI commit generation crosses workspace transitions and admits duplicate calls before a render. Retire the active run on scope changes and use synchronous admission.
@nwparker
nwparker marked this pull request as ready for review October 21, 2026 23:34
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8b9b2a80-0616-4e8a-8ffe-345a3b217d90
📥 Commits

Reviewing files that changed from the base of the PR and between 10d4104 and 2f4e49c.

📒 Files selected for processing: 2
  • mobile/src/source-control/use-mobile-commit-message-generation.test.ts
  • mobile/src/source-control/use-mobile-commit-message-generation.ts

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

📝 Walkthrough

The hook now tracks the active generation run and its client and worktree scope. It rejects requests while a run is active and applies completion updates only when that run remains active. Tests cover stale results after a worktree change, repeated requests before loading renders, and a Suspense transition between worktrees.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 2f4e4

No merge-blocking issue was identified. Generation results remain scoped to the current workspace, and repeated requests do not start a second active run.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. 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 identifies the two primary changes: workspace ownership for mobile commit generation and single-request admission.
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 description covers all required sections and clearly explains the change, rationale, testing, visual evidence, compatibility review, and limitations. It references related issue #30142 rather than…
Full details: Description check

Explanation

The description covers all required sections and clearly explains the change, rationale, testing, visual evidence, compatibility review, and limitations. It references related issue #30142 rather than using a Fixes # entry, and required PR CI checks remain unchecked, but these do not make the description largely incomplete.

  • 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
nwparker merged commit 250f81a into stablyai:main Oct 22, 2026
23 checks passed
@nwparker nwparker changed the title fix(mobile): own commit generation by workspace and admit once fix(mobile): keep generated commit messages in the workspace that requested them Oct 22, 2026
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