Skip to content

chore(scripts): add debt ratchet to the session-accessor boundary guard#101178

Merged
jalehman merged 2 commits into
mainfrom
b62.2/accessor-ratchet-debt-gate
Jul 6, 2026
Merged

chore(scripts): add debt ratchet to the session-accessor boundary guard#101178
jalehman merged 2 commits into
mainfrom
b62.2/accessor-ratchet-debt-gate

Conversation

@jalehman

@jalehman jalehman commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

The session-accessor boundary guard (scripts/check-session-accessor-boundary.mjs) only enforces no-regress on files already migrated to the accessor. Files not on a migrated list are skipped entirely, and a file can be read-migrated but not write-migrated. This let #98510 add a new direct updateSessionStore write in src/gateway/server-methods/sessions.ts (read-listed, not write-listed) without any check firing, and lets unmigrated files accumulate new legacy call sites invisibly.

Why This Change Was Made

The accessor is the storage-neutral boundary for session/transcript runtime persistence (#88838). Until the remaining legacy call sites are migrated, the guard needs a debt ratchet so the unmigrated tail can only shrink: a checked-in, deterministic baseline of legacy call-site counts per unmigrated file per concern. Counts above baseline fail; new files with legacy calls fail; counts below baseline also fail with an instruction to regenerate, so the baseline can never go stale and allow debt to be reintroduced.

User Impact

None at runtime — check infrastructure only. For contributors: adding a legacy session-store call site anywhere now fails CI with a pointer to the accessor; removing call sites requires running pnpm lint:tmp:session-accessor-boundary:gen to ratchet the baseline down in the same PR.

Evidence

  • Baseline (scripts/lib/session-accessor-debt-baseline.json): 7 concerns, 66 file entries; src/gateway/server-methods/sessions.ts locked at 3 writes, closing the feat: add session thread management #98510 gap class.
  • Determinism: regenerated repeatedly, byte-identical (SHA-256 match).
  • Guard passes on clean tree; fake new call site in an unmigrated file fails (4 > 3); removing a call site fails with the regen instruction (verified via temporary edits, reverted).
  • node scripts/run-vitest.mjs test/scripts/check-session-accessor-boundary.test.ts: 34/34 pass.
  • oxfmt/oxlint clean on touched files; structured review (codex/gpt-5.5) clean, zero findings.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: M maintainer Maintainer-authored PR labels Jul 6, 2026
@jalehman
jalehman merged commit c7295e4 into main Jul 6, 2026
105 of 107 checks passed
@jalehman
jalehman deleted the b62.2/accessor-ratchet-debt-gate branch July 6, 2026 20:55
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 7, 2026
…rd (openclaw#101178)

* chore(scripts): add debt ratchet baseline to session-accessor boundary gate

* fix(scripts): fail session-accessor debt gate until baseline ratchets down
jalehman added a commit that referenced this pull request Jul 7, 2026
Squash-and-replay of sqlite/sessions-transcripts-storage-flip (361 commits,
old head 7766516) onto main @ 21f2512, per the prep-series plan:
Phase 0/1 accessor-prep PRs (#101178-#101182, #101688, #101699) landed the
seam on main first, so this rebase reduces to the SQLite storage
implementation behind the session accessor.

Beyond the flip branch content, this merge:
- implements findTranscriptEvent (reverse-seq), recordInboundSessionMeta and
  updateSessionLastRoute over SQLite (deriveLastRoutePatch shared with the
  file-era store for doctor paths)
- adds cross-agent fork support (targetStorePath) so worktree/cross-agent
  sessions.create forks land child transcript rows in the target agent DB
- keeps main's newer behavior across the conflict surface (work admission,
  archive-gated deletes, preflight overflow budgeting, model fallback,
  replyOptions dispatch shape, lifecycle-header ordering)
- adopts the storage-neutral ContextEngineSessionTarget while preserving the
  deprecated CompactResult.sessionFile for shipped plugin readers

Known remainder (tracked for follow-up commits on this PR): ~415 test-case
failures across 43 files, dominated by stale vi.mock factories missing
main-side exports; prod typecheck, full build, and boundary ratchet are green.

Co-Authored-By: Claude Fable 5 <[email protected]>
jalehman added a commit that referenced this pull request Jul 8, 2026
Squash-and-replay of sqlite/sessions-transcripts-storage-flip (361 commits,
old head 7766516) onto main @ 21f2512, per the prep-series plan:
Phase 0/1 accessor-prep PRs (#101178-#101182, #101688, #101699) landed the
seam on main first, so this rebase reduces to the SQLite storage
implementation behind the session accessor.

Beyond the flip branch content, this merge:
- implements findTranscriptEvent (reverse-seq), recordInboundSessionMeta and
  updateSessionLastRoute over SQLite (deriveLastRoutePatch shared with the
  file-era store for doctor paths)
- adds cross-agent fork support (targetStorePath) so worktree/cross-agent
  sessions.create forks land child transcript rows in the target agent DB
- keeps main's newer behavior across the conflict surface (work admission,
  archive-gated deletes, preflight overflow budgeting, model fallback,
  replyOptions dispatch shape, lifecycle-header ordering)
- adopts the storage-neutral ContextEngineSessionTarget while preserving the
  deprecated CompactResult.sessionFile for shipped plugin readers

Known remainder (tracked for follow-up commits on this PR): ~415 test-case
failures across 43 files, dominated by stale vi.mock factories missing
main-side exports; prod typecheck, full build, and boundary ratchet are green.

Co-Authored-By: Claude Fable 5 <[email protected]>
giodl73-repo pushed a commit to giodl73-repo/openclaw that referenced this pull request Jul 8, 2026
…rd (openclaw#101178)

* chore(scripts): add debt ratchet baseline to session-accessor boundary gate

* fix(scripts): fail session-accessor debt gate until baseline ratchets down
jalehman added a commit that referenced this pull request Jul 9, 2026
Squash-and-replay of sqlite/sessions-transcripts-storage-flip (361 commits,
old head 7766516) onto main @ 21f2512, per the prep-series plan:
Phase 0/1 accessor-prep PRs (#101178-#101182, #101688, #101699) landed the
seam on main first, so this rebase reduces to the SQLite storage
implementation behind the session accessor.

Beyond the flip branch content, this merge:
- implements findTranscriptEvent (reverse-seq), recordInboundSessionMeta and
  updateSessionLastRoute over SQLite (deriveLastRoutePatch shared with the
  file-era store for doctor paths)
- adds cross-agent fork support (targetStorePath) so worktree/cross-agent
  sessions.create forks land child transcript rows in the target agent DB
- keeps main's newer behavior across the conflict surface (work admission,
  archive-gated deletes, preflight overflow budgeting, model fallback,
  replyOptions dispatch shape, lifecycle-header ordering)
- adopts the storage-neutral ContextEngineSessionTarget while preserving the
  deprecated CompactResult.sessionFile for shipped plugin readers

Known remainder (tracked for follow-up commits on this PR): ~415 test-case
failures across 43 files, dominated by stale vi.mock factories missing
main-side exports; prod typecheck, full build, and boundary ratchet are green.

Co-Authored-By: Claude Fable 5 <[email protected]>
jalehman added a commit that referenced this pull request Jul 9, 2026
Squash-and-replay of sqlite/sessions-transcripts-storage-flip (361 commits,
old head 7766516) onto main @ 21f2512, per the prep-series plan:
Phase 0/1 accessor-prep PRs (#101178-#101182, #101688, #101699) landed the
seam on main first, so this rebase reduces to the SQLite storage
implementation behind the session accessor.

Beyond the flip branch content, this merge:
- implements findTranscriptEvent (reverse-seq), recordInboundSessionMeta and
  updateSessionLastRoute over SQLite (deriveLastRoutePatch shared with the
  file-era store for doctor paths)
- adds cross-agent fork support (targetStorePath) so worktree/cross-agent
  sessions.create forks land child transcript rows in the target agent DB
- keeps main's newer behavior across the conflict surface (work admission,
  archive-gated deletes, preflight overflow budgeting, model fallback,
  replyOptions dispatch shape, lifecycle-header ordering)
- adopts the storage-neutral ContextEngineSessionTarget while preserving the
  deprecated CompactResult.sessionFile for shipped plugin readers

Known remainder (tracked for follow-up commits on this PR): ~415 test-case
failures across 43 files, dominated by stale vi.mock factories missing
main-side exports; prod typecheck, full build, and boundary ratchet are green.

Co-Authored-By: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR scripts Repository scripts size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant