Skip to content

improve(sessions): reduce progress-card update payload reads - #149790

Merged
steipete merged 1 commit into
mainfrom
codex/sqlite-progress-card-projection-0916
Sep 16, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/sqlite-progress-card-projection-0916

Conversation

@steipete

@steipete steipete commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Related: #146197

What Problem This Solves

Replacing, clearing, or resetting a progress card unnecessarily loads its previous Markdown and step payloads from SQLite.

User Impact

No user-visible behavior changes. These writes transfer less stored content into JavaScript; no migration or operator action is needed.

Why This Change Was Made

Read only the metadata these operations need, retaining all native integer conversions and revision/timestamp handling. Conditional dismissal still reads and parses the full card before checking its revision, preserving existing errors and live-authority behavior.

Evidence

  • Paired native SQLite proof: replacement returned TEXT 4,995→15 bytes, clear 5,002→15, reset 9,990→30. Query and row counts were unchanged; complete stored/reopened state and conditional-dismissal outcomes matched. No latency claim.
  • Original production failed exactly the six intended payload-budget assertions; the candidate passed. Malformed JSON and unsafe-integer error behavior remained intact.
  • 37/37 final owner, reset-boundary, and Gateway authority tests passed. Scoped conflict, file-size, assertion-safety and storage guards, formatting, and two-file type-aware lint passed. Independent P0–P2 review found no actionable issues.
  • Local proof ran at db1d5d2; the patch, relevant source contexts, and private dependencies were preserved exactly when refreshing to 08584b3. Full local typechecks and full check:changed were not run. Exact-head hosted CI35062479374, including the required gate, passed at da2d59e92c95. Native preparation and merge completed. Merged as 05a5bd1c19b742e350ae4683535637fcf08d14b9; current-main ancestry, complete native outcome, native checkout/local PR branches/lock removal and remote head-branch deletion were independently verified.

@clawsweeper

clawsweeper Bot commented Sep 16, 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: M maintainer Maintainer-authored PR labels Sep 16, 2026
@steipete
steipete marked this pull request as ready for review September 16, 2026 06:09
@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 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 16, 2026, 3:03 AM ET / 07:03 UTC (Revision 2).

ClawSweeper review

What this changes

Progress-card replacement, clearing, and reset read only stored metadata, with regression coverage for payload transfer, persisted state, and existing error behavior.

Merge readiness

✅ Ready for maintainer review

This remains a useful, bounded optimization absent from current main and the latest release. No actionable correctness or security defects were found; the maintainer-authored PR should proceed through normal landing.

Priority: P2
Reviewed head: da2d59e92c95c0c6a507bdadf6ec7f922c3fd538

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused implementation with relevant storage regressions, documented measurements, and verified successful CI at the reviewed head.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate, and no authority change triggers additional proof; its native SQLite measurements and durable-state checks directly address the changed store operations.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate, and no authority change triggers additional proof; its native SQLite measurements and durable-state checks directly address the changed store operations.
Evidence reviewed 8 items Introduced scope: The verified merge-base-to-head patch changes only the progress-card store and its tests. The supplied test merge contains those same changes relative to its pinned main parent; unrelated endpoint drift is excluded.
Current main still materializes payloads: Replacement, unconditional clear, and reset still call the full-row selector on fetched main. That selector returns markdown and steps_json even when these operations consume only metadata.
Latest release comparison: The v2026.9.4 source also uses full-row reads for these operations, so the submitted optimization is not already shipped.
Findings None None.
Security None None.

How this fits together

Progress cards store an agent’s current task status in its session database. Gateway updates and conversation resets use this store, whose revisions and contents determine what clients display.

flowchart TD
 A[Gateway update or session reset] --> B[Progress-card store]
 B --> C{Conditional dismissal?}
 C -->|Yes| D[Read full card and validate revision]
 C -->|No| E[Read metadata only]
 D --> F[Existing SQLite transaction]
 E --> F
 F --> G[Updated card or revision tombstone]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +25, Tests +136. Total +161 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 31 6 +25
Tests 1 158 22 +136
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 189 28 +161

Review metrics

Metric Value Why it matters
Production versus regression coverage production net +25 lines; tests net +136 lines Production growth adds a narrow metadata projection; the larger test change protects transfer budgets, durable-state parity, and existing errors.

Root-cause cluster

Relationship: partial_overlap
Canonical: #146197
Summary: This PR implements one explicitly recorded optimization within the broader SQLite campaign.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep the existing storage owner and dismissal semantics while avoiding payload materialization for operations that only need metadata.

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

Yes: current main visibly selects Markdown and step payloads during replacement, clear, and reset despite consuming only metadata; this review verified the source path without executing it.

Is this the best way to solve the issue?

Yes: narrowing the existing owner's projection preserves its write and dismissal contracts without introducing another store, configuration option, or migration.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded storage-performance improvement without an 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 maintainer-authored PR is exempt from the external-contributor proof gate, and no authority change triggers additional proof; its native SQLite measurements and durable-state checks directly address the changed store operations.

Evidence

What I checked:

  • Introduced scope: The verified merge-base-to-head patch changes only the progress-card store and its tests. The supplied test merge contains those same changes relative to its pinned main parent; unrelated endpoint drift is excluded. (src/session-cards/progress-card-store.ts:67, da2d59e92c95)
  • Current main still materializes payloads: Replacement, unconditional clear, and reset still call the full-row selector on fetched main. That selector returns markdown and steps_json even when these operations consume only metadata. (src/session-cards/progress-card-store.ts:50, bebe37501ae9)
  • Latest release comparison: The v2026.9.4 source also uses full-row reads for these operations, so the submitted optimization is not already shipped. (src/session-cards/progress-card-store.ts:50, 3a9d69db306c)
  • Mutation and authorization contracts preserved: Conditional dismissal still loads and decodes the full card before checking revision and completion. Other mutations retain all integer metadata reads, revision increments, timestamps, and transaction ownership. The Gateway still invokes assertCurrent inside its write transaction before entering this store. (src/session-cards/progress-card-store.ts:158, da2d59e92c95)
  • Meaningful regression coverage: The tests instrument actual native SQLite statement execution, bound returned text bytes, inspect complete stored rows, reopen the database, and check malformed JSON plus unsafe-integer rejection without mutation. They introduce no production-only testing hook. (src/session-cards/progress-card-store.test.ts:84, da2d59e92c95)
  • Recorded measurements and exact-head CI: The supplied PR body reports paired native SQLite returned-text measurements of 4,995→15 bytes for replacement, 5,002→15 for clear, and 9,990→30 for reset, with unchanged query counts and durable results. GitHub independently confirms CI run 35062479374 succeeded at the reviewed head. This review did not execute tests or independently reproduce those measurements. (da2d59e92c95)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-16T06:23:00.402Z sha da2d59e :: needs maintainer review before merge. :: none

@steipete
steipete merged commit 05a5bd1 into main Sep 16, 2026
266 checks passed
@steipete
steipete deleted the codex/sqlite-progress-card-projection-0916 branch September 16, 2026 07:22
@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 17, 2026
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. 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