Skip to content

improve: avoid loading transcript revisions for exact retries - #146381

Merged
steipete merged 1 commit into
mainfrom
codex/count-transcript-retries-round3
Sep 12, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/count-transcript-retries-round3

Conversation

@steipete

@steipete steipete commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Related: #146376

What Problem This Solves

Meeting transcript retries load every revision of the same utterance before deciding whether an exact copy already exists.

User Impact

Repeated transcript updates with many retained revisions use less CPU and memory. Existing retry and revision behavior stays the same; no database migration or configuration change is required. Minimal histories can incur a small latency cost from the extra SQL predicates.

Why This Change Was Made

Ask SQLite for one exact match instead of loading all revisions into JavaScript. Preserve session scope, NULL versus false, exact metadata bytes, and the existing handling of unpaired Unicode surrogates.

Evidence

  • 88 store and capture tests passed; both changed cases passed again after the equivalent Unicode-helper and test lint fixes. Extended existing retry coverage checks all compared fields, historical retries, session/date separation, embedded NUL, metadata key order, and lone surrogates. Core typechecking, scoped lint, formatting and diff checks passed. Exact-head CI is required before landing.
  • Real public appendUtteranceForSession calls against isolated on-disk SQLite, with 200 alternating before/after samples per case on the final implementation. At 1,000 revisions, median early retry 3.28 → 0.58 ms, latest retry 4.15 → 1.28 ms, and new revision 4.57 → 1.30 ms. Fixtures used approximately 492-byte text plus 191-byte metadata per revision.
  • At 20 revisions, medians improved from 0.50 → 0.48 ms, 0.47 → 0.44 ms, and 0.68 → 0.60 ms respectively. One-revision cases were approximately unchanged to 0.10 ms slower; this is not a universal speedup.
  • The exact-match read returns zero or one scalar row instead of all matching payloads. At 1,000 revisions, a retry previously returned about 775 KB of strings. Tests and disk fixtures verify revisions and sequence bookkeeping remain intact.
  • Independent P0–P2 autoreview found no actionable issues; the subsequent type-compatible Unicode helper and test lint adjustment preserve the reviewed behavior. ClawSweeper reviewed the final head with no findings, and exact-head CI passed. Timings are synthetic local measurements, not production guarantees. No external live audio source was exercised.

@steipete
steipete marked this pull request as ready for review September 12, 2026 19:49
@clawsweeper

clawsweeper Bot commented Sep 12, 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 size: S maintainer Maintainer-authored PR labels Sep 12, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 12, 2026
@clawsweeper

clawsweeper Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 12, 2026, 3:58 PM ET / 19:58 UTC.

ClawSweeper review

What this changes

Meeting transcript storage checks SQLite for one exact retry match instead of loading every retained revision, with expanded coverage for equality edge cases.

Merge readiness

✅ Ready for maintainer review

Keep open: the optimization remains useful on current main, preserves the inspected retry contract, and has relevant on-disk performance evidence. No actionable patch defect was found.

Priority: P2
Reviewed head: 6cf7cddd424d1fbdd6735cd7fd8087b3c2b3eeb0

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused optimization with relevant real-database measurements, meaningful boundary coverage, and no identified correctness defect.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The captured body reports final-implementation public store calls against real on-disk SQLite, showing faster populated-history retries and preserved revision bookkeeping; external audio is outside the changed query contract.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured body reports final-implementation public store calls against real on-disk SQLite, showing faster populated-history retries and preserved revision bookkeeping; external audio is outside the changed query contract.
Evidence reviewed 9 items Verified introduced change: The pinned merge-base-to-head diff changes only the retry query and its store tests; unrelated base-branch changes are excluded.
Current main still materializes revisions: Current main selects all same-ID utterance rows and compares their fields in JavaScript, so the proposed optimization is not already implemented.
Latest release retains the old query: The v2026.9.4 source also selects complete revisions before comparing them. The release source was inspected through GitHub’s contents endpoint after the local historical blob read failed.
Findings None None.
Security None None.

How this fits together

