Skip to content

docs(mobile): Hermes V1 pin A/B measured no RAM reduction - #4837

Merged
iscekic merged 12 commits into
mainfrom
hermes-mem-c716
Jul 29, 2026
Merged

docs(mobile): Hermes V1 pin A/B measured no RAM reduction#4837
iscekic merged 12 commits into
mainfrom
hermes-mem-c716

Conversation

@iscekic

@iscekic iscekic commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

What this PR became: a documentation note and workflow learnings — no product change
ships
. The section implemented a Hermes V1 250829098.0.16 pin for react-native@0.86.0
to remove the per-worklet ~512 KB metadata regression of the bundled .0.14 engine, measured
it against the unmodified engine in a single on-device A/B round, and found no measurable
RAM reduction
— so the patch, override and lockfile change were dropped per the plan's
pre-registered ship-nothing branch. A workaround that measurably buys nothing must not ship.

What remains in the diff:

  • apps/mobile/AGENTS.md — one bullet recording the regression, the tried pin, the measured
    numbers below, and the recommendation to take the fix via React Native ≥ 0.86.2 / 0.87
    (plus the standing prohibition of worklets Bundle Mode while NativeWind remaps
    react-native, reanimated#9817).
  • .kilo_workflow/learnings/ — eight new environment learnings from the two device rounds,
    plus a victim-side recovery recipe added to the existing slot-release entry.

Why the pin was expected to help: RN 0.86.0 ships Hermes V1 250829098.0.14, which
attaches ~512 KB of metadata per unique worklet
(Software Mansion;
fixed in .0.15+). This app imports react-native-reanimated in ~57 source files, so ~30
live worklets would exceed the 15 MB gate. RN 0.86.2 itself carries the fix but is blocked by
the repo's minimumReleaseAge gate until ~2026-08-01 and pinned by Expo SDK 57 — the upgrade
remains the correct path once eligible.

Verification

On-device A/B (the decision evidence). One emulator boot (kilo_pixel7, debug
dev-client), one locked flow (login → Agents → session transcript → Profile → KiloClaw),
three cold-start iterations per arm; arm A .0.14 vs arm B .0.16, engine swap proven by
per-ABI libhermesvm.so sha256 (all four ABIs differ across arms) and the Gradle cache
gaining 250829098.0.16; dumpsys meminfo App Summary Pss(KB):

Iter A TOTAL (MB) A NativeHeap (MB) B TOTAL (MB) B NativeHeap (MB)
1 881.68 610.35 901.65 611.01
2 900.50 607.80 889.22 606.92
3 868.29 608.69 906.85 608.57
Median 881.68 608.69 901.65 608.57

Frozen thresholds (≥ 15 MB lower on either median, 2/3 iterations consistent): both
signals missed
— TOTAL PSS went +19.97 MB the other way (0/3 below), Native Heap moved
−0.11 MB (noise). Arm A reproduced the pre-merge baseline within ~1.6% (895.71/607.60 MB),
so the measurement environment was sound. Behavior on the .0.16 engine was otherwise
correct on both platforms: Android cold launch/login/lists/animations clean with zero
error-class Hermes/worklets logcat lines; iOS Podfile.lock resolved hermes-engine (250829098.0.16) and the smoke flow passed — the pin is safe, it just buys nothing here.

Automated gates (green locally): root pnpm format:check + pnpm typecheck;
apps/mobile: format:check, typecheck, lint, check:unused, test (277 files /
2337 tests), pnpx expo-doctor 20/20. Root pnpm test (web/web-env) could not be run green
locally under host saturation (load 275–740; 1303×60 s timeouts, 330×5 s, 11 connection
terminations on shared postgres — all in apps/web suites, none touching this diff, which
contains no web code); CI on origin/main was green at 2026-07-28T16:02Z, so PR CI is the
authority for those suites.

Visual Changes

N/A — no user-facing change remains in the diff.

Reviewer Notes

iscekic added 8 commits July 28, 2026 14:45
96154f1 fixed the untargeted tmux session lookup in dispatch-role.sh
itself (session resolved through $TMUX_PANE, falling back to an own
session), so the workaround this learning recorded is obsolete.
From e2e-verifier r0 (baseline gate): booting on an explicit port around
default-serial claim contention, maestro flow traps on Android under host
load (exit-code, full-string regex, ANR/timeout hardening), and recovering
a wedged CLI relay window. The stale-claims cause is updated for the
guest-boot-id claim keying that landed in 96154f1.
A bare session target lets tmux compute the new window's index, which can
land on an occupied slot: on a two-window session with active window 0 the
first dispatch after launch fails with 'create window failed: index 1 in
use' (tmux 3.7b). Target "<session>:" so tmux appends at the next free
index instead.
…sion

Patch react-native version files and override hermes-compiler to match
upstream 0.86.2's lockstep pair. Document removal at RN ≥ 0.86.2/0.87 and
local native-cache bust (fingerprint ignores root patches).
…atch

The original patch hunk dropped upstream's '\ No newline at end of file'
marker on the + side, so the patched sdks/.hermesv1version gained a
trailing newline. ReactAndroid/hermes-engine/build.gradle.kts reads that
file with readText() and no trim. Re-authored via pnpm patch-commit so the
patched file stays byte-identical to upstream apart from the version
string; version.properties hunk unchanged. Lockfile diff is the patch
hash only.
@iscekic iscekic self-assigned this Jul 28, 2026
@kilo-code-bot

kilo-code-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Executive Summary

The last commit (2a15f00a) deleted the apps/mobile/AGENTS.md bullet that documented the Hermes V1 A/B measurement and ship-nothing decision, so the current diff no longer contains any product documentation despite the PR title/description stating that bullet is what remains.

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
apps/mobile/AGENTS.md N/A (deleted, no longer in diff) Commit 2a15f00a ("Update AGENTS.md") removed the entire Hermes V1 regression bullet added by the prior commit, instead of updating it. gh pr diff --name-only no longer includes apps/mobile/AGENTS.md at all — the net diff on that file is now zero. The PR title ("docs(mobile): Hermes V1 pin A/B measured no RAM reduction") and description ("What remains in the diff: apps/mobile/AGENTS.md — one bullet recording the regression...") no longer match the actual diff, which contains only .kilo_workflow/learnings/* files and no record of the measured finding, the frozen-threshold miss, or the RN ≥ 0.86.2 recommendation. If the deletion was intentional, update the PR description to match; otherwise restore the bullet.
Files Reviewed (9 files)
  • .kilo_workflow/learnings/e2e-slot-release-stopped-another-sections-stack.md
  • .kilo_workflow/learnings/mobile-android-maestro-flow-pitfalls.md
  • .kilo_workflow/learnings/mobile-android-stale-claims-explicit-port.md
  • .kilo_workflow/learnings/mobile-e2e-cli-relay-window-wedge.md
  • .kilo_workflow/learnings/mobile-ios-cold-build-shareextension-pods-root.md
  • .kilo_workflow/learnings/mobile-ios-maestro-session-row-and-back.md
  • .kilo_workflow/learnings/mobile-metro-file-map-stale-after-node-modules-relayout.md
  • .kilo_workflow/learnings/mobile-native-build-cache-ignores-root-patches.md
  • .kilo_workflow/learnings/pnpm-install-noop-leaves-virtual-store-drift.md

(No content changes to these 9 files since the last review at 639543bde; only apps/mobile/AGENTS.md changed since then, and it now nets to no diff.)

Fix these issues in Kilo Cloud

Previous Review Summaries (2 snapshots, latest commit 41d095c)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 41d095c)

Status: No Issues Found | Recommendation: Merge

Executive Summary

The on-device A/B measurement failed the pre-committed threshold (median TOTAL PSS rose from 881.7 MB to 901.7 MB, Native Heap flat), so the Hermes V1 patch, hermes-compiler override, and lockfile changes were reverted per the PR's own documented ship-nothing branch; the current diff contains only a documentation note recording the result and unrelated workflow-tooling changes, all reviewed with no security, correctness, or breaking-change issues.

Files Reviewed (11 files)
  • apps/mobile/AGENTS.md (documents the dropped pin and measured numbers)
  • .kilo_workflow/dispatch-role.sh
  • .kilo_workflow/learnings/e2e-slot-stack-killed-by-foreign-slot-churn.md
  • .kilo_workflow/learnings/mobile-android-maestro-flow-pitfalls.md
  • .kilo_workflow/learnings/mobile-android-stale-claims-explicit-port.md
  • .kilo_workflow/learnings/mobile-e2e-cli-relay-window-wedge.md
  • .kilo_workflow/learnings/mobile-ios-cold-build-shareextension-pods-root.md
  • .kilo_workflow/learnings/mobile-ios-maestro-session-row-and-back.md
  • .kilo_workflow/learnings/mobile-metro-file-map-stale-after-node-modules-relayout.md
  • .kilo_workflow/learnings/mobile-native-build-cache-ignores-root-patches.md
  • .kilo_workflow/learnings/pnpm-install-noop-leaves-virtual-store-drift.md

Previous review (commit a9aba33)

Status: No Issues Found | Recommendation: Merge

Executive Summary

Reviewed the Hermes V1 engine/compiler version pin (patch, override, lockfile, docs) and the unrelated workflow-tooling changes; no security, correctness, or breaking-change issues found with high confidence.

Files Reviewed (9 files)
  • patches/react-native@0.86.0.patch
  • pnpm-workspace.yaml
  • pnpm-lock.yaml (generated, mechanical patch-hash/override diff only)
  • apps/mobile/AGENTS.md
  • .kilo_workflow/dispatch-role.sh
  • .kilo_workflow/learnings/mobile-android-maestro-flow-pitfalls.md
  • .kilo_workflow/learnings/mobile-android-stale-claims-explicit-port.md
  • .kilo_workflow/learnings/mobile-e2e-cli-relay-window-wedge.md
  • .kilo_workflow/learnings/mobile-native-build-cache-ignores-root-patches.md

Reviewed by claude-sonnet-5 · Input: 26 · Output: 11.6K · Cached: 787.8K

Review guidance: REVIEW.md from base branch main

iscekic added 3 commits July 28, 2026 21:39
Metro file-map staleness after node_modules relayout, pnpm v11 no-op
install virtual-store drift, e2e stack kills under foreign slot churn,
iOS cold-build ShareExtension PODS_ROOT defect, iOS Maestro row/back
idioms.
…uction

Single-session on-device A/B (PR #4837 verifier r1, kilo_pixel7
emulator, debug dev-client, identical locked flow, 3 cold starts per
arm, per-ABI libhermesvm.so hashes confirmed distinct):

  median TOTAL PSS   881.68 MB (.0.14) vs 901.65 MB (.0.16)  -> +19.97 MB
  median Native Heap 608.69 MB (.0.14) vs 608.57 MB (.0.16)  ->  -0.11 MB

The frozen gate (>=15 MB lower on either signal, 2/3 iterations
consistent) missed on both signals, so the workaround buys nothing and
must not ship (plan ship-nothing branch). Removes the react-native
patch, the hermes-compiler override and the lockfile change; keeps an
apps/mobile/AGENTS.md note with the measured numbers recommending the
fix via React Native >= 0.86.2 / 0.87.
# Conflicts:
#	.kilo_workflow/dispatch-role.sh
@iscekic iscekic changed the title fix(mobile): pin Hermes V1 250829098.0.16 for memory regression docs(mobile): Hermes V1 pin A/B measured no RAM reduction Jul 28, 2026
@iscekic

iscekic commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

(bot) @kilocode-bot please review the current head (639543b): the diff changed since your last summary — a merge of origin/main absorbed the dispatch-role.sh change and replaced the slot-churn learning with an update to the existing e2e-slot entry.

@kilo-code-bot

kilo-code-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review — head 639543bde (re-review after the origin/main merge)

Verified by checking out the head and diffing three-dot against origin/main
(merge base 28e45f4ba). The diff now matches the PR description: docs-only, ship-nothing.

1. Current changeset — 10 files, +165 / −0

File Change
apps/mobile/AGENTS.md +1 bullet (Hermes V1 regression, tried pin, measured medians, take-the-fix-via-RN-0.86.2 recommendation)
.kilo_workflow/learnings/e2e-slot-release-stopped-another-sections-stack.md +12 (victim-side recovery recipe appended to the existing entry)
8 × .kilo_workflow/learnings/mobile-*.md, pnpm-install-noop-*.md new environment learnings

gh pr diff --name-only agrees exactly with the local three-dot diff — no drift between GitHub's view and the branch.

2. dispatch-role.sh is out, slot-churn file absorbed — confirmed

  • .kilo_workflow/dispatch-role.sh is not in the three-dot diff, and the head's copy is byte-identical to origin/main (git diff origin/main FETCH_HEAD -- .kilo_workflow/dispatch-role.sh is empty). The branch's earlier bb0293338 role-window fix is fully absorbed by main's lineage (#4826/subsequent), so this PR no longer carries shared-script changes.
  • e2e-slot-stack-killed-by-foreign-slot-churn.md was added on the branch (04893205f) and removed in the merge (639543bde, −21), with its operational content folded into the existing e2e-slot-release-... entry (+12 net vs main). No orphan file, no duplicated entry, and the churn learning's substance survived rather than being silently dropped. Good resolution.

3. No product/app code remains — confirmed

  • No patches/react-native@0.86.0*.patch (only the pre-existing expo-server-sdk and react-native-appsflyer patches).
  • No hermes-compiler / Hermes entry anywhere in pnpm-workspace.yaml; apps/mobile/package.json still "react-native": "0.86.0" and untouched.
  • No lockfile change in this PR. For the record: a naive two-dot git diff origin/main FETCH_HEAD -- pnpm-lock.yaml shows −3 lines (@kilocode/session-ingest-contracts), but that is main-side content added after the merge base by #4832, not PR content — the three-dot diff has zero pnpm-lock.yaml delta.
  • Zero files under apps/, services/, packages/ other than the single AGENTS.md doc line.

4. Learnings content — spot-checked against the tree, all claims hold

  • e2e-slot entry (updated): the appended stack=none-for-live-stacks attribution to the #4836 name-mangling bug matches e5fb4f27c's own commit message verbatim ("status always printed 'stack=none' even with the stack up"), and status does gate on tmux has-session -t "$(stack_session "$wt")" (.kilo_workflow/e2e-slot.sh:171). "already fixed" is accurate on current main (#4836 + #4842 both merged). The new paragraph reads as a natural continuation of the existing entry — symptom → cause → fix → operational note → victim-side recovery — with no contradiction of the prose above it.
  • mobile-android-stale-claims-explicit-port.md: 96154f115 (#4826, Android claims/boot-id) exists on main as described.
  • mobile-android-maestro-flow-pitfalls.md: Search sessions... placeholder confirmed (session-list-search-header.tsx:35); open-app.yaml's extendedWaitUntil … timeout: 30000 confirmed (line 31), so the "30 s is too short" note is grounded.
  • mobile-ios-maestro-session-row-and-back.md: accessibilityLabel={… 'Go back'} confirmed (screen-header.tsx:107).
  • pnpm-install-noop-leaves-virtual-store-drift.md: repo is on pnpm@11.1.2, consistent with the v11 short-circuit claim; its cross-reference to mobile-metro-file-map-stale-after-node-modules-relayout.md resolves to a file added in this same PR (no dangling link).
  • Numbers are internally consistent: the medians in AGENTS.md (881.7 / 901.7 TOTAL, 608.7 / 608.6 Native) are the correct medians of the PR body's three iterations per arm, and the ship-nothing conclusion follows from the pre-registered ≥15 MB gate (TOTAL went +19.97 MB the wrong way, Native −0.11 MB).

5. Non-blocking nits (no change requested)

  1. The new AGENTS.md bullet is one 873-char line; the longest pre-existing line in that file is 230. format-check is green, so this is purely readability — a nested sub-bullet block would be easier to scan later.
  2. mobile-android-stale-claims-explicit-port.md and mobile-native-build-cache-ignores-root-patches.md embed host-specific detail (/Users/igor/Projects/.worktrees/..., ~/Library/Caches/Kilo/..., $TMPDIR). WORKFLOW.md steers machine-only facts to the gitignored learnings/system/. Committing these is defensible since the substance is repo-script behavior (fingerprint scope, claim files), but the literal absolute paths will read as noise on another machine.
  3. mobile-ios-cold-build-shareextension-pods-root.md identifies a real repo-side defect (project-level REACT_NATIVE_PATH via ${PODS_ROOT} leaks into the ShareExtension target, which has no Pods xcconfig) and only records a temporary local workaround. That deserves a tracked follow-up issue for the config plugin, otherwise the next cold iOS build rediscovers it from a learning file.

6. CI / merge state

All required checks green on this head (typecheck, lint, format-check ×2, test, test (kilo-app), check-unused, drizzle-check, markdown table padding, CodeQL, trufflehog); mergeStateStatus: BLOCKED is solely REVIEW_REQUIRED. The unrunnable local pnpm test (web/web-env) caveat in the description is moot — the diff contains no web/service code and CI ran those suites green.

Recommendation

Approve / merge. Dropping the pin is the right call: a workaround that misses its own pre-registered threshold (and trended the wrong way on TOTAL PSS) should not ship, and the residual value — the measurement, the "don't retry this" record, and the RN ≥ 0.86.2 path — is exactly what belongs in AGENTS.md plus learnings. The diff is now clean of shared-script and dependency churn.

@kilo-code-bot

kilo-code-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

The re-review is already posted: #4837 (comment)

Verdict: docs-only, ship-nothing diff confirmed after the merge — dispatch-role.sh absorbed cleanly, slot-churn content folded into the existing e2e-slot entry with no orphan/duplicate, no product code or lockfile changes snuck in. A few non-blocking nits (long AGENTS.md line, host-specific paths, suggest tracking the ShareExtension REACT_NATIVE_PATH issue separately). Recommendation: approve/merge.

@iscekic

iscekic commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

(bot) Re-review on 639543b acknowledged — thanks. On the non-blocking nits: (1) the AGENTS.md bullet follows the file's existing one-line-bullet style (the bullet it replaced was the same shape); (2) host-specific paths in learnings are by design — they are machine-local environment records; (3) the ShareExtension REACT_NATIVE_PATH fix candidate is recorded in .kilo_workflow/learnings/mobile-ios-cold-build-shareextension-pods-root.md for whoever owns that config plugin; a separate tracking issue is out of this section's scope. No code changes from the nits.

@iscekic iscekic added the human-ready The PR is ready for human review. label Jul 28, 2026
@iscekic
iscekic requested a review from pandemicsyn July 29, 2026 00:50
@iscekic
iscekic merged commit 951b893 into main Jul 29, 2026
17 checks passed
@iscekic
iscekic deleted the hermes-mem-c716 branch July 29, 2026 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

human-ready The PR is ready for human review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants