Skip to content

improve: reduce repeated sender reads in shared transcripts - #148672

Merged
steipete merged 2 commits into
mainfrom
codex/sqlite-catalog-source-facts-0914
Sep 15, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/sqlite-catalog-source-facts-0914

Conversation

@steipete

@steipete steipete commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Exporting a shared transcript repeatedly reads the same sender's profile and verified identity for every message on a page.

User Impact

Repeated senders require fewer database reads. Portable identities, per-message fallback labels, ordering, and cursors remain covered by the page-reader tests. A page reuses the first successful display facts for each sender; the next page reads fresh facts, including intervening profile and identity changes.

Why This Change Was Made

The existing attribution owner supplies a page-scoped projector that lazily reuses successful profile facts, including absent profiles or identities. It preserves first-encounter lookup and error order, computes labels separately for every message, and performs no eager lookup of later senders. One-shot callers retain their existing operation.

The cache lasts only for one synchronous page computation. An external commit or repeated read-admission failure for an already-read sender is no longer observed within that computation. Attribution remains display information; the source plugin's current sharing and session checks after awaited work are unchanged.

Evidence

  • Original implementation: the repeated-sender fixture returned 18 rows / 1,080 TEXT bytes across 32 relevant SELECTs. It failed only the three new upper-budget assertions; the native integer-error control passed.
  • Candidate: the same real page-reader fixture passes budgets of at most 5 SELECTs, at most 3 rows, and fewer than 512 TEXT bytes, with positive-observation assertions. These measure profile and identity reads, not all page SQL or latency.
  • Node 26.8.2: 28/28 tests passed across the complete catalog SDK and session-share sibling files.
  • Node 24.19.0: all 3 focused cases passed, covering portable identity, repeated senders with next-page freshness, and native errors before hidden-content filtering. Seven other cases were explicitly filtered out and are covered by the full Node 26 run.
  • Sources and private dependency bindings remained unchanged through each run, and all observed test descendants settled. Formatting and git diff --check passed.
  • Independent P0–P2 review completed cleanly in two passes, with no findings. The source and evidence checks after review passed.
  • Hosted CI on the initial head covered 19 selected static obligations and caught an unused internal export. Commit 7d18fc748d removes only that export modifier; its internal actor caller and runtime behavior remain unchanged. Normal formatting hooks passed.
  • All 13 remaining static obligations passed on repaired head 7d18fc748d, including all three unused-export scans, SDK exports/surface and plugin boundaries, both historical ratchets, and the selected temporary-file report. Source and private dependency guards passed, with all observed descendants settled. This completes the selected checks alongside the 19 earlier hosted obligations; their recorded source/dependency scopes remain distinct.
  • Final-head hosted CI passed, including the required CI gate. ClawSweeper reviewed the same commit with no findings. Native maintainer preparation and merge completed; landed as 98b321fce638620713efafb39f85fbec3bde5fce, with main ancestry and cleanup verified.

No SDK export, schema, transaction, retention, or permission change is included. No latency, memory, or disk-I/O improvement is claimed.

Related: #146197

@steipete steipete self-assigned this Sep 15, 2026
@clawsweeper

clawsweeper Bot commented Sep 15, 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 gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Sep 15, 2026
@steipete
steipete marked this pull request as ready for review September 15, 2026 01:14
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 15, 2026
@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 14, 2026, 9:50 PM ET / September 15, 2026, 01:50 UTC (Revision 3).

ClawSweeper review

What this changes

Reuse sender profile and verified GitHub identity facts within each shared-transcript page while preserving per-message labels and refreshing facts on subsequent pages.

Merge readiness

✅ Ready for maintainer review

The optimization remains useful: current main still repeats sender lookups. No actionable correctness or security defect was found in the introduced patch, and no verified replacement supersedes it.

Priority: P2
Reviewed head: 7d18fc748df0ef25eec11fff6288d0625f41b28e

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level optimization with meaningful regression coverage and no supported blocking findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository state identifies a maintainer-authored PR, so the external-contributor proof gate does not apply. Reported page-reader measurements and freshness/error tests support the changed attribution owner; historical UI screenshots do not prove the optimization, and no authority-bearing behavior changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies a maintainer-authored PR, so the external-contributor proof gate does not apply. Reported page-reader measurements and freshness/error tests support the changed attribution owner; historical UI screenshots do not prove the optimization, and no authority-bearing behavior changes.
Evidence reviewed 8 items Introduced change and cache lifetime: The verified merge-base-to-head delta is confined to the attribution owner, its page-reader caller, and catalog tests. The projector caches completed profile reads, including missing facts, while recomputing each message's label. A fresh projector is created for every page invocation, whose projection loop has no await.
Current main still performs repeated lookups: Inspected both current-main production modules: each user-message projection still invokes the one-shot participant projection, which reads profile display facts and verified identities again. The inspected latest-release tree, v2026.9.4, contains neither catalog module; no shipped or current-main implementation of this optimization was established.
Authorization remains outside attribution: The unchanged Session Share command checks eligibility before reading and rechecks group, store, agent, and session identity after awaiting the page and before returning it. Documentation explicitly defines sender attribution as display metadata that grants no access. This native transcript path supplies no affirmative dependency on the Codex harness.
Findings None None.
Security None None.

How this fits together

Session Share lets a paired Gateway display selected native OpenClaw transcripts. The catalog reader converts stored messages and sender profiles into bounded, portable transcript pages; the sharing plugin separately controls publication permission.

flowchart LR
  A[Shared transcript request] --> B[Check session publication]
  B --> C[Read stored conversation page]
  C --> D[Reuse sender facts within page]
  E[Profile and verified identity store] --> D
  D --> F[Build portable messages and labels]
  F --> G[Recheck publication permission]
  G --> H[Return page and cursor]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +33, Tests +115. Total +148 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 47 14 +33
Tests 1 116 1 +115
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 163 15 +148

Review metrics

Metric Value Why it matters
Attribution read budget Reported baseline 32 SELECTs; candidate at most 5 The real page-reader fixture measures repeated profile and identity reads without claiming whole-page latency gains.
Production versus test growth Production net +33 lines; tests net +115 lines Production growth implements bounded reuse in the existing owner; test growth covers read budgets, freshness, labels, and native errors.

Technical review

Best possible solution:

Keep sender-fact reuse inside the existing attribution owner, limited to one synchronous page, with fresh reads on subsequent pages and publication checks owned by Session Share.

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

Yes: current-main source repeats profile and identity reads for each message from the same sender, and the submitted page-reader fixture measures that path. This review did not execute the fixture.

Is this the best way to solve the issue?

Yes: lazy page-scoped reuse removes repeated reads without eager sender loading, persistent cache invalidation, or a new public API.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 25155c466de2.

Labels

Label justifications:

  • P2: This is a bounded database-read optimization for shared transcript pages, with no established urgent user-facing failure.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied repository state identifies a maintainer-authored PR, so the external-contributor proof gate does not apply. Reported page-reader measurements and freshness/error tests support the changed attribution owner; historical UI screenshots do not prove the optimization, and no authority-bearing behavior changes.

Evidence

What I checked:

  • Introduced change and cache lifetime: The verified merge-base-to-head delta is confined to the attribution owner, its page-reader caller, and catalog tests. The projector caches completed profile reads, including missing facts, while recomputing each message's label. A fresh projector is created for every page invocation, whose projection loop has no await. (src/gateway/session-catalog-identity.ts:81, 7d18fc748df0)
  • Current main still performs repeated lookups: Inspected both current-main production modules: each user-message projection still invokes the one-shot participant projection, which reads profile display facts and verified identities again. The inspected latest-release tree, v2026.9.4, contains neither catalog module; no shipped or current-main implementation of this optimization was established. (src/gateway/session-transcript-catalog.ts:127, 25155c466de2)
  • Authorization remains outside attribution: The unchanged Session Share command checks eligibility before reading and rechecks group, store, agent, and session identity after awaiting the page and before returning it. Documentation explicitly defines sender attribution as display metadata that grants no access. This native transcript path supplies no affirmative dependency on the Codex harness. (extensions/session-share/src/node-commands.ts:158, 7d18fc748df0)
  • Public SDK contract stays unchanged: The SDK continues exporting the existing page reader, title reader, actor projection, and receiver linker. The new source projector remains Gateway-internal; removing the old internal export does not remove an SDK operation. The receiver linker serves a different attribution direction and cannot replace the source-side optimization. (src/plugin-sdk/session-transcript-runtime.ts:62, 7d18fc748df0)
  • Behavioral and query-budget coverage: Read the complete catalog test file and statement counter. New coverage exercises the real page reader with merged and missing profiles, independently varying fallback labels, next-page rename and identity removal, and native integer errors before hidden-content filtering. The supplied PR body reports baseline 32 SELECTs versus candidate budgets of at most 5, plus 28 passing catalog/share tests on Node 26 and three focused cases on Node 24. These are reported results; this read-only review did not execute tests. (src/plugin-sdk/session-transcript-runtime.catalog.test.ts:417, 7d18fc748df0)
  • Merged feature history and routing: Current-main history identifies the original Session Share implementation at feat: share selected sessions read-only with a paired team Gateway #136253 and its conversation-only refinement at fix(session-share): hide subagents and tool activity #146598. Both are merged and concern earlier functionality, not this repeated-read optimization. Raw commit inspection identified the original commit's recorded parent; the attribution module is absent from that parent's tree and present in the feature commit. Some earlier-head comparison and blame reads failed on an unavailable historical blob; no conclusions rely on those failed reads. (src/gateway/session-catalog-identity.ts:24, 5278a8f2ed9e)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; 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 (2 earlier review cycles)
  • reviewed 2026-09-15T01:20:32.961Z sha 706b9fa :: needs maintainer review before merge. :: none
  • reviewed 2026-09-15T01:39:40.205Z sha 7d18fc7 :: needs maintainer review before merge. :: none

@steipete
steipete merged commit 98b321f into main Sep 15, 2026
207 checks passed
@steipete
steipete deleted the codex/sqlite-catalog-source-facts-0914 branch September 15, 2026 02:01
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 15, 2026
…#148672)

* improve: reduce repeated sender reads in shared transcripts

* refactor: keep catalog source participant projection internal

---------

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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