Meeting transcript providers feed utterances into OpenClaw’s shared SQLite store. The store suppresses exact retries while retaining revisions for later reading, summaries, and exports.

flowchart TD
  A[Transcript provider] --> B[Append utterance]
  B --> C[Session-scoped exact-match query]
  C --> D{Exact retry exists?}
  D -->|Yes| E[Keep stored history unchanged]
  D -->|No| F[Append revision and advance sequence]
  F --> G[Transcript reads and summaries]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +13, Tests +41. Total +54 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 28 15 +13
Tests 1 57 16 +41
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 85 31 +54

Review metrics

Metric Value Why it matters
Retry result materialization All matching payload rows → at most 1 scalar row This removes revision-sized JavaScript result allocation without adding an index or changing persisted data.

Technical review

Best possible solution:

Retain the existing transcript store and exact equality semantics while returning only the existence result needed for retry suppression.

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

Yes: current main clearly loads all same-ID revisions for each retry, and the PR supplies populated-store timings through the public append operation; this review did not execute benchmarks.

Is this the best way to solve the issue?

Yes: the bounded query uses the existing owner and preserves null, metadata-byte, Unicode, and session-scoping semantics without a migration or parallel implementation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 63bafe6492ec.

Labels

Label changes:

  • add P2: This is a bounded performance improvement for meeting transcripts with many retained revisions.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The captured body reports final-implementation public store calls against real on-disk SQLite, showing faster populated-history retries and preserved revision bookkeeping; external audio is outside the changed query contract.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured body reports final-implementation public store calls against real on-disk SQLite, showing faster populated-history retries and preserved revision bookkeeping; external audio is outside the changed query contract.

Label justifications:

  • P2: This is a bounded performance improvement for meeting transcripts with many retained revisions.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured body reports final-implementation public store calls against real on-disk SQLite, showing faster populated-history retries and preserved revision bookkeeping; external audio is outside the changed query contract.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured body reports final-implementation public store calls against real on-disk SQLite, showing faster populated-history retries and preserved revision bookkeeping; external audio is outside the changed query contract.

Evidence

What I checked:

  • Verified introduced change: The pinned merge-base-to-head diff changes only the retry query and its store tests; unrelated base-branch changes are excluded. (src/transcripts/store-sqlite.ts:140, 6cf7cddd424d)
  • Current main still materializes revisions: Current main selects all same-ID utterance rows and compares their fields in JavaScript, so the proposed optimization is not already implemented. (src/transcripts/store-sqlite.ts:141, 63bafe6492ec)
  • Latest release retains the old query: The v2026.9.4 source also selects complete revisions before comparing them. The release source was inspected through GitHub’s contents endpoint after the local historical blob read failed. (src/transcripts/store-sqlite.ts, 3a9d69db306c)
  • Existing storage owner and transaction preserved: The public append operation serializes metadata once and invokes the same SQLite helper inside the existing write transaction. The patch leaves insertion, sequence advancement, schema, and session identity unchanged. (src/transcripts/store.ts:548, 6cf7cddd424d)
  • Equality contract coverage: The inspected tests exercise historical retries, nullable fields, false versus absent finality, embedded NUL, metadata key order, session/date separation, and lone-surrogate handling through the public store. Tests were read, not executed during this read-only review. (src/transcripts/store.test.ts:210, 6cf7cddd424d)
  • Production-path performance evidence: The captured PR body reports 200 alternating before/after samples per case using public appendUtteranceForSession calls against isolated on-disk SQLite. At 1,000 revisions, early retries improved from 3.28 to 0.58 ms and latest retries from 4.15 to 1.28 ms; one-revision cases could be 0.10 ms slower. These are reported synthetic measurements, not reviewer-run benchmarks or production guarantees. (6cf7cddd424d)

Likely related people:

  • steipete: 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.

@steipete
steipete merged commit 2d012df into main Sep 12, 2026
267 checks passed
@steipete
steipete deleted the codex/count-transcript-retries-round3 branch September 12, 2026 20:34
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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