Skip to content

refactor(sessions): use archived projection for maintenance - #123896

Merged
RomneyDa merged 1 commit into
mainfrom
fix/session-maintenance-archived-projection
Aug 15, 2026
Merged

RomneyDa merged 1 commit into
mainfrom
fix/session-maintenance-archived-projection

Conversation

@RomneyDa

Copy link
Copy Markdown
Member

Related: #123081

What Problem This Solves

The SQLite stale-session probe added in #123081 queried archivedAt by parsing the canonical JSON payload with a raw SQLite CASE expression, even though the session schema already promotes and backfills that value into the typed archived_at query column. This left routine maintenance code harder to read and unnecessarily dependent on SQLite JSON1 behavior.

Why This Change Was Made

Use the existing session_nodes.archived_at projection through Kysely's typed query builder. The projection is maintained by the canonical session write and migration paths; malformed entry payloads remain isolated by the existing row parser.

This is an AI-assisted, maintainer-requested cleanup follow-up to #123081.

User Impact

No intended behavior change. Archived sessions remain protected from stale-session pruning, while the maintenance query becomes smaller and follows the schema's promoted-column contract.

Evidence

@clawsweeper

clawsweeper Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Aug 15, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 Aug 15, 2026
@clawsweeper

clawsweeper Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 14, 2026, 8:20 PM ET / August 15, 2026, 00:20 UTC.

ClawSweeper review

What this changes

The PR replaces the SQLite stale-session probe’s raw JSON predicate with the typed session_nodes.archived_at projection.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

No blocking findings. This small maintainer-authored cleanup correctly uses the session projection already owned by the canonical writer and migration path; wait for exact-head CI before merging.

Priority: P3
Reviewed head: e93de624e857f1cd50802f7f4454c216cd115a27

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A small, coherent refactor aligned with the authoritative session projection and existing boundary coverage.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored internal refactor is exempt from the external-contributor real-behavior-proof gate; the PR supplies focused test-run evidence as supplemental validation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored internal refactor is exempt from the external-contributor real-behavior-proof gate; the PR supplies focused test-run evidence as supplemental validation.
Evidence reviewed 7 items Changed predicate: The PR changes only the stale-candidate filter to archived_at IS NULL, while retaining row parsing and the shared preservation decision.
Projection owner: The canonical session-node writer projects entry.archivedAt into archived_at; this is the authoritative owner boundary for the query column.
Writer synchronization: Every canonical insert or update writes the projected archived_at value together with entry_json, avoiding a second maintenance-specific source of truth.
Findings None None.
Security None None.

How this fits together

SQLite session writes invoke maintenance to detect and prune stale, removable sessions. The maintenance probe filters indexed session metadata before loading canonical session records and preserving archived or otherwise protected history.

flowchart LR
  A[Session write] --> B[Session node writer]
  B --> C[Archived timestamp projection]
  C --> D[Maintenance probe]
  D --> E[Load eligible sessions]
  E --> F[Prune stale rows]
  E --> G[Preserve archived history]
Loading

Before merge

  • Complete next step (P2) - No repair is needed; the remaining merge gate is completion of exact-head CI.
Agent review details

Security

None.

PR surface

Source -8. Total -8 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 1 9 -8
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 1 9 -8

Review metrics

Metric Value Why it matters
Production versus test LOC production +1/-9 (net -8); tests +0/-0 The refactor removes raw JSON-query logic without adding a parallel maintenance path or new test-support surface.

Root-cause cluster

Relationship: partial_overlap
Canonical: #123081
Summary: This PR is a focused cleanup of the stale-session probe introduced by the related merged session-maintenance repair.

Members:

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

Technical review

Best possible solution:

Keep archived_at as the stale-probe predicate and leave projection synchronization with the canonical session writer and migration path.

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

Not applicable: this is a behavior-preserving query refactor; current owner-boundary tests define the relevant stale-pruning and archived-history invariants.

Is this the best way to solve the issue?

Yes. Reading the promoted column follows the canonical writer and migration contract, while the alternative keeps maintenance coupled to raw SQLite JSON parsing.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against ad508a51c285.

Labels

Label changes:

  • add P3: This is a small internal maintenance cleanup with no intended user-visible behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored internal refactor is exempt from the external-contributor real-behavior-proof gate; the PR supplies focused test-run evidence as supplemental validation.

Label justifications:

  • P3: This is a small internal maintenance cleanup with no intended user-visible behavior change.
  • 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: This maintainer-authored internal refactor is exempt from the external-contributor real-behavior-proof gate; the PR supplies focused test-run evidence as supplemental validation.

Evidence

What I checked:

Likely related people:

  • RomneyDa: Authored the related merged session-maintenance work and this focused follow-up. (role: recent area contributor; confidence: high; commits: a01d40bfb9bb, e93de624e857; files: src/config/sessions/session-accessor.sqlite-maintenance.ts, src/config/sessions/session-accessor.conformance.test.ts)
  • Vyctor H. Brzezowski: Recent history shows a touch to the maintenance module, though the session-specific ownership trail is secondary to RomneyDa. (role: recent adjacent contributor; confidence: low; commits: dc8facb060e8; files: src/config/sessions/session-accessor.sqlite-maintenance.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Let the running exact-head CI checks complete successfully before merge.

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.

@RomneyDa
RomneyDa merged commit d862148 into main Aug 15, 2026
192 checks passed
@RomneyDa
RomneyDa deleted the fix/session-maintenance-archived-projection branch August 15, 2026 00:31
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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