Skip to content

refactor(persist): delegate SessionStore mechanism to acp-kernel/persist - #196

Closed
ranxianglei wants to merge 2 commits into
2026-08-22_openai-system-hoistfrom
2026-08-22_kernel-persist
Closed

refactor(persist): delegate SessionStore mechanism to acp-kernel/persist#196
ranxianglei wants to merge 2 commits into
2026-08-22_openai-system-hoistfrom
2026-08-22_kernel-persist

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Protocol-consolidation Phase P (user direction m00509: billion-context 的持久化机制进入内核,下游复用).

What

  • SessionStore becomes a thin POLICY adapter over StateStore<PersistedSession> (acp-kernel/persist, shipped 0.0.40/fix(anthropic): forward round-2 stream with proper framing (vertical-text bug) #126 + 0.0.41/release v0.1.38 #130): ~270 lines of duplicated mechanism deleted (atomic write, rename retry, debounce timers, write chains, corrupt-tolerant walk).
  • Kernel gains nothing proxy-specific; proxy keeps: record schema (PersistedSession v3), namespaced layout (relPathFor), validity, build/buildSession, env knobs (BILI_PERSIST*), singleton. Public API unchanged (session.ts/server.ts/export.ts untouched).

On-disk migration

  • New files: envelope {version, savedAt, id, payload}. Old flat files (all versions, incl. v1) load via the kernel's legacy adoption hook and re-persist as envelope on the next dirty write — old sessions never break, files migrate organically.

Semantics upgrades (documented in tests)

  • scheduleSave builds the record at WRITE time (freshest state under coalescing) instead of capturing at call time.
  • In-process loadSync with stale meta still resolves via the kernel's discovered-file cache — id is authoritative, meta is only a path hint (isolation probe uses a cold store).

Deps

Tests

  • 513/513 green (512 baseline + 1: pre-envelope flat-file adoption → re-persist envelope round-trip). tsc build-scope clean. Fixes nothing user-visible on its own; unlocks single-sourced persistence across proxy + omp (billion-context-omp#131).

@ranxianglei

Copy link
Copy Markdown
Owner Author

防止模型擅自合并,先关闭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant