Repository navigation
fix(ci): keep a squash-merged RPC recording pin reachable through its pull request - #23720
Conversation
… pull request Main's "RPC recording pin" check has been red since #22762: that branch pinned the recording corpus to its own commit 03995ae, and the squash-merge left that commit out of main's history. Every behaviour-change squash did the same, and each needed a hand-made repin PR to clear it (#23565, #23535, #23046 and more). The guard now accepts a pin that is either in this history or in the head of the pull request whose squash wrote it into the manifest. It finds that pull request from the `(#n)` subject of the commit that added the pin and fetches `refs/pull/<n>/head`, which GitHub keeps after the branch is deleted. The reproduce step uses the same lookup, so it can still check the pinned tree out.
|
| import { runProcess } from '../../src/shared/child-process/run-process.ts' | ||
| import { RECORDING_DRIVERS } from '../src/test-support/rpc-recording/recording-drivers.ts' | ||
| import { readScenarios } from '../src/test-support/rpc-recording/scenario-input.ts' | ||
| import { checkPinReachable, PIN_MANIFEST } from './rpc-recording-pin-reachability.mts' |
There was a problem hiding this comment.
New module can skip replay The reproduction change gate still lists only the guard script, not this newly imported reachability module. If a future PR changes only the new module,
reproduce --if-changed-since can skip the pinned-tree replay even though the code deciding whether reproduction can proceed has changed. Include the module in the gate's tracked paths.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 📝 WalkthroughWalkthroughThe recording-pin checker now tests whether a baseline is reachable from the requested ref or from an associated pull-request head. The workflow invokes the Priority: ⚪ Not assessed Merge Risk: 🔵 Low · up to Some valid recording pins could fail the mobile CI check when their qualifying pull request is omitted from the first lookup page or follows an unavailable head. These are narrow cases; the change is mergeable with owner awareness or follow-up. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to The change fixes squash-merged pins, but it also permits the reproduction job to run code from a pinned commit outside the checked-out branch while a read-scoped GitHub token is available. The exact commit is verified before use, which limits the exposure; its provenance and credential boundary still warrant review. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 5 files. (2 skipped: 2 unsupported.)
✨ 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.
🧹 Nitpick comments (1)
mobile/scripts/rpc-recording-pin-guard.mts (1)
243-249: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a CLI regression test for the unreachable-pin early return.
The tests cover the helper verdict, but not the
reproduceentrypoint. The workflow test only checks command text. Add focused entrypoint coverage that supplies an unreachable pin, asserts the failure, and confirms that the pinned-tree reproduction does not start. This covers caller sequencing without duplicatingcheckPinReachabletests.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 23cc7637-7711-485a-954a-95fb59955680
📒 Files selected for processing (6)
.github/workflows/mobile.ymlconfig/scripts/mobile-recording-pin-checkout.test.mjsmobile/scripts/rpc-recording-pin-guard.mtsmobile/scripts/rpc-recording-pin-guard.test.tsmobile/scripts/rpc-recording-pin-reachability.mtsmobile/src/test-support/rpc-recording/README.md
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
There was a problem hiding this comment.
ℹ️ No critical issues — two minor suggestions inline.
Reviewed changes
- New reachability module —
mobile/scripts/rpc-recording-pin-reachability.mtsaccepts a pin that is an ancestor of the checked-out commit, or one kept by the head of the pull request whose squash wrote it, found viagit log --first-parent --max-count=1 -S<pin> -- <manifest>. - Guard rewired —
mobile/scripts/rpc-recording-pin-guard.mtsdrops the oldcheckPinAncestry, imports the new module, and fetches the pin inreproducebefore checking it out; the subcommand is renamedancestry→reachable. - Tests —
mobile/scripts/rpc-recording-pin-guard.test.tsadds squash-pass, force-push-fail and no-(#n)-fail cases against a throwaway bare remote withrefs/pull/7/head. - Workflow/config/docs —
.github/workflows/mobile.yml,config/scripts/mobile-recording-pin-checkout.test.mjsandmobile/src/test-support/rpc-recording/README.mdfollow the rename; the README no longer prescribes a follow-up repin.
I independently verified the load-bearing external claim: GitHub permits fetching refs/pull/<n>/head for merged/closed PRs, and the explicit-refspec fetch plus lazy blob fetches work under fetch-depth: 0 + filter: blob:none with the persisted checkout credentials.
ℹ️ Nitpicks
- The workflow comment ("GitHub keeps for good") and module JSDoc ("outlives the branch") claim stronger permanence than GitHub documents. Retention is reliable in practice but not guaranteed (repo-cache clearing is a documented exception), and the failure mode is a loud fetch error, so this is wording only.
fetchPullRequestHeadthrows on any fetch failure instead of returning a verdict, so a non-GitHuborigin(e.g. GitLab) or a fork clone without the ref aborts with a stack trace rather than the repin instruction. Returningnot-an-ancestor/unreachablewould keep the guard's failure vocabulary uniform.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| import { runProcess } from '../../src/shared/child-process/run-process.ts' | ||
| import { RECORDING_DRIVERS } from '../src/test-support/rpc-recording/recording-drivers.ts' | ||
| import { readScenarios } from '../src/test-support/rpc-recording/scenario-input.ts' | ||
| import { checkPinReachable, PIN_MANIFEST } from './rpc-recording-pin-reachability.mts' |
There was a problem hiding this comment.
Splitting the pin logic into rpc-recording-pin-reachability.mts leaves the new file out of CORPUS_PROVENANCE_PATHS (lines 31-35), so a PR that changes only the reachability driver skips the reproduce gate even though it now decides which pin is fetched. Add mobile/scripts/rpc-recording-pin-reachability.mts to the list and to seedProvenance in the test so the "refuses to answer" check covers it.
In CI's blobless clone, `git log -S` fetches the manifest's blobs one commit at a time, a few seconds each. Under the 30 s process default the walk was killed after a handful of manifest commits, which main's history already exceeds (up to 7 manifest commits between a pin landing and the next pin change), and the guard then failed with an empty "Could not find the commit that pinned" error. The lookup and the pull request fetch now carry explicit budgets and say when they timed out. The not-an-ancestor instruction now names the pull request whose head was checked, or says the commit that pinned it names none. Adds the two merge-preview shapes the guard runs on: a branch opened after a squash resolves main's pin through the squash's pull request, and a branch whose rebase dropped its own pinned commit fails on its pull request instead of on main.
After a squash the pinned commit can live only in its pull request's head, so a clone that never fetched it makes `git diff --quiet <baseline>` exit 128. The recorder reported that as "Product sources or lockfile differ from the pinned main baseline", which sends the developer to repin a tree that may match. It now prints git's error and the command that fetches the pin.
| }) | ||
| if (baseline.code !== 0) { | ||
| // A pin a squash left only in its pull request's head is a missing object, not product drift. | ||
| if (baseline.code !== 0 && baseline.code !== 1) { |
There was a problem hiding this comment.
Archive-tree guidance is outdated
In an archive extraction without .git, git diff now reports a Git error, so this branch prints “Could not diff against the pinned baseline.” The README still says this case prints “Product sources or lockfile differ from the pinned main baseline.” That mismatch can send someone diagnosing an archive-tree failure down the wrong path; please update the README description.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
ℹ️ No new issues in the incremental delta — the two open threads from the prior review are not addressed by these commits and remain unresolved.
Reviewed changes
Since the prior pullfrog review (6e82c43), two commits:
- Lookup timeouts —
mobile/scripts/rpc-recording-pin-reachability.mtsraises the pin-lookup and PR-head fetch budgets (PIN_LOOKUP_TIMEOUT_MS600 s,PIN_FETCH_TIMEOUT_MS180 s) because a blobless clone services the-Swalk's blobs on demand, andfailureDetailreports a timeout distinctly from a git error. - Missing pin vs drift —
mobile/scripts/rpc-recording.mtstreats any non-1 exit fromgit diff --quiet <baseline>as a missing pinned object and prints thereachablefetch instruction, leaving exit 1 as the product-drift failure. - Failure wording — the
not-an-ancestorinstruction now states whether the pinning commit named a pull request. - Tests/docs — merge-preview cases for a branch opened after the squash and for a rebase that dropped the pinned commit; README notes no follow-up repin is needed.
Verified independently: git diff --quiet <missing-object> exits 128, so the new !== 0 && !== 1 classification is correct, and mobile/scripts/rpc-recording-pin-guard.test.ts passes 23/23 in-container.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…ng pin The recording pin guard found the pull request that keeps a squash-dropped pin by walking main's first-parent history for the commit that wrote the pin into the manifest and reading "(#n)" off its subject. A merger who edits the squash title loses the number, and the push to main turns red anyway. That already happened on main: of the 22 squashes that left a pin outside main's history, #21674's title had no "(#n)". The guard now asks GitHub for the pull requests associated with the pinned commit (GET /repos/{owner}/{repo}/commits/{sha}/pulls) and, for each in turn, fetches refs/pull/<n>/head and accepts only when git proves the pin is an ancestor of that head. GitHub only nominates candidates, so a wrong answer can fail the guard but never pass it. The endpoint named the right pull request for all 22 historical cases, #21674 included, and names none for commits a force-push orphaned. This removes the pickaxe walk, its 600 s budget and its lazy blob fetches in a blobless clone, the first-parent subtlety, and the subject regex. A revert that restores an older pull-request-only pin now resolves too, because the lookup is by the pin itself rather than by the commit that last wrote it. CI passes the job token to both guard steps and grants the job pull-requests: read. Local runs work without a token on this public repo and send GITHUB_TOKEN or GH_TOKEN when set. A failed lookup throws with the HTTP status, and names the rate limit when an unauthenticated call is refused.
| `GitHub answered ${url} with something other than a list: ${body.slice(0, 300)}` | ||
| ) | ||
| } | ||
| return pulls.flatMap((pull) => (typeof pull?.number === 'number' ? [pull.number] : [])) |
There was a problem hiding this comment.
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 9e3037fa-2232-4b21-8529-7c738afe6951
📒 Files selected for processing (6)
.github/workflows/mobile.ymlconfig/scripts/mobile-recording-pin-checkout.test.mjsmobile/scripts/rpc-recording-pin-guard.mtsmobile/scripts/rpc-recording-pin-guard.test.tsmobile/scripts/rpc-recording-pin-reachability.mtsmobile/src/test-support/rpc-recording/README.md
🚧 Files skipped from review as they are similar to previous changes (2)
- mobile/src/test-support/rpc-recording/README.md
- mobile/scripts/rpc-recording-pin-guard.mts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
| export async function pullRequestsWithCommit(root: string, commit: string): Promise<number[]> { | ||
| const url = `https://api.github.com/repos/${await gitHubRepository(root)}/commits/${commit}/pulls` | ||
| const token = process.env.GITHUB_TOKEN || process.env.GH_TOKEN | ||
| const response = await fetch(url, { | ||
| headers: { | ||
| Accept: 'application/vnd.github+json', | ||
| ...(token ? { Authorization: `Bearer ${token}` } : {}) | ||
| }, | ||
| signal: AbortSignal.timeout(PULL_REQUEST_LOOKUP_TIMEOUT_MS) | ||
| }).catch((error: unknown) => { | ||
| // Node's fetch hides the network reason (DNS, TLS, reset) in `cause`. | ||
| const cause = error instanceof Error && error.cause ? ` (${String(error.cause)})` : '' | ||
| throw new Error( | ||
| `Could not ask GitHub which pull requests hold ${commit} (${url}): ${String(error)}${cause}` | ||
| ) | ||
| }) | ||
| const body = await response.text() | ||
| // GitHub's answer for a commit it has never seen, which no pull request can hold. | ||
| if (response.status === 422 && body.includes('No commit found')) { | ||
| return [] | ||
| } | ||
| if (!response.ok) { | ||
| const rateLimited = !token && (response.status === 403 || response.status === 429) | ||
| throw new Error( | ||
| `GitHub answered ${response.status} to ${url}: ${body.slice(0, 300)}` + | ||
| (rateLimited | ||
| ? '\nUnauthenticated GitHub API calls are rate-limited; set GITHUB_TOKEN or GH_TOKEN.' | ||
| : '') | ||
| ) | ||
| } | ||
| const pulls: unknown = JSON.parse(body) | ||
| if (!Array.isArray(pulls)) { | ||
| throw new Error( | ||
| `GitHub answered ${url} with something other than a list: ${body.slice(0, 300)}` | ||
| ) | ||
| } | ||
| return pulls.flatMap((pull) => (typeof pull?.number === 'number' ? [pull.number] : [])) | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '80,205p' mobile/scripts/rpc-recording-pin-reachability.mts
sed -n '305,360p' mobile/scripts/rpc-recording-pin-guard.test.tsRepository: stablyai/orca
Length of output: 7454
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- callers and related symbols ---'
rg -n -C 3 'pullRequestsWithCommit|PullRequestLookup|checkPinReachable|rpc-recording-pin-reachability|recording-pin' mobile/scripts .github README.md docs 2>/dev/null | head -n 500
printf '%s\n' '--- relevant source outline and surrounding definitions ---'
ast-grep outline mobile/scripts/rpc-recording-pin-reachability.mts
printf '%s\n' '--- project files mentioning pagination or GitHub API contracts ---'
rg -n -i -C 2 'per_page|pagination|GitHub API|pull request.*commit|commit.*pull request' . --glob '!node_modules' --glob '!dist' --glob '!build' | head -n 400Repository: stablyai/orca
Length of output: 41774
🤖 get_repo_knowledge executed:
get_repo_knowledge stablyai/orca /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/architecture /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/learnings
Length of output: 47632
🏁 Script executed:
#!/bin/bash
printf '%s\n' '--- callers ---'
rg -n -C 4 'pullRequestsWithCommit|PullRequestLookup|checkPinReachable|rpc-recording-pin-reachability|recording-pin' mobile .github README.md docs 2>/dev/null | head -n 500
printf '%s\n' '--- script structure ---'
ast-grep outline mobile/scripts/rpc-recording-pin-reachability.mts 2>/dev/null || true
printf '%s\n' '--- pagination references ---'
rg -n -i -C 2 'per_page|pagination|pull requests associated with a commit|commit.*pull request|pull request.*commit' . --glob '!node_modules' --glob '!dist' --glob '!build' 2>/dev/null | head -n 400Repository: stablyai/orca
Length of output: 41782
Fetch all pages from the commit-to-pull-request lookup.
pullRequestsWithCommit reads only the first page. checkPinReachable uses this fallback when local ancestry fails, including pins retained only by a squashed pull request's head. The tests show that an associated pull request can be irrelevant while a later associated pull request qualifies.
A qualifying pull request on a later page can therefore be omitted, causing the recording-pin workflow to exit with failure. per_page=100 only increases one page's size. Follow Link: rel="next" until all pages are read.
| } | ||
| // A squash drops the branch commit the pin names, and the branch may already be deleted, but | ||
| // GitHub keeps the pull request's head ref for good. | ||
| const pullRequests = await pullRequestsHolding(root, baseline) | ||
| for (const pullRequest of pullRequests) { | ||
| const pullRequestHead = await fetchPullRequestHead(root, pullRequest) | ||
| if ((await present()) && (await isAncestor(root, baseline, pullRequestHead))) { | ||
| return { ok: true, baseline, ref, pullRequest } | ||
| } | ||
| } | ||
| const pullRequestCause = | ||
| pullRequests.length === 0 | ||
| ? 'and GitHub associates no pull request with it' | ||
| : 'and no head of a pull request GitHub associates with it holds it ' + | ||
| `(${pullRequests.map((pullRequest) => `refs/pull/${pullRequest}/head`).join(', ')})` | ||
| if (!(await present())) { | ||
| return { | ||
| ok: false, | ||
| baseline, | ||
| ref, | ||
| failure: 'unreachable', | ||
| message: repinInstruction( | ||
| baseline, | ||
| resolved, | ||
| `is not a commit in this clone, ${pullRequestCause}` | ||
| ) | ||
| } | ||
| } | ||
| return { |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Continue checking associated pull-request heads after a fetch failure.
When an earlier associated pull-request head cannot be fetched, fetchPullRequestHead throws and aborts checkPinReachable. The checker therefore does not test later pull-request heads, even when a later head contains the baseline commit. This can fail the mobile CI guard for a narrow combination of multiple associated pull requests and an unavailable earlier head. Catch the fetch error for each head, continue the loop, and preserve the fetch failure if no head qualifies.
Suggested fix
const pullRequests = await pullRequestsHolding(root, baseline)
+ let pullRequestHeadError: unknown
for (const pullRequest of pullRequests) {
- const pullRequestHead = await fetchPullRequestHead(root, pullRequest)
+ let pullRequestHead
+ try {
+ pullRequestHead = await fetchPullRequestHead(root, pullRequest)
+ } catch (error) {
+ pullRequestHeadError = error
+ continue
+ }
if ((await present()) && (await isAncestor(root, baseline, pullRequestHead))) {
return { ok: true, baseline, ref, pullRequest }
}
}
+ if (pullRequestHeadError !== undefined) throw pullRequestHeadError📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| } | |
| // A squash drops the branch commit the pin names, and the branch may already be deleted, but | |
| // GitHub keeps the pull request's head ref for good. | |
| const pullRequests = await pullRequestsHolding(root, baseline) | |
| for (const pullRequest of pullRequests) { | |
| const pullRequestHead = await fetchPullRequestHead(root, pullRequest) | |
| if ((await present()) && (await isAncestor(root, baseline, pullRequestHead))) { | |
| return { ok: true, baseline, ref, pullRequest } | |
| } | |
| } | |
| const pullRequestCause = | |
| pullRequests.length === 0 | |
| ? 'and GitHub associates no pull request with it' | |
| : 'and no head of a pull request GitHub associates with it holds it ' + | |
| `(${pullRequests.map((pullRequest) => `refs/pull/${pullRequest}/head`).join(', ')})` | |
| if (!(await present())) { | |
| return { | |
| ok: false, | |
| baseline, | |
| ref, | |
| failure: 'unreachable', | |
| message: repinInstruction( | |
| baseline, | |
| resolved, | |
| `is not a commit in this clone, ${pullRequestCause}` | |
| ) | |
| } | |
| } | |
| return { | |
| } | |
| // A squash drops the branch commit the pin names, and the branch may already be deleted, but | |
| // GitHub keeps the pull request's head ref for good. | |
| const pullRequests = await pullRequestsHolding(root, baseline) | |
| let pullRequestHeadError: unknown | |
| for (const pullRequest of pullRequests) { | |
| let pullRequestHead | |
| try { | |
| pullRequestHead = await fetchPullRequestHead(root, pullRequest) | |
| } catch (error) { | |
| pullRequestHeadError = error | |
| continue | |
| } | |
| if ((await present()) && (await isAncestor(root, baseline, pullRequestHead))) { | |
| return { ok: true, baseline, ref, pullRequest } | |
| } | |
| } | |
| if (pullRequestHeadError !== undefined) throw pullRequestHeadError | |
| const pullRequestCause = | |
| pullRequests.length === 0 | |
| ? 'and GitHub associates no pull request with it' | |
| : 'and no head of a pull request GitHub associates with it holds it ' + | |
| `(${pullRequests.map((pullRequest) => `refs/pull/${pullRequest}/head`).join(', ')})` | |
| if (!(await present())) { | |
| return { | |
| ok: false, | |
| baseline, | |
| ref, | |
| failure: 'unreachable', | |
| message: repinInstruction( | |
| baseline, | |
| resolved, | |
| `is not a commit in this clone, ${pullRequestCause}` | |
| ) | |
| } | |
| } | |
| return { |
There was a problem hiding this comment.
ℹ️ No new issues in this incremental delta — the one open earlier thread on the provenance-path list is unchanged, so this is not an approval.
Reviewed changes
Since the prior pullfrog review (73d0d8e), one commit (70ba1eb):
- GitHub-backed pin lookup —
mobile/scripts/rpc-recording-pin-reachability.mtsdrops thegit log --first-parent -S<pin>squash-subject parse forGET /repos/{owner}/{repo}/commits/{sha}/pulls, then fetches each returnedrefs/pull/<n>/headand accepts the pin only where git confirms it is an ancestor; the lookup is injectable (PullRequestLookup) so tests never touch the network. - Repository and token plumbing —
gitHubRepositoryFromRemote/gitHubRepositoryresolveowner/repofromGITHUB_REPOSITORYor theoriginURL,pullRequestsWithCommitsendsGITHUB_TOKEN/GH_TOKENwhen present, and maps GitHub's 422No commit foundto an empty result. - Workflow and tests —
.github/workflows/mobile.ymlgrantspull-requests: readand passesGITHUB_TOKENto both pin steps; the guard test adds a stubbed-fetch suite (lookup, token, rate-limit, remote parsing) plus squash, edited-squash-title and multi-PR-head cases.
Verified independently against the live repository: GET /commits/03995ae…/pulls returns #22762 (the squash that dropped the pin this PR exists to keep reachable), and a bogus SHA returns the exact No commit found for SHA 422 body the code matches.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Review status: ready for a human decision (not merged; merge is Brennan's call)What this fixes: How it works now (head What changed during review (4 review loops plus an architecture review):
Evidence:
Known limits, all failing loudly rather than passing wrongly:
App QA: not applicable. This PR changes only CI and test tooling, with no app, mobile, Windows or SSH code, so Electron and emulator QA were not run. The live evidence is the PR's own recording-pin job above. Not caused by this PR: an earlier run's "static analysis" red came from a localization key missing in main's |
Merging main brought #22762's recordings, #23757's repin and #23720's recorder change, so the corpus is repinned to the merge commit, the last commit to touch a recorded path, and re-recorded whole. Against main, 786 recordings move only their baseline header and 4 native chat recordings change content: their nativeChat.subscribe and nativeChat.unsubscribe carry the per-subscription token instead of claude:session-1, which also moves their scenarioSha256.
…3700, #22943, #23720, #23793, #23776, #23796) into #23059 #23573 (keep a turn's bar on the prompt that opened it) is ported onto the turn-record membership instead of kept as a second owner lookup: - The running turn's bar comes from nativeChatTurnMembership, which now returns barTurnKey beside liveTurnKey. Where the host states each row's turn they are the same key: the running root turn's anchor, and a message handed over mid-turn is already scoped to that turn. Where the host states no scope, rows still group by position, so barTurnKey is the user entry the running record names (through the same anchors) while liveTurnKey keeps the positional live group, as #23573 kept row liveness on the newest prompt. - activeTurnOpenedBy, selectStructuredAgentTurnBars' openedBy and selectNativeChatActiveTurnKey are removed; the desktop list, the slot builder and both turn-status hooks read barTurnKey. - The queued-send clock (queuedUntil: a turn counts from the previous turn's end when its send waited behind it) is kept, read in the same one-pass walk over root turn records that keys timing by anchor. - Its tests are adapted to pass a journal: each runs on a host that states no scope (the original expectations), and the desktop and mobile bar tests also run on a scoped host. #23621 (a message Claude folds into its running turn no longer splits the turn) is host-only and merged as is: the translator contract carries both openTurnInLiveProviderCycle and #23059's command-turn members. Both sides grew the Claude translator past its line budget, so its result branch moves unchanged into claude-result-journaling.ts, beside claude-message-journaling.ts (the pre-commit lint refuses the merge without it). #23801's Codex child path (no error-driven end) and #23059's Codex /compact guard (a command turn ends only on turn/completed) both stand.
Main's #23720 taught the RPC recording pin guard to find a squash-dropped pin through its pull request's head. This branch removes the pin, the guard, its CI job and the pin-checkout test, so the guard, its test, the new rpc-recording-pin-reachability.mts, the checkout test and the job stay deleted; nothing in #23720 outlives the pin. #23815's README wording edit fell inside the deleted pin section and is superseded by this branch's text.
…chat feed that replaced it (#22939) * fix(mobile): don't unsubscribe a terminal stream that already ended * fix(mobile): keep the stream registry under the line cap and expect no error after a streamed end The streamed `end` now closes a direct stream, so a later reply for that id is unrouted instead of reaching the listener as an error; the subscription recording test expected the old error. Inline the error wrapper so the registry fits the 300-line cap, and shorten the comments. * fix(mobile): reopen a native chat stream the host ended while the screen still shows it * fix(mobile): only the focused screen takes back a host-ended chat feed, and a reopen keeps loaded history * fix(mobile): give each native chat subscription its own token, and reopen with the first page * test(mobile): pin the reopened chat subscribe params without a cast * fix(mobile): show a host-ended chat feed as an error instead of reopening it With a token per subscription, the desktop ends a phone chat feed only when the phone closes it or the socket drops: no client sends the connection-wide chat unsubscribe, a socket close delivers no end, and every desktop with mobile chat keys feeds by the client's token. The reopen-with-backoff layer and the history-keeping reopen merge guarded a trigger that no longer exists, so they are removed. An end that still reaches the screen settles the feed as an error, so a dead feed is never shown as live; leaving and re-entering the chat subscribes again with a fresh token. * test(mobile): re-record the RPC goldens for the per-subscription chat token Each nativeChat.subscribe now sends its own token, so the native chat scenarios expect `claude:session-1:<id>` in the subscribe params, and the four native chat recordings (native-chat-page-earlier and the session.native-chat-page matrix) record that token in their subscribe and unsubscribe payloads. Every other golden moved only its `baseline` header, repinned to the commit recorded from. * test(mobile): repin RPC recordings to the merge with main and re-record Merging main moved the product tree the recordings are pinned to, so the baseline is repinned to the merge commit and the whole corpus re-recorded. Only the four native chat recordings change content, because each nativeChat.subscribe now carries a per-subscription token; every other recording moves only its baseline header. * test(mobile): repin RPC recordings to the merge with main and re-record Merging main brought #22762's recordings, #23757's repin and #23720's recorder change, so the corpus is repinned to the merge commit, the last commit to touch a recorded path, and re-recorded whole. Against main, 786 recordings move only their baseline header and 4 native chat recordings change content: their nativeChat.subscribe and nativeChat.unsubscribe carry the per-subscription token instead of claude:session-1, which also moves their scenarioSha256.

ELI5
The mobile test corpus records which exact commit it was recorded from. When a pull request re-records it, it points that record at one of its own commits. Squash-merging throws that commit away from main's history, and a CI check then turned main red until someone opened a follow-up PR just to point the record at a main commit. This PR teaches the check where the "thrown away" commit still lives, so main stays green and the follow-up PRs are no longer needed.
What Changed
Before:
Mobile Checks / RPC recording pinhas failed on every push to main since #22762 (29c7d5d). That PR pinned the corpus to its own branch commit03995ae, and the squash left03995aeout of main's history. The guard only accepted a pin that is an ancestor of the checked-out commit, so it failed with "pinned to a commit that is not an ancestor of this commit". The same thing happened after every PR that re-records the corpus, and each one needed a hand-made repin PR: #23565, #23535, #23046, #22702, #22407, #22394, #21105, #21092, #21065 and more. Main's history has 61 commits that touched the pin file, 49 of which changed the pin.After: the guard (
mobile/scripts/rpc-recording-pin-reachability.mts, split out of the guard file) accepts a pin that is either:For (2) the guard asks GitHub which pull requests contain the pinned commit (
GET /repos/{owner}/{repo}/commits/{pin}/pulls). For each one, in order, it fetchesrefs/pull/<n>/headintorefs/rpc-recording-pin/pull/<n>and accepts the pin only if git confirms the pin is an ancestor of that head. GitHub only suggests candidates and git makes the decision, so a wrong or stale answer from GitHub can make the check fail but never pass. GitHub keeps pull request head refs after the branch is deleted.The
reproducestep runs the same check first, so the pinned tree can still be checked out when the branch is gone. The CLI subcommand is renamed fromancestrytoreachableto match what it now checks.CI passes the job's own token (
GITHUB_TOKEN) to both guard steps, and the recording-pin job now declarescontents: readandpull-requests: read. The token raises GitHub's API rate limit. Local runs work without a token because the repository is public, and they sendGITHUB_TOKENorGH_TOKENwhen one is set. The repository name comes fromGITHUB_REPOSITORYin CI, or else from theoriginremote URL.If GitHub cannot be reached, the guard fails with the HTTP status and GitHub's message, and it says when the cause is the unauthenticated rate limit. It never passes in that case. The workflow, its config test and the corpus README are updated. The README no longer tells people to open a follow-up repin after a squash.
The recorder (
mobile/scripts/rpc-recording.mts) now tells a pinned commit that your clone does not have apart from real product drift. Before, a developer on main right after such a squash was told "Product sources or lockfile differ from the pinned main baseline" and sent to repin for nothing; now it prints git's error and thereachablecommand that fetches the pin.Nothing changes for the app. This touches CI and test tooling only.
One accepted risk: on a push to main, the reproduction step now checks out the pinned pull request commit, which is not in main's history, and runs the recording suites from it. That same commit already ran in the pull request's own reproduction, and its SHA is in the reviewed diff. The job token is now read-only (
contents: read,pull-requests: read) and no secrets reach the step. The remaining exposure is the pnpm package-store cache that the setup step saves for main at job end on a cache miss.Why
The pin exists so the corpus can later be checked out and replayed against the exact tree it was recorded from. That only requires the pinned commit to stay retrievable. It does not have to be in main's history. Under squash-merge a branch commit never lands in main's history, but GitHub keeps it permanently under
refs/pull/<n>/head. The follow-up repin PRs only rewrote thebaselineheader of every golden and changed no recorded behaviour, so they were bookkeeping that kept main red.The pull request is found by asking GitHub about the pinned commit itself. This does not depend on how the squash was titled, how the branch was merged, or which later commit last touched the manifest. I checked the question against main's full history. Of the 49 commits that changed the pin, 22 pinned a commit that is not in main's history, so each of those turned main red under the old guard. For all 22, GitHub's answer named the right merged pull request, and all 22 of those pull request heads still hold the pin. For commits that a force-push removed from a pull request, GitHub returns no pull request, so those pins still fail.
Alternatives considered:
git log --first-parent -S<pin>) and read the(#n)that GitHub appends to squash titles. I rejected it because the title can be edited at merge time, and that has already happened here: fix(omp): attach desktop and mobile images through file mentions #21674 was squash-merged with an edited title that has no(#n). That is 1 of the 22 cases, and the title-based guard would still have turned main red there. The history search also cost up to 14 lazy file downloads in CI's partial clone (20 to 56 seconds on main's worst stretch), needed a 10-minute time budget, and misread a revert that restores an older pin. Asking GitHub about the pin needs one API call instead.git fetch origin <sha>can download. GitHub serves commits by SHA even when no branch or pull request keeps them. I checked this with four commits that force-pushes had removed from merged pull requests: all four still downloaded. So this check would pass a pin that GitHub may later delete. Requiring the pin to be an ancestor of a named pull request head is what makes the check sound.mobile/src,src/shared, the mobile lockfile) changed in 387 main commits over the last two weeks. A branch's recorded tree almost never exists unchanged on main after a squash, so that pin would break just as often.The check still fails where it should. A pin that no kept ref holds fails with the same repin instruction as before. That covers a pin GitHub links to no pull request, and a pull request whose head no longer holds the pin because the author force-pushed after pinning. The message now says which of the two happened. A pull request whose rebase dropped its own pinned commit fails on the pull request itself, before the squash reaches main.
Linked Issue
None. Reported in the team Slack (#orca CI channel), where main's
Mobile Checkswas red on #22762 and #23605.Visual Proof
N/A — CI and test tooling only; no UI or app behaviour change.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
mobile/scripts/rpc-recording-pin-guard.test.ts: 30/30 pass. The reachability cases use a throwaway bare remote that keeps a branch head atrefs/pull/7/head, and they replace the GitHub call with a stub:(#n)passes, because the pull request comes from GitHub (the fix(omp): attach desktop and mobile images through file mentions #21674 case);refs/pull/7/head;fetchstubbed: it sends the token and reads the pull request numbers; it treats GitHub's "No commit found" (HTTP 422) as no pull request; it mentions the rate limit on a 403 without a token; and it readsowner/repofrom https and ssh remote URLs.Ablations:
config/scripts/mobile-recording-pin-checkout.test.mjsnow also asserts the job'scontents: read/pull-requests: readpermissions and the token on both guard steps. It passes 2/2, and it fails whenpull-requests: readis removed.Against the real repository, in a CI-shaped clone (
--filter=blob:none, full history):e8e144bf3ca:pinned to a commit that is not an ancestor of this commit, exit 1 (the CI failure this PR fixes);bd5dca4406f:Recording pin 03995ae… is kept by refs/pull/22762/head.in 2.0 s with a token and 2.3 s without one (about 3.3 s wall time including Node startup);e7da72c3d7(title without(#n)):Recording pin 1006ad670a… is kept by refs/pull/21674/head.in 4.4 s;This PR edits the guard, which is one of the paths that force the full corpus reproduction to run on the PR. CI therefore replays the corpus against the pinned tree
03995ae, which it reaches through the new lookup.oxlintandoxfmt --checkare clean on the changed files. The guard test sits outside mobile's test typecheck on purpose (seemobile/tsconfig.test.json).AI Disclosure
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Cross-platform: the guard runs git through
runProcesswith argv arrays, the same as before. SSH, mobile app and backwards compatibility: no runtime code changes. The pull request lookup is one HTTPS call to api.github.com, and it only happens when main's pin is held by a pull request rather than main's history; a network or GitHub error fails the job loudly (re-run clears it) and never passes it. The fetch uses theoriginremote, as CI's checkout does. In a local clone whoseoriginis not on GitHub, the guard asks forGITHUB_REPOSITORY=<owner>/<repo>. In a clone whoseoriginis a fork, it asks about the fork, so it fails rather than passing wrongly, but the message does not say the fork is the cause.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)