Repository navigation
feat(mobile): a failed hybrid-shell update is recorded on the device and shown in Troubleshoot - #22321
Conversation
The fetch threw plain errors whose only content was prose naming asset paths and hashes, so a caller could not keep the cause without keeping the prose. Each refusal now carries a code beside the unchanged message. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
A release build forwards no console output to logcat, so a refused or failed page update left the fallback banner and nothing else. Every exit from a failed update read now emits a record-update-failure effect: the cause as a closed code (never an error message), the generation offered and the one on disk, and what went on screen instead. The runner stamps host id and time and the generation store appends it to a bounded log in the cache root, five per host and twenty in all, oldest evicted first. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Removal clears the host's entries from the shell's update-failure log after the metadata commit, unawaited and best-effort: it is evidence about a host that is gone and never a reason to hold the removal. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
A "Workspace updates" section lists the newest recorded failure of each paired host: the reason, the generation offered, and what the shell showed instead. It renders nothing until a failure has been recorded and mounts only where the hybrid shell can run. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe mobile web shell now classifies fetch and update failures with structured data. Sessions record failure facts with build IDs, outcomes, walls, host IDs, and timestamps. A bounded, validated Priority: ⬇️ Low Merge Risk: 🔵 Low · up to Failure diagnostics may occasionally be lost or restored incorrectly during overlapping updates and host removal; this is bounded to troubleshooting data but should be addressed. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: b7a99f22-48dd-4977-804c-37bdcb7ac3e8
📒 Files selected for processing (31)
mobile/app/troubleshoot.tsxmobile/src/diagnostics/mobile-web-shell-update-failure-copy.tsmobile/src/diagnostics/mobile-web-shell-update-failure-row.test.tsxmobile/src/diagnostics/mobile-web-shell-update-failure-row.tsxmobile/src/mobile-web-shell/forget-host-update-failures.test.tsmobile/src/mobile-web-shell/forget-host-update-failures.tsmobile/src/mobile-web-shell/generation-store.tsmobile/src/mobile-web-shell/mobile-web-shell-dev-facts.tsmobile/src/mobile-web-shell/mobile-web-shell-failed-update-fallback.test.tsmobile/src/mobile-web-shell/mobile-web-shell-refused-update-decision.test.tsmobile/src/mobile-web-shell/mobile-web-shell-session-contract.tsmobile/src/mobile-web-shell/mobile-web-shell-session-effects.test.tsmobile/src/mobile-web-shell/mobile-web-shell-session-effects.tsmobile/src/mobile-web-shell/mobile-web-shell-session-grants.test.tsmobile/src/mobile-web-shell/mobile-web-shell-session-test-fixtures.tsmobile/src/mobile-web-shell/mobile-web-shell-session.test.tsmobile/src/mobile-web-shell/mobile-web-shell-session.tsmobile/src/mobile-web-shell/mobile-web-shell-update-failure-log.test.tsmobile/src/mobile-web-shell/mobile-web-shell-update-failure-log.tsmobile/src/mobile-web-shell/mobile-web-shell-update-failure-outcome.tsmobile/src/mobile-web-shell/mobile-web-shell-update-failure-record.test.tsmobile/src/mobile-web-shell/mobile-web-shell-update-failure.test.tsmobile/src/mobile-web-shell/mobile-web-shell-update-failure.tsmobile/src/mobile-web-shell/use-mobile-web-shell-session.test.tsmobile/src/mobile-web-shell/use-mobile-web-shell-session.tsmobile/src/notifications/push-registration-cancellation.test.tsmobile/src/transport/host-removal-lifecycle.test.tsmobile/src/transport/host-removal-lifecycle.tsmobile/src/transport/mobile-web-bundle-fetch-refusal.tsmobile/src/transport/mobile-web-bundle-fetch.test.tsmobile/src/transport/mobile-web-bundle-fetch.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
| export async function recordUpdateFailureIn( | ||
| fs: GenerationFileSystem, | ||
| failure: MobileWebShellUpdateFailure | ||
| ): Promise<void> { | ||
| await writeUpdateFailureLog(fs, appendUpdateFailure(await readUpdateFailureLog(fs), failure)) | ||
| } | ||
|
|
||
| export async function forgetHostUpdateFailuresIn( | ||
| fs: GenerationFileSystem, | ||
| hostId: string | ||
| ): Promise<void> { | ||
| const entries = await readUpdateFailureLog(fs) | ||
| const kept = entries.filter((entry) => entry.hostId !== hostId) | ||
| if (kept.length !== entries.length) { | ||
| await writeUpdateFailureLog(fs, kept) |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
rg -n "createGenerationStore|recordUpdateFailure|forgetHostUpdateFailures|function serialize|const serialize" mobile/src mobile/app
sed -n '300,350p' mobile/src/mobile-web-shell/generation-store.ts
sed -n '90,130p' mobile/src/mobile-web-shell/mobile-web-shell-update-failure-log.ts
sed -n '1,40p' mobile/src/mobile-web-shell/forget-host-update-failures.ts
sed -n '130,205p' mobile/src/mobile-web-shell/use-mobile-web-shell-session.tsRepository: stablyai/orca
Length of output: 20453
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- GenerationStore declarations and instance construction ---'
rg -n -C 3 "createGenerationStore|createStore|Troubleshoot|troubleshoot|createExpoGenerationFileSystem|recordUpdateFailure|forgetHostUpdateFailures" mobile/src mobile/app
printf '%s\n' '--- generation-store structure and filesystem calls ---'
sed -n '1,110p' mobile/src/mobile-web-shell/generation-store.ts
sed -n '285,345p' mobile/src/mobile-web-shell/generation-store.ts
printf '%s\n' '--- update failure log full relevant source ---'
sed -n '1,145p' mobile/src/mobile-web-shell/mobile-web-shell-update-failure-log.ts
printf '%s\n' '--- filesystem implementation and interface ---'
rg -n -C 5 "interface GenerationFileSystem|type GenerationFileSystem|createExpoGenerationFileSystem|writeText|readText|delete\(" mobile/src/mobile-web-shell
printf '%s\n' '--- diagnostics/Troubleshoot callers ---'
rg -n -i -C 5 "troubleshoot|generation-store" mobile/src mobile/app | head -n 300Repository: stablyai/orca
Length of output: 43464
🤖 get_repo_knowledge executed:
get_repo_knowledge stablyai/orca /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/learnings /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/conventions
Length of output: 35867
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- runtime store factory ---'
sed -n '1,60p' mobile/src/mobile-web-shell/mobile-web-shell-runtime.ts
printf '%s\n' '--- Troubleshoot failure row ---'
sed -n '1,90p' mobile/src/diagnostics/mobile-web-shell-update-failure-row.tsx
printf '%s\n' '--- host cleanup lifecycle ---'
sed -n '1,60p' mobile/src/transport/host-removal-lifecycle.ts
printf '%s\n' '--- filesystem port and Expo adapter ---'
cat -n mobile/src/mobile-web-shell/generation-store-file-system.ts
printf '%s\n' '--- update log read/write operations ---'
cat -n mobile/src/mobile-web-shell/mobile-web-shell-update-failure-log.ts | sed -n '55,135p'
printf '%s\n' '--- production createGenerationStore references ---'
rg -n -g '!*.test.*' "createGenerationStore|createExpoGenerationFileSystem|forgetHostUpdateFailures|recordUpdateFailure" mobile/src mobile/app
printf '%s\n' '--- omitted filesystem output from prior request ---'
rg -n -C 8 "GenerationFileSystem|createExpoGenerationFileSystem|writeText|readText" /tmp/coderabbit-shell-logs/shell-output-YRY8zH | head -n 220Repository: stablyai/orca
Length of output: 39953
Serialize update-failure changes across all store instances.
GenerationStore.serialize is local to each createGenerationStore instance. Two shell sessions or host cleanup can therefore interleave read-modify-write operations on the same update-failures.json. A later write can lose a new failure or restore an entry removed by host cleanup.
Use one queue shared by the cache root for both operations. The filesystem adapter provides no shared queue or JSON merge. Troubleshoot only reads the file.
This affects device-local diagnostic evidence, not generation or host data, so classify this as a minor issue.
There was a problem hiding this comment.
Agreed, and it is the same gap the lane report lists: every createGenerationStore call owns its own promise tail, so a forget issued from host removal and a record issued from the mounted session order only within their own instance. Removal also never deletes the host's generation tree today, for the same reason. The follow-up (next PR) makes the generation store one per process, handed out by the shell runtime, so host removal and the mounted session share one queue; both the failure record and the cache delete then go through it. Kept out of this PR so the record itself lands inert first; the loss here is bounded to a diagnostic entry.
There was a problem hiding this comment.
@Jinwoo-H, thanks for the clear scope decision.
A process-wide GenerationStore supplied by the shell runtime will make recordUpdateFailure, forgetHostUpdateFailures, and generation-tree cleanup use the same serialization queue. That addresses the race described in this thread.
The current impact is limited to bounded diagnostic data, but the race remains until the follow-up lands. Would you like me to open a GitHub issue that links this PR and defines the required shared-store and cleanup work?
(ᵔᴥᵔ)
You are interacting with an AI system.
There was a problem hiding this comment.
ℹ️ No critical issues — one design observation below.
Reviewed changes
- Typed fetch refusals.
MobileWebBundleFetchErrornow carries a closedMOBILE_WEB_BUNDLE_FETCH_REFUSALScode, replacing the plainErrors the bundle fetch threw for a short/oversized/mismatched asset, a mid-fetch build change, a misrouted chunk and an abort. Callers keep a code instead of a message that names asset paths and hashes. - A closed failure vocabulary.
mobile-web-shell-update-failure.tsmaps any rejection to{reason, hostCode}(transport →connection-lost; host bundle code →host-refused; fetch error → its refusal; incompatible reply →reply-unreadable; elseunrecognised-error), keeps the old transport/bundle split viareadFailureSide, and flattens a compat verdict to one wall code. - A device-local record.
mobile-web-shell-update-failure-log.tsreads/appends/forgets entries inupdate-failures.jsonin the shell cache root (outside every host's generation folder), through the store's single write queue, bounded to 5/host and 20 total, strict-schema validated on read and write, with build ids kept only when 64-hex. - The reducer writes one record per failed read.
onDownloadFailedwraps the existing decision and appends arecord-update-failureeffect carrying the cause, the requested/cached build ids and the outcome read off the resulting state; the runner stamps host id and time. - Host removal forgets the host's entries, after metadata commit and fire-and-forget.
- Troubleshoot row.
MobileWebShellUpdateFailureRowand its copy show the newest recorded failure per still-paired host, and render nothing until one exists. - Tests cover the fetch codes, each reducer exit, the log's bounds/validation/privacy, the row, and host removal.
ℹ️ A transient failure can become the displayed "last update failed" line
Because onDownloadFailed records on every path — the transport-side no-connection/connection-lost outcomes and the waiting outcome included — and the row shows only the newest entry per host, a routine socket drop mid-download can occupy (and hide) the asset/build refusal this feature exists to surface. Nothing clears the log after a later successful update either, so a failure a subsequent attempt quietly recovered still reads as the last update failure.
Technical details
# The row can show a failure that is neither the interesting one nor current
## Affected sites
- `mobile/src/mobile-web-shell/mobile-web-shell-session.ts:226` — `onDownloadFailed` appends the record on every decision, transport-side and `waiting` included.
- `mobile/src/mobile-web-shell/mobile-web-shell-update-failure-log.ts:18` — the 5-slot per-host ring fills oldest-first regardless of `reason`, so five later transport drops evict an earlier bundle refusal.
- `mobile/src/diagnostics/mobile-web-shell-update-failure-row.tsx:20` — the row shows only `findLast` per host, so those other entries are invisible.
- No success path clears the log; only `forgetHostUpdateFailures` (host removal) does.
## Required outcome
- Decide whether the single displayed line should prefer a bundle-side failure over a transport/`waiting` one, and whether a successful activation should clear that host's recorded failures so the row describes the current state rather than the most recent failed attempt.
## Open questions for the human
- Is this row meant as historical evidence ("here is why an update once failed") or as a statement about the last update? The current copy reads as the latter ("Last update from Host 1 failed …"). If it is evidence, the current behavior is intentional and this note is informational; if it is current-state, a later success or a superseding bundle failure should update what it shows.DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
On the design observation, two halves, taken differently. The newest failure being a socket drop is the row telling the truth about the last attempt: the reason word is what a triager reads, and a refusal that happened before it is not the current problem. Left as is. The second half is a copy defect: once a later update from the same host lands, "Last update from Host N failed" is false, and nothing cleared the record. Fixing here before merge: a successful commit of a newer generation forgets that host's entries (reducer success exit, same forget path host removal uses; no schema change, no clearing on a cache open). The row then shows a failure only while it is the last thing that happened. |
…commits The Troubleshoot row reads "Last update from Host N failed", which stops being true the moment a later update from that host lands. The activated step for the build this flow downloaded now emits forget-update-failures for the host. A cache open, an offline open and a same-build hit activate a build the flow never requested, so they leave the record alone. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 5f13be2b-fc14-4113-bd19-b69f0bb26928
📒 Files selected for processing (5)
mobile/src/mobile-web-shell/mobile-web-shell-failed-update-fallback.test.tsmobile/src/mobile-web-shell/mobile-web-shell-session-contract.tsmobile/src/mobile-web-shell/mobile-web-shell-session.tsmobile/src/mobile-web-shell/mobile-web-shell-update-failure-record.test.tsmobile/src/mobile-web-shell/use-mobile-web-shell-session.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.
| await store.recordUpdateFailure({ ...effect.failure, hostId, at: runtime.now() }) | ||
| return | ||
| case 'forget-update-failures': | ||
| await store.forgetHostUpdateFailures(hostId) |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
set -euo pipefail
ast-grep outline mobile/src/mobile-web-shell/generation-store.ts --view expanded
ast-grep outline mobile/src/mobile-web-shell/mobile-web-shell-update-failure-log.ts --view expanded
rg -n -C 8 \
'recordUpdateFailure|forgetHostUpdateFailures|update-failures|queue|serial' \
mobile/src/mobile-web-shell/generation-store.ts \
mobile/src/mobile-web-shell/mobile-web-shell-update-failure-log.tsRepository: stablyai/orca
Length of output: 13606
🏁 Script executed:
#!/bin/bash
set -euo pipefail
ast-grep outline mobile/src/mobile-web-shell/use-mobile-web-shell-session.ts --view expanded
rg -n -C 10 \
'createGenerationStore|GenerationFileSystem|fileSystem|cache|store' \
mobile/src/mobile-web-shell/use-mobile-web-shell-session.tsRepository: stablyai/orca
Length of output: 5875
🏁 Script executed:
#!/bin/bash
set -euo pipefail
ast-grep outline mobile/src/mobile-web-shell/mobile-web-shell-runtime.ts --view expanded
rg -n -C 12 \
'createMobileWebShellRuntime|createStore|GenerationFileSystem|cache|fileSystem|root' \
mobile/src/mobile-web-shell/mobile-web-shell-runtime.tsRepository: stablyai/orca
Length of output: 2644
🏁 Script executed:
#!/bin/bash
set -euo pipefail
ast-grep outline mobile/src/mobile-web-shell/generation-store-file-system.ts --view expanded
rg -n -C 14 \
'createExpoGenerationFileSystem|GenerationFileSystem|root|document|cache|FileSystem' \
mobile/src/mobile-web-shell/generation-store-file-system.tsRepository: stablyai/orca
Length of output: 4013
Serialize update-failure operations across GenerationStore instances.
Each hook instance creates a separate store and queue. Both update-failure operations modify the shared update-failures.json file. Concurrent stores can lose records or recreate a failure after a clear. Use one serialization boundary for all operations that share the shell cache root.
There was a problem hiding this comment.
Same finding as your earlier thread on the log module, same answer: every createGenerationStore call owns its own tail today, and the next PR makes the store one per process (handed out by the shell runtime) so host removal, the record and this forget share one queue. Kept out of this PR so the record lands inert first; the loss is bounded to a diagnostic entry.
There was a problem hiding this comment.
@Jinwoo-H, understood. The current race can only affect bounded device-local diagnostic records. The process-wide GenerationStore in the next PR will provide the required shared serialization boundary.
Would you like me to open a follow-up issue for that change?
You are interacting with an AI system.
…cer #22299 added main at 9ece273 measures 4212 modules against a pin of 4211: the native-chat fix added src/shared/agent-session-journal-producer.ts, which three shared modules on the session route import, and its PR touched nothing under mobile/ so the mobile job never ran. Re-measured on this merged head and the joiner read off the closure list. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
There was a problem hiding this comment.
ℹ️ No critical issues — one narrow edge in the new success-clears-record path noted inline.
Reviewed changes
- A successful update now clears the record.
activatedemitsforget-update-failureswhen the activated build equals therequestedBuildIdthe flow set out to download, and the effect runner clears that host's entries through the store's single write queue. requestedBuildIdis tracked per flow. Set inonManifestReadwhen a newer generation is fetched, reset bystartFlowandretry-pressed, so a cache open, the fallback, an offline open and a same-build hit all leave the record.- Coverage. A reducer suite asserts the forget and each non-forget exit; an integration test in
mobile-web-shell-failed-update-fallback.test.tsmounts, records a refusal and another host's entry, then re-mounts onto a successful download and asserts only the other host's entry survives.
This addresses the design question raised previously about nothing clearing the log after a successful update. One residual edge is noted inline.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
… build-id match The fetch reads the manifest again and commits the build that read named, so a host that moved between the session's read and the fetch's committed a build other than requestedBuildId, the forget was skipped, and the stale "last update failed" line outlived the update that should clear it. The activating state now says where it came from, download or cache, and the forget follows a download's activation. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- The clear-on-success predicate is now source-based.
MobileWebShellSessionState'sactivatingvariant carriessource: 'download' | 'cache';download-stagedsetsdownloadand the cached/fallback/offline/same-build opens setcache, andactivatedemitsforget-update-failuresonly when the prior state was adownloadactivation. This replaces theevent.buildId === session.requestedBuildIdcomparison, which compared the session's manifest read against the build the fetch's re-read actually committed. requestedBuildIdkeeps its remaining job. Still set on a newer-generation manifest read and reset bystartFlow/retry-pressed, but now only feedsofferedBuildIdon the recorded failure rather than gating the forget.- Coverage. A red-first case exercises the host moving between the two manifest reads and asserts the forget still fires, alongside the existing forget and four non-forget exits; the touched suites were updated to the new state shape.
Focus is confined to the mobile shell session reducer and its tests; no RPC or wire change. This addresses the prior review's inline concern, which is retired. The focused suites (mobile-web-shell-session, -update-failure-record, -refused-update-decision, -session-manifest-persist, shell-page-frame) pass locally (128/128).
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

On an OTA build (
EXPO_PUBLIC_MOBILE_SHELL=ota; inert for native builds), a failed or refused page update now leaves evidence on the phone, and Troubleshoot shows it.Gap. When the shell cannot download a newer page generation and falls back to the cached one (#22237), a release build left no record of why: React Native release builds do not forward
console.*to logcat, so every shell diagnostic line is invisible on a shipped phone. Both emulator runs on 2026-09-22 ended with the banner as the only on-device signal.Record, not log. The session reducer emits one new effect,
record-update-failure; the effects runner stamps host id and time and appends toupdate-failures.jsonin the shell cache root, outside any host's generation folder so recovery, eviction and corrupt-cache deletes do not erase it. Each entry:{hostId, at, reason, hostCode|null, offeredBuildId|null, cachedBuildId|null, outcome, wall|null}.reasonis a closed list (the bundle fetch now refuses with nine typed reasons instead of plain errors whose text named asset paths); build ids are kept only when they are hex digests; no error message, URL or token is ever stored, asserted by a test. Bounded to 5 entries per host and 20 total, oldest evicted; a host's entries are forgotten after its removal is saved. Every failure entry point (manifest read with no client or rejecting, download with no client, fetch refusal, stage or commit throw) and every outcome the gates can reach (failure screen, native route, wall, cached version, waiting) has its own case.Troubleshoot. A "Workspace updates" section, present only where the shell can run and something was recorded, reads the record: "Last update from Host 1 failed 12m ago: asset checksum mismatch (generation 3f2a…). Fell back to the saved version (generation 9e8d…)." Copy shows only what was recorded.
No RPC or wire change; device-local. Left as follow-ups: host removal does not delete the host's generation cache (only eviction does); separate generation-store instances do not share a write queue, so a write racing a removal can lose one entry.
A later successful update clears the record. Reviewer-found: nothing forgot a host's entries once an update from it landed, so "Last update from Host N failed" went false. The reducer's
activatingstate now records its source (downloadfromdownload-staged,cachefrom the cached-generation open), andactivatedemitsforget-update-failuresonly for a download's activation; a cache open, the fallback, an offline open and a same-build hit leave the record. Not build-id equality: the fetch re-reads the manifest and commits that build, which can be newer than what this flow was offered (reviewer-found, red-first case for the host moving between reads). No new entry type, no schema change.Session-route closure pin
SESSION_ROUTE_MODULES4,211→4,212 for a joiner this PR did not add: #22299 (src/shared/agent-session-journal-producer.ts, nomobile/file, so its mobile job never ran); measured on the merged head and named in the pin comment.