Skip to content

perf(sessions): retain transcript previews across metadata edits - #166635

Merged
steipete merged 3 commits into
mainfrom
steipete/perf-micro-metadata-edit-transcript-backfill-20260919
Oct 7, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/perf-micro-metadata-edit-transcript-backfill-20260919

Conversation

@steipete

@steipete steipete commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Renaming, pinning, or editing session metadata repeatedly queued transcript preview/fallback backfills and discarded valid reads already in flight. Ten metadata edits caused ten unnecessary backfills.

User Impact

Metadata edits retain the existing preview without another transcript read. Transcript appends/replacements, fallback-model changes, and completed transcript repairs still refresh the affected facts. No schema, stored-data, configuration, or update changes are required. The generated data-model compatibility checklist is inapplicable: “backfill” here enriches in-memory rows, and the new revisions exist only in a process-local Map. This matches ClawSweeper’s final-head technical assessment that no stored-data contract changes.

Why This Change Was Made

The existing backfill owner now retains the revision of its actual inputs: session generation, transcript watermark, and fallback-model facts. Materialization is the scheduling boundary. Transcript publications revoke that revision immediately, including during throttled refresh windows; archive eviction, removal, and disposal release it. Reconciliation publishes transcript scope because repaired indexes can become readable without changing their watermark.

Equal-revision publications still wake queued work after a failed readiness drain. Completed reads survive metadata changes between readiness settlement and consumption: they wait for materialization without rereading the transcript. The generic enqueue paths and archive materialization-object fence are removed.

Production LOC is +31 (80 added, 49 removed). Retaining the projection-specific revision and its lifecycle is necessary to reuse completed and in-flight reads while fencing stale transcript and fallback results.

Evidence

Scenario Original code Candidate
Ten metadata edits 10 backfills 0 backfills
Subsequent transcript append — 1 backfill; preview updates
Rename while the first preview read is held Valid preview discarded Held preview publishes

The metadata regression uses real session writes and resident projection reads. Negative controls reproduced the metadata count and in-flight rename defects, an omitted stored-model revision input, and both readiness failures in the earlier PR revision. Recovery coverage proves retained queued work resumes and completed fields survive the readiness handoff. Both final readiness cases pass in 3 ms and assert exactly two transcript reads for two rows.

Validation uses the authorized AWS Crabbox fallback after Blacksmith lease tbx_01m4b3j0z2pdc9az6tykjwbm6n remained queued for 15 minutes. No local tests, builds, or typechecks ran.

Final validation passed on head 206ed7e4c13c6018479b98aa87c5142f58d5baa0, AWS cbx_6ddda4d2a7ec, run run_4b148b4b2e2ab0de076af3e700bddd7b. The exact head and all 11 lane source hashes were checked before execution:

  • pnpm test src/gateway/health/collector.session-row-projection.test.ts --maxWorkers=1: 2 passed, 39.96 s wrapper wall time; the previously timed-out case completed in 691 ms.
  • pnpm test src/gateway/session-row-changes.gateway.test.ts --maxWorkers=1: 3 passed, 25.55 s wrapper wall time.
  • node scripts/run-vitest.mjs over the seven other health files, backfill/foreground/projection siblings, and reconciliation lifecycle: 86 passed across 11 files, 95.55 s wrapper wall time.
  • 91 tests passed across 13 files.
  • node scripts/check-changed.mjs --base d72a907b6125aef3ad98b709c533c8dec2f16c49 --head 206ed7e4c13c6018479b98aa87c5142f58d5baa0: passed, including core and all 27 test type graphs, lint, dead exports, storage/security guards, and zero runtime import cycles. The complete frozen-install/tests/gate command took 16m44s, excluding sync.

Hosted CI passed on the final head: run 37664242038, 699 s elapsed wall time. The lead watcher squash-merged the PR as e73b64b7f620e79844064a945447bbbb2a1f15d8; the merge is on current main and all 11 lane files match the validated head. All task leases are released.

Earlier valid proof includes 335 tests across 47 files, followed by 42 final projection tests across three files and a passing full changed gate after the readiness correction. The latter gate included core and all 27 test type graphs, lint, dead exports, storage/security guards, and zero runtime import cycles; command time was 13m55s. Codex autoreviews are clean through P2 for the implementation, readiness corrections, and health fixture correction. All 11 lane files are byte-identical across the final rebase.

Single-worker test costs before the two small readiness cases were added: foreground 31.98 s wall time (metadata regression 601 ms), backfill 33.47 s, reconciliation lifecycle 54.21 s. The final three-file projection run took 68.23 s wrapper wall time. Harness/import and existing worker-lifecycle setup account for most of these costs.

CI on a03bef4e38a8 exposed an obsolete health/status fixture wait for metadata backfill (120 s timeout); this patch deletes that wait while preserving readiness, result, zero-SQL, and topology assertions. An audit of all 17 remaining backfill observers and relevant custom waits found no other obsolete waits. A second CI failure came from unchanged runtime-publication expectations; main fixed it in d0f181418b13. This branch rebases onto that fix and contains only its three lane commits, with no copied upstream fix.

This is synthetic owner-boundary proof. Production CPU/RSS and end-to-end latency were not measured, and no Gateway deployment was performed.

Remote run ledger

All validation used the installed Crabbox CLI. Commands on each lease ran sequentially; no local tests, builds, or typechecks ran.

Provider / lease Command / purpose Result
Blacksmith Testbox tbx_01m4b3j0z2pdc9az6tykjwbm6n Warmup Queued for 15 minutes; stopped before execution.
AWS cbx_fb9274b40051 Foreground metadata-count regression against original production code Expected failure: 10 backfills for 10 edits.
AWS cbx_fb9274b40051 Foreground/backfill/archive/recovery focused files Backfill file passed; stopped a stalled draft test fixture and released the lease.
AWS cbx_e2151f0ab263 Validation sync Cancelled before tests to incorporate the review finding; lease released.
AWS cbx_8942fe1f2889 Stored-model negative control and focused files Negative control failed as intended; 13 backfill tests passed; a draft foreground fixture timed out. Its publication wait was corrected.
AWS cbx_8942fe1f2889 Validation sync Cancelled before tests for the rebase; lease released.
AWS cbx_b864eccbedfe Validation sync Cancelled before tests for the final fixture correction; lease released.
AWS cbx_8e2b0d79342c In-flight rename negative control, focused files, 44 sibling files, changed gate Negative control failed as intended; 335 candidate tests passed; gate found the projection-owner line cap; equivalent callback shortening fixed it.
AWS cbx_8e2b0d79342c First changed-gate rerun Line cap passed; lint identified the receiver-free callback declaration. Added this: void without changing runtime behavior.
AWS cbx_8e2b0d79342c Focused lint, full changed gate, and docs inventory Passed on the final production source; lease released.
AWS cbx_9eade5d481c0 Conflict-only rebase: four affected test files, core types, and focused lint 49 passed, core types and lint passed.

| AWS cbx_9bb0b65512e6 | Initial readiness-failure negative control; three projection files; lint; staged changed gate | Negative control failed as intended; 41 tests passed; lint and full gate passed (run_c9f450145c96763470027776f5bcdb78, 15m45s command time). |

| AWS cbx_9bb0b65512e6 | Final recovery proof attempt (run_85e3b0ef37f981a6a126d3b5949b354a) | Cancelled after sync finalization stopped progressing; workload did not start. Lease released. |

| AWS cbx_a610e94fc08c | Recovery negative controls; three projection test files; focused lint (run_cd3d87ac972636ac36514d4e3f044af5) | Both controls failed as intended; 42 candidate tests passed. Lint required equivalent loop spelling; gate had not started. |

| AWS cbx_a610e94fc08c | Final focused lint and staged changed gate (run_f16ab68572225e9b173bcac8122e8a48) | Passed, 13m55s command time; lease released. |

| AWS cbx_ed83cd959be9 | Health correction validation attempt (run_10d5ba0d5d07144d024584c1a1aa8209) | Cancelled during sync to incorporate main’s publication-test fix by rebase; no workload ran; lease released. |

| AWS cbx_baf70db7941c | Rebased-head full-manifest attempt (run_a85cd3d39c2c6c97e4d1cf61dba6b839) | Cancelled during quiet full sync of the unpublished commit; no workload ran; lease released. Published the reviewed head as draft so the next lease can fetch it directly. |

| AWS cbx_6ddda4d2a7ec | Frozen install; final health/publication tests; health/projection/reconciliation siblings; full PR changed gate (run_4b148b4b2e2ab0de076af3e700bddd7b) | 91 tests passed across 13 files; full gate passed, 16m44s combined command time; lease released. |

@clawsweeper

clawsweeper Bot commented Oct 7, 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 gateway Gateway runtime size: M labels Oct 7, 2026
@steipete
steipete force-pushed the steipete/perf-micro-metadata-edit-transcript-backfill-20260919 branch from d71d68f to 670b64c Compare October 7, 2026 15:05
@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 Oct 7, 2026
@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 7, 2026, 1:59 PM ET / 17:59 UTC (Revision 4).

ClawSweeper review

What this changes

The PR retains completed and in-flight session transcript previews across metadata edits while refreshing them when transcript or fallback-model inputs change.

Merge readiness

⛔ Blocked before merge - 1 item remains

This remains a useful, focused optimization with no blocking correctness finding. The earlier migration-proof blocker does not apply: the retained revisions are process-local and change no stored-data contract.

Priority: P2
Reviewed head: 206ed7e4c13c6018479b98aa87c5142f58d5baa0

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused implementation with meaningful regression coverage and no identified blocking defect; reported remote validation was not independently rerun.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository state identifies a MEMBER-authored PR, so the external-contributor proof gate does not apply. Reported owner-boundary validation exercises real session writes and preview publication, with synthetic readiness controls; production performance was not measured. No stored-data contract changes, so migration proof is inapplicable.
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 MEMBER-authored PR, so the external-contributor proof gate does not apply. Reported owner-boundary validation exercises real session writes and preview publication, with synthetic readiness controls; production performance was not measured. No stored-data contract changes, so migration proof is inapplicable.
Evidence reviewed 8 items Pinned introduced change: Reviewed the merge-base-to-head introduced diff. The device-identity repair path belongs to base-branch work and is not attributed to this PR.
Runtime revision ownership: The backfill owner retains revisions in a local Map keyed by row identity, compares generation, transcript watermark, and fallback inputs, and clears them on removal and disposal. No schema, serialized format, migration, or persistent cache contract changes; the previous compatibility-proof request is therefore inapplicable.
Invalidation and publication boundaries: Transcript publications revoke retained backfill revisions immediately; materialization schedules replacement work. Archive eviction and row removal release revisions. The existing publication owner resolves the current live row before applying optional transcript fields.
Findings None None.
Security None None.

How this fits together

The Gateway’s session-row projection combines committed session metadata with background transcript reads. It supplies session lists and descriptions with previews and model facts without delaying foreground requests.

flowchart TD
 A[Session metadata publications] --> C[Resident session rows]
 B[Transcript updates and repairs] --> C
 C --> D[Compare transcript input revision]
 D -->|Unchanged| E[Retain preview work]
 D -->|Changed| F[Background transcript read]
 E --> G[Session lists and descriptions]
 F --> G
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +31, Tests +115, Docs +4. Total +150 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 6 80 49 +31
Tests 4 172 57 +115
Docs 1 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 256 106 +150

Review metrics

Metric Value Why it matters
Production versus regression coverage production +31, tests +115 net LOC The production growth has a stated lifecycle justification and is accompanied by metadata, fallback, and readiness regressions.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/gateway/session-row-projection-backfill.ts, migration/backfill/repair: src/gateway/session-row-projection.ts, unknown-data-model-change: src/gateway/session-row-projection-backfill.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep transcript enrichment under the existing projection owner, retaining valid work across neutral edits and revoking it when its actual inputs or residency change.

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

Yes, source establishes the unnecessary enqueue and held-read invalidation path on fetched main, and the PR supplies a focused ten-edit regression with reported baseline failure. This review did not execute a current-main reproduction.

Is this the best way to solve the issue?

Yes, retaining input revisions in the existing backfill owner is a focused solution, with explicit invalidation and cleanup rather than a competing cache or scheduling path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 24d311dcf66d.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded session-preview performance and publication improvement without evidence of an urgent user-facing outage.
  • 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 MEMBER-authored PR, so the external-contributor proof gate does not apply. Reported owner-boundary validation exercises real session writes and preview publication, with synthetic readiness controls; production performance was not measured. No stored-data contract changes, so migration proof is inapplicable.

Evidence

