Skip to content

fix(ui): report scoped snapshot transaction failures - #173553

Merged
steipete merged 2 commits into
mainfrom
deslop/z20-1-snapshot-clear-20261015
Oct 15, 2026
Merged

steipete merged 2 commits into
mainfrom
deslop/z20-1-snapshot-clear-20261015

Conversation

@steipete

@steipete steipete commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

An aborted IndexedDB transaction could report that an account-scoped chat snapshot clear succeeded, even though its cached records remained.

User Impact

Explicit scope clearing now reports transaction errors. Ordinary single-session cache eviction remains best effort. No schema, rendered UI, config, or protocol changes.

Why This Change Was Made

Use the existing transaction completion owner instead of treating complete, error, and abort as equivalent success events. The narrow regression uses a real IndexedDB transaction abort and verifies the record was not deleted.

Best-effort tradeoffs accepted

Net production LOC: 2 removed. This is a silent-failure bug fix, exempt from the cleanup batch floor.

Evidence

  • Before repair: the scope-clear regression failed because its promise resolved instead of rejecting; the single-session control passed.
  • After repair: 23 tests passed across the new invalidation regression and the existing snapshot store suite. New regression bodies: 6 ms; loaded-host wrapper: 167.37 s (Vitest 112.44 s).
  • Formatting and git diff --check pass.
  • Independent P0-P2 review found no issue in this packet. The complete multi-packet review found one unrelated MCP diagnostic issue, corrected separately.
  • Targeted production and regression graph typecheck passes, including after the fixture lint repair. Runtime import cycles: zero. Production import edges are unchanged, so this cut cannot add a static import component. The full madge scan was stopped after30minutes without a result; no full static scan pass is claimed.
  • Changed-file check: conflict-marker and line-cap gates pass. Max-lines itself passed but its combined command failed on inherited environment-count ratchet drift (452 variables, budget453). The subsequent broad assertion scan was deliberately stopped after the aggregate command exceeded20minutes; no passing aggregate check is claimed.
  • Lint-suppression test:2/3 pass, existing inventory mismatch96vs94 in untouched ui/src/test-helpers/control-ui-streaming-reply.ts (no-unnecessary-type-conversion and unbound-method, two each). No baseline/suppression changes. Exact-head hosted CI remains the broad gate.
  • Targeted source-backed lint found one unbound-method reference in the regression. The fixture now binds the native method to its test database; no suppressions were added. The fixed graph typecheck and affected two-case regression pass (120.26s wrapper /71.77s Vitest; bodies435ms). No fixed-head lint pass is claimed; exact-head hosted lint is required before merge.

The change does not modify rendering; behavior is proved at the IndexedDB boundary.

Exact-head hosted CI run38824831588 completed with the ci-gate successful; no failed jobs, CI reruns, dispatches or green-only pushes. Hosted lint supplies the fixed-fixture lint gate. Earlier draft-only skipped CI is not counted as proof.

@clawsweeper

clawsweeper Bot commented Oct 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.

@steipete
steipete marked this pull request as ready for review October 15, 2026 23:35
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T23:37:48.756215Z c32af4a Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c32af4af6a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

for (const event of ["complete", "error", "abort"]) {
transaction.addEventListener(event, () => resolve(), byPrefix ? { once: true } : undefined);
}
void transactionComplete(transaction).then(resolve, reject);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Catch scoped-clear rejections in retirement paths

When IndexedDB aborts during credential retirement or a warm-boot scope mismatch, this newly rejecting promise is reached through void clear(...) in ui/src/app/gateway-store.credentials.ts:91-94 or void clearWarmBootState(...) in ui/src/app/bootstrap-warm-boot.ts:131-134; neither caller attaches a rejection handler. The failure therefore becomes an unhandled promise rejection rather than a controlled report, while the scoped records remain uncleared. Catch and log the failure at these fire-and-forget boundaries, or keep this cleanup best effort.

AGENTS.md reference: AGENTS.md:L81-L81

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 15, 2026
@clawsweeper

clawsweeper Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR makes account-scoped snapshot deletion reject failed IndexedDB transactions while preserving best-effort single-session eviction.

Example: An IndexedDB transaction aborts while clearing cached conversations for account-a at wss://cache.example.

  • Before: The clear promise resolves even though the cached records remain.
  • After: The clear promise rejects; single-session eviction still resolves.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The focused regression supports the storage contract, but an actionable caller-handling defect remains.
Proof confidence 🦐 gold shrimp (3/6) Ordinary contributor proof gating is exempt for this maintainer-authored PR; the supplied evidence exercises the storage API with fake-indexeddb, and the inspected historical screenshots do not demonstrate this changed path.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Account-scoped cached conversations can remain after cleanup reports success.
Reason: The maintainer-authored direction corrects a defined silent failure through the existing owner without adding settings or changing storage formats.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep this PR open: it fixes a current silent-failure bug, but the new rejection escapes two fire-and-forget cleanup callers.

Priority: P2
Reviewed head: c32af4af6a7600afe09b2781d36cc7d8dac19b5e

Before merge

  • Handle rejected scope clears at both background cleanup callers (P2) - When the deletion transaction aborts during credential retirement or a warm-boot account mismatch, this line now rejects through clearStoredChatSnapshots and clearWarmBootState. gateway-store.credentials.ts:93 and bootstrap-warm-boot.ts:131–134 both discard that promise without a catch, producing an unhandled rejection instead of a controlled failure report. Handle and record the failure at those fire-and-forget boundaries while retaining rejection for awaited scope clears and synchronous boot-record removal; cover both caller paths with an aborted-clear regression.

Findings

  • [P2] Handle rejected scope clears at both background cleanup callers — ui/src/pages/chat/session-snapshot-database.ts:179

Tests

  • Missing end-to-end proof: No browser scenario or caller-level regression demonstrates controlled handling of an aborted clear during credential retirement and warm-boot scope mismatch.
Agent review details

How this fits together

The Control UI snapshot cache receives account-scoped invalidations from credential retirement and warm boot, deletes matching IndexedDB records, and returns a completion promise to its callers.

flowchart TD
  A[Credential retirement] --> C[Warm boot cleanup]
  B[Account scope mismatch] --> C
  C --> D[Snapshot invalidation]
  D --> E[IndexedDB deletion transaction]
  E --> F[Completion or rejection]
Loading

Technical review

Best possible solution:

Keep strict scope-clear rejection and handle failures at both background cleanup callers without delaying synchronous boot-record retirement.

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

Source establishes that main resolves aborted deletions and that this PR propagates rejection into two unchecked callers; the author reports a failing-before, passing-after storage regression, but no code was executed during this read-only review.

Is this the best way to solve the issue?

Reusing transactionComplete is the appropriate small repair, provided its newly rejecting result is handled at every affected background caller.

Full review comments:

  • [P2] Handle rejected scope clears at both background cleanup callers — ui/src/pages/chat/session-snapshot-database.ts:179
    When the deletion transaction aborts during credential retirement or a warm-boot account mismatch, this line now rejects through clearStoredChatSnapshots and clearWarmBootState. gateway-store.credentials.ts:93 and bootstrap-warm-boot.ts:131–134 both discard that promise without a catch, producing an unhandled rejection instead of a controlled failure report. Handle and record the failure at those fire-and-forget boundaries while retaining rejection for awaited scope clears and synchronous boot-record removal; cover both caller paths with an aborted-clear regression.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 1bd533dfc7e4.

Provenance checked

  • Scoped snapshot deletion settlement changes intended behavior with a stated reason (9764de1: Account-scoped offline caching retained usable conversations through connection failures; subsequent consolidation preserved transaction settlement and distinguished explicit clearing from best-effort eviction.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test ui/src/pages/chat/session-snapshot-invalidation.test.ts ui/src/pages/chat/session-snapshot-store.test.ts ui/src/app/bootstrap.warm-boot.test.ts ui/src/app/gateway-store.device-credential.test.ts --maxWorkers=1
  • git diff --check

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 81901bf adds ui/src/pages/chat/session-snapshot-database.ts:144 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 81901bfd217e; files: ui/src/pages/chat/session-snapshot-database.ts)
  • RoboClaw: Raw commit 9764de1 adds ui/src/pages/chat/session-snapshot-database.ts:168 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9764de174749; files: ui/src/pages/chat/session-snapshot-database.ts)

PR surface

Source -2, Tests +64. Total +62 across 2 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 1 3 5 -2
Tests 1 64 0 +64
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 67 5 +62

Labels

Label changes:

  • add P2: This is a focused cache-cleanup correctness fix with an introduced, bounded unhandled-rejection defect.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: This is a focused cache-cleanup correctness fix with an introduced, bounded unhandled-rejection defect.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 15, 2026, 7:49 PM ET / 23:49 UTC.

@steipete
steipete merged commit 8cab2a3 into main Oct 15, 2026
160 of 162 checks passed
@steipete
steipete deleted the deslop/z20-1-snapshot-clear-20261015 branch October 15, 2026 23:51
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 16, 2026
## What Problem This Solves

An aborted IndexedDB transaction could report that an account-scoped chat snapshot clear succeeded, even though its cached records remained.

## User Impact

Explicit scope clearing now reports transaction errors. Ordinary single-session cache eviction remains best effort. No schema, rendered UI, config, or protocol changes.

## Why This Change Was Made

Use the existing transaction completion owner instead of treating complete, error, and abort as equivalent success events. The narrow regression uses a real IndexedDB transaction abort and verifies the record was not deleted.

## Best-effort tradeoffs accepted

- Single-session eviction remains intentionally best effort; explicit scope clearing rejects on failure. No new best-effort concession is introduced. The swallowed transaction outcomes originated in openclaw#162428 and survived openclaw#167780/openclaw#168206; the regression demonstrates the bug without claiming a human incident.

Net production LOC: **2 removed**. This is a silent-failure bug fix, exempt from the cleanup batch floor.

## Evidence

- Before repair: the scope-clear regression failed because its promise resolved instead of rejecting; the single-session control passed.
- After repair: 23 tests passed across the new invalidation regression and the existing snapshot store suite. New regression bodies: 6 ms; loaded-host wrapper: 167.37 s (Vitest 112.44 s).
- Formatting and `git diff --check` pass.
- Independent P0-P2 review found no issue in this packet. The complete multi-packet review found one unrelated MCP diagnostic issue, corrected separately.
- Targeted production and regression graph typecheck passes, including after the fixture lint repair. Runtime import cycles: zero. Production import edges are unchanged, so this cut cannot add a static import component. The full madge scan was stopped after30minutes without a result; no full static scan pass is claimed.
- Changed-file check: conflict-marker and line-cap gates pass. Max-lines itself passed but its combined command failed on inherited environment-count ratchet drift (452 variables, budget453). The subsequent broad assertion scan was deliberately stopped after the aggregate command exceeded20minutes; no passing aggregate check is claimed.
- Lint-suppression test:2/3 pass, existing inventory mismatch96vs94 in untouched `ui/src/test-helpers/control-ui-streaming-reply.ts` (no-unnecessary-type-conversion and unbound-method, two each). No baseline/suppression changes. Exact-head hosted CI remains the broad gate.
- Targeted source-backed lint found one unbound-method reference in the regression. The fixture now binds the native method to its test database; no suppressions were added. The fixed graph typecheck and affected two-case regression pass (120.26s wrapper /71.77s Vitest; bodies435ms). No fixed-head lint pass is claimed; exact-head hosted lint is required before merge.

The change does not modify rendering; behavior is proved at the IndexedDB boundary.

Exact-head hosted CI run38824831588 completed with the ci-gate successful; no failed jobs, CI reruns, dispatches or green-only pushes. Hosted lint supplies the fixed-fixture lint gate. Earlier draft-only skipped CI is not counted as proof.
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 P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant