Skip to content

perf(ios): stop redrawing the model menu and buttons on every keystroke - #194235

Merged
vyctorbrzezowski merged 2 commits into
openclaw:mainfrom
Marvinthebored:fix/ios-composer-draft-isolation
Nov 17, 2026
Merged

vyctorbrzezowski merged 2 commits into
openclaw:mainfrom
Marvinthebored:fix/ios-composer-draft-isolation

Conversation

@Marvinthebored

@Marvinthebored Marvinthebored commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Editing a draft makes the clean chat composer observe draft changes outside the editor and primary controls, causing unnecessary parent work on each keystroke.

User Impact

Draft edits stay within the draft-dependent composer sections. The existing Send, Talk, placeholder, and model-picker layout is unchanged. This does not claim a measured typing-latency improvement.

Why This Change Was Made

Reuse the existing ChatComposerSection observation boundary for the editor overlay and clean primary controls. No new state, renderer, or cache is introduced. The small wrappers are necessary observation boundaries.

Evidence

Published author verification is recorded here; the maintainer update below identifies the current checks and remaining limitations.

  • Baseline regression compiled and failed: outer draft observation invalidations were 1, expected 0.
  • Patched focused suite: 15 tests in 2 suites passed. A strengthened assertion also verifies the deferred primary-controls body still observes draft changes; that run passed all 15 tests in 0.077 seconds.
  • Simulator: compact composer/draft growth and Stop availability while drafting during an active response passed. Rotation/sidebar test skipped because the simulator lacked expanded window space (2 passed, 1 skipped).
  • Inspected recording frames show the rendered follow-up draft and keyboard during an active response. No device or typing-latency proof is claimed.
  • Same-family Codex and cross-family Grok reviews found no production correctness defect. Addressed coverage findings by adding positive child-body observation and narrowing the test name. The observation test does not claim to exercise rendered menu invalidation or the Talk branch.
  • Scoped SwiftFormat: 0/3 files require formatting. Scoped SwiftLint: no errors; one pre-existing empty_string warning at line 219 of the parity test.
  • Simplification: retained the existing observation owner and no duplicate rendering path; every production hunk serves draft isolation.

AI-assisted implementation and review.

Inspectable simulator artifacts

Simulator draft and primary-control samples

Mounted runtime proof

One additional simulator UI test passed (iPhone 17 Pro, iOS 27.2). Temporary instrumentation on the published source fix records the actual mounted composer, model-controls, editor, and primary-control evaluations. From the first nonempty editor event through deletion back to empty, the composer and model-controls each evaluated zero times; the editor and primary controls observed the draft changes. Startup/keyboard-focus evaluations precede that interval. SwiftUI coalesced some edits (editor lengths 1,4,5,4,3,2,0), so this is not a one-render-per-keystroke assertion.

XCTest and visually inspected screenshots verify empty Talk/no Send → “mount” with enabled Send/no Talk → cleared Talk/no Send. Synthetic fixture, not live gateway or device proof; no measured latency claim. Instrumentation is evidence-only and is not shipped.

Empty Talk

Draft Send

Cleared Talk

Maintainer verification

Reviewed candidate: bbe4a082ad69f85edfeac1b54ed517500051bb4f.

The production fix is unchanged. The maintainer follow-up replaces the test-only lock/count wrapper with Mutex, preserves both the parent-isolation and positive child-observation assertions, and sorts the imports. Scoped SwiftFormat and SwiftLint pass; an independent review found no actionable P0–P2 issue.

The earlier native-app regression run executed and passed ChatInputResponsivenessTests on this production source. That run temporarily included the shared test in the app test target; the temporary copy was removed. Fresh attempts to run the untouched package test target on iOS are disclosed separately: the package cannot compile unrelated OpenClawClientCredentialStoreTests uses of Process, and the product schemes have no test action. Those attempts did not execute this test. No source exclusions or new test transplant was used to hide that limitation; the new head still requires its normal CI.

Maintainer before/after

These are retained recordings from the native iPhone simulator in this review, using the same isolated Gateway and synthetic conversation. Left: the two observation boundaries removed for the baseline. Right: the published production fix. Both show typing the same draft and clearing it, with the keyboard and Talk → Send → Talk transition preserved. Initial idle time was trimmed independently and the takes were paired at normal playback speed. The video demonstrates interaction parity, not a latency benchmark; the observation-count evidence above supports the reduced-work claim.

Clean comparison

Before After
Draft before observation isolation Same draft with observation isolation

Annotated comparison

Typing and clearing before and after

Video

composer-before-after.mp4

@clawsweeper

clawsweeper Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 6, 2026
@clawsweeper

clawsweeper Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR isolates draft-dependent editor and primary-control evaluation using the existing SwiftUI observation boundary.

Example: Type “mount” in the iOS composer, then clear it.

  • Before: Draft reads subscribe surrounding editor and footer construction to input changes.
  • After: Draft-dependent sections update independently while the Talk → Send → Talk transition remains intact.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused implementation and mounted simulator evidence support merging once the required current-head checks complete.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): Mounted iPhone simulator traces exercise the production composer during typing and clearing, supported by inspected Send/Talk screenshots and baseline/candidate regression logs; the production fix remains unchanged, and no physical-device latency improvement is claimed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Editing a draft causes unnecessary evaluation of surrounding native composer controls.
Reason: The narrow change removes demonstrated observation work, preserves interaction behavior, and has explicit support from the assigned MEMBER reviewer.

Merge readiness

✅ Ready for maintainer review

This PR provides a focused, maintainer-supported performance improvement that current main still needs; no actionable correctness or security defect was found.

Priority: P2
Reviewed head: bbe4a082ad69f85edfeac1b54ed517500051bb4f

Before merge

None.

Findings

None.

Agent review details

How this fits together

The shared native chat composer consumes observable draft and session state and renders the editor, model controls, and Send/Stop/Talk actions for iOS and macOS.

flowchart TD
    A[Draft edits] --> B[Chat view model]
    B --> C[Editor section]
    B --> D[Primary controls section]
    E[Session and catalog state] --> F[Model controls]
    C --> G[Native composer]
    D --> G
    F --> G
Loading

Technical review

Best possible solution:

Keep draft reads inside the existing section boundaries while preserving the current editor and primary-control behavior.

Do we have a high-confidence way to reproduce the issue?

Current-main builders eagerly read draft-dependent state, and the supplied baseline regression records the resulting outer observation invalidation; this review executed no target code.

Is this the best way to solve the issue?

The smallest complete repair reuses ChatComposerSection at the two draft-reading subtrees, preserving existing state ownership and avoiding a cache or parallel rendering path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against af9d6236b33f.

Provenance checked

  • Composer section evaluation keeps the original intent (04fdb54: Split nested native view evaluation to restore Debug main-thread stack headroom.)
  • Clean composer controls keeps the original intent (5dd4c6e: Align iOS composer controls with WebUI while retaining native input capabilities; later shared macOS work reused these controls.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Marvinthebored: Raw commit 04fdb54 adds apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatComposer.swift:71 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 04fdb5425a2f; files: apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatComposer.swift)
  • Peter Steinberger: Raw commit c3002fc adds apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatComposer+CleanControls.swift:138 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c3002fc598c7; files: apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatComposer+CleanControls.swift)
  • Colin Johnson: Raw commit 5dd4c6e adds apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatComposer+CleanControls.swift:104 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5dd4c6e3b087; files: apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatComposer+CleanControls.swift)

PR surface

Source +10, Tests +39. Total +49 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 11 1 +10
Tests 1 39 0 +39
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 50 1 +49

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus test LOC Production +11/-1; tests +39/-0 The growth supplies two necessary observation boundaries and one regression covering parent isolation plus continued child observation.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Avoids unnecessary recurring native composer work without claiming an urgent availability problem or measured typing-latency improvement.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (4 earlier review cycles)
  • reviewed 2026-11-06T17:05:05.056Z sha ca086cfc2e38b5323ce82bb51dcfcfbd75462d0b :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-06T17:28:34.314Z sha ca086cfc2e38b5323ce82bb51dcfcfbd75462d0b :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-06T18:45:33.914Z sha ca086cfc2e38b5323ce82bb51dcfcfbd75462d0b :: needs maintainer review before merge. :: none
  • reviewed 2026-11-11T02:22:55.447Z sha 6035937668f61194b36bdf784f421b56d9aaa2ed :: needs maintainer review before merge. :: none

Reviewed November 16, 2026, 9:09 PM ET / November 17, 2026, 02:09 UTC (Revision 5).

@Marvinthebored

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 6, 2026
@Marvinthebored

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 6, 2026
@Marvinthebored Marvinthebored changed the title fix(ios): avoid rebuilding clean composer controls on draft edits perf(ios): stop redrawing the model menu and buttons on every keystroke Nov 9, 2026
@Marvinthebored
Marvinthebored force-pushed the fix/ios-composer-draft-isolation branch from ca086cf to 6035937 Compare November 11, 2026 01:48
@Marvinthebored

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 11, 2026
@vyctorbrzezowski vyctorbrzezowski self-assigned this Nov 13, 2026
@vyctorbrzezowski

Copy link
Copy Markdown
Member

Maintainer review: the production fix remains unchanged and reuses the existing observation boundary. I simplified the test counter to Mutex and corrected import ordering. The retained native-app test proves parent isolation while the child continues to observe draft changes; the before/after below confirms typing, clearing and Talk/Send parity through the app. It is not a latency benchmark.

The current body records the fresh iOS package-test limitation: unrelated tests use Process, which is unavailable on iOS; the product schemes have no test action. I have not represented those attempts as passing. Scoped format/lint and the independent source review pass; current-head CI remains required.

composer-before-after.mp4

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@vyctorbrzezowski
vyctorbrzezowski enabled auto-merge (squash) November 17, 2026 02:04
@vyctorbrzezowski
vyctorbrzezowski merged commit 53278c3 into openclaw:main Nov 17, 2026
94 of 96 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 17, 2026
…ke (openclaw#194235)

* fix(ios): avoid rebuilding clean composer controls on draft edits

* test(ios): simplify composer invalidation probes

---------

Co-authored-by: Vyctor H. Brzezowski <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants