Repository navigation
perf(accounts): avoid materializing avatars for owner checks - #147032
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 9:22 AM ET / 13:22 UTC (Revision 2). ClawSweeper reviewWhat this changesPersonal model-account checks read only profile identity and merge status instead of loading avatar bytes, with regression coverage for valid and unresolved owners. Merge readiness✅ Ready for maintainer review The optimization remains useful on current main, and no actionable patch defect was found. The related merged work does not supersede it; the maintainer-designated PR should remain open for normal landing. Priority: P2 Review scores
Verification
How this fits togetherPersonal model accounts store credentials and provider selections under a canonical user profile. Chat metadata and account operations resolve that profile before reading or changing its account records. flowchart TD
A[Chat metadata or account operation] --> B[Profile identity lookup]
B --> C[Read identity and merge status]
C --> D[Resolve existing merge target]
D --> E{Valid canonical owner?}
E -->|Yes| F[Read or update account records]
E -->|No| G[Empty result or owner error]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +4, Tests +67. Total +71 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep canonical owner resolution centralized and project only the fields account operations consume. Do we have a high-confidence way to reproduce the issue? Yes, by source inspection: main's account-owner lookup delegates to selectAll, which includes avatar bytes even though only identity and merge status are consumed. Runtime allocation and latency were not measured in this review. Is this the best way to solve the issue? Yes. Reusing the existing resolver with a narrower projection removes unnecessary materialization without introducing caches, duplicate resolution policy, or migration work. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0a7b7fecfd7f. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
* commit '0ac8a700e43efceef73d92fe8e50b185819e38ad': (27 commits) test(acpx): prove targeted turn cancellation (#137049) fix(ci): honor realtime meeting live-test opt-in (#147044) improve: reduce heartbeat enrollment work for large fleets (#147055) fix(gateway): install despite stale Linux session bus addresses (#146569) chore(i18n): refresh native locales (#147025) fix: avoid Gateway reinstalls when macOS service inspection is inconclusive (#146880) fix(pairing): QR setup rejects trusted-proxy gateways without a shared secret (#147036) fix(update): bound activation and accept slow Windows identity reads (#147019) perf(accounts): avoid materializing avatars for owner checks (#147032) improve(status): report external and ArrayBuffer memory (#141902) fix(update): preserve linked plugins during post-core sync (#147009) fix(channels): keep replies working after hot config reloads (#147001) refactor(gateway): defer worker transcript runtime loading (#143495) improve: reduce GitHub OAuth maintenance work for large agent rosters (#147021) fix(test): avoid settings lock writer startup timeouts (#147029) fix(update): correct backup guidance and cover incident regressions (#147023) refactor(gateway): share connection lifecycle across transports (#145950) refactor(telegram): share HTML text escaping (#146936) perf(build): reduce disk use in UI performance checks (#146687) refactor(memory-wiki): share freshness result construction (#146935) ... # Conflicts: # src/config/sessions/session-accessor.sqlite-reclamation-memory.test.ts
Related: #146953
What Problem This Solves
Personal model-account ownership checks materialized the entire user-profile row, including avatar bytes, although they only use the canonical ID and merge status. Repeated metadata and account reads paid that allocation cost unnecessarily.
How This Fixes It
Select only
idandmerged_intothrough the existing merge-aware profile resolver. All account readers and writers retain their current owner checks, one-hop merge behavior, and refusal of missing or unresolved owners. No cache, schema, permission, or public-contract change is involved.Evidence
Four real SQLite regressions deny access to the avatar column and exercise direct ownership, completed merges, missing merge targets, and unflattened tombstones. All four fail with the original query and pass after the change. Public link, ownership, and pinned-credential reads remain covered, as do invalid-owner write refusals.
All 91 focused owner/profile tests pass on current main. Type-aware lint, formatting, and independent review through P2 pass. The state/logging type graph and reclamation-memory runtime regression pass after integrating the canonical main fixture repair in #147028. Exact-head CI passed on
d4e435739d477552bef921a9c76d86152b657248. This change proves avoided avatar materialization, not elimination of all physical page reads or attribution of all server CPU to this lookup.