Skip to content

fix(sessions): isolate maintenance from channel plugin resolvers - #129490

Merged
steipete merged 1 commit into
mainfrom
codex/issue-121252
Aug 25, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/issue-121252

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes #121252.

A loaded channel plugin could execute its conversation resolver while synchronous session-store maintenance was classifying unrelated session keys. If that resolver threw, the SQLite write transaction rolled back and unrelated Telegram or Discord turns silently lost their replies.

Why This Change Was Made

The maintenance owner only needs structural thread-suffix detection. Replace its plugin-dispatching thread parser with the existing pure session-key suffix parser, removing all channel-plugin execution from synchronous maintenance while preserving primary sessions, synthetic entries, generic threads, Telegram topics, external group/channel conversations, archived rows, and pinned rows.

Production LOC: +2/-2 (net 0). Tests: +127/-1.

User Impact

A faulty or incompatible channel plugin can no longer abort unrelated inbound Telegram or Discord session writes. Their replies are delivered normally, and the faulty plugin's group session remains preserved by the existing retention policy.

Thanks @arividar for identifying the shared-maintenance failure mechanism.

Evidence

  • Four targeted owner-boundary regressions fail on unmodified main and pass with the repair.
  • OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs src/config/sessions/store-maintenance-recent-preservation.test.ts src/config/sessions/store.pruning.test.ts src/config/sessions/session-accessor.conformance.test.ts src/channels/turn/run-channel-turn.finalize.test.ts: all 127 tests pass.
  • Real isolated SQLite plus actual prepared Telegram and Discord inbound turns: each sends one final reply, commits its session transaction, preserves the faulty channel group, and calls the faulty resolver zero times. The unmodified baseline rolls back both writes and sends zero replies.
  • env -u OPENCLAW_TESTBOX OPENCLAW_LOCAL_CHECK=1 node scripts/check-changed.mjs -- src/config/sessions/store-maintenance.ts src/config/sessions/store-maintenance-recent-preservation.test.ts src/config/sessions/session-accessor.conformance.test.ts: complete changed gate passes, including production/test typechecking, lint, formatting, dead-code checks, and database/schema guards.
  • Fresh structured autoreview: clean; independent maintainer review: approved.
  • Proposed head: d76aff7bf695a22141bf8c075dd51f7f6495fb9d.

@clawsweeper

clawsweeper Bot commented Aug 25, 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: S maintainer Maintainer-authored PR labels Aug 25, 2026
@steipete
steipete marked this pull request as ready for review August 25, 2026 17:26
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. 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 25, 2026
@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 2:58 PM ET / 18:58 UTC.

ClawSweeper review

What this changes

Replaces plugin-aware thread detection during session maintenance with pure session-key suffix parsing and adds regression coverage for retention and SQLite writes.

Regression provenance

Possible regression — probable (reviewed change; known regression link). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open for maintainer review. The focused parser substitution removes plugin execution from the synchronous maintenance path, but the branch is behind main and its required-check rollup is red.

Priority: P1
Reviewed head: d76aff7bf695a22141bf8c075dd51f7f6495fb9d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The source-backed, net-neutral repair is focused; exact-head CI remains the merge gate.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nonetheless describes isolated SQLite and prepared-channel after-fix evidence.
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 PR is exempt from the external-contributor proof gate; its body nonetheless describes isolated SQLite and prepared-channel after-fix evidence.
Evidence reviewed 5 items Current-main failure path: Current main invokes the loaded-plugin thread resolver while classifying protected maintenance entries; the PR replaces this call.
Plugin resolver can throw at this boundary: The loaded resolver calls a plugin messaging hook directly, with no local catch around the hook invocation.
Canonical owner-boundary repair: The proposed maintenance classifier uses the existing pure suffix parser, avoiding loaded plugin dispatch while retaining generic thread protection.
Findings None None.
Security None None.

Live Verification

Command: OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs src/config/sessions/store-maintenance-recent-preservation.test.ts src/config/sessions/session-accessor.conformance.test.ts

Result: FAIL (failed) — step 1 run OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs src/config/sessions/store-maintenance-recent-preservation.test.ts src/config/sessions/session-accessor.conformance.test.ts: previous terminal command was still running after 30 seconds: "OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs src/config/sessions/store-maintenance-recent-preservation.test.ts src/config/sessions/session-accessor.conformance.test.ts"

[test] starting test/vitest/vitest.runtime-config.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-129490-xgYJCN/target

 ✓  runtime-config  src/config/sessions/session-accessor.conformance.test.ts (47 tests) 11539ms
     ✓ conforms for entry load/list/timestamp/upsert/update/replace/patch  315ms
     ✓ conforms for lifecycle entry and transcript cleanup  2126ms
     ✓ conforms for lifecycle entry and transcript cleanup  1423ms
     ✓ applies SQLite session-entry maintenance inside entry write transactions  1419ms
 ✓  runtime-config  src/config/sessions/store-maintenance-recent-preservation.test.ts (5 tests) 9ms

 Test Files  2 passed (2)
      Tests  52 passed (52)
   Start at  18:59:06
   Duration  18.87s (transform 5.67s, setup 64ms, import 6.94s, tests 11.55s, environment 0ms)

[test] passed 1 Vitest shard in 24.61s

Assertions:

  • FAIL expect_output: Tests

How this fits together

Session-store maintenance classifies persisted conversation keys during SQLite updates. It feeds retention decisions that must not execute channel-plugin code, because a resolver exception can roll back an unrelated inbound turn.

flowchart LR
  A[Inbound channel turn] --> B[Session store update]
  B --> C[Maintenance classification]
  C --> D[Pure thread suffix parser]
  D --> E[Retention decision]
  E --> F[SQLite commit and reply]
  G[Channel plugin resolver] -. must not run .-> C
Loading

Before merge

  • Resolve merge risk (P1) - The branch is behind main and the supplied exact-head required-check rollup reports failures, so it needs a refreshed head and green required checks before merge.
  • Complete next step (P2) - This protected maintainer PR needs exact-head CI recovery and normal merge review, not a separate repair job.
Agent review details

Security

None.

PR surface

Source 0, Tests +126. Total +126 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 2 2 0
Tests 2 127 1 +126
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 129 3 +126

Review metrics

Metric Value Why it matters
Production versus test LOC production +2/-2 (net 0); tests +127/-1 (net +126) The fix removes a plugin-dispatching call without growing production logic and adds targeted owner-boundary regression coverage.

Stored data model

Persistent data-model change detected: serialized state: src/config/sessions/session-accessor.conformance.test.ts, serialized state: src/config/sessions/store-maintenance-recent-preservation.test.ts, unknown-data-model-change: src/config/sessions/session-accessor.conformance.test.ts, unknown-data-model-change: src/config/sessions/store-maintenance-recent-preservation.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #121252
Summary: This PR explicitly targets the linked cross-channel reply-loss report through its session-maintenance rollback mechanism.

Members:

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

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Rebase the net-neutral owner-boundary repair onto current main, preserve the transaction regression coverage, and merge only after exact-head checks pass.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Rebase the net-neutral owner-boundary repair onto current main, preserve the transaction regression coverage, and merge only after exact-head checks pass.

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

Yes—source establishes the failure path, and the added regression sets a throwing resolver while exercising unrelated SQLite session writes.

Is this the best way to solve the issue?

Yes—the maintenance owner only needs structural key classification; retaining plugin-aware parsing there would preserve the transaction-side exception path.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: A throwing channel plugin can silently interrupt active inbound reply workflows by rolling back session maintenance.
  • 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 PR is exempt from the external-contributor proof gate; its body nonetheless describes isolated SQLite and prepared-channel after-fix evidence.

Evidence

What I checked:

Likely related people:

  • Shakker: Current-main blame attributes the protected-session classifier and parser call to this available history commit. (role: recent session-maintenance contributor; confidence: medium; commits: 18234ea96456; files: src/config/sessions/store-maintenance.ts, src/sessions/session-key-utils.ts)

Rank-up moves

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

  • Rebase onto current main and resolve the required-check failures on the resulting exact head.

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-08-25T18:15:51.276Z sha d76aff7 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/issue-121252 branch from d76aff7 to 872d5c6 Compare August 25, 2026 21:13
@steipete
steipete force-pushed the codex/issue-121252 branch from 872d5c6 to 5d2cc61 Compare August 25, 2026 22:10
@steipete
steipete merged commit 0dd1ca5 into main Aug 25, 2026
196 checks passed
@steipete
steipete deleted the codex/issue-121252 branch August 25, 2026 22:37
@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 P1 High-priority user-facing bug, regression, or broken workflow. 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.

[bug] buzz plugin - Enabling Buzz channel breaks inbound reply resolution for all non-Buzz channels

1 participant