Skip to content

perf(mobile): don't refetch profiles that are already on the wire - #9447

Merged
brow merged 2 commits into
mainfrom
tomb/mobile-profile-inflight-dedupe
Nov 13, 2026
Merged

brow merged 2 commits into
mainfrom
tomb/mobile-profile-inflight-dedupe

Conversation

@brow

@brow brow commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

UserCacheNotifier.preload skipped profiles already queued but not ones already on the wire. Opening a channel preloads the same people from several places (compose bar, DM header, member list); a preload that arrives while the first batch is in flight queues those people again, and the next batch downloads their profiles a second time. On Block's Builderlab, opening one channel sent the same 77-author kind 0 request twice, 521 KB each.

A preload now leaves out profiles whose batch is in flight and waits for that batch instead. Only profiles that are neither cached, queued nor in flight start a new batch.

Validation

Added test: while a batch for a and b is on the wire, preloads for b and for b, c send one more request, for c only, and all three preloads complete once their profiles arrive. It fails without this change (the second request asks for b again). Existing user cache tests pass; full mobile test suite and flutter analyze pass.

On an iPhone 12 mini signed in to Block's Builderlab (instrumented profile build), opening two channels in a row: before this change the second channel downloaded its 77 members' profiles twice (1,019 KB of kind 0 events), and the first downloaded its 43 twice (50 KB). With it, each downloaded them once: 509 KB and 25 KB.

Regressions

None expected. A caller whose profiles are in flight now waits for that batch instead of a new one, so it resolves no later than before; a failed in-flight batch reports failure to it, as its own batch would have.

A preload that arrived while a profile batch was in flight queued the same
people again, so opening a channel could download one batch twice (521 KB on
Builderlab). Wait for the in-flight batch instead.

Signed-off-by: Tom Brow <[email protected]>
@brow

brow commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T19:10:58.258919Z 5485ab5 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: aaf63503ce

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@localhost>
Signed-off-by: Tom Brow <[email protected]>
@brow
brow marked this pull request as ready for review November 13, 2026 19:09
@brow
brow requested a review from a team as a code owner November 13, 2026 19:09
@brow
brow deployed to codex-review November 13, 2026 19:09 — with GitHub Actions Active
@github-actions github-actions Bot added the codex-security-review-current The posted Codex security review matches its recorded range. label Nov 13, 2026
@github-actions

Copy link
Copy Markdown

🔐 Codex Security Review

Note: This is an automated, security-focused review generated by Codex.
Use it as a supplement to human review; false positives are possible.

Scope

  • Exact PR diff: 59ae028a360242d43ffbfdafca8a76eda00484d9...5485ab582ce0bf46236b1a5443a10f60d4f0586c
  • Model: gpt-6.1-sol

💡 Click "edited" above to see earlier reviews for this PR.


Review Summary

Overall Risk: NONE

No concrete issues found in the authorized PR range after tracing request deduplication, completion handling, profile validation, and community changes.

Findings

No concrete security, correctness, or reliability findings were identified.

Notes

  • Review used read-only source inspection. Builds and tests were not executed, as requested.

Generated by Codex Security Review |
Requested by: @brow |
Workflow run

@kazemek21 kazemek21 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Kyle reviewed this PR and the Nexus review-tracker notes and approved with no comments.

Posted by Codex (gpt-6.1-sol) on behalf of kylez

@brow
brow merged commit a540e7b into main Nov 13, 2026
60 checks passed
@brow
brow deleted the tomb/mobile-profile-inflight-dedupe branch November 13, 2026 21:39

This branch was successfully deployed

1 active deployment
codex-review — 5485ab58 Deployed Nov 13, 2026 by brow via Run Codex Security Review #15014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex-security-review-current The posted Codex security review matches its recorded range.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants