Skip to content

feat(mobile): render agent session history from the desktop's bundle (OTA phase C, C5.1) - #21596

Merged
Jinwoo-H merged 21 commits into
mainfrom
ota-c5-1-agent-history
Sep 19, 2026
Merged

Jinwoo-H merged 21 commits into
mainfrom
ota-c5-1-agent-history

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor

What this is

OTA phase C, C5.1: the agent-history domain becomes the third page route the desktop-served bundle can stand in for (/h/[hostId]/agent-history/[worktreeId], the first route with two dynamic segments). Behind the dev-only shell flag; released native phones are untouched. No contract file changes; no new shell verb; no storage key. C5.2 (the golden-closure certification) follows as its own PR.

What changed

  1. The web route handoff refuses what it cannot serve (C1 file, ruled before this PR). useRouteHandoff on the web answered two things and fell through to a local push for three different reasons; only one of them, a target the shell listed as the page's, is a case where a local push is right. The other two, an href the protocol's own pattern drops and a shell that answered no, mounted a screen the page does not serve: the bundle carries every route under app/h, so the fallback ran the native session screen on React Native Web inside the shell rather than painting Unmatched. The outcome is now tri-state (local, handed-off, refused); a refused target stays put and the reason is logged once per client. Render-check red-first on the one labelled control that leaves the page ("Back to hosts") with navigate withheld: before, the page went to / and painted Unmatched Route; after, it stays on the host route, posts no navigate frame, and reports no fault. C2.2's back keeps its local fallthrough on purpose: it has no target to mount, so router.back() on a one-entry document is the same nothing a refusal would be.
  2. Host id encoded at every href the host page builds (the C1.2 class): the two in the worktree row's navigation actions, then, from a bot thread, five more in host-screen-header.tsx and use-host-worktree-actions.ts, pinned as a census over the host page's four source files (two raw /h/${…} reads that compare against a pathname rather than build a link are exempted by count with the reason). One edge named and left: navigateFromHostList short-circuits when the current pathname equals the target, and for an id that needs encoding the comparison now differs, so a tap on the screen you are already on re-navigates rather than no-ops.
  3. Route entry. The manifest entry with navigate and storage; agent-history/[worktreeId].tsx takes the shell switch and gains a .web.tsx sibling plus its override entry; the panel takes its router from the handoff seam. The three resume writes (aiVault.prepareSessionResume, session.tabs.createTerminal, terminal.send) needed no page-side handling: a seam test runs each through the bridge and against the same fake directly and compares verdicts (a refused create raises the host's message on both; a lost reply or a shell disposed mid-flight stays delivery-unknown on both). Two pins grew deliberately: the builder's route list and the shell-flag census, whose switched-route list is now a named array so each later domain adds one line.
  4. Main merged (4609e003dc, resolving C2.2's back member and docstring against item 1 inside the merge commit; the merge also carries eight lines present in neither parent, five of them the refused case's assertion that no navigate frame crossed, written against the notify recorder main's render check added), then the panel's Back button pinned to the shell handoff: red on the pre-merge head (three of four cases, since back was still expo-router's own), green after the merge. A test commit with no product change: the wiring was item 3's seam swap, and this is what would have caught its absence.

What the parity gate does and does not prove here

787 goldens replay unchanged (396 identical, classes 341/3/6/33/8, nothing unclassified; no golden moved). Not exercised: the resume mutation registry's idempotency (the client mutation id is reused until success), since no golden replays a write twice. Haptics on React Native Web resolve rather than reject: the builder resolves expo-haptics to its .web.ts, which calls navigator.vibrate where it exists (the Android WebView vibrates) and otherwise runs its hidden-switch trick on iOS or returns. The C3 series adds a haptics.web.ts no-op on its C3.1 branch (not on main yet) to suppress that DOM trick; nothing here depends on it.

Notes for C5.2

The design measured the page closure at 27 families / 134 goldens on a main since repinned twice; C5.2 re-derives at its own base. The route reaches firstParam through the source-control barrel, which drags two dozen icons into the closure; mocked in tests, relocation deferred.

Checks

Mobile tsc, tests-typecheck ratchet, whole-tree oxlint, format (mobile and root on the changed config files), both changed-code gates against main, root config/scripts suite (render check included), full mobile suite including the bridged parity gate.

Review round 1 (approve; four folds)

Fresh reviewer at 3613a803f3 reproduced the handoff change red-first (five unit cases flip and the render case lands on Unmatched Route), the back pin (exactly three of four cases red with back reverted; the local-pop branch pinned by dropping canGoBack()), the merge (C2.2's back byte-identical to main, only the overturned paragraph dropped, no assertion lost), and the parity baseline (sums to 787). It confirmed console.warn is the page's diagnostic reporter (same shape as createPageDiagnosticReporter; the fault notify would tear the page down) and that only id, not _meta, is load-bearing in the scripted replies. Findings folded: the seam test never reached terminal.send (all three cases settle the create) and its docstring overstated the two-leg comparison; the dynamic-segment docstring and encoding test omitted ./.., which reach the shell failure screen rather than the native panel (pre-existing, same as the host index route); no browser case mounted the route (it paints, posts no fault, owns its chunk); and a comment claimed the refusal set lives for the client when it lives for the hook instance. Body correction: the haptics sentence described a dependency that is not the one installed.

Review round 2 (SHIP WITH NITS)

Fresh reviewer at 1823ff3904 broke at the folds and they held: deleting the terminal.send call fails the three second-write cases in under a second with a bounded "never reached the shell" rather than a hang; the locked fixture is the shape the reader consumes; stripping params from the shell double reds the browser case both by URL and by text; the chunk case keys on the builder's route-map name and asserts absent-before, present-after; push, replace and dismissTo have no local fallthrough outside pageRoutes; nothing under the bridge contract changed; parity sums to 787. Findings folded: the ...router spread passed expo-router's navigate (and prefetch) through unwrapped, so a navigate to a non-page target would have pushed locally (latent: no call site), now wrapped with the wrapped member set pinned; a test title still said "once per client"; the agent-history render case's docstring overclaimed (the double answers no RPC, so the panel paints its unable-to-load state and a render-time gap in a list row is not covered). Body corrections: the merge commit's own eight lines are named above; the haptics sentence no longer speaks of C3's no-op as landed.

Round-2 folds landed as 860577cc30 (navigate wrapped; prefetch prefetches locally for served routes and is dropped otherwise, never handed over; the wrapped member set is derived from the router's parameter tuples and pinned both ways), 971d7aba75, 43e93cf395 and 39b15e395d. After #21592 landed the shared render harness, main was merged (f39271d7d2, no conflict) and the agent-history cases moved into their own file, config/scripts/mobile-web-app-agent-history-render.test.mjs (047fb009f5), registered in the mobile_web_app job beside the drawer check; the shared render test is back under the root max-lines cap. The new file holds five cases: the two moved (mount with params; lazy chunk absent before and present after), Back with navigate granted (exactly one navigate-back frame, page stays put), Back without it (same tap, nothing posted), and a rendered session row. The row case scripts status.get, worktree.ps and aiVault.listSessions through the harness's replies with shapes lifted from the recorded corpus (aivault-history-screen-listed, with the status version fields from transport-host-status-gates-ready, because the protocol gate above every host route reads the same method), opened at the worktree whose path matches the session's cwd; on any other worktree the same replies paint "No agent sessions", so the case asserts the row's title and message count and the absence of both silent states. The earlier caveat narrows to the resume path and the scope tabs, which need taps and a second scripted turn and are covered on device.

CI at merge

Every check is green except two items that main itself carries at this hour and that this PR does not touch: static analysis fails on ClientHostedBrowserPagePane.markup.test.tsx:153 (a naming-rule violation merged with 0e1a5f39d0; fix in #21637), and root shard 3/8 fails pane-title-update-global-scan-budget.test.tsx deterministically since 340627f3a3 (#21540), which also fails on main's tip. Also failing on main's tip without this branch: src/relay/omp-fresh-launch-environment.test.ts:94, src/main/pi/omp-transcript-metadata.test.ts:47 and tests/e2e/omp-child-session-recovery.unit.test.ts:109 (OMP resume changes merged with #20622 and its neighbours). Every one reproduces on main without this branch; merged with those exceptions named. The static-analysis item is fixed on main by #21637 and is green on this head.

Bot threads (four folded)

Pullfrog: five more raw host-id interpolations in the host page, folded as above (plus a follow-up guarding the one optional id with an empty segment the route rule refuses rather than the string "undefined", which it would accept as a host so named). CodeRabbit: a . or .. host id reached the shell route and ended at document-load-failed instead of the native panel; the route now asks the bridge's route schema first and stays native when the answer is no, mirroring the guard C3.1 adds for the files routes (the host index route has the same hole and is left for the module that will hold all three guards); the pin asserts the native render and gained the worktree-id case. CodeRabbit: the wrapped router members dropped expo-router's options argument; all four target-takers now forward it on the local branch, and the docstring states that options do not cross to the shell. Pullfrog: the docstring counted the pre-fold member set; it now counts six wrapped members, five target-takers, four decided by the route list, prefetch decided differently, back with no target.

…opening it here

`useRouteHandoff`'s web sibling answered two things — handed off, or push it
locally — and fell through to the local router for three different reasons. Only
one of them is a page route. An href the protocol's own pattern drops and a shell
that answered no are the page reaching past what this shell can serve, and the
bundle carries every route under `app/h`, so the fallback does not paint
Unmatched: it mounts `session/[worktreeId]` on React Native Web inside the shell.

The outcome is now tri-state. A target outside `pageRoutes` is never pushed
locally; the page stays where it is and names the reason once per client, which
is the bound the other page-side reporters take.

Proved in the render check against the real bundle: with the double granting no
`navigate`, "Back to hosts" left the host route for `/` and painted Unmatched
before this, and now stays put, posts nothing and reports no page fault.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
… build

Both targets this sheet offers interpolated `hostId` raw — the C1.2 class the
C1.8 stack fixed at the route files and `web.tsx`, at the last two sites that
still had it. `useLocalSearchParams` answers the decoded value, so a deep-linked
id carrying `?`, `#` or whitespace stops being one segment.

It matters more from C5.1 on. Inside the page these targets go through
`useRouteHandoff`, which matches the pathname against the shell's `pageRoutes`
before deciding anything, and the id is the segment the pattern is reading.

The worktree id was already encoded at both sites; this makes the host id match,
and the new test pins all four targets rather than only the one that moved.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…(OTA phase C, C5.1)

The second page route. `agent-history/[worktreeId].tsx` already shipped in the
bundle with its own chunk, so listing it adds nothing to the download and moves
no route count: the switch is `index.tsx`'s, and the shell still decides, because
a bundle naming a grant this app lacks renders the native panel instead.

Its `.web.tsx` sibling is required for `index.web.tsx`'s reason — the native file
reaches OrcaMobileWebShellView, whose requireNativeViewManager runs at import and
takes the whole bundle down in a browser, since the manifest imports every route.

First route with two dynamic segments, so both are encoded. Grants are `navigate`
and `storage`: a resumed session opens the native session screen, the worktree
list now reaches this screen without leaving the page, and `app/h/_layout.tsx`
reads the app's own sidebar width above every page route.

The panel's router becomes `useRouteHandoff`, which is the seam that tells those
two apart: agent history is a page route and is pushed here, the session screen is
not and goes to the shell.

The three writes a resume makes needed no page-side handling and have none. What
they needed was a test that the descriptor's handling survives the extra hop, so
each is run through the bridge and against the same fake directly and the two
verdicts compared: a refused create raises the host's message, and a lost reply or
a shell disposed mid-flight stays delivery-unknown rather than becoming a failure
a user would retry blindly. No golden covers those three.

The flag census grows its first entry since C1.3, which is what it is for.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Brings in C2.2 (#21582, 1ef9473), which adds the `back` member this series
needs. Two files conflicted, both in the C1 seam C5.1's first commit rewrote.

`route-handoff.web.ts`: the member list merged on its own — C2.2's `back` sits
between the `replace` and `dismissTo` whose bodies C5.1 changed — so only the
docstring was resolved. Both halves kept: C2.2's "four members, three carry a
target and `back` does not", and C5.1's paragraph on the third outcome. One
sentence of C2.2's dropped as overturned by the C5 ruling, which landed after it
branched: a refused target no longer falls through to the local router, because
the bundle carries every route under `app/h` and that fallthrough mounts a screen
the page does not serve rather than painting Unmatched.

`back` keeps its own fallthrough, and the resolved docstring now says why: it
carries no target to mount, so `router.back()` on a one-entry document is the
same nothing a refusal would have been. Ruling 1 does not reach it.

`route-handoff.web.test.tsx`: only the helper block conflicted; `beforeEach`
merged on its own. Kept C5.1's flipped assertions and warn capture, took C2.2's
`canGoBack` mock, `backs()` helper and appended describe block. 25 tests green.

`config/scripts/mobile-web-app-render.test.mjs` merged clean, and C2.2's shell
double is better than what C5.1's refused case had: it records every notify. That
case now asserts no `navigate` frame crossed, which is the absence oracle the url
alone could not give — a page that stayed put because the shell did the pushing
looks identical otherwise. C2.2's own case grants `navigate` and asserts the same
frame present on the same control, so the pair reads as one claim. 19 tests green.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
C5.1 wired this button by swapping the panel's `useRouter` for `useRouteHandoff`;
nothing else was needed, because `RouteHandoff` is the router's own shape and the
seam's web sibling decides `back`. So this commit is the test that would have
caught the wiring being absent, not a fix.

Red before the merge, green after, on the same four cases: on `e897e8123a`, where
`back` was still expo-router's own spread member, 3 failed and 1 passed — the one
that passed is the local-pop case, which is the branch C2.2 did not change. After
the merge brought in C2.2's `back`, all 4 pass. The pre-merge run named the notify
by its literal `'navigate-back'` because the contract constant did not exist yet;
it is the same string `BRIDGE_NAVIGATE_BACK_NOTIFY` holds, so the two runs asked
the same question.

Both module substitutions are the builder's own rather than conveniences: the web
bundle resolves `route-handoff` and `client-context` to their `.web` siblings, so
mocking each to its sibling gives this screen the module graph it has inside the
page. The frames are read off the port pair's lane rather than off a spy, and one
case asserts a frame crossed at all before either absence is read as an answer.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
@coderabbitai

coderabbitai Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: 715abf6b-fb29-4261-90cd-5c67e776b2bf

📥 Commits

Reviewing files that changed from the base of the PR and between 1d79b22 and c3fe36f.

📒 Files selected for processing (7)
  • mobile/app/h/[hostId]/agent-history/[worktreeId].tsx
  • mobile/src/host-screen/host-route-href-encoding.test.ts
  • mobile/src/host-screen/host-screen-header.tsx
  • mobile/src/host-screen/use-host-worktree-actions.ts
  • mobile/src/mobile-web-shell/mobile-web-shell-agent-history-route.test.tsx
  • mobile/src/navigation/route-handoff.web.test.tsx
  • mobile/src/navigation/route-handoff.web.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • mobile/src/mobile-web-shell/mobile-web-shell-agent-history-route.test.tsx
  • mobile/src/navigation/route-handoff.web.test.tsx

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


📝 Walkthrough

Walkthrough

The change adds agent session history to the mobile web-shell route registry, native route switching, web overrides, and build validation. The agent-history panel now uses route handoff for native navigation, and worktree links encode dynamic path segments. Web route handoff now forwards local navigation options, handles navigate and prefetch, and refuses malformed or shell-rejected targets. Tests cover routing, encoding, bridge back navigation, resume writes, and refused navigation.

Priority: ⬇️ Low

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 65.38% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 26 functions across 18 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description gives extensive technical context, scope, rationale, testing details, and review history. However, it omits several required template sections, including the Linked Issue with a `Fixes… Add all required template sections. Include a linked issue using Fixes #<issue>, attach before-and-after visual proof or write N/A with a reason, complete the AI Disclosure and Agent skill upstream boundary sections, add Notes covering …
✅ Passed checks (3 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 identifies the main change: rendering agent session history from the desktop-served bundle as part of OTA phase C5.1.
Full details: Description check

Explanation

The description gives extensive technical context, scope, rationale, testing details, and review history. However, it omits several required template sections, including the Linked Issue with a Fixes # reference, Visual Proof or an explicit N/A explanation, AI Disclosure, Agent skill upstream boundary, Notes, and the Checklist. It also does not clearly provide the required user-facing ELI5 explanation.

Resolution

Add all required template sections. Include a linked issue using Fixes #&lt;issue&gt;, attach before-and-after visual proof or write N/A with a reason, complete the AI Disclosure and Agent skill upstream boundary sections, add Notes covering the requested compatibility concerns, and complete the Checklist with testing and validation status.

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

Round 1, finding 1. All three `resumeAiVaultSessionInTerminal` cases settled the
create (`ai-vault-resume-launch.ts:158`), so `terminal.send` had never crossed the
bridge and the half of the resume that types the command into the pane was
uncompared. Three cases now drive both writes: a refused send raises the host's
message, an accepted send reporting `accepted: false` in-band says "Terminal input
is locked", and a send the host takes resolves — the last one being the presence
precondition, since a run that failed at the create would give the same shape of
verdict as one that failed at the send.

Reading `requests[1]` straight after settling the create finds nothing on the
bridged leg: the second write is made only once the first settles, so it is two
more lane round trips away. `nthRequest` waits instead, and says how many it saw
when it gives up, so this cannot pass by proving the opposite of what it says.

The locked reply is `{ send: { accepted: false } }`, not `{ accepted: false }`:
the reader is `reply.send?.accepted !== false` (`review-terminal-reply-schema.ts:65`),
and the flat shape resolves rather than throwing. Written the flat way first, both
legs agreed on "(resolved)", which is the comparison doing its job.

Also finding 1's second half: the file docstring claimed every case runs twice and
differences the verdicts, which was false for the dispose case — a fake RPC client
has no door to shut, so there is no native run to compare against. The docstring
now says so and the case carries the same note.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Round 1, finding 2. The route's docstring listed `/ ? #` and whitespace and the
encoding test covered five ids of that kind, which together implied encoding makes
any id safe. It does not: `encodeURIComponent('..')` is `'..'`, so the pathname
reaches `BRIDGE_ROUTE_PATHNAME_PATTERN` intact, fails the lookahead that stops a
climb out of `/h/` (`bridge-caps.ts:68`, read through `bridge-envelope.ts:117`),
and the shell answers with `reportShellFailure` — a failure screen where the route
would otherwise have rendered the native panel it already has.

Pinned, not fixed, and the docstring now says which. `app/h/[hostId]/index.tsx`
builds its pathname identically and has the same hole, so this series fixing one
of two call sites would leave the shape behind and stop describing it. The new
case asserts both halves — the segment survives encoding unchanged, and the
pattern refuses the pathname — so a later change that starts encoding dots fails
here and has to say which screen it wants instead.

Characterisation, so it was green on the first run rather than red: the claim is
about behaviour that already ships, and the value is that the refusal is on record.

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 — minor suggestions inline.

Reviewed changes

  • Tri-state route handoff — route-handoff.web.ts now distinguishes local / handed-off / refused: a page-route target is pushed locally, while a malformed href or a shell that answers notifyNavigate false stays put and logs once per reason. back deliberately keeps its local fallthrough.
  • Agent-history page route — [worktreeId].tsx gains the shell switch (flag + both ids, native panel as fallback), a .web.tsx sibling and a web-overrides.json entry, and the route is declared in MOBILE_WEB_PAGE_ROUTES with navigate + storage.
  • Panel router seam — MobileAgentSessionHistoryPanel reads useRouteHandoff() instead of useRouter(), so both Back and the resume push cross the page seam (native is a pass-through).
  • Host-id encoding — both worktree-row navigation hrefs encode the host id, with a test pinning all four targets.
  • Tests — new back-handoff, resume-writes differential, route-entry, flag-census and bundle-list coverage, plus a real-browser refusal check for dismissTo('/').

ℹ️ Nitpicks

  • mobile-web-app-render.test.mjs:722-723 still says the handoff's local branch "belongs to a push the page makes through useRouteHandoff — of which this tree has none today". This PR adds exactly that push (the host-list action sheet → agent history), so the claim is now stale.
  • use-shell-stack-pop.ts:34 and use-shell-stack-pop.test.tsx:236 enumerate the MobileWebShellScreen mount sites as the worktree list and the embedded browser route; agent-history/[worktreeId].tsx is now a third.

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

})

/**
* The C1.2 class, at the last two sites that still had it.

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.

These are not the last two sites that interpolate the host id raw. host-screen-header.tsx:188,204,307,318 (Accounts/Tasks) and use-host-worktree-actions.ts:192 (openWorktreeSession) also build /h/${hostId}/... from the decoded params.hostId and are reachable inside the host-list page, so a deep-linked host id carrying ?/# still opens the wrong screen there. Either encode those too or narrow this comment, so the C1.2 audit does not read as closed.

Round 1, finding 3. Nothing rendered this route's real module graph anywhere. The
unit tests mock react-native, safe-area, svg, lucide and the icon assets away —
they have to, since react-native is Flow source vitest cannot parse — so a
component in this closure with no web build would have reached a device before it
reached a test. The render check is the only place the graph meets React Native
Web, and this route was not in it.

Two cases. The first mounts the route from the shell double and reads the screen:
"Agent Session History" and the worktree label the params half carried, no fault,
no console error, no CSP refusal, and the URL the page wrote for itself. That also
proves `init.route.params` end to end on a route that has a dynamic segment too,
which §1 of the design claimed and nothing checked.

The second pins the chunk. C5 is the first series whose success path pulls a
second chunk after the first paint, which on iOS goes through WKURLSchemeHandler
under `script-src 'self'`. The chunk is named from the builder's own route map
rather than guessed from the bytes, and asserted absent from what the first route
loaded, so this says the route came over the wire now.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Round 1, finding 4. The comment claimed one line per reason "for the life of one
client", borrowing `createPageDiagnosticReporter`'s bound. The set is built inside
the `useMemo` keyed on `[client, router]`, so it is per hook instance: in practice
the memo is not recomputed, because `useRouter()` is expo-router's module
singleton and the page holds one client, but every screen calling the hook gets
its own set and a reason can be reported once per screen rather than once per
document.

Says that now, and why it is not tightened: a per-module set would outlive the
page's client, which is the lifetime the rest of these reporters are scoped to,
and there is no document-wide reporter to join without reaching into a contract
file the C2 lane owns.

Records the other half of the finding too, which came back confirmed rather than
changed: `console.warn` is right here. It is the vocabulary `page-bootstrap.ts:35`
already writes in, and a `fault` notify would be wrong twice — the shell drops the
generation on a page fault, and a navigation the page declined is not a failure.

Comment only; no behaviour change, 25 navigation tests unchanged and green.

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: 4cf16a56-7222-435d-84f8-f95ddc908ab6

📥 Commits

Reviewing files that changed from the base of the PR and between 3613a80 and 1823ff3.

📒 Files selected for processing (5)
  • config/scripts/mobile-web-app-render.test.mjs
  • mobile/app/h/[hostId]/agent-history/[worktreeId].tsx
  • mobile/src/agent-history/agent-history-resume-writes.test.ts
  • mobile/src/mobile-web-shell/mobile-web-shell-agent-history-route.test.tsx
  • mobile/src/navigation/route-handoff.web.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • mobile/app/h/[hostId]/agent-history/[worktreeId].tsx
  • mobile/src/navigation/route-handoff.web.ts

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

@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

This run reviewed the four commits since the prior pullfrog review at 3613a803f3 — test and docstring changes only, no product behavior change.

  • Real-browser mount of the agent-history route — mobile-web-app-render.test.mjs now mounts /h/[hostId]/agent-history/[worktreeId] under the shell double and asserts the route's own chunk is fetched on client-side navigation, the first C5 path that pulls a second chunk after first paint.
  • Resume differential reaches the send — agent-history-resume-writes.test.ts gains nthRequest/bothLegs helpers and three cases that settle the create then exercise terminal.send (refused send, accepted-but-accepted:false, both writes resolve), comparing the bridged and direct verdicts.
  • Dot-segment id pinned — mobile-web-shell-agent-history-route.test.tsx and the route docstring record that encodeURIComponent leaves ./.. unchanged and the bridge's pathname pattern then refuses them; documented as pre-existing and shared with index.tsx.
  • Refusal-reporter docstring corrected — route-handoff.web.ts now states the once-per-reason set lives for the hook instance, not the client.

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

…of five

Round 2, finding 1. `...router` hands through everything this file does not name,
and two of the members it did not name take an href: `navigate` and `prefetch`.
`navigate` to a route outside `pageRoutes` went straight to expo-router and pushed
it into this document — the hole the tri-state exists to close, reopened under a
name nobody had looked at. No call site uses it today, which is why it shipped.

`navigate` is now wrapped exactly as `push` is: which of push-or-collapse it does
is a decision about this document's stack, and a target outside this document has
no such stack.

`prefetch` is decided the other way, explicitly. It is the one target-taker that
must never reach the shell: a prefetch is a background load, `navigate` is the
only thing the shell can be told, so handing one over would open a screen nobody
asked for. A route this document serves is prefetched here, which is what the
per-route chunk split makes worth doing; every other one is dropped without a
line, because a warm-up that did not happen is not a failure to report.

The docstring's "four members that can leave this document" is now five wrapped
members and a rule for which is which.

A list would rot, so the pin is derived: `HrefTakingRouterMember` reads the
parameter tuple of every member of `RouteHandoff` and `WRAPPED_HREF_MEMBERS` is
asserted equal to it in both directions. It reads the tuple rather than testing
assignability because `() => void` is assignable to `(href: RouterHref) => void`,
which would make `back`, `dismissAll` and `reload` target-takers and prove
nothing. Checked both ways: dropping `prefetch` from the list fails the compile
with "Type 'HrefTakingRouterMember' does not satisfy the constraint", and the
union resolves to exactly the five, with `back` and `setParams` outside it.

The pin is in the product module because `mobile/tsconfig.json` excludes tests.
The runtime test asserts each wrapped member is not the router's own function and
that `setParams` still is, so a hook that wrapped everything fails too.

Red first: 4 of the new cases fail against the previous file, 33 pass now.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Round 2, finding 2. The source comment was corrected in round 1 and this test's
title was not, so the two disagreed about the bound the refusal set actually has:
the set lives in the `useMemo`, so it is per hook instance, and a title claiming
per client is the stronger promise the code does not make.

Title only; the case and its assertions are unchanged.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Round 2, finding 3. The docstring claimed the case is where the panel's closure
meets React Native Web, which overstates it. The shell double answers no RPC, so
the session scan fails and the panel paints its "Unable to Load" state: the
session list, its rows, the resume button and the scope tabs never render, and a
render-time gap inside any of them would pass this check.

Now says both halves — import-time evaluation of every module in the closure and
the panel's own chrome are covered, the list subtree is not — and names what
covering the rest would take: a double that answers `aiVault.listSessions`, which
is a different instrument and would put domain behaviour in this file.

Text only. This case moves to its own file on the extracted harness after the
merge with #21592; the corrected text travels with it.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
My round-2 fold added `WRAPPED_HREF_MEMBERS` as a second import of
`./route-handoff.web`, which `import(no-duplicates)` fails in the focused-plugins
pass of the changed-code gate. Joined to the existing import below the mocks,
which is where an import of the module under test has to sit in this file.

Found by running the changed-code gate rather than by review: mobile tsc, whole
tree oxlint and the suite were all green with it.

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: 928bae62-3c85-4af4-9f99-b4d843f6933f

📥 Commits

Reviewing files that changed from the base of the PR and between 1823ff3 and 39b15e3.

📒 Files selected for processing (3)
  • config/scripts/mobile-web-app-render.test.mjs
  • mobile/src/navigation/route-handoff.web.test.tsx
  • mobile/src/navigation/route-handoff.web.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • config/scripts/mobile-web-app-render.test.mjs

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

@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 stale count in the handoff docstring.

Reviewed changes

This run reviewed the four commits since the prior pullfrog review at 1823ff3904 — the round-2 folds.

  • Every target-taking router member is now wrapped — navigate hands a non-page target to the shell exactly as push does, and prefetch warms only routes this document serves and drops the rest silently, so the spread no longer leaves a target-taker exposed.
  • The wrapped set is pinned at compile time — HrefTakingRouterMember reads each RouteHandoff member's parameter tuple (not assignability, which would count back/dismissAll/reload) and WRAPPED_HREF_MEMBERS is asserted equal to it both ways, so a future href-taking member fails to compile until someone decides what the page does with it.
  • Runtime coverage for both members — the test pins each wrapped member against the router's own function and keeps setParams identical, then exercises navigate (shell / local / refused) and prefetch (warm / dropped / silent).
  • Docstring and test-title corrections — the real-browser route case now states what it does not cover, the refusal set is described per hook instance, and the handoff import is deduplicated.

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

* the lesser failure, and the route policy is what keeps the case off a device in the first place:
* a shell that grants no `navigate` renders no page route at all.
*
* `back` keeps a fallthrough the other three lost, and for the reason they lost theirs: it has no

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.

This docstring still counts the pre-860577cc30 wrapped set: navigate is now a fourth target-carrier (and a fifth member that can leave), and prefetch is a fifth target-carrier that is deliberately dropped, so "the other three" here and "four"/"the three that carry a target" at lines 105-106 no longer match the returned object. The commit message says this docstring was updated to "five wrapped members"; the file disagrees.

… harness

The render check gained browser cases from three domain series at once, each
under the `.mjs` cap of 600 counted lines alone and no two of them together: at
39b15e3 the file was 781 raw lines and clean, main's was 786 and clean, and
their merge was 857 raw and 623 counted, which is the CI red on #21596. C1.10
extracted the harness so a domain gets a file instead. This is C5's, and the
render check is back to 639 raw lines and clean.

Five cases. The two that moved — the route mounts and paints, and its chunk is
fetched on navigation — plus three new ones.

Back, twice. With `navigate` granted the page's Back control posts exactly one
`navigate-back` notify and the page does not move; with the grant withheld the
same tap reaches the same handler and posts nothing. The pair is the point: the
document holds the single history entry the entry wrote with `replaceState`, so a
Back this page served itself would also have gone nowhere and looked identical.
This is the first proof of that handoff in a browser rather than against a mocked
router.

And a row. The harness's new `replies` lets the double answer named methods, so
the panel now renders a real session instead of its "Unable to Load" state, which
is the render-time gap the round-2 docstring conceded. Assertions are on the row's
own text and message count, plus the absence of both silent states — the scan
failing, and a session out of scope.

Replies lifted from the corpus, and one of them needed two scenarios. The session
and worktree lists are `aivault-history-screen-listed`'s. Its `status.get` is a
capability list alone, and the first run painted "Update Orca on your computer":
`HostProtocolGate` above every host route reads the same method for fields that
scenario never scripts. The status reply merges those from
`transport-host-status-gates-ready`, and the comment says why two.

`wt-history` is load-bearing, not incidental. The panel opens on the `workspace`
scope and filters by paths from the worktree list, so on any other worktree these
same replies paint "No agent sessions" — green, and proving nothing.

Registered in the `mobile_web_app` job beside the drawer check, which is the job
that makes a missing mobile install fail rather than skip.

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 in this delta — the new commits are test-only.

Reviewed changes

This run reviewed the two commits since the prior pullfrog review at 39b15e395d: a merge of main and the move of the agent-history browser cases into their own file.

  • Agent-history render cases get their own file — config/scripts/mobile-web-app-agent-history-render.test.mjs takes the two cases from the shared render check (mount with params; lazy chunk absent before and present after a client-side navigation) and adds three: a session row painted from corpus-shaped replies, Back with navigate granted (exactly one navigate-back frame, page stays put), and Back without it (nothing posted, page stays put). Registered in the mobile_web_app job; the shared mobile-web-app-render.test.mjs drops back under the .mjs line cap.
  • Corpus-shaped fixture — the row case scripts status.get (protocol fields from transport-host-status-gates-ready, the aiVault.v1 capability from aivault-history-screen-listed), worktree.ps and aiVault.listSessions with the recorded shapes, and asserts both the row's own fields and the absence of the two silent states ("Unable to Load", "No agent sessions").
  • main merged — no conflict; the cross-version-wire job in pr.yml is main's, not this branch's.

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

Pullfrog on #21596. My earlier commit fixed the two hrefs in the row's navigation
sheet and stopped there; five more sites in the same page interpolate the decoded
id raw — Accounts and Tasks in both header layouts
(`host-screen-header.tsx:188,204,307,318`) and the session target
`openWorktreeSession` builds (`use-host-worktree-actions.ts:192`).

Same C1.2 class. The persisted host store admits any non-empty id and both
`useLocalSearchParams` and the store answer it decoded, so one carrying `/`, `?`,
`#` or whitespace stops being the single segment `matchesRoutePattern` reads.
Inside the page that decides where a tap goes, because the handoff matches the
pathname against the shell's `pageRoutes` before choosing this document or the
native stack.

A census rather than five more assertions: the failure is a habit, not a bug —
each of these was written by copying the one beside it, and the seventh will be
too. It counts `/h/${...}` interpolations across the host page's four source
files and requires `encodeURIComponent` at each, with a presence check so it
cannot pass on an empty list.

Two sites are exempt and stay raw: `use-host-worktree-actions.ts:171` and
`app/h/_layout.tsx:100` compare against a pathname the router answers rather than
building a link, so encoding them would change what a comparison matches instead
of what a tap opens. The exemption is subtracted by count rather than matched
away, so a file that lost its comparison and gained a raw target does not come
out even.

ONE BEHAVIOURAL EDGE, named rather than fixed. `navigateFromHostList` short
-circuits when `pathname` equals the target minus its query. That comparison now
has an encoded target on one side and whatever `usePathname()` answers on the
other, so for a host id that needs encoding the short-circuit stops firing and a
tap on the screen you are already on re-navigates instead of doing nothing. It is
a redundant navigation, not a wrong one, and the guard at :171 is unaffected
because it compares against the same raw form it always did. Left alone because
fixing it means deciding what `usePathname()` returns for an encoded segment,
which is a question worth its own change.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The commit before this one did not typecheck: `useHostWorktreeActions` takes
`hostId` as `string | undefined`, and `encodeURIComponent` does not. I committed
on a green test run without waiting for `tsc`, which is my error and the reason
this is a second commit rather than an amend — the lane forbids rewriting a
commit that exists.

`?? ''` rather than a cast or a non-null assertion. An absent id then builds
`/h//session/...`, an empty segment the shell's own route rule refuses, instead
of the string "undefined", which that rule would accept as a host genuinely named
undefined. Every other member of this hook already guards the same field.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…d refuse its id

CodeRabbit on #21596. The persisted host store admits any non-empty id, so `.` or
`..` reaches this route, survives `encodeURIComponent` unchanged, and fails the
bridge's own segment rule. The route handed it over anyway: `bridge-host.ts`
parses the route against `BridgeInitRouteSchema`, drops it to null when it fails,
and the page answers an `init` naming no screen with "Update Orca to open this
workspace". A failure screen, in place of the native panel sitting right behind
this switch.

The route asks the schema first now and stays native when the answer is no, which
is where every route starts. Mirrors C3.1's call for the files routes
(`69e618e19a`), including its reason for using the schema rather than a copy of
its bounds: two spellings of one rule drift, and the half that matters is the
half the page reads.

The pin moves with it. It characterised the refusal before — asserting the
pathname was built and that the pattern rejected it — and now asserts the native
render, for a dot host id and for a dot worktree id, which is the other segment
and was never covered.

`app/h/[hostId]/index.tsx` has the same hole and is not fixed here, as asked: it
builds its pathname the same way and hands it over unchecked. When C3.1 is also
on main the two guards and `mobile-file-shell-route.ts` belong in one module
beside the schema, rather than a third spelling of a one-line call.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…mbers

CodeRabbit (major) on #21596. expo-router's `push`, `replace`, `navigate` and
`dismissTo` are `(href, options?)`, and the wrappers took the href alone. A local
push asking for `{ withAnchor: false }` reached the router without it, so inside
the page the router did something other than what the caller wrote — silently,
because dropping an optional argument is not a type error.

Each wrapper forwards both on its local branch now. Nothing in this tree passes
options today, which is why it went unnoticed and exactly why it needed pinning:
the first caller to pass one would have had it dropped without a word.

Options do not cross to the shell, and the docstring says so rather than leaving
it to be discovered. The `navigate` notify carries an href and nothing else, so a
target handed over is opened by the native stack on that stack's own terms. That
is the right shape — the options describe a push inside a document the shell's
target is not in — but it is a loss, and a loss worth naming.

Four existing assertions moved from `toHaveBeenCalledWith(href)` to
`(href, undefined)`. That is what the router now receives when a caller passes
none, and expo-router reads an undefined second argument as absent; the comment
above them says so, so the next reader does not take it for a bug.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Pullfrog on #21596. The header still described the set as it stood before
`860577cc30`: "the four members that can leave this document", "the three that
carry a target", "the other three". There are six wrapped members now and five
carry a target, so every count in the paragraph was one or two short and a reader
checking the object against the prose would have found neither explained.

Now says six wrapped, five target-takers named and pinned by
`WRAPPED_HREF_MEMBERS`, four decided by the shell's route list, `prefetch` the
fifth and decided differently for a reason the member's own comment gives, and
`back` the sixth carrying no target at all.

Comment only; 36 navigation tests unchanged and green.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
@Jinwoo-H

Copy link
Copy Markdown
Contributor Author

Merging with root shards 1/8, 3/8 and 5/8 red: every failing test also fails on main's tip without this branch (pane-title-update-global-scan-budget since 340627f3a3/#21540; omp-fresh-launch-environment, omp-transcript-metadata, omp-child-session-recovery.unit since the OMP resume changes around 605a4ef868/#20622). Static analysis, both mobile jobs and the other five shards are green; two review rounds and four bot threads folded.

@Jinwoo-H
Jinwoo-H merged commit 211821d into main Sep 19, 2026
27 of 32 checks passed
@Jinwoo-H
Jinwoo-H deleted the ota-c5-1-agent-history branch September 19, 2026 09:15
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