Skip to content

feat(mobile): a failed hybrid-shell update is recorded on the device and shown in Troubleshoot - #22321

Merged
Jinwoo-H merged 11 commits into
mainfrom
ota-fu-update-refusal-diagnostic
Sep 22, 2026
Merged

Jinwoo-H merged 11 commits into
mainfrom
ota-fu-update-refusal-diagnostic

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 18 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​984 $\color{#cf222e}{\Huge{\mathbf{−}}}$​59 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​925
Prod 18 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​644 $\color{#cf222e}{\Huge{\mathbf{−}}}$​54 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​590

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 to update-failures.json in 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}. reason is 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 activating state now records its source (download from download-staged, cache from the cached-generation open), and activated emits forget-update-failures only 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_MODULES 4,211→4,212 for a joiner this PR did not add: #22299 (src/shared/agent-session-journal-producer.ts, no mobile/ file, so its mobile job never ran); measured on the merged head and named in the pin comment.

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
@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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 configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 7db6563e-e3c5-4601-bb28-a164a031494b

📥 Commits

Reviewing files that changed from the base of the PR and between 73c56d5 and c35c39c.

📒 Files selected for processing (1)
  • config/scripts/mobile-web-app-session-terminal-closure.test.mjs

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The 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 update-failures.json log persists records and removes them when hosts are removed. Troubleshoot displays the newest failure for each paired host when the shell flag can be enabled. Tests cover classification, persistence, cleanup, and rendering.

Priority: ⬇️ Low

Merge Risk: 🔵 Low · up to c35c3

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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 45.90% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 61 functions across 32 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly describes the main change: recording failed hybrid-shell updates on the device and showing them in Troubleshoot. It is specific, though somewhat long.
Description check ✅ Passed The description explains the problem, user-visible change, implementation, and follow-up behavior. It also describes testing and security safeguards. It does not use the template headings or provide t…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: b7a99f22-48dd-4977-804c-37bdcb7ac3e8

📥 Commits

Reviewing files that changed from the base of the PR and between 11db2b9 and 34d7b79.

📒 Files selected for processing (31)
  • mobile/app/troubleshoot.tsx
  • mobile/src/diagnostics/mobile-web-shell-update-failure-copy.ts
  • mobile/src/diagnostics/mobile-web-shell-update-failure-row.test.tsx
  • mobile/src/diagnostics/mobile-web-shell-update-failure-row.tsx
  • mobile/src/mobile-web-shell/forget-host-update-failures.test.ts
  • mobile/src/mobile-web-shell/forget-host-update-failures.ts
  • mobile/src/mobile-web-shell/generation-store.ts
  • mobile/src/mobile-web-shell/mobile-web-shell-dev-facts.ts
  • mobile/src/mobile-web-shell/mobile-web-shell-failed-update-fallback.test.ts
  • mobile/src/mobile-web-shell/mobile-web-shell-refused-update-decision.test.ts
  • mobile/src/mobile-web-shell/mobile-web-shell-session-contract.ts
  • mobile/src/mobile-web-shell/mobile-web-shell-session-effects.test.ts
  • mobile/src/mobile-web-shell/mobile-web-shell-session-effects.ts
  • mobile/src/mobile-web-shell/mobile-web-shell-session-grants.test.ts
  • mobile/src/mobile-web-shell/mobile-web-shell-session-test-fixtures.ts
  • mobile/src/mobile-web-shell/mobile-web-shell-session.test.ts
  • mobile/src/mobile-web-shell/mobile-web-shell-session.ts
  • mobile/src/mobile-web-shell/mobile-web-shell-update-failure-log.test.ts
  • mobile/src/mobile-web-shell/mobile-web-shell-update-failure-log.ts
  • mobile/src/mobile-web-shell/mobile-web-shell-update-failure-outcome.ts
  • mobile/src/mobile-web-shell/mobile-web-shell-update-failure-record.test.ts
  • mobile/src/mobile-web-shell/mobile-web-shell-update-failure.test.ts
  • mobile/src/mobile-web-shell/mobile-web-shell-update-failure.ts
  • mobile/src/mobile-web-shell/use-mobile-web-shell-session.test.ts
  • mobile/src/mobile-web-shell/use-mobile-web-shell-session.ts
  • mobile/src/notifications/push-registration-cancellation.test.ts
  • mobile/src/transport/host-removal-lifecycle.test.ts
  • mobile/src/transport/host-removal-lifecycle.ts
  • mobile/src/transport/mobile-web-bundle-fetch-refusal.ts
  • mobile/src/transport/mobile-web-bundle-fetch.test.ts
  • mobile/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.

Comment on lines +109 to +123
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)

@coderabbitai coderabbitai Bot Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ 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.ts

Repository: 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 300

Repository: 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 220

Repository: 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@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.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues — one design observation below.

Reviewed changes

  • Typed fetch refusals. MobileWebBundleFetchError now carries a closed MOBILE_WEB_BUNDLE_FETCH_REFUSALS code, replacing the plain Errors 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.ts maps any rejection to {reason, hostCode} (transport → connection-lost; host bundle code → host-refused; fetch error → its refusal; incompatible reply → reply-unreadable; else unrecognised-error), keeps the old transport/bundle split via readFailureSide, and flattens a compat verdict to one wall code.
  • A device-local record. mobile-web-shell-update-failure-log.ts reads/appends/forgets entries in update-failures.json in 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. onDownloadFailed wraps the existing decision and appends a record-update-failure effect 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. MobileWebShellUpdateFailureRow and 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.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@Jinwoo-H

Copy link
Copy Markdown
Contributor Author

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 5f13be2b-fc14-4113-bd19-b69f0bb26928

📥 Commits

Reviewing files that changed from the base of the PR and between 34d7b79 and 73c56d5.

📒 Files selected for processing (5)
  • mobile/src/mobile-web-shell/mobile-web-shell-failed-update-fallback.test.ts
  • mobile/src/mobile-web-shell/mobile-web-shell-session-contract.ts
  • mobile/src/mobile-web-shell/mobile-web-shell-session.ts
  • mobile/src/mobile-web-shell/mobile-web-shell-update-failure-record.test.ts
  • mobile/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.

Comment on lines +157 to +160
await store.recordUpdateFailure({ ...effect.failure, hostId, at: runtime.now() })
return
case 'forget-update-failures':
await store.forgetHostUpdateFailures(hostId)

@coderabbitai coderabbitai Bot Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ 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.ts

Repository: 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.ts

Repository: 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.ts

Repository: 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.ts

Repository: 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@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

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues — one narrow edge in the new success-clears-record path noted inline.

Reviewed changes

  • A successful update now clears the record. activated emits forget-update-failures when the activated build equals the requestedBuildId the flow set out to download, and the effect runner clears that host's entries through the store's single write queue.
  • requestedBuildId is tracked per flow. Set in onManifestRead when a newer generation is fetched, reset by startFlow and retry-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.ts mounts, 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.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using 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

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

  • The clear-on-success predicate is now source-based. MobileWebShellSessionState's activating variant carries source: 'download' | 'cache'; download-staged sets download and the cached/fallback/offline/same-build opens set cache, and activated emits forget-update-failures only when the prior state was a download activation. This replaces the event.buildId === session.requestedBuildId comparison, which compared the session's manifest read against the build the fetch's re-read actually committed.
  • requestedBuildId keeps its remaining job. Still set on a newer-generation manifest read and reset by startFlow/retry-pressed, but now only feeds offeredBuildId on 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).

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@Jinwoo-H
Jinwoo-H merged commit 7240368 into main Sep 22, 2026
32 checks passed
@Jinwoo-H
Jinwoo-H deleted the ota-fu-update-refusal-diagnostic branch September 22, 2026 22:36
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