Skip to content

fix(mobile): sources name their environment, no toggle flash, one back button - #1017

Merged
Jacksondr5 merged 3 commits into
j5/mainfrom
j5code/mobile-1012
Nov 11, 2026
Merged

Jacksondr5 merged 3 commits into
j5/mainfrom
j5code/mobile-1012

Conversation

@Jacksondr5

@Jacksondr5 Jacksondr5 commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Problem

Jackson's Checkpoint 4 on his iPhone found three issues in mobile Agent Setup. A persona's or playbook's source didn't say which server it lives on. Toggling a persona looked like a redraw. In the persona editor, the back button "pulsed" on the first change. Closes #1012.

What changed

  • Sources name their environment. A persona sheet's Source row reads "Personal on openclaw" or " on openclaw". A playbook's line reads "Library on …", "From source folder on …" or "From on …".
  • No flash on toggle. Before this change, the name took the pending value's colour, and every switch was disabled, so dimmed, while the save ran. Now the switch alone shows the new value, and the name changes colour once the change is saved. Taps on a row that's still saving are ignored, without disabling the switch. A tap on another row while a save runs snaps back, as toggleAgent already refused it.
  • One back button. The form no longer swaps iOS's native back button for a custom one when it becomes dirty; UIKit animates that swap, which is the pulse. With usePreventRemove active, native stack sets preventNativeDismiss, and react-native-screens' stack cancels a native Back and sends it through the guard. Swipe back on a form with unsaved changes now asks too, where trunk's custom item turned swipe off.

UI changes

Dirty Edit: native Back asks before discarding:

iOS before iOS after
Dirty Edit: native Back asks before discarding, iOS before Dirty Edit: native Back asks before discarding, iOS after

Dirty Create: native Back asks before discarding:

iOS before iOS after
Dirty Create: native Back asks before discarding, iOS before Dirty Create: native Back asks before discarding, iOS after

Persona details: Source names its environment:

iOS before iOS after
Persona details: Source names its environment, iOS before Persona details: Source names its environment, iOS after

Before: the first keystroke crossfades the back button, then a dirty Back:

ios-edit-first-key-back-before.mp4

After: the back button stays put, and a dirty Back asks first:

ios-edit-first-key-back-after.mp4

After: dirty edge and content swipes ask first:

ios-edit-dirty-swipes-after.mp4

After: toggling a persona off and on, with no grey flash:

ios-toggle-after.mp4

Android:

State Android before Android after
Personal persona Source Personal persona Source, Android before Personal persona Source, Android after
Folder persona Source Folder persona Source, Android before Folder persona Source, Android after
Library and source-folder playbooks Library and source-folder playbooks, Android before Library and source-folder playbooks, Android after
Project playbooks Project playbooks, Android before Project playbooks, Android after
Toggle pending while the server is held Toggle pending while the server is held, Android before Toggle pending while the server is held, Android after
Create persona discard prompt Create persona discard prompt, Android before Create persona discard prompt, Android after
Edit persona discard prompt Edit persona discard prompt, Android before Edit persona discard prompt, Android after

A refused toggle reverts and explains why (after only):

Refused persona toggle with error toast, Android after

Android before: six toggles and a held pending double tap; the switches dim while saving:

toggles-and-held-bed54-before-published.mp4

Android after: the same sequence, with switches undimmed and the name colour changing only once saved:

toggles-and-held-3919-after-published.mp4

Live testing

iOS: PASS at 7403b795b0 against base bed54fa2fc, on iOS 26.5 (crew tester, report test-reports/pr-1017/ios-7403b795b0.md).

  • On Edit and Create, with unsaved changes, the native Back, the edge swipe and the content swipe all ask "Discard changes?". Keep editing keeps the text, and Discard leaves.
  • With nothing unsaved, Back and the edge swipe leave, and saving leaves with no prompt.
  • On base the back button visibly crossfades on the first keystroke; on head it doesn't change.
  • The Source row names the environment, and the toggle doesn't flash grey.
  • No pop starts and then snaps back. With the keyboard up, a refused swipe dropped and restored the keyboard, so the form moved under the dialog. The dirty-swipe video shows this at 7403b795b0.

Known limit for Checkpoint 5: with the keyboard up, a refused swipe drops and restores the keyboard under the Discard dialog (the dirty-swipe video above). On this app's iOS stack navigator, gestureEnabled only feeds preventNativeDismiss, so it can't turn the swipe off separately. The only way to stop it is the custom back item, which brings back the pulse. 3919a0c1a2 tried the flag, and 6c38493737 reverts it; the head's tree matches the tested 7403b795b0.

Android: PASS at 3919a0c1a2 against base bed54fa2fc, on Android 16, light theme (crew tester, report test-reports/pr-1017/3919a0c1a2.md). The head 6c38493737 has the same tree as 7403b795b0; the only difference from 3919a0c1a2 is an iOS-only option, so the run stands.

  • Every persona and playbook source names the environment.
  • Toggles keep switches undimmed, and the name greys only once the save lands. A second tap on a saving switch is ignored, and a refused write reverts with an error toast. A tap on a different row during a save snaps back without a message, which is expected (one save at a time).
  • On Create and Edit, header Back and hardware Back ask first when there are unsaved changes, and leave at once on a clean form. Saves leave with no prompt.

Not exercised: dark theme, a second connected environment, relay or tunnel, and Back during an in-flight save.

Checklist

  • One concern: the description has no "also" (one issue, Mobile Agent Setup: environment name with each source, no toggle flash, and no back-button pulse #1012, from one checkpoint)
  • Tests cover the changed behavior: unchanged tests pass; nothing new, since these are copy and UI-state changes
  • UI changes: before/after screenshots above, and a video for motion or interaction
  • Live testing: the section above says what ran live and what did not
  • Upstream-owned files: none edited
  • Upstream product: no change
  • Surfaces: mobile only (web already has its own source lines); iOS and Android both run the form
  • Docs: not in this PR; the wave 5 docs PR covers it

Claude Opus 5.5 in J5 Code (Claude Code harness).

🤖 Generated with Claude Code

…k button

A persona's Source row and a playbook's source line now name the
environment they live on.

Toggling a persona no longer greys the name or dims every switch while
the save runs; the switch alone shows the new value, and the name
follows once the change is saved.

The persona form keeps iOS's native back button instead of swapping to
a custom one when it becomes dirty. Native stack cancels the native Back
and swipe while the removal guard holds, so the guard still asks first.

Closes #1012

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vercel

vercel Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
j5-code Ready Ready Preview Nov 11, 2026 10:39pm UTC

Request Review

@github-actions github-actions Bot added the size:M 30-99 effective changed lines (test files excluded in mixed PRs). label Nov 11, 2026

@Jacksondr5 Jacksondr5 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Combined panel review (reviewer-opus + reviewer-sol) at 7403b79

Verdict: no source findings, and the panel approves the source. Approval is conditional on the iOS device check of the Back flows (below), which this PR's design depends on, plus captures and J5 CI.

  • Environments are named. The persona sheet's Source row adds "on " through personaDetailRows' optional environmentLabel, with the Personas page's selected environment label passed in. Playbook lines read "Library on …", "From source folder on …" or "From on …".

  • No toggle flash. The name's colour follows the saved persona.enabled, and the switch shows the pending value. Switches are disabled only when the session can't operate, so no switch dims during a save. A second tap on a row with a pending value is ignored in onValueChange. On iOS, RN's Switch then restores the pending value. Note for the tester: a tap on a different row while one is saving hits toggleAgent's busy return (false), so that row quietly snaps back. That's acceptable, but worth seeing.

  • One Back button. SettingsFormScreen drops the iOS header swap and keeps the native Back button. The guard comes from usePreventRemove in useSettingsFormExit. On iOS this app uses J5's createV5StackNavigator.ios with react-native-screens v5's Stack.Screen (the T3 fork 5.0.0-t3.48), and on that path:

    • The navigator sets preventNativeDismiss from preventedRoutes[key]?.preventRemove and routes onNativeDismissPrevented to goBack() (createV5StackNavigator.ios.tsx:168–175).
    • RNSStackNavigationController.mm checks shouldPreventNativePopToController both in the swipe's gestureRecognizerShouldBegin (:28–34) and in its overridden popViewControllerAnimated (:173–181), which the native Back button reaches. Each emits onNativeDismissPrevented, so both run the guard.
    • The JS pop after a save is let through by _performingReactUpdate.

    Upstream's scheduled-task editor comment ("native Back pops before removal guards") may predate this fork's support, so the source favours the design, but the device decides. If it fails, the fallback is upstream's always-custom back item without swipe back.

For the iOS device run: native Back and swipe with unsaved changes ask "Discard changes?". "Keep editing" stays on the form, "Discard" leaves, and both are blocked while saving. After a save, the form leaves. A clean form leaves at once.

Reviewer-run checks

  • mobile src/j5/agents and reactCompilerCoverage.test.ts: 1114 passed (reviewer-opus). reviewer-sol: 14 persona and compiler checks.
  • mobile vp run typecheck: exit 0
  • lint: clean on src/j5/agents and src/j5/playbooks; git diff --check: clean

Reviewed by Claude Opus 5.5 (reviewer-opus) and Sol 6.1 (reviewer-sol) in J5 Code.

@github-actions github-actions Bot added the vouch:trusted Author is trusted by repo permissions or the VOUCHED list. label Nov 11, 2026
A refused swipe dropped and restored the keyboard under the Discard
dialog, so a guarded form turns the gesture off, as trunk did. The
gesture flag doesn't change the header, so the back button stays put.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On iOS, the V5 stack navigator uses gestureEnabled only to set
preventNativeDismiss, which the unsaved-changes guard already sets, so
the flag never turned swipe off. Trunk's swipe was off because of the
custom back item, which this PR removes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@Jacksondr5 Jacksondr5 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Panel delta check (reviewer-opus + reviewer-sol) at 3919a0c

Verdict: one should-fix. The new gestureEnabled: !guarded is a no-op on this app's iOS stack, so the delta doesn't change the swipe behaviour it sets out to change. (Raised by reviewer-sol, confirmed by reviewer-opus.)

Why it's a no-op:

  • In J5's iOS navigator (createV5StackNavigator.ios.tsx), the only use of gestureEnabled is line 169: preventNativeDismiss = preventedRoutes[key]?.preventRemove || options.gestureEnabled === false. No separate gesture prop reaches the v5 Stack.Screen; its native props have none.
  • A guarded form already sets preventRemove, so preventNativeDismiss is true either way. The native props are identical before and after.
  • In RNSStackNavigationController.mm, the swipe's gestureRecognizerShouldBegin (:28–37) refuses the pop and emits onNativeDismissPrevented. The navigator turns that into goBack() (:173–175), which opens the guard's dialog.

So a dirty swipe still opens "Discard changes?", and the keyboard drops under the native alert, which is iOS's usual behaviour for an alert over an active text field. That's what the tester measured, and it was also trunk's behaviour, since trunk's custom back item set the same flag on the same path.

Ways forward (the Captain's call):

  • (a) Accept the measured behaviour, a dirty swipe asking "Discard changes?" the way native Back does, and drop the no-op wiring (guarded prop and NativeStackScreenOptions) so the code doesn't claim a swipe-off it doesn't do.
  • (b) Make a dirty swipe truly inert. That needs the navigator to tell a swipe apart from the Back button, which is an edit to upstream's createV5StackNavigator.ios.tsx (a zone-3 product change), so it isn't recommended for this.

The rest of #1017 is unchanged and still approved. Reviewer-run: mobile vp run typecheck exits 0 and reactCompilerCoverage.test.ts passes (1093).

Reviewed by Claude Opus 5.5 (reviewer-opus) and Sol 6.1 (reviewer-sol) in J5 Code.

@Jacksondr5 Jacksondr5 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Panel note (reviewer-opus + reviewer-sol) at 6c38493: the revert's tree is identical to the approved 7403b79 (tree bb0fcc9678; git diff is empty). The panel's source approval is restored. The dirty-swipe keyboard bounce under the "Discard changes?" alert is recorded in the PR as a known limit, accepted by the Captain, for Checkpoint 5. Android evidence and J5 CI remain the gates.

Reviewed by Claude Opus 5.5 (reviewer-opus) and Sol 6.1 (reviewer-sol) in J5 Code.

@Jacksondr5
Jacksondr5 marked this pull request as ready for review November 11, 2026 23:03
@coderabbitai

coderabbitai Bot commented Nov 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 7 billable files and costs up to $1.75.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 5 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available. Your 52 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between bed54fa and 6c38493.

Files selected for processing: 7

  • apps/mobile/src/j5/agents/AgentCreateScreen.tsx
  • apps/mobile/src/j5/agents/AgentEditorScreen.tsx
  • apps/mobile/src/j5/agents/AgentLibrarySettingsScreen.tsx
  • apps/mobile/src/j5/agents/PersonaSheet.tsx
  • apps/mobile/src/j5/agents/SettingsFormScreen.tsx
  • apps/mobile/src/j5/agents/personaDetails.ts
  • apps/mobile/src/j5/playbooks/PlaybookLibrarySettingsScreen.tsx
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

This branch was successfully deployed

1 active deployment
Preview — 6c384937 Deployed Nov 11, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 effective changed lines (test files excluded in mixed PRs). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mobile Agent Setup: environment name with each source, no toggle flash, and no back-button pulse

1 participant