What I checked:

  • Pinned introduced change: Reviewed the merge-base-to-head introduced diff. The device-identity repair path belongs to base-branch work and is not attributed to this PR. (206ed7e4c13c)
  • Runtime revision ownership: The backfill owner retains revisions in a local Map keyed by row identity, compares generation, transcript watermark, and fallback inputs, and clears them on removal and disposal. No schema, serialized format, migration, or persistent cache contract changes; the previous compatibility-proof request is therefore inapplicable. (src/gateway/session-row-projection-backfill.ts:22, 206ed7e4c13c)
  • Invalidation and publication boundaries: Transcript publications revoke retained backfill revisions immediately; materialization schedules replacement work. Archive eviction and row removal release revisions. The existing publication owner resolves the current live row before applying optional transcript fields. (src/gateway/session-row-projection.ts:357, 206ed7e4c13c)
  • Behavioral regression coverage: The foreground regression uses real session writers and the resident projection to assert zero transcript rereads across ten metadata edits, then one read and an updated preview after an append. Adjacent tests protect held-read publication, stale fallback rejection, and membership freshness. (src/gateway/session-row-projection.foreground.test.ts:216, 206ed7e4c13c)
  • Recovery and reported validation: The queue regression covers readiness rejection and metadata arriving during readiness settlement, requiring both queued publications with exactly two reads. The captured PR body reports failing baseline controls, 335 earlier candidate tests, and 42 recovery tests plus the changed-source gate. These are reported remote results; this read-only review executed no tests and does not claim production CPU or latency measurements. (src/gateway/session-row-projection.backfill.test.ts:439, 206ed7e4c13c)
  • Current-main necessity: Fetched main still uses unconditional enqueue-based backfill scheduling and queued-work invalidation of held reads. It does not contain this revision-retention implementation. The PR remains open and unmerged in the supplied GitHub context; no merged replacement is established. (src/gateway/session-row-projection-backfill.ts:45, 24d311dcf66d)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: 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 (3 earlier review cycles)
  • reviewed 2026-10-07T15:22:00.500Z sha 670b64c7e61c85bc22c0a8f8cc94b06f1d8713bd :: blocked before merge. :: none
  • reviewed 2026-10-07T15:44:07.429Z sha 670b64c7e61c85bc22c0a8f8cc94b06f1d8713bd :: blocked before merge. :: none
  • reviewed 2026-10-07T17:12:08.248Z sha a03bef4e38a840d95b633d65186248f646120587 :: blocked before merge. :: none

@steipete
steipete marked this pull request as ready for review October 7, 2026 15:25
@steipete
steipete enabled auto-merge (squash) October 7, 2026 15:30
@steipete
steipete marked this pull request as draft October 7, 2026 15:35
auto-merge was automatically disabled October 7, 2026 15:35

Pull request was converted to draft

@steipete
steipete marked this pull request as ready for review October 7, 2026 17:06
@steipete
steipete enabled auto-merge (squash) October 7, 2026 17:10
Keep backfill revisions tied to transcript watermarks and fallback inputs,
preserving completed and in-flight work across unrelated metadata changes.
Invalidate repaired transcript projections explicitly and release revisions
with row residency.

Cover metadata edit counts, held preview publication, and stored model
changes through the resident projection and real session writers.
@steipete
steipete marked this pull request as draft October 7, 2026 17:35
auto-merge was automatically disabled October 7, 2026 17:35

Pull request was converted to draft

@steipete
steipete force-pushed the steipete/perf-micro-metadata-edit-transcript-backfill-20260919 branch from a03bef4 to 206ed7e Compare October 7, 2026 17:36
@steipete
steipete marked this pull request as ready for review October 7, 2026 18:06
@steipete
steipete enabled auto-merge (squash) October 7, 2026 18:11
@steipete
steipete merged commit e73b64b into main Oct 7, 2026
211 checks passed
@steipete
steipete deleted the steipete/perf-micro-metadata-edit-transcript-backfill-20260919 branch October 7, 2026 18:19
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 8, 2026
…nclaw#166635)

* perf(sessions): retain transcript previews across metadata edits

Keep backfill revisions tied to transcript watermarks and fallback inputs,
preserving completed and in-flight work across unrelated metadata changes.
Invalidate repaired transcript projections explicitly and release revisions
with row residency.

Cover metadata edit counts, held preview publication, and stored model
changes through the resident projection and real session writers.

* fix(sessions): preserve backfills across readiness changes

* test(gateway): stop awaiting metadata transcript backfills
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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