Skip to content

perf(profiles): prepare disclosure through the profile reader - #166283

Merged
steipete merged 21 commits into
mainfrom
dbasync/w6profile
Oct 7, 2026
Merged

steipete merged 21 commits into
mainfrom
dbasync/w6profile

Conversation

@steipete

@steipete steipete commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Self-profile disclosure, project recents, and cookie/media policy checks queried SQLite on the Gateway thread. Session projection startup also hydrated the profile catalog natively before preparing it through the reader.

User Impact

This internal performance and ownership change preserves RPC shapes, schemas, stored bytes, permissions, FIFO writes, and accepted-write settlement. It adds no service, cache, dependency, or new OPENCLAW_* name.

Why This Change Was Made

users.self reuses identity and GitHub facts from its existing authority snapshot. Project recents prepare exact aliases through the read worker, preserve next-request foreign-commit visibility, and recheck current authority after awaited work. The resident profile catalog hydrates off-thread and remains retained through projection and HTTP response lifetimes; warm catalog reads use memory.

Catalog replacement moves every alias to the replacement together and revokes old prepared identities. Cookie, asset, and media-ticket paths retain canonical profile resolution and current plugin access checks. The generic Gateway catalog hydration and person-reference SQL fallbacks are removed.

Worker participant writes now resolve profile aliases only after an exact participant miss. The native adapter still prepares aliases before its agent transaction. Exact-first selection, alias ordering, participant limits, rollback and publication remain intact.

Session metadata patches previously invalidated an active trajectory-retention sweep through the connection-wide mutation counter. Their receipt now advances only the committed counter, reusing the sweep's prepared run summaries because metadata upserts do not change trajectory rows. The freshness probe, lease and connection checks, deferred publication, rollback behavior and retention policy remain unchanged. Actual trajectory appends and trims still publish refreshed session summaries.

Evidence

Current head f6b8cefbd66552ed0b824557d2f0c2f5d6de131f, tree ce61d633d528fc59a23744bf76accd315bcfd80b. It is a test-only descendant of production head 85e08d2d83442fac07b8cfedb7b450370622d7d3, which integrates main c6698b1e9b2b4adc9e0c2b0ee10439fe9936b693 with a merge commit. Full production P2 review and the extraction review are clean. Final SQL and SDK qualification pass. Exact-current-head CI, ClawSweeper and the corrected 21-file integration run are complete. No merge or auto-merge request has been submitted.

Exact-head CI is green: 108 successful checks, 61 skipped, one neutral and three successful status contexts, including the enforced CI gate. No CI rerun or admin exception was used for this head. All task-owned cloud leases are released.

The metadata receipt covers both callback patches and main's fixed-operation reductions. The negative control retaining callback-only capture failed exactly the reducer commit/replacement cases on retention completion, while the four original controls passed. Both final test files pass all 26 cases in 245.69 seconds including cold worker compilation; the session-test type graph passes in 13.41 seconds. The six moved retention cases are unchanged. Their extraction fixes the integrated test's 1,071-line failure against its 1,000-line cap; line and mock-export guards pass without exemptions. No assertions, timeouts, sleeps or retries were weakened.

The selected 21-file run covers both patch files, retention, turn/source publication, maintenance, deferred plugin refresh, placement and import/build boundaries, plus core/core-test/test-root types, Madge, focused lint and structural guards. All 21 files passed on f6 in 519.65 combined runtime command seconds. Core production types passed in 16.84 seconds, core-test types in 390.02 seconds, test-root types in 63.38 seconds and Madge in 18.20 seconds (zero cycles); focused lint/format and every structural guard passed. The complete focused proof took 1092.54 seconds, with no failed command or rerun. Exact head/tree/parents/base, source cleanliness, sealed inputs and all unique passing paths were independently verified. Archive SHA256: 70d17e4fb966282def90ac4f295ca19010393ca3c940ccc75b6bdb76259643c3. The completed 72-file e599 run remains evidence for unchanged contracts (1463.32 combined command seconds, full changed/types 1378.39 seconds, Madge 18.25 seconds). Its captured source/base/parents and all distinct passing file paths were independently verified. Prior archive SHA256: 23d3e5024509dbd377189b12ec908b40b6055cc6fec2af6111af55b9a830e776.

A separate integrated projection line-cap failure was repaired by f8388333eefe with an equivalent type reference; the emitted JavaScript was byte-identical. Metadata repair a77bcdee624eb removed repeated trajectory aggregates. Main's phase-local reducer integration is 85e08d2d8344; the test-only cap repair is f6b8cefbd665.

Final SQL qualification and measured-source reuse

The final measured flows satisfy the coordinator rules. Measurements compare main c6698b1e9b2b4adc9e0c2b0ee10439fe9936b693 with production head 85e08d2d83442fac07b8cfedb7b450370622d7d3, using three alternating main/candidate pairs for full and focused workloads. All 12 workloads completed; independent inspection matched native/census sequence, site, phase and worker identity and conserved exact phase/thread/SQL totals. Zero native SQL calls failed. Node 24.21.0 / SQLite 3.53.4 / pnpm 12.5.1 match. Archive SHA256: cdc356fa5ef1bb9618beb92695a3356666c2d93f8b7ddd8d6c73a6eca175befa.

The landing head f6b8cefbd66552ed0b824557d2f0c2f5d6de131f is a direct test-only descendant. Its exact diff changes only session-entry-patch.test.ts, adds session-entry-patch.retention.test.ts, and adds session-entry-patch.test-support.ts. The helper has exactly two static consumers, both those tests. Excluding exactly these three paths, all 52,764 tracked tree entries have identical modes/blob IDs and manifest SHA256 50c1fc4dd4f01cf996fdbed6f0819c3fc48bb47b78a6f7c9cb44312d7db33073. There are no runtime, dependency, build configuration or workload changes. Raw results remain labeled 85e; reuse for f6 rests on this source identity proof, not relabeling or an unperformed rerun.

Flow/window Main across pairs Candidate across pairs Median change Candidate/main duration ratio
First turn 4473, 4478, 4479 4472, 4473, 4476 -5.0 1.002067
Warmed statements/turn 1530.8, 1532.3, 1532.1 1529.6, 1529.3, 1529.6 -2.5 1.001424
Second session 5274, 5241, 5260 5261, 5258, 5265 +1.0 1.012325
Control plane 45, 45, 45 45, 50, 52 +5.0 1.000922
users.self, statements/request 15.0, 15.0, 15.0 10.0, 10.0, 10.0 -5.0 0.836538
projects.list, statements/request 20.0, 20.0, 20.0 17.0, 17.0, 17.0 -3.0 1.127660
Populated cold boot 1872, 1871, 1871 1868, 1868, 1868 -3.0 1.004170
Focused connect 247, 246, 245 248, 245, 247 +1.0 0.998270

First/warmed medians improve; the 0.5% turn-noise exception is unnecessary. The positive non-turn windows (+1 second-session, +5 control-plane, +1 focused-connect) fit the absolute tolerance and have the owner attribution below. All other aggregate full-flow medians are flat or lower. The complete users.self/projects.list flow comprises ten requests; individual slices can contain periodic work and are retained without substituting a favorable slice.

Every positive warmed command group: totals below cover all 30 turns; group medians are diagnostic and are not added to construct a flow median.

Command Total SQL main→candidate Requests main→candidate Owner/sender and cause PR touch assessment Sample worker / request / SQL UTC
session-exact-entries 6642→6657 (+15) 1290→1290 readExactSessionEntriesWithLifecycle / hasOpenClawAgentReadOnlySchema; sender session initialization and existing Gateway session readers. Existing schema/user-version/metadata checks; 1290 requests unchanged. All positive native/sender files byte-identical. 8785/9; 8785:9:task-worker:155; 2026-10-07 21:08:36.769
audit.writer.process 780→782 (+2) 60→60 src/audit/audit-event-writer.ts → audit-event-writer.worker.ts. Existing audit writer schema admission; request count unchanged. All positive native/sender files byte-identical. 13531/5; 13531:5:sqlite-broker:625; 2026-10-07 21:16:15.243
pluginState.entries 20→24 (+4) 10→12 notifyPendingPairingRequests (extensions/device-pair/notify.ts) → plugin-state worker entries. Concrete scheduled device-pair notifier; two additional entry reads fall in warmed windows. Scheduler, sender and native files byte-identical. 8785/5; 8785:5:sqlite-broker:507; 2026-10-07 21:08:46.161
workers.placementProjection 1176→1179 (+3) 360→360 runRead / dispatchQueuedReads in session-row-placement-projection.ts → placement store reader. Existing placement reader revalidation; 360 requests unchanged. Executed sender/kernel unchanged. Generic shared-reader file differs only in unrelated profile dispatch. 8785/8; 8785:8:task-worker:291; 2026-10-07 21:08:45.488
sessionRows.sharedFacts 549→551 (+2) 325→324 withSessionRowDatabaseFacts / readExactBatch → readSharedFacts / ACP reader. Existing refresh facts/cache checks; total requests decrease 325→324. Executed refresh and ACP functions unchanged. Generic shared-reader file differs only in unrelated profile dispatch. 8785/7; 8785:7:task-worker:127; 2026-10-07 21:08:37.043
acpSessions.metadata 64→72 (+8) 60→60 chat-send-admission.ts → session-meta-readonly.ts → readAcpSessionCommand. Existing ACP/schema admission; 60 requests unchanged. Sender and ACP kernel unchanged; generic shared-reader profile edits are unrelated. 8785/7; 8785:7:task-worker:142; 2026-10-07 21:08:38.689
devicePairing.list 210→216 (+6) 35→36 Scheduled notifyPendingPairingRequests → device-pairing reader. One additional scheduled notifier read falls within warmed windows. Scheduler, notifier and executed pairing branch unchanged; generic shared-reader profile edits are unrelated. 8785/7; 8785:7:task-worker:294; 2026-10-07 21:08:46.160
session-entry-read 1882→1886 (+4) 240→240 readSessionEntryWorkerRequest → resolveSessionEntry; senders include reply session baseline and local-turn preparation. Existing private-entry schema/participant cache checks; 240 requests unchanged. All positive native/sender files byte-identical. 8785/9; 8785:9:task-worker:166; 2026-10-07 21:08:36.894
auth-profile-rows 928→936 (+8) 90→90 readAuthProfileRowsReadOnly / sqlite-json.ts through readonly helper process. Existing helper connection/schema/WAL checks; 90 requests unchanged. All retained positive native/sender files byte-identical; no payload values logged. 8937/0; process:8937:7; 2026-10-07 21:08:36.978

The pairing rows have observed scheduler capture→send→receive→SQL links to the device-pair notifier, not a background label inferred from table names or thread IDs. Other rows use their retained request/native stacks. Every source file in every positive warmed group was Git-blob-compared at the exact main/85e pins; the only changed file is the shared reader in the explicitly marked rows, whose relevant dispatch branches are unchanged. There are no positive warmed SQL groups with missing-send or unbound provenance. Profile catalog preparation occurs once/run during boot on both sides; no warmed profile catalog/alias/authority requests occur. New readiness checks are memory-only; the catalog-hydration path requires a catalog request, absent in these windows.

Positive non-turn windows and other important offsets:

Window / group Exact census and added work Ownership / PR touch
Control plane +5 median mentions.mutate: SQL [7,7,7]→[7,9,11], requests 1/run unchanged; schema/user-version checks. mentions.snapshot: SQL [10,10,10]→[10,13,13], requests 2/run unchanged; schema/user-version/schema-metadata checks. Existing commitMentionChanges / readMentionSnapshot → mention-inbox worker/synchronization functions are unchanged. Only generic shared-reader profile dispatch differs; the mention branch is unchanged.
Second-session +1 median: placement/shared facts Placement requests 39/run→40/run; SQL [123,123,126]→[131,131,131]. Shared-facts requests [36,34,36]→[36,36,36], SQL [78,75,85]→[82,82,78]. Existing session-row-placement-projection queued reads and withSessionRowDatabaseFacts refresh functions. Generic reader file has unrelated profile edits; these execution branches and sender functions are unchanged. No added profile hydration command.
Second-session snapshot/cache groups Prepare 26 / commit 32 requests per run on both sides. Prepare SQL [84,84,86]→[86,86,84]; commit SQL [509,506,509]→[509,509,509]. Existing exact-row/participant/main-key cache reads vary. The module and enclosing commitSessionEntryPatch are PR-touched. The executing readSessionEntryPatchSnapshot function is byte-identical, as are its lower readers. No retention-capture or trajectory-aggregate SQL is observed in this phase. Source has a zero-SQL guard path when no current sweep exists; the trace does not directly observe WeakMap state.
Second-session other read/cache variation Exact-entry 113 requests/run, entry-read 23/run, metadata append 17/run unchanged. Added exact-entry/cache/participant reads are offset by private-reader, maintenance, participant-alias and notification work. Existing executed reader/publication functions unchanged; full per-command arrays and SQL groups retained.
Second-session host session lookup Two existing native groups (data-version and exact entry) occur in two of three baseline runs and all three candidate runs. Complete native chain is resolveSessionKeyForRequestInternal → prepareAgentCommandExecution → agentCommandFromGatewayIngress → chat-send-commentary-media. All retained native files unchanged. This is explicitly unbound host SQL, with native stack/time evidence and no worker request ID; it is not relabeled background. Its median count is unchanged.
Focused connect +1 median One boot-issued prepared-model-catalog request crosses the phase boundary. Total catalog SQL is 18 per focused run and 30 per full run on both sides. prepareWorkerGeneration / PreparedModelRuntimeBuildResources.load / acquireAgentRuntimePluginRegistry unchanged. Phase placement, not added profile catalog work.
users.self slice 07 increase Scheduled pending delivery recovery falls inside the candidate slice. Total sessionDelivery.list SQL is 10/run on both sides; complete users.self flow 15→10 statements/request. Scheduler capture links startPendingSessionDeliveryRuntime to restart-continuation delivery recovery; all relevant owner/sender/native files unchanged.

The repaired retention receipt executes eight freshness reads and zero trajectory aggregates during the first turn of every final pair. Main starts/reads/deletes retention twice; candidate once. Combined retention-owned first-turn SQL is 48→43 in every pair. The reducer route captures for operation-or-next inputs and publishes only after an actual write; this preserves correctness without restoring aggregate reads. No receipt SQL is observed in warmed or second-session windows.

Non-turn trace samples:

Group Worker pid/thread Request key SQL timestamp UTC
04.second-session / session.entry.patch.prepare 8785/13 8785:13:sqlite-broker:890 2026-10-07 21:08:56.620
04.second-session / session.entry.patch.commit 8785/13 8785:13:sqlite-broker:934 2026-10-07 21:08:57.238
04.second-session / sessionRows.sharedFacts 8785/7 8785:7:task-worker:496 2026-10-07 21:08:56.330
04.second-session / workers.placementProjection 8785/7 8785:7:task-worker:502 2026-10-07 21:08:56.466
05.control-plane / mentions.mutate 11206/5 11206:5:sqlite-broker:1108 2026-10-07 21:12:41.145
05.control-plane / mentions.snapshot 11206/7 11206:7:task-worker:608 2026-10-07 21:12:41.136
03.users-self-07 / sessionDelivery.list 10282/6 10282:6:sqlite-broker:45 2026-10-07 21:10:27.879
01.connect / catalog 10282/9 10282:9:task-worker:1 2026-10-07 21:10:27.759

Raw audits retain all full source stacks, sender/receiver timestamps, monotonic times, request IDs and scheduler capture IDs. Line positions are advisory because of the existing source-map warning; owner assessments also use function symbols, command branches and pinned source/blob comparisons. Missing and unbound observations remain explicit rather than globally labeled background. Row payloads were intentionally not logged, so the exact row identity behind each cache miss cannot be reconstructed; the executed owner/operation and request census are recorded.

Historical +173 non-alias statements were attributed by receiver to row facts +62, state leases +46, target inventory +29, shared reader +25, plugin metadata +12, private entry +8, maintenance/activity −9. That nonalternating series lacked event clocks and sender census. Its exact initiating requests cannot be recovered; new worker IDs/timestamps are not retroactively attached to old events. Qualification uses the final alternating 85e / c669 series, then the separately proved test-only identity from 85e to f6.

Historical block-ordered receiver attribution
Old added group SQL delta over 30 warmed turns Receiver owner / retained stack PR touched?
Session row facts +62 Agent read-only scope → session row-facts reader / participant projection Receiver unchanged; upstream projection file changed
State leases +46 Shared-state worker → lease acquire/release, including open/ownership envelope Retained receiver stack unchanged; old initiating caller absent
Session target inventory +29 Agent read-only scope → readSessionStoreTargetInventory Receiver unchanged; upstream topology file changed
Shared-state reader +25 Shared reader → ACP/shared-facts reads and admission checks File changed in profile dispatch; observed ACP/envelope branches unchanged
Plugin metadata +12 Shared-state worker → plugin metadata row reader Retained receiver stack unchanged; old initiating caller absent
Session entry reads +8 Session entry worker → entry/participant reads Receiver unchanged; old initiating caller absent
Maintenance/activity offsets −9 Existing agent maintenance and activity readers Differing receiver stacks unchanged
Other worker total +173

Released SDK compatibility

The local c669→85e SDK report passed in 809.42 seconds, with zero direct SDK signature/kind changes, zero entrypoint changes and 130 compatible reachable-only exports. All five declaration differences match the already audited optional profile-authority fields, internal participant/retention helpers and equivalent projection types. Digest a1b5215102060de63a0d96091ab6c72872b7fda2d51723c42073bf3b93ce6dd5 (acknowledgement a1b52151). Stable v2026.9.8 and beta v2026.10.1-beta.1 were checked; existing released signatures remain compatible.

Reuse for f6 was separately verified from the exact three-file test diff. The new helper has only two test consumers, no ambient/global declarations, and is outside the SDK's explicit source and declaration roots. All runtime, SDK inventory/configuration, tooling and dependency bytes are unchanged. Broader namespace/configuration admission fingerprints observe the added paths; this is semantic SDK-input equivalence, not identical admission receipts or an unperformed f6 SDK run. Original report identity is preserved. All SDK temporary worktrees are removed.

Retained compatibility, CI history and overlap

Released synchronous coding-tool creation, Mention Inbox/model-account methods, transcript presentation and standalone bootstrap retain their native cold selectors. Eight shared profile sites remain follow-up debt until compatible callers migrate. The pre-existing indexed shared-profile alias fallback at src/config/sessions/session-accessor.sqlite-participants.native.ts:86 remains on worker exact misses; native preparation remains before the transaction. No new host read is introduced inside a grant.

Earlier CI reds for terminal-font typing and X publication were independently inherited and resolved by integrated main fixes 1d10375ee563b and d641ea18101f8. Earlier worker-abort failures reproduced on both sources and their main fixes are integrated. No job was rerun merely to obtain green. Earlier ClawSweeper findings on browser assets and Activity fixtures were repaired and verified; the preceding head's review had no actionable correctness/security findings. ClawSweeper completed on f6 at 2026-10-07 21:25 UTC with no actionable correctness or security findings; its remaining evidence request is now complete.

Overlap includes #166102, #166054, profile-adjacent worker cutovers, incognito #165901, locked writes #165921, ownership umbrella #162433, and test consolidation #166619. Main integrations preserve session authority, native creation, adjacent cleanup, avatar reuse, executor/worker repairs current reader custody, conversation worker authority from #166259, and phase-local reducers from #166674. The hunks remain focused on profile disclosure and its measured retention interaction.

Read self-profile details with the existing authority snapshot, prepare exact project aliases in the reader, and hydrate the resident catalog without native SQL. Keep physical-store aliases attached to one replacement catalog and retain current profile facts for cookie and media disclosure.

Preserve synchronous SDK fallbacks, existing schemas, write ordering, settlement, and permission behavior.
Select one agreeing cookie profile reference before preparing its catalog, and avoid starting preparation for responses that already ended or closed. Keep the final policy and post-await lifetime checks.

Exercise the real asynchronous HTTP boundary and preserve zero storage work for mixed grants and terminal responses.
Prune obsolete profile mock allowances and keep the media session type private after moving its last external consumer. Carry Vincent Koc’s already-landed private CallBrief export fix from #166147 so the pinned base passes the same unused-export guard.
@clawsweeper

clawsweeper Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: voice-call Channel integration: voice-call app: web-ui App: web-ui gateway Gateway runtime scripts Repository scripts size: XL labels Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: f6b8cefbd66552ed0b824557d2f0c2f5d6de131f
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/gateway/http-auth-plugin-cookie.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/http-auth-user-profile.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/http-auth-utils.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 6, 2026
@clawsweeper

clawsweeper Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 7, 2026, 6:00 PM ET / 22:00 UTC (Revision 24).

ClawSweeper review

What this changes

Moves Gateway profile disclosure and catalog preparation to database workers, avoids unnecessary participant alias reads, and preserves retention progress across session metadata patches.

Merge readiness

✅ Ready for maintainer review

Keep open as useful, ready work: current main still performs the targeted native profile reads, and the previous integration-evidence request is satisfied. No actionable correctness or security finding remains.

Likely related people: steipete and vincentkoc, based on prior merged profile-authority and catalog work (medium-confidence routing).

Priority: P2
Reviewed head: f6b8cefbd66552ed0b824557d2f0c2f5d6de131f

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Strong source-bound runtime measurements, completed integration evidence, and preserved authority boundaries support readiness.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Recorded paired Gateway workloads exercise worker-backed profile disclosure and catalog preparation on 85e, showing reduced targeted SQL and successful completion; f6 changes only test extraction. The completed exact-head integration closes the prior request. No stored-data contract changes require migration proof.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Recorded paired Gateway workloads exercise worker-backed profile disclosure and catalog preparation on 85e, showing reduced targeted SQL and successful completion; f6 changes only test extraction. The completed exact-head integration closes the prior request. No stored-data contract changes require migration proof.
Evidence reviewed 8 items Pinned introduction and source identity: Reviewed the introduced c6698b1..f6b8cef delta. Raw head records confirm 85e08d2 as the original head's parent; the parent-to-head file delta contains only the three session-patch test/support paths. GitHub's commit patch confirms the retention cases were extracted without changing their assertions.
Still necessary on current main: Fetched main still calls getUserProfileListItem after preparing users.self authority and retains the synchronous native catalog hydration path. The branch instead returns the profile representation prepared with its authority snapshot.
Final disclosure authority: Browser assets prepare cookie profile facts, reject terminal responses, reauthorize the cookie, and check captured client authority before serving bytes. Catalog replacement redirects all retained locators and invalidates previous prepared identities; inspected coverage includes credential rotation, profile demotion, replacement, and revoked media access.
Findings None None.
Security None None.

How this fits together

The Gateway uses profile identity, roles, and aliases to authorize requests and present session information. Database workers prepare these facts, while Gateway owners check current authority before returning profile data, assets, or media.

flowchart TD
  A[Profile and HTTP requests] --> B[Database read worker]
  C[SQLite profile state] --> B
  B --> D[Retained profile catalog]
  D --> E[Current authority checks]
  E --> F[Profile and session responses]
  E --> G[Plugin assets and media]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +133, Tests +626, Docs +22, Other -2. Total +779 across 69 files.

View PR surface stats
Area Files Added Removed Net
Source 24 548 415 +133
Tests 40 841 215 +626
Docs 2 22 0 +22
Config 0 0 0 0
Generated 0 0 0 0
Other 3 3 5 -2
Total 69 1414 635 +779

Review metrics

Metric Value Why it matters
Production versus test growth Production net +133 LOC; tests/support net +626 LOC Production growth supports retained worker preparation and authority checks; test growth covers storage and disclosure lifecycle boundaries.

Technical review

Best possible solution:

Use the existing worker and profile owners for preparation while preserving synchronous final authorization, released SDK contracts, and committed retention receipts.

Do we have a high-confidence way to reproduce the issue?

Not applicable as a new bug reproduction: source inspection establishes the native reads being optimized, and the recorded paired Gateway workloads exercise the changed paths.

Is this the best way to solve the issue?

Yes. Reusing existing database and profile owners avoids competing storage or authority mechanisms, and the compatibility and lifecycle evidence supports the cutover.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 400bab4a7937.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded internal performance and ownership improvement with no demonstrated urgent user-facing regression.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Recorded paired Gateway workloads exercise worker-backed profile disclosure and catalog preparation on 85e, showing reduced targeted SQL and successful completion; f6 changes only test extraction. The completed exact-head integration closes the prior request. No stored-data contract changes require migration proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. Recorded paired Gateway workloads exercise worker-backed profile disclosure and catalog preparation on 85e, showing reduced targeted SQL and successful completion; f6 changes only test extraction. The completed exact-head integration closes the prior request. No stored-data contract changes require migration proof.

Evidence

What I checked:

  • Pinned introduction and source identity: Reviewed the introduced c6698b1..f6b8cef delta. Raw head records confirm 85e08d2 as the original head's parent; the parent-to-head file delta contains only the three session-patch test/support paths. GitHub's commit patch confirms the retention cases were extracted without changing their assertions. (src/config/sessions/session-entry-patch.retention.test.ts:29, f6b8cefbd665)
  • Still necessary on current main: Fetched main still calls getUserProfileListItem after preparing users.self authority and retains the synchronous native catalog hydration path. The branch instead returns the profile representation prepared with its authority snapshot. (src/gateway/server-methods/users.ts:167, 400bab4a7937)
  • Final disclosure authority: Browser assets prepare cookie profile facts, reject terminal responses, reauthorize the cookie, and check captured client authority before serving bytes. Catalog replacement redirects all retained locators and invalidates previous prepared identities; inspected coverage includes credential rotation, profile demotion, replacement, and revoked media access. (src/gateway/control-ui-plugin-assets.ts:365, f6b8cefbd665)
  • Retention invariant: Metadata receipts advance the committed mutation counter without replacing trajectory summaries. Publication remains post-commit, and current-sweep checks preserve foreign-commit, lease, connection, and mutation invalidation. Six boundary cases cover prepared/reducer commits and replacements, rollback, and foreign writes. (src/trajectory/runtime-retention.sqlite.ts:214, f6b8cefbd665)
  • Captured body and completed prior request: The full live body matches the supplied snapshot SHA256 41ffa884428ecd1696fac43c46c6acdea214fe889672e74bd59ff5e35f5d03b1 and 21,992 UTF-16 units. Its completed evidence records all 21 selected integration files passing on f6, 519.65 runtime command seconds, and passing type, lint, cycle, and structural checks. This satisfies the sole retained rank-up request from the previous same-head review. (f6b8cefbd665)
  • Production behavior and compatibility evidence: The recorded c669-to-85e alternating Gateway workloads completed all 12 runs with zero failed native SQL calls; users.self decreased from 15 to 10 statements/request and projects.list from 20 to 17. The body preserves measured-source attribution and separately establishes the test-only f6 descendant. Released SDK qualification reports no direct signature, kind, or entrypoint changes; inspected production changes introduce no schema, serialized format, configuration default, or retention-policy change. (src/state/user-profile-identity.read.ts:174, 85e08d2d8344)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (23 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-07T18:27:34.780Z sha 64cfef5 :: blocked before merge. :: none
  • reviewed 2026-10-07T18:59:12.230Z sha a77bcde :: blocked before merge. :: none
  • reviewed 2026-10-07T19:20:14.164Z sha 16ae8d0 :: blocked before merge. :: none
  • reviewed 2026-10-07T19:59:10.347Z sha e599292 :: blocked before merge. :: none
  • reviewed 2026-10-07T20:37:11.047Z sha e599292 :: needs changes before merge. :: none
  • reviewed 2026-10-07T21:06:11.508Z sha 85e08d2 :: needs changes before merge. :: none
  • reviewed 2026-10-07T21:25:42.026Z sha f6b8cef :: needs changes before merge. :: none
  • reviewed 2026-10-07T21:44:39.629Z sha f6b8cef :: needs changes before merge. :: none

Merge current main while preserving profile disclosure through the existing
reader and main's GitHub identity binding and error handling.

Prepare profile-bound browser asset cookies through the catalog owner, retain
that catalog through the response, and recheck current request authority before
serving bytes. Cover cold/replaced catalogs and credential rotation or response
closure during preparation. Preserve RPC, SDK, storage, and permission contracts.
@openclaw-barnacle openclaw-barnacle Bot removed the channel: voice-call Channel integration: voice-call label Oct 7, 2026
@steipete

steipete commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The browser-asset cookie caller is corrected at 932b473. Cold/replaced catalog requests and authority invalidation during preparation have passing boundary tests, including a negative control. The PR body records current proof and the remaining landing prerequisites.

@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Oct 7, 2026
@steipete

steipete commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot removed the rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. label Oct 7, 2026
Reuse the row owner's optional stored-entry type and remove the redundant
session-entry type import. This keeps the integrated projection within its
line limit with byte-identical emitted JavaScript and no signature change.
Preserve main's worker conversation guard alongside the metadata-only retention
receipt. Retain all host-owned test routes and append this PR's cookie suite
to the existing membership list without changing its routing.
Merge main's TEMP-generation schema validation optimization so the profile
cutover and metadata retention receipt are tested against the current owner.
Preserve main's mutation tracking and the retention freshness, transaction,
and live-lease boundaries.
@steipete

steipete commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Oct 7, 2026
Preserve main's fixed-operation patch path and cover its metadata writes with
the active retention receipt. Capture before patch-owned preparation and publish
only after an actual metadata mutation and its replacement receipt preparation.
Extend the existing retention boundary fixture for reducer commits and replacement.
@steipete

steipete commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Oct 7, 2026
Move the six retention cases without changing their assertions and share the
existing database fixture. Keep the patch suite within its line budget while
preserving both callback and worker-reducer coverage.
@steipete

steipete commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Oct 7, 2026
@steipete
steipete merged commit 656604d into main Oct 7, 2026
186 checks passed
@steipete
steipete deleted the dbasync/w6profile branch October 7, 2026 22:13
@steipete

steipete commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 8, 2026
…aw#166283)

* perf(profiles): prepare disclosure through the profile reader

Read self-profile details with the existing authority snapshot, prepare exact project aliases in the reader, and hydrate the resident catalog without native SQL. Keep physical-store aliases attached to one replacement catalog and retain current profile facts for cookie and media disclosure.

Preserve synchronous SDK fallbacks, existing schemas, write ordering, settlement, and permission behavior.

* fix(profiles): reject inadmissible cookie reads before preparation

Select one agreeing cookie profile reference before preparing its catalog, and avoid starting preparation for responses that already ended or closed. Keep the final policy and post-await lifetime checks.

Exercise the real asynchronous HTTP boundary and preserve zero storage work for mixed grants and terminal responses.

* chore(profiles): keep ticket assertion invariant adjacent

* chore(profiles): finish cutover guard cleanup

Prune obsolete profile mock allowances and keep the media session type private after moving its last external consumer. Carry Vincent Koc’s already-landed private CallBrief export fix from openclaw#166147 so the pinned base passes the same unused-export guard.

* refactor(gateway): express projection startup drain condition

* fix(gateway): satisfy profile cutover lint contracts

* test(gateway): finish profile reader fixture migration

* refactor(gateway): reuse prepared row owner type

Reuse the existing prepared-reader owner parameter type for projection callbacks, removing the duplicated structural declaration. This restores the line cap without changing emitted JavaScript or runtime behavior.

* perf(sessions): skip unused worker participant profile reads

Resolve profile aliases only after an exact participant miss in the sharing worker. Preserve native eager preparation, merge attribution, participant limits, and transaction publication through the shared implementation.

* perf(trajectory): reuse retention facts for metadata patches

Advance the active sweep's committed mutation counter after session metadata
patches without re-aggregating unchanged trajectory rows. Keep foreign-write,
lease, rollback and connection-lifetime checks and the existing append/trim
receipt behavior.

Cover the worker patch boundary for commit, generation replacement, rollback
and foreign writes, including the aggregate-read budget and retention outcome.

* refactor(gateway): derive stored entry type from projection row

Reuse the row owner's optional stored-entry type and remove the redundant
session-entry type import. This keeps the integrated projection within its
line limit with byte-identical emitted JavaScript and no signature change.

* test(sessions): split metadata retention coverage from patch suite

Move the six retention cases without changing their assertions and share the
existing database fixture. Keep the patch suite within its line budget while
preserving both callback and worker-reducer coverage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts security-sensitive-changed size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant