Repository navigation
feat(mobile): add the Linger Mobile App and its computer side - #685
jeffrey-bin wants to merge 20 commits into
Conversation
The Mobile App (apps/mobile) reaches its own computer over a Noise XK session, on the local network or through Relay nodes that forward only ciphertext (apps/relay). TeamHub gains the Mobile Gateway, Paired Phones, the Relay node list, push delivery through the Push Service, and the Voice Bridge for recording and Live from the phone. Web Settings > Phones pairs and approves phones and manages Relay nodes; docs/mobile.md specifies the protocol. The mobile migrations follow main's (00894 to 00896).
There was a problem hiding this comment.
Approve with nits (1 P2, 2 P3)
Scope: base main, merge base 8b7fe39b, 5 commits, 517 files (+41,346 / −846). Loaded coderbook, ponytail-review and karpathy-guidelines; ran in a separate session. The PR is very large, so most of the time went to the security boundary on the computer side: the TeamHub Mobile Gateway (handshake, allowlist, dispatch, streams), Paired Phones, Relay nodes, push, the Voice Bridge proxy and config/env. The React Native app under apps/mobile (about 22k lines) got only a targeted look at its pairing and refusal handling. The Relay server internals got only -race tests, not a line-by-line read.
Findings
P2
apps/teamhub/internal/mobilegateway/session_test.go:36: thepipeWiretest double races with the gateway, so this test file is flaky.servewrites the encrypted refusal welcome and then callsw.Closeright away (session.go,refuse(closeRefused, code)).pipeWire.Readusesselecton bothp.inandp.closed. When both are ready, Go picks one at random, so the phone side sometimes getsio.EOFeven though the welcome is already buffered. A real WebSocket delivers queued messages before the close frame, so the fake behaves worse than the real wire. I rango test -count=3 -run TestPairingIsRateLimited ./internal/mobilegateway/on this head and gotsession_test.go:448: EOFin one of three runs. A plain-racerun of the package also failed once.make -C apps/teamhub testruns this package, socheck (teamhub)will fail now and then. Fix: inRead, first tryp.inwith a non-blockingselect, and only then wait onin,closedandctx.
P3
apps/teamhub/internal/pairedphone/pairedphone.go:103: everyCreatePendingPairedPhoneerror becomesErrBadPairRequest. That includes a lost connection, a constraint error or a NUL byte inname. The phone showsBAD_HELLOand nothing is logged. The comment says this branch is a retry that must resume, but a real retry fails first atConsumeMobilePairingInvite, because the invite was already spent, and getsINVITE_INVALID. The app handles that case inapps/mobile/src/computer/pairing.ts:122. Map only the unique violation onpublic_key(pgconn code23505) toErrBadPairRequest, and wrap and return the rest, sophoneErrorCodelogs them asUNAVAILABLE.apps/teamhub/internal/mobilepush/mobilepush.go:29: the comment says "the trigger in migration 00887 names it", but the trigger is in00894_paired_phones.sql.
Verified as fine
- Allowlist runs before dispatch.
dispatchRequestmatches the decodedtarget.PathagainstmobileRoutesbefore building the request, and rebuilds it fromtarget.RequestURI()(mobilegateway/dispatch.go). Gin routes on the same decodedURL.Path, so%2For..cannot make the allowlist and the router see different paths. Gin answers unmatched paths with a redirect, not an internal re-dispatch.mobile_allowlist_test.gochecks that every entry is a real public route. Sign-in, password, logout, phone approval and removal, and relay PATCH/DELETE are not on the list. - Identity comes only from the session.
Authorization,Cookie,Origin,Hostand the forwarding headers are stripped (dispatch.go).optionalPrincipaltakes the digest from the context set byWithPhoneSessionbefore it looks at cookies (app/app.go:1194).PhoneSessionreturns false for an empty digest (gateway.go:292), so a pending phone gets no principal. Pending sessions also reset every request and socket frame withPAIRING_PENDING(session.gohandle). The device session'stoken_hashis random and no raw token exists for it (pairedphone.createSession), so no cookie can present it./v0/session/renewis not on the allowlist, so a phone never renews a cookie session. - Handshake. Noise XK uses a prologue bound to the computer's public key, and the first message must have an empty payload (
handshake.go). The phone's identity is the static key proved in message 3. The pair attempts are rate-limited, andTestAHandshakeForAnotherComputerFailscovers a wrong-key handshake. - Approve/remove races with a live handshake. After
track,servecallsResumeagain, so a removal or approval that lands between admission and tracking still takes effect (session.go).Approverequiresapproved_at IS NULL AND removed_at IS NULLand the pending lifetime (queries/paired_phone.sql).Removerevokes the device session in the same transaction. - Password change. It does not unpair phones;
Resumerotates the revoked session. This is a deliberate choice and is documented indocs/mobile.md:45. - Decision kinds. The phone-only restriction is enforced on the server inside the authorization step (
typedcard/decisions.go,OnlyKinds) and returnsDECIDE_ON_COMPUTER. It does not depend on what the client shows. - Push grants. A push grant is accepted only when
service_urlequals the configured Push Service (handlers_mobile_phones.go).callingPhonereturns 403 to browser sessions. The push HTTP client refuses redirects (app.go,CheckRedirect). On 410/401 the worker clears the grant with a compare-and-clear on the same grant value. - Relay links. Relay links are forced off on the public development seed (
config/service_credentials.go), because every checkout on that seed shares one host key. Relay dials reject link-local, multicast and unspecified addresses after DNS (transport.gorelayDialer). The Relay checks host ownership with an X25519+HMAC proof bound to a nonce (apps/relay/internal/relay/proof.go). - Voice Bridge. The proxy requires TeamHub's node-services credential (
bridge-proxy.ts). The Bridge worker trusts only a per-process random token, and checks the LiveKit grant for eachstartand that a resumed session belongs to the same phone (voice-runtime/src/bridge.ts:197-210). - Env and config. The new variables are in
.env.exampleorscripts/env-inventory.json, andapps/relay/**/*.gowas added to the inventory scan. TeamHub reads the env only ininternal/config.user.envdrops empty values (local-installation/src/user-environment.ts,readUserEnvironment), so the template's emptyTEAMHUB_MOBILE_RELAY_URL=does not turn Relay links off for Desktop users. - Migrations. The new migrations are forward-only.
voice_sessions.clienthas a default, so existing rows and old callers keep working.00894to00896do not collide withmain, whose latest migration is00893. - Language. No CJK in added lines outside the locale catalogs, and none in any commit message. The added-line grep hit only on
·(U+00B7), which is not CJK.
Not verified: most of the apps/mobile UI and offline outbox logic; the Relay's splice and rate-limit code beyond its tests; the Push Service sealing in apps/relay/internal/push; and how a phone recovers when a password change revokes its device session mid-session (requests get 401 until it reconnects).
Process notes
- The branch is 9 commits behind
main.mainrequires up-to-date branches, so it needs a rebase before merge. - No merge commits. No fixup or "address review" commits that need squashing.
CI
- All required checks pass on
8bc9865e. - CI does not run
check-relay,check-mobileorcheck-voice-runtime.scripts/check-plan.mjsgives them nocikey, so they only run locally, the same as the existing voice-runtime convention. The Relay is a public internet-facing service with no CI coverage. - I ran locally:
go test -race -count=1 ./...inapps/relay: pass.go test -race -count=1oninternal/mobilerelayandinternal/mobilepush: pass.internal/mobilegateway:TestPairingIsRateLimitedfailed intermittently with and without-race(the P2 above), and passed in a 3×-racererun.
Automated review by Claude Code
Automated review of 8bc9865 by Claude Code.
… name the push trigger's migration
There was a problem hiding this comment.
Approve (0 findings)
Follow-up on 8bc9865. Scope: base main, merge base 8b7fe39, 6 commits, 517 files in the PR. The incremental diff since the previous review touches 3 files, and all 3 were reviewed in full context. Loaded the review skill's own rules only. The helper skills (coderbook, ponytail-review, karpathy-guidelines) were not loaded separately for this small follow-up. This review ran in a separate session.
Previous findings
- P2 – test pipe
Readrace (mobilegateway/session_test.go): Resolved.pipeWire.Read(apps/teamhub/internal/mobilegateway/session_test.go:37-43) first takes a queued message without blocking, then falls back to the blocking select. A message sent before the close now always wins, which matches WebSocket ordering.go test -count=3 ./internal/mobilegateway/passed locally. - P3 – every pairing insert error swallowed as
BAD_HELLO(pairedphone/pairedphone.go): Resolved. Only a23505onpaired_phones_public_key_keynow maps toErrBadPairRequest(apps/teamhub/internal/pairedphone/pairedphone.go:111-116). Any other error is wrapped (record pending phone: %w).phoneErrorCodelogs it asmobile.authenticate_failedand returnsUNAVAILABLE(apps/teamhub/internal/mobilegateway/session.go:207-209). - P3 – comment names the wrong migration (
mobilepush/mobilepush.go): Resolved. The comment now names00894(apps/teamhub/internal/mobilepush/mobilepush.go:28), which is where the trigger lives (apps/teamhub/migrations/00894_paired_phones.sql).
Findings
None.
Verified as fine
- Constraint name:
public_key bytea NOT NULL UNIQUE(apps/teamhub/migrations/00894_paired_phones.sql:23) on tablepaired_phonesgets PostgreSQL's default namepaired_phones_public_key_key, so the new match fires. The insert's only other unique keys are a freshidgen.New("phone")ID andpaired_phones_session_id_key, and pending phones do not setsession_id. - Retry after
UNAVAILABLE: the invite is consumed in the same transaction (pairedphone.go:96-103), anddefer tx.Rollbackreturns it on failure. The phone's message "Your computer could not pair right now. Try again in a moment." (apps/mobile/src/computer/pairing.ts:52-53) is therefore accurate: the same code still works. - Failure handling on the phone:
UNAVAILABLEis a known pairing failure (apps/mobile/src/computer/pairing.ts:31-39) and maps to a retry message. It is not one of the "removed/unknown" refusals. - Error matching pattern: the inline
errors.As(..., *pgconn.PgError)check with code23505and a constraint name follows the existing pattern (apps/teamhub/internal/agentruntimestate/runner.go:534andapps/teamhub/internal/document/tree.go:385). TeamHub has no shared helper this check should reuse. - English-only: the grep for
\p{Han}on added lines matched only the middle dot·(U+00B7) in UI separators. That is not a CJK ideograph. No commit message contains CJK. - Merge commits: none in the PR.
- Unverified: this follow-up did not repeat a full assumption check of the 41k-line feature beyond the previous review. Only the incremental diff and the pairing error path were re-traced end to end.
Process notes
8bc9865,c21e2ace,41664891and9e399c95are follow-upfix/testcommits that patch code added earlier in this PR, mostly in505b5858.maintakes rebase merges, so these patch commits will land onmainas they are. Consider squashing them into the commits they fix.- Merge state is
BLOCKED, probably because the required checks are still pending.
CI
At review time most checks were pending: check (teamhub), check (contracts), check (packages), check (desktop), check (computer-go), check (computer-go-windows), check (installer), check (teamhub-cli), both web tests shards, web-static and repository-gate. CodeQL, Analyze (actions) and changes passed. Ran locally: go test -count=3 -p 4 ./internal/mobilegateway/, which passed.
Automated review by Claude Code
Automated review of 9e399c9 by Claude Code.
There was a problem hiding this comment.
Approve (0 P0, 0 P1, 0 P2, 0 P3)
Scope: follow-up on 9e399c9. Base main, merge base 02d6c317 (the current origin/main tip). 7 commits, 517 files (+41359 / −846). I ran the review in a separate session. The coderbook, ponytail-review and karpathy-guidelines checklists were applied from the review recipe.
Previous findings
The previous review at 9e399c9 reported no findings, so there is nothing to carry forward.
What changed since 9e399c9
The only new commit is 77f0890b, "Merge branch 'main' into feat/mobile-app".
git show --remerge-diff 77f0890bis empty, so the merge resolved no conflicts by hand.- I compared the PR's own diff before and after the merge:
git diff <old merge base> 9e399c9againstgit diff 02d6c317 HEAD. Apart from blobindexlines, the two are identical. No PR code changed in this push. - The 27 commits brought in from
mainshare one file with this PR:apps/web/src/i18n/locales/zh-CN.json. Main only added keys to it, and every locale catalog still parses as JSON. - Main added no TeamHub migrations, so this PR's
00894–00896stay the newest, in order and without number collisions. - Main's
gatewayUrlchange (da6c9481) concerns the node-services gateway, not the Mobile Gateway. It touches none of this PR's files.
Findings
None.
Verified as fine
Because "unchanged since the last review" doesn't prove the code is correct, I re-checked the riskiest parts of the full PR:
- Mobile API allowlist runs before dispatch.
apps/teamhub/internal/mobilegateway/dispatch.go:47-59parses the path withurl.ParseRequestURIand rejects any request that carries a host.- It then calls
allowed()on the decoded path. That function (allowlist.go:69-100) matches whole segments only, and a:segment never matches an empty segment. - The request is rebuilt from the same parsed URL (
dispatch.go:61-64), so the path that was checked is the path that gets routed. - A dot segment such as
/v0/rooms/../messagesonly fills a parameter (roomID=".."). It cannot reach a route outside the allowlist.
- Phone identity can't be spoofed through headers. Callers can't inject the identity. The session digest is carried in the context (
WithPhoneSession),strippedRequestHeadersis applied after the caller's headers are copied (dispatch.go:70-77), andRemoteAddris set server-side. - Gateway setup fails safe. It is disabled when no static key secret is configured. A bad key is logged as
mobile.gateway_unavailableand the gateway is not started (feature_mobile.go:26-33). - Relay sync is serialized. It is held under
mobileRelaySyncand reads the stored list withcontext.WithoutCancel, so a caller that stops waiting can't leave the Gateway on the old list (feature_mobile.go:59-79). - Migration
00894keeps its invariants in the schema.approved_atandsession_idare set together, and so arepush_grantandpush_service_url.- Phone public keys and
session_idare unique. - The push service URL must use https.
- The trigger enqueues push jobs only when an approved phone that holds a grant exists for the tenant.
- The down migration refuses with an error, so the migration is forward-only.
Process notes
- The branch includes the merge commit
77f0890b.mainonly takes rebase merges, so please rebase ontomaininstead of merging it in.
CI
Most checks were still pending at review time, and none had failed. I ran no tests myself: this push changed no PR code, and the merge needed no conflict resolution.
Automated review by Claude Code
Automated review of 77f0890 by Claude Code.
There was a problem hiding this comment.
Approve (0 findings)
Scope: follow-up on 77f0890. Base main, merge base 02d6c317; 8 commits on the PR. The new delta is one commit (6431d40, 1 file, +8 lines). I re-ran the assumption check across the whole merge-base diff and spot-checked the high-risk areas. Helper skills: the review recipe from linger-pr-review was applied directly; coderbook, ponytail-review and karpathy-guidelines were not loaded separately. This review ran in a separate session.
Previous findings
The previous review (77f0890) had no findings.
Findings
None.
Verified as fine
- The new test fix is sound. In
packages/local-installation/src/byok-source.ts:696the heartbeatsetIntervalis registered beforeapplySource.applySourcethen awaits a real file read (readPreviousRuntimePaths,byok-source.ts:549) before it callslocalmodels(:550). The earlier native-preparation steps also involve real I/O, which fake timers don't move. That meansvi.advanceTimersByTimeAsynccould run before the interval existed. The test now waits for itslocalmodelsdouble to be called (byok-source.test.ts:387-396) before advancing time, so the interval is guaranteed to be registered by then. The change is test-only. It is outside the mobile feature, but it unblocks thepackagescheck and is small, so I am not counting it as an unrelated change. - Migrations.
00894to00896do not collide with anything onmainsince the merge base. None of the 7 newermaincommits add a migration. - Relay node checks.
mobilerelay.CheckPublic(apps/teamhub/internal/mobilerelay/mobilerelay.go:91-114) refuses loopback, private, link-local, unspecified and multicast hosts for phone-added nodes. The dialer (apps/teamhub/internal/mobilegateway/transport.go:395-411) checks the IP it actually dials after DNS, refusing link-local, unspecified and multicast addresses (this blocks cloud metadata). It deliberately allows loopback and private addresses for local and LAN Relays, and a comment documents that. Note: the public check only runs when a node is added, so a phone-added hostname that later re-resolves to a private address would still be dialed. Per the comment this is an accepted tradeoff, and only an approved paired phone can add nodes. TEAMHUB_MOBILE_RELAY_URLis added to the user environment template and key list (packages/local-installation/src/user-environment.ts:17,35-37).- CJK check. Every Han-script match in added lines is either U+00B7 (middle dot) or in the allowed
apps/web/src/i18n/locales/zh-CN.json. No commit message contains CJK. - Commit authors.
6431d40is linked to the GitHub accountjeffrey-bin.
Process notes
- The branch contains merge commit
77f0890("Merge branch 'main' into feat/mobile-app").maintakes only rebase merges, which drop merge commits along with any conflict resolution in them, so please followmainby rebasing instead. - The branch is 7 commits behind
main(merge state BLOCKED).mainhas since changedapps/web/src/i18n/locales/zh-CN.json,contracts/openapi/components/domain.yamland the generated contracts, so expect conflicts there. Regenerate the contracts after rebasing.
CI
At review time Analyze, CodeQL and changes had passed. repository-gate, web-static, the web tests and the check (*) jobs were still pending. I ran no tests myself: the only new change is a test-timing fix, and I verified it against the source.
Automated review by Claude Code
Automated review of 6431d40 by Claude Code.
There was a problem hiding this comment.
Approve (0 findings)
Scope: base main, merge base eafcfd41, 9 commits, ~100 files (+41,367 / −846). This is a follow-up on 6431d40. Helper skills coderbook, ponytail-review and karpathy-guidelines were referenced per the review recipe. The review ran in a separate session.
Previous findings
The previous review (6431d40) approved the PR with no findings, so there is nothing to carry over.
Findings
None.
What changed since 6431d40
The only new commit is 1b5accab Merge branch 'main' into feat/mobile-app. git show --remerge-diff 1b5accab is empty, so it resolves no conflicts and adds no PR code. Its 25-file delta is exactly main's local-runtime and installer changes (eafcfd41, 59ca26b0, ...), none of which touch mobile code.
Verified as fine
- Migrations: after the merge, main's newest migration is
00893_transcript_only_captures.sql. The PR's00894–00896follow it with no number collision (apps/teamhub/migrations/). - Mobile API allowlist: every phone request goes through
allowed()(apps/teamhub/internal/mobilegateway/allowlist.go:66) before dispatch. Paths with a different segment count never match, and a:segment rejects empty segments. Anything not on the list gets a 404 inside the Gateway (apps/teamhub/internal/mobilegateway/dispatch.go:53-59), so auth, Agent API and internal routes are unreachable from a phone. - Phone identity:
- The Gateway strips
AuthorizationandCookie(plus forwarding headers) from phone requests (dispatch.go:29-37,:75-77). - Identity comes only from the in-process context key (
apps/teamhub/internal/mobilegateway/gateway.go:287-295). No network request can set that key. optionalPrincipalresolves the phone's digest throughsessions.Activeon every request (apps/teamhub/internal/app/app.go:1194-1222). A revoked or rotated phone session (apps/teamhub/internal/pairedphone/pairedphone.go:169) therefore stops working at its next request.
- The Gateway strips
- Phone-specific restrictions: decision answers and Relay node additions branch on
PhoneSession(apps/teamhub/internal/app/handlers_typed_card_decisions.go:51,apps/teamhub/internal/app/handlers_mobile_relays.go:64). - Language: the added lines contain no CJK outside the locale catalogs. The only hits from the
\p{Han}grep are the separator·(U+00B7). No commit message contains Chinese.
Unverified: this follow-up did not re-walk the full 41k-line diff beyond the paths above (Noise handshake, Relay splicing, the push trigger, the RN app). For those it relies on the previous review at 6431d40, since the code is unchanged since then.
Process notes
- The PR has two merge commits (
77f0890band1b5accab, both "Merge branch 'main' into feat/mobile-app"). Neither resolves a conflict, butmaintakes rebase merges only, so please rebase ontomaininstead of merging it in.
CI
- Passed:
changesandCodeQL. - Still pending when this review ran:
check (teamhub),check (contracts),check (computer-go),check (computer-go-windows),check (desktop),check (installer),check (packages),check (teamhub-cli),repository-gate,web-static,web tests (1/2, 2/2)andAnalyze (actions). - Merge state is BLOCKED, presumably by the pending required checks. The branch already contains
origin/main, so it is not behind. - No tests were run locally.
Automated review by Claude Code
Automated review of 1b5acca by Claude Code.
# Conflicts: # apps/voice-runtime/AGENTS.md # packages/local-installation/src/byok-source.test.ts
There was a problem hiding this comment.
Approve (0 findings)
Scope: follow-up on 1b5accab. Base main, merge base 4b5b4266 (the current main tip, so the branch is up to date). 10 commits and 517 files in the PR diff. The coderbook, ponytail-review and karpathy-guidelines checklists were applied from the review instructions. This review ran in a separate session.
Previous findings
The previous review (1b5accab) approved with no findings, so there is nothing to carry over.
What changed since 1b5accab
The only new commit is 2b8b7d69, which merges origin/main into the branch. I compared the PR's own diff before the merge (eafcfd41..1b5accab) with the diff after it (4b5b4266..2b8b7d69), ignoring hunk headers. They differ in exactly two places:
packages/local-installation/src/byok-source.test.tsis no longer in the PR. Its fix, which waits for the mount before advancing fake timers, is already onmainin the same form. The conflict resolution tookmain's copy, andgit diff origin/main HEADon that file is empty.apps/voice-runtime/AGENTS.mdkeeps the PR's Bridge bullet andmain's new Live audio-stats bullet side by side. Nothing was lost in the conflict resolution.
No other line of the PR's own changes moved.
Findings
None.
Verified as fine
- Files both sides changed:
live-worker.ts,voice-media.yaml, generated contracts,zh-CN.json, andapps/voice-runtime/AGENTS.md.mainadded browser reply-audio stats, which the worker only logs when a client sends them. The PR'sclientTools(context.client)(apps/voice-runtime/src/live-worker.ts:364, used at:791) changes only the tool list. A phone that never sends stats is unaffected.- The
check (contracts)job is green, so the regenerated contracts match the merged OpenAPI.
- Migrations:
00894–00896remain the highest numbers, andapps/teamhub/migrationshas no duplicate prefixes after the merge. - Language: the only added CJK is in
apps/web/src/i18n/locales/zh-CN.json, an allowed catalog. No commit message contains CJK. - Unchanged since the previous review: I re-ran the PR-wide check for clear P0/P1 problems in the merge-base diff and the merge commit. Because the PR's own content is identical to
1b5accab, I did not re-audit its 41k lines line by line. The previous review stands for that content.
Process notes
- The branch has three merge commits (
77f0890b,1b5accab,2b8b7d69).mainonly takes rebase merges, which drop merge commits along with any conflict resolutions inside them. Followmainby rebasing instead.
CI
All 16 checks pass, including check (teamhub), check (contracts), check (packages), check (web), web tests 1/2 and 2/2, repository-gate and CodeQL. I ran no tests locally: the merge introduced no PR-side code changes that needed one.
Automated review by Claude Code
Automated review of 2b8b7d6 by Claude Code.
…h the keyboard up; clearer diagnostics The + opens a menu of Camera, Photos and Files; photos arrive as JPEG. With the keyboard up the Agent's face and name sit centered like a navigation bar, its current work below and Stop where Record sits. Settings draws its own title in line with the groups, the two diagnostics actions get icons and a line each, and the Library's refresh spinner shows only for a pull.
On a network change, on returning to the foreground and every 30 s, a session on a Relay dials only the stored LAN origins in the background and swaps to the first that completes its handshake, closing the Relay session without a new round or backoff. A voice call in progress keeps its route.
There was a problem hiding this comment.
Approve with nits (1 P2, 1 P3)
Scope: follow-up on 2b8b7d6 (previous verdict: Approve, no findings). Base main, merge base 4b5b426; 12 commits in the PR, the 2 new commits (17e0788c, c62b8285, 24 files) reviewed in full, and the whole-PR diff re-scanned for P0/P1 in the paths the new commits touch (connection lifecycle, session streams, composer uploads). Helper skills loaded: coderbook, ponytail-review, karpathy-guidelines. Ran in a separate session.
Previous findings
None: the review of 2b8b7d6 reported no findings.
Findings
P2
Switching a Relay session to the LAN cuts off an in-flight attachment upload: apps/mobile/src/computer/connection.ts:206 and apps/mobile/src/chat/composer.tsx:171
upgradeToLan()holds the move only whileopenSockets > 0. That count covers socket streams: Live voice and meeting recording throughbridge-client.ts:264. It does not cover request streams. When the LAN answers, the Relay session is closed (session.close()in the success branch), and every open request on it resets withSESSION_CLOSED(session/session.ts:529).- Failure scenario: the phone is on home Wi-Fi but connected through the Relay, for example because the LAN dial lost the first round. The user picks a 20 MB video, and its upload runs for a while over the Relay. The 30-second timer or a network event then wins the LAN dial.
uploadAttachmentrejects, thecatchatcomposer.tsx:182removes the chip, and the user sees "… did not upload. Try again." and has to pick the file again.docs/mobile.md:256says requests cut off by the switch recover: "queries retry, the event stream resumes …, and the outbox resends". The composer's upload is not on that list and does not recover. - Fix (pick one): retry the upload once in the composer on
SessionClosed/NotConnectedwith the samelocalIdidempotency key it already passes; or havePhoneSessioncount uploads in progress next to#socketsand skip the upgrade while that count is above zero. Then add the case to the paragraph indocs/mobile.md.
P3
FoldedStage copies the Stop button from WorkLine: apps/mobile/src/chat/agent-stage.tsx:222
- The Stop
PressableinFoldedStage(accessibility label,disabled={isStopping},hitSlop={10}, the three style states,stopSquare) is the same as the one inWorkLineatagent-stage.tsx:152-165. A later change to one, such as the label or the disabled behavior, can easily miss the other. A smallStopButton({ roomId, runId, agentName })used by both removes the copy.
Verified as fine
- Only one upgrade at a time, and no leaked dial.
#upgradingguards against reentry (connection.ts:206-216), and the test callsupgradeToLan()twice. Every LAN dial settles becausePhoneSession.openhas a 10 s handshake timeout (session/session.ts:22,262).done()clears the guard once every dial has settled, so a hanging dial on cellular cannot block later upgrades. - The switch causes no reconnect round or backoff.
#accept(next, "lan")replaces#sessionbeforesession.close(), so the Relay session's close listener returns early (#sessionClosedchecksthis.#session !== session). The test checks that the status staysconnectedand the Relay is dialed only once. - Losing dials and stale results are closed. The success branch closes
nextif the upgrade was aborted, the connection stopped, the session changed, the route is no longerrelay, the new session ispending, or a socket opened during the dial.reconnect(),stop(),#accept()and#sessionClosed()all call#stopUpgrade(), which aborts the dial and clears the 30 s timer. - Voice is protected. Live and meeting recording both use
openSocketthrough the Bridge (voice/bridge-client.ts:264, used bylive-screen.tsxandrecord-screen.tsx).PhoneSession.#socketsis added to in#openforFrameType.socket, and removed inrelease()and on close (session/session.ts:408,425,526). - Consumers pick up the new session.
#acceptemitsconnected, which bumpsrevisioninComputerProvider(computer/computer-context.tsx:181-188).useTeamHubis memoized on the session object (state/queries.tsx:99-113), so queries and effects rerun against the LAN session. - The picker change keeps the 25 MB check.
pickFilemapsfileSizetosize, so the existingMAX_UPLOAD_BYTEScheck (composer.tsx:163) applies to Camera and Photos too. TheCAMERA_USAGEstring is shared by theexpo-cameraandexpo-image-pickerplugins, so the two cannot write differentNSCameraUsageDescriptionvalues (app.config.ts:9-11). - Docs:
docs/mobile.mdand the acceptance recipe in.agents/skills/verify-linger/features/mobile.mddescribe the new behavior. Apart from the P2 above, the description matches the code. - Chinese text: the only real CJK in added lines is in
apps/web/src/i18n/locales/zh-CN.json, where it is allowed. The other\p{Han}hits are the·middle dot. No commit message contains CJK.
Process notes
- The branch has 3 merge commits (
77f0890b,1b5accab,2b8b7d69) and is 3 commits behindmain.maintakes only rebase merges, so rebase ontomaininstead of merging it in.
CI
All 16 checks pass. CI does not run check-mobile, check-relay or check-voice-runtime: scripts/check-plan.mjs gives them no ci key, so they run only locally. I installed the mobile workspace and ran vitest run src/computer/connection.test.ts: 14/14 passed, including the three new upgrade tests. I did not run the rest of check-mobile (lint, typecheck, the other tests) or any device build.
Automated review by Claude Code
Automated review of c62b828 by Claude Code.
There was a problem hiding this comment.
Approve with nits (0 new findings; 1 previous P2 not resolved)
Scope: follow-up on c62b828, reviewing d93a1cb against base main (merge base 4b5b426). The PR has 13 commits and 525 files; one new commit (3 files) since the previous review. Helper skills: their sections were applied from the review instructions, which name them, but the skills were not loaded separately. Ran in a separate session.
Because the PR is large (+41,890 lines), the whole-PR assumption check this time covered only the code the new commit touches and calls (composer → useTeamHub → PhoneConnection route switch → TeamHub attachment idempotency). The rest of the PR was not re-audited in this pass.
Previous findings
- P2: switching to the LAN interrupts an in-flight attachment upload. Not resolved. The new retry at
apps/mobile/src/chat/composer.tsx:173-189cannot succeed in the case it targets.sendcallsteamHub.run, andteamHubis theuseMemoobject the component captured whenattachstarted.useTeamHub(apps/mobile/src/state/queries.tsx:94-111) closes over thesessionvalue from that render. When the route switches,PhoneConnectionaccepts a new session object and closes the old one (apps/mobile/src/computer/connection.ts:250-254). One second later the retry calls the same stalerun, seessession.closed === trueand rejects withNotConnected. The upload is still dropped with "did not upload. Try again." Fix: makesendread the current session, for exampleconst latest = useRef(teamHub); latest.current = teamHub;andsend = () => latest.current.run(...). Add a unit test where the first call fails withSessionClosedand the retry must use a different session object. The server side is ready:UploadMessageAttachmentreplays by the same idempotency key (apps/teamhub/internal/collaboration/message_attachments.go:114-124), so reusinglocalIdis correct once the retry reaches a live session. - P3: the folded stage duplicated the Stop button. Resolved.
StopButton(apps/mobile/src/chat/agent-stage.tsx:122-145) is now used by bothWorkLineandFoldedStage.
Findings
None new.
Verified as fine
StopButtonkeeps the original behaviour: it uses the sameuseStopRun(roomId)hook, the samestopping.has(runId)disabled state and the same accessibility label (agent-stage.tsx:122-145).WorkLineandFoldedStagestill readstoppingfor their own "Stopping…" text.- The retry is gated to transport errors only (
SessionClosed,NotConnected). HTTP errors such as 413 still surface their specific message (composer.tsx:183-197). - The retry reuses the same
localIdas theIdempotency-Key(apps/mobile/src/api/teamhub.ts:195-227). TeamHub locks and replays by that key with a request hash over name, media type, size and sha256 (message_attachments.go:105-124), so a resend of an upload that already landed produces no duplicate. docs/mobile.mdis updated for the new upload behaviour. It will become accurate once the retry above reaches the live session.- No CJK text in the added lines or commit messages. Grep matched only the
·(U+00B7) separator in UI strings, which is not Han.
Process notes
- The branch carries three merge commits from
main(2b8b7d69,1b5accab,77f0890b).maintakes only rebase merges, so the branch should followmainby rebase.
CI
All 16 checks pass on d93a1cb. No tests were run locally: the new commit has no Go or concurrency code, and the remaining issue is clear from reading the code.
Automated review by Claude Code
Automated review of d93a1cb by Claude Code.
There was a problem hiding this comment.
Approve (0 findings)
Follow-up on d93a1cb. Scope: base main, merge base 4b5b4266, 14 commits; the new commit 27618af6 (3 files) reviewed in full, plus the assumption check over the touched upload path. Helper skills: coderbook loaded; ponytail-review and karpathy-guidelines applied from their checklists. Ran in a separate session.
Previous findings
The previous review (d93a1cb) had no findings.
Findings
None.
Verified as fine
- The retry now uses the live session.
useTeamHubreturns a new memoized object wheneversessionorhostIdchanges (apps/mobile/src/state/queries.tsx:100-111), and itsruncaptures that session in a closure. Ind93a1cbthe retry called the capturedteamHub.run, which was bound to the closed session and would always reject withNotConnected. The composer now keepslatestTeamHubin a ref that an effect updates (apps/mobile/src/chat/composer.tsx:124-127), andsendreads the ref on each attempt (composer.tsx:181-191), so the second attempt runs on the session that is open at that moment. - Host guard. The retry rejects if
hostIdchanged between the first attempt and the retry (composer.tsx:182-183), so an upload never goes to a different computer. Thecatchinattachturns that rejection into the generic "did not upload" message and removes the pending file (composer.tsx:205-211). - Idempotency. Both attempts reuse the same
localIdas the idempotency key (composer.tsx:176,189), so a retry after a half-delivered upload is not stored twice on the computer. - Retry bounds.
sendRetryingOnceretries only errors thatsessionLostmatches, and only once (apps/mobile/src/chat/upload-retry.ts:16-22). Other errors, such as a 413HttpError, pass through unchanged.upload-retry.test.tscovers the route-move case (the second attempt lands on the new session), the case where both attempts fail, and the pass-through. That test would fail against thed93a1cbbehavior of reusing the captured session. - English only. The
\p{Han}grep matched only the U+00B7 middle dot (·) in UI strings and thezh-CN.jsoncatalog. There is no CJK text outside the translation catalogs, and no commit message contains CJK.
Not verified: what happens if the composer unmounts mid-upload. The ref then stops updating, and the retry would use the last session the composer saw. I did not try this on a device.
Process notes
- The branch has 3 merge commits from
main(2b8b7d69,1b5accab,77f0890b).mainonly takes rebase merges, which drop merge commits along with any conflict resolution in them. Please rebase ontomaininstead. 27618af6only fixes the retry introduced ind93a1cbc. Consider squashing it into that commit.- Both commit authors are linked to the
jeffrey-binGitHub account.
CI
At review time, 8 checks pass (including check (contracts), check (packages), check (desktop), check (teamhub-cli) and web tests (2/2)). 7 are still pending: check (teamhub), check (computer-go), web tests (1/2), web-static, repository-gate and others. No failures so far. Merge state is BLOCKED while the checks are pending. I did not run upload-retry.test.ts locally because apps/mobile has no installed node_modules in this worktree. Confirm that the CI plan's check-mobile target runs for this head.
Automated review by Claude Code
Automated review of 27618af by Claude Code.
# Conflicts: # apps/web/src/features/rooms/chat/voice-mode/voice-mode-mini-window.tsx
There was a problem hiding this comment.
Approve with nits (1 P3)
Scope: follow-up on 27618af. Base main, merge base 9196e8dc; reviewed head 7740fd08. Since the previous review the only new PR commit is the merge 7740fd08 of origin/main; I reviewed its conflict resolution with git show --remerge-diff (6 files: migrations renumbered 00894–00896 → 00895–00897, new 00898_mobile_preview_handoff_repair.sql, the mobilepush.go comment, and the Voice Mode mini window). Whole-PR diff: 528 files, 15 commits (4 of them merges). The helper skills (coderbook, ponytail-review, karpathy-guidelines) were not loaded for this follow-up; the review ran alone in a separate session.
Previous findings
The previous review (27618af) approved with no findings, so there is nothing to track.
Findings
P3
apps/teamhub/migrations/00898_mobile_preview_handoff_repair.sql:1: the PR description is out of date. Its Boundary section still says "Migrations:00894to00896". After the merge, the mobile migrations are00895_paired_phones,00896_voice_session_clientand00897_mobile_relay_nodes. The description also does not mention the new forward-only repair migration00898, which recreatesroom_handoffsandroom_handoff_reportson databases from the0.1.9-mobile.1preview build. Fix: update the Boundary/Migrations bullet. Add one line saying that preview-build databases are repaired by00897(IF NOT EXISTS) and00898, and that00898cannot be rolled back.
Verified as fine
- Preview-database upgrade path. A preview database recorded versions 894 (paired_phones), 895 (voice_session_client) and 896 (mobile_relay_nodes). With the new numbering, goose treats 894–896 as applied. The objects for
00895_paired_phonesand00896_voice_session_clientalready exist from the preview's 894/895.00897_mobile_relay_nodes.sql:9usesCREATE TABLE IF NOT EXISTS, and its columns are unchanged from the previous head's00896.00898then creates main's skipped00894_room_handoff_reportsobjects. I compared the two: the table and index definitions in00898(lines 7–25) match00894_room_handoff_reports.sql:2-19column for column, withIF NOT EXISTSadded. On a fresh or main database, all of these statements do nothing. - Version uniqueness: the migrations directory now lists 00893–00898 with no duplicates (
migrations_test.goTestMigrationVersionsAreUnique,check (teamhub)green).repository-gate, which runscheck-migration-history.shagainst the target tip, passed. - Stale references: the only code reference to the renumbered push trigger,
apps/teamhub/internal/mobilepush/mobilepush.go:28, now names00895.git grepfinds no other reference to0089[4-8]outside the SQL files. - Voice Mode conflict resolution:
voice-mode-mini-window.tsx:157-162,481-488keeps main'swakingandcheerprops and the PR's per-recipient avatar (voiceActorId/voiceName). It drops the PR'savatarSpinwrapper, andgit grep avatarSpinfinds no CSS left behind.roomNameis no longer destructured and is not used. - Push trigger:
00895_paired_phones.sql:51-77enqueues a job only when an approved, non-removed phone with apush_grantexists in the tenant. The job runs in the publishing transaction, and Down is forward-only. - English-only: added lines and commit messages contain no CJK ideographs. The only matches from
\p{Han}are the middle dot·(U+00B7), outside the locale catalogs.
Unverified
- Preview-build schema identity: I assumed the preview build's
mobile_relay_nodes,paired_phonesandvoice_sessions.clientare identical to this PR's. If the preview shipped a different shape, theIF NOT EXISTSin00897would keep the old one. - The rest of the 42k-line PR is unchanged since the previous review, and I did not re-read it in depth.
Process notes
- The branch contains 4 merge commits (
7740fd08,2b8b7d69,1b5accab,77f0890b).maintakes rebase merges only, and a rebase merge drops merge commits along with the conflict resolutions in them, including the Voice Mode mini window resolution and the migration renumbering above. Rebase ontomaininstead of merging it in. - The branch is up to date with
origin/main(0 commits behind).BLOCKEDreflects required review, not a stale base.
CI
Every check passes except Analyze (actions) (CodeQL for GitHub Actions). The analysis itself finished, and the job failed around uploading the results. The PR touches no file under .github/, so the failure is unrelated to this change. I ran no tests locally; the merge changes only SQL migrations and one Web component, which check (teamhub), check (web) and the web test shards cover.
Automated review by Claude Code
Automated review of 7740fd0 by Claude Code.
…ne the keyboard Replies alert once an Agent's turn ends: after 30 s, unless a later Agent message supersedes it, the Agent still works, the Human read it, or someone is looking at the Room on the Web or the phone. Decisions alert at once and are time-sensitive. Alerts collapse per Room and kind. Each phone chooses replies, decisions and alerts while active (PUT /v0/me/phone/push-preferences, migration 00899). The phone sends Room presence while a chat is on screen. Chats open with the keyboard up and the stage folds with the keyboard's own progress through react-native-keyboard-controller; the + menu draws in a window overlay, grows from the +, and more controls give haptics.
There was a problem hiding this comment.
Approve with nits (2 P2, 2 P3)
Scope: follow-up on 7740fd0, reviewing 675c7c3. Base main, merge base 9196e8dc. 16 commits and 100+ files in the whole PR. The new commit touches 38 files (push once per turn, Room presence from the phone, push preferences, keyboard controller, attach menu). I read the incremental diff in full and rechecked the whole PR's push path. Helper skills (coderbook, ponytail-review, karpathy-guidelines) were not loaded; I followed the review checklist directly. Ran in a separate session.
Previous findings
- Not resolved: PR description's migration numbers are stale. The Boundary section still says
00894to00896. The PR now adds00895–00899: the repair migration00898and the new00899_paired_phone_push_preferences.sql.
Findings
P2
-
apps/teamhub/internal/mobilepush/mobilepush.go:170: a decision alert goes to every Human's phone in the Space, not only the decider's.GetMobilePushMessage.asks_decision(paired_phone.sql:116-120) is true when any Human has a pending decision on the Message.ListPushTargetsForRoomreturns the phones of every Human in the tenant, and the query is not filtered by Room membership.ClassifyreturnsKindDecisionfor every target that hasPushDecisionson, without comparing against the decider. The reply branches do compare (DirectHumanActorID/MentionedActorIdsvstarget.HumanActorID). So when Human A gets a decision card in a Space shared with Human B, B's phone shows "Linger needs your decision". The alert carries theroom_idof a Room B may not be able to open. Fix: selectarray_agg(d.decider_actor_id)(pending, human) and haveClassifyrequireslices.Contains(deciders, target.HumanActorID). Add a case toTestClassify. -
apps/teamhub/internal/store/queries/paired_phone.sql:127andapps/teamhub/internal/app/app.go:797: in a group Room, other actors can suppress a mention alert meant for this Human. Two checks cause this:supersededis true when any later Agent conversation message exists in the Room. If Agent A @-mentions the Human and Agent B posts something unrelated withinReplyDelay, A's job is skipped. B's message doesn't mention the Human, so no alert is ever sent.recentlyPresent(roomID)is true when any Account sent presence (handlers_room_presence.go:28-40). Another Human looking at the group therefore holds back this Human's alerts.
The contract text (
teamhub-public-mobile-phones.yaml, "while the Human looks at the Room") and theapp.gocomment both describe the Human's own presence. Fix:- Scope supersession to later messages that would also alert this target: the same direct agent, or one that mentions the Human. Alternatively, only treat a message as superseded in direct chats.
- Check presence by
accountID + "\x00" + roomID, which the throttle already keys on. This needs the target'saccount_idinListPushTargetsForRoom.
P3
-
apps/mobile/src/app/(main)/settings/index.tsx:419: when saving preferences fails, the switch shows one value and the stored record holds another.setPushPreferences(push/push.ts:132) writespreferences: next, preferencesPending: truebefore the PUT. If the PUT throws, the UI reverts the switch topreviousand says "did not reach your computer". The record still holdsnextwithpreferencesPending, sosyncPushGrantsends it on the next session. The user believed the change failed, but it gets applied later. Either keep the optimistic value and show "will be sent when connected", or restore the record on failure. -
apps/teamhub/internal/store/queries/paired_phone.sql:130:run_activecountsqueuedruns and runs that already replied. The existingListRunningRoomIDsForTenantAccount(room_run_control.sql:1-17) deliberately usesstatus='running' AND NOT agent_local_run_replied(run_id), because "a queued Run may wait indefinitely for an offline Computer". With the new condition, a queued Run of another Agent on an offline computer holds a reply alert for the fullRunGrace(10 min). Reuse the same predicate.
Verified as fine
- River snooze loop: a reply snoozes until
ReplyDelayand then rechecks every 30 s while a run is active, bounded byRunGrace(mobilepush.go:119-131). Facts are re-read on each attempt, so read state and supersession stay current. PUT /v0/me/phone/push-preferencesis phone-only viacallingPhone. The integration test checks a 403 for a browser session (mobile_phones_test.go:516). Unknown or removed phones map toErrUnknownPhone(pairedphone.go:391).- The phone's
POST /v0/rooms/:/presencegoes through the sameAuthorizedRoomcheck as the Web (handlers_room_presence.go:76-80). The allowlist entry uses the existing:segment form (allowlist.go:134). - Migration
00899adds NOT NULL columns with defaults. The defaults matchDEFAULT_PUSH_PREFERENCES(push/grant.ts). ThePhonePushPreferencescontract and generated Go/TS types are consistent. disablePushnow clearsgrantedAt/expoToken, so re-enabling push forces a fresh grant.updatePushRecordkeeps preferences across other writes, whichgrant.test.tscovers.- Relay push payload:
collapseId/tag=kind:room_id,threadId= room.push_test.goasserts this.docs/mobile.mdis updated to match. - No CJK in added lines or commit messages.
Process notes
- The branch contains 4 merge commits (
7740fd08,2b8b7d69,1b5accab,77f0890b).maintakes rebase merges only, so rebase ontomaininstead. The branch is not behindorigin/main. 675c7c34bundles the push rework with the keyboard-controller and attach-menu changes. These would read better as separate commits.
CI
8 checks pass and 7 are still pending (teamhub, computer-go, contracts, desktop, installer, packages, web tests). None failed. I ran no tests myself.
Automated review by Claude Code
Automated review of 675c7c3 by Claude Code.
There was a problem hiding this comment.
Approve with nits (0 new findings; 4 previous P2/P3 findings still open)
Scope: follow-up on 675c7c3, reviewing head 975b774 against main (merge base 9196e8d, the current origin/main). 17 commits in the PR. The new range is 1 commit and 3 files: apps/mobile/app.config.ts, apps/relay/internal/push/push.go, docs/mobile.md. The coderbook skill was loaded. The ponytail-review and karpathy-guidelines skills were not loaded for this small delta. This review ran in a separate session.
Coverage limit: the PR adds about 42.7k lines. This pass reviewed the full new delta. It did not re-audit the whole merge-base diff line by line; it relied on the previous review for that.
Previous findings
- P2: decision push is not limited to the decider (
apps/teamhub/internal/mobilepush/mobilepush.go:170). Not resolved.Classifyis unchanged and still sendsKindDecisionto every target withPushDecisionsset, without comparing against the deciding Human. - P2: in a group, another participant's activity can suppress a mention alert (
apps/teamhub/internal/store/queries/paired_phone.sql:120-127). Not resolved. Thesupersededsubquery is unchanged. - P3: when saving preferences fails, the UI and the local record disagree (
apps/mobile/src/app/(main)/settings/index.tsx:419). Not resolved. Thecatchstill rolls back only the React state throughsetPreferences(previous). - P3:
run_activecounts queued Runs and Runs that already replied (apps/teamhub/internal/store/queries/paired_phone.sql:130). Not resolved. The query still usesrun.status IN ('queued', 'running').
Findings
No new findings.
Verified as fine
- Entitlement removal.
apps/mobile/app.config.tsdropscom.apple.developer.usernotifications.time-sensitive, which the provisioning profile lacks, so the iOS build no longer fails on a profile mismatch. - Relay request unchanged. The Relay still sends
interruptionLevel: "time-sensitive"for decisions (apps/relay/internal/push/push.go:218and thealertsmap atpush.go:51-53). Only the comment changed. - Docs aligned.
docs/mobile.md:366-367now states the same behavior as the code comment. - Unverified (Apple platform behavior). The new comment and docs say iOS delivers a
time-sensitiverequest asactivewhen the app lacks the entitlement. I could not confirm this from code. If Apple's behavior is different, decision alerts would still arrive but would not break through Focus. That loss is already the intended effect of removing the entitlement, and nothing else in the app depends on it. - No Chinese. Added lines and commit messages contain no CJK characters.
- Commit author.
975b774is authored byjeffrey@simplexai.com, which is linked to GitHub userjeffrey-bin.
Process notes
- The PR contains 4 merge commits from
main(7740fd0,2b8b7d6,1b5acca,77f0890).maintakes only rebase merges, which drop merge commits along with any conflict resolution in them, so followmainby rebase instead. - The branch is up to date with
main; its merge base is the currentorigin/main. Merge state is BLOCKED, pending required review.
CI
All 16 checks pass. I ran no tests myself; the delta is one config removal plus a comment and a doc change.
Automated review by Claude Code
Automated review of 975b774 by Claude Code.
…'s own presence A decision alert goes only to the phones of the Human it asks. Only a later reply in a direct chat supersedes one; in a group another Agent's message no longer swallows a mention. Presence counts only the phone's own Account, and the running light matches the Room's: running and not yet replied. A preference change that cannot reach the computer stays on the phone and is sent later.
There was a problem hiding this comment.
Approve (0 P0, 0 P1, 0 P2, 0 P3)
Scope: follow-up on 975b774, reviewing head 5231ef2 against main (merge base 9196e8d), 18 commits. I read the new commit 5231ef2 in full (9 files) and re-checked the push assumptions it depends on across the PR. The coderbook, ponytail-review and karpathy-guidelines conventions were applied from the review skill. Ran in a separate session. This pass did not re-read all 42k lines of the PR line by line. It covered the delta and the push, presence and decision paths the delta changes.
Previous findings
The previous review (975b774, approve with nits) had no findings to track.
Findings
None.
Verified as fine
- The decision alert goes only to the decider.
GetMobilePushMessagenow returnsdecider_actor_ids, which aggregates the pending decisions' human deciders (apps/teamhub/internal/store/queries/paired_phone.sql:116-120).ClassifysendsKindDecisiononly whentarget.HumanActorIDis among them (apps/teamhub/internal/mobilepush/mobilepush.go:169-175). This matters becauseListPushTargetsForRoomreturns every paired phone of every Human in the tenant, not just Room members (paired_phone.sql:92-100). Before this commit, any Space member with decisions turned on got the alert. A newTestClassifycase, "another Human's decision", covers it.AsksDecisionhas no remaining references. - Presence is counted per Account.
presentForreads the sameaccountID + "\x00" + roomIDkey thatnotifyRoomPresenceadmits (apps/teamhub/internal/app/handlers_room_presence.go:45-50,:93-94). A throttled repeat hint leaves the earlier timestamp in place, and that timestamp is still inside the 30s window (interval 15s < window 30s). The worker checks presence per target and only when!PushWhenActive(mobilepush.go:139-141).NewWorkerhas one caller (app.go:791), and its nil default was updated.recentlyPresentis still used byhandlers_membership.go:111, so it isn't dead code.TestRoomPresenceIsPerAccountcovers the other-Account case and the window expiry. run_activenow matches the Room's running light. The new predicatestatus = 'running' AND NOT agent_local_run_replied(run_id)overroom_agent_runsis the same one thatListRunningRoomIDsForTenantAccountuses (room_run_control.sql:1-9).agent_local_run_replied(migrations/00852_baseline.sql:517-560) treats an output withcontinues=true, a later or still-open activity, and a newer input as not replied. So a multi-message turn still holds back the earlier replies until the final one.- Supersession is limited to direct chats.
r.direct_human_actor_id IS NOT NULL AND EXISTS(...)(paired_phone.sql:121-129) means another Agent's message in a group no longer swallows a mention. The column is nullable (it iscoalesced to''above), so the NULL check is correct. - The offline preference is resent.
setPushPreferenceswritespreferencesPending: truebefore the network call (apps/mobile/src/push/push.ts:130-137).syncPushGrantresends pending preferences on the next session and then clears the flag (push.ts:86-95). It runs frompush-sync.tsx:54and from pairing. So the new message "Saved on this phone. Your computer gets it when it connects." matches what the code does, and dropping the rollback insettings/index.tsxis correct. - Docs.
docs/mobile.md(Push section) was updated to match all four behavior changes. - Generated store code.
paired_phone.sql.gomatches the query edits (the newaccount_idcolumn and the[]stringscan). - No CJK. No CJK was found in code, comments or commit messages. The only hits are in
apps/web/src/i18n/locales/zh-CN.json, which is allowed, plus false positives on·from grep.
Process notes
- The branch has 4 merge commits from
main(7740fd08,2b8b7d69,1b5accab,77f0890b).maintakes rebase merges only, so these merge commits and any conflict resolutions in them would be dropped. Rebase ontomaininstead. - The branch is 12 commits behind
origin/main, andmainrequires up-to-date branches, so it needs a rebase before it can merge. - All commit authors are linked to GitHub accounts.
CI
All checks except changes were still pending when this review ran; changes passed. I ran no tests myself: the delta is covered by the unit tests it adds (TestClassify, TestRoomPresenceIsPerAccount), and I found nothing that needed a local run to confirm.
Automated review by Claude Code
Automated review of 5231ef2 by Claude Code.
There was a problem hiding this comment.
Approve (0 P0, 0 P1, 0 P2, 0 P3)
Scope: follow-up on 5231ef2 at head 2daf8e0. Base main, merge-base 18b77437. Reviewed 20 commits and 534 files in the merge-base diff, and the 2 commits added since the previous review (6e74ab96 merges origin/main, 2daf8e04 is a one-line test fix). Loaded coderbook. ponytail-review and karpathy-guidelines were not loaded, but their checks were applied from the review checklist. This review ran in a separate session.
Previous findings
The previous review (5231ef2) had no findings.
Findings
None.
Verified as fine
- No PR change rode along in the merge. I compared the PR's own diff before the merge (
merge-base..5231ef2) with its diff after (merge-base..2daf8e0). The only difference ismountUpgrade: () => () => {}inapps/node-services/tests/agent/executor/http/agent-manager-http-server.test.ts:1069. The merge resolved no conflicts inside PR code. - The test fix matches the real interface.
HttpHost.mountUpgrade(path, handler): () => voidis declared atapps/node-services/src/http-host.ts:45. The new fake returns a no-op unmount, the same shape as the other fakes inapps/node-services/tests/model-packages.test.ts:331. - Main's changes don't conflict with the mobile code.
- Main added an optional
detailto the runtime failure schema (contracts/openapi/components/agent-runtime-state.yaml) and a pendingtarget. apps/mobiledoes not parse these schemas strictly: there are no.strict()or runtime-failure parsers underapps/mobile.- Main's new Another Me failure-dismiss route is Web-only. The mobile route allowlist is enforced in
apps/teamhub/internal/mobilegateway, and a route outside it never reaches TeamHub (session_test.go:330).
- Main added an optional
- Migrations still run in order.
- After the merge, main adds no migrations. The PR's
00895–00899follow main's00894_room_handoff_reports. 00898_mobile_preview_handoff_repair.sqlmatches00894_room_handoff_reports.sqlcolumn for column and index for index, usingIF NOT EXISTS. It is a no-op on databases that already ran00894.00899only adds columns with defaults.
- After the merge, main adds no migrations. The PR's
- No CJK in added lines or commit messages. The only matches outside the locale catalogs are the
·(U+00B7) separators in mobile UI strings. These are not Han ideographs.
Process notes
- The branch contains 5 merge commits from
main(6e74ab96,7740fd08,2b8b7d69,1b5accab,77f0890b).maintakes only rebase merges, which drop merge commits, so followmainby rebasing instead. - The merge state is BLOCKED while CI runs.
CI
CodeQL, Analyze (actions) and changes pass. All other checks (teamhub, packages, contracts, desktop, installer, computer-go, computer-go-windows, teamhub-cli, web tests, web-static, repository-gate) were still pending when this review ran. I ran no tests myself, because the only new PR change is a one-line test fake.
Automated review by Claude Code
Automated review of 2daf8e0 by Claude Code.
What and why
Adds the Linger Mobile App (
apps/mobile, React Native + Expo): a phone client for the user's own computer. The phone has no account of its own. It pairs with a computer and then reaches it end to end encrypted, over the local network or through Relay nodes that only forward ciphertext./v0/mobile/relays), push delivery through the Push Service, and the Mobile API allowlist.apps/relay): host control links, splices, spare data sockets, and the Push Service.docs/mobile.mdspecifies the protocol..agents/skills/verify-linger/features/mobile.mdadds the app's acceptance recipes.An adversarial review hardened both sides, for example:
How it was verified
make check BASE=origin/main. One unrelated failure remains locally:scripts/ci/desktop-release.test.tsunder macOS's bash 3.2. This branch does not touch that script.features/mobile.mdagainst a Desktop running this branch: pairing, routes and pinned nodes, Relay node refusals, messaging, offline outbox across a computer restart, Agent sheet, Library, meeting recording, Live entries, diagnostics, and removal. Push, QR scanning, a second computer and attachments need hardware and were not run.Boundary
docs/mobile.md,apps/teamhub/AGENTS.md,apps/voice-runtime/AGENTS.md, the OpenAPI contracts and.env.exampleare updated.00895to00897add the mobile tables and avoice_sessions.clientcolumn with a default. A trigger enqueues push jobs only for phones that hold a grant.00898is a forward-only repair for databases of the mobile preview desktop build, which recorded its migrations as00894–00896and so never ran main's00894_room_handoff_reports. It creates those tables and indexes if missing and changes nothing elsewhere.00897is idempotent for the same reason.00899adds each phone's push preferences (push_replies,push_decisions,push_when_active).TEAMHUB_MOBILE_RELAY_URL(an extra node; empty turns Relay links off) andTEAMHUB_MOBILE_PUSH_SERVICE_URL. Both have code defaults.relaykeep working, and an explicitly emptyrelaysmeans every node is off.