Repository navigation
docs(llm): record P0.2 event-sourcing audit — net-new infra, explicit defer - #143
Merged
Merged
Conversation
… defer P0.2 (SessionEvent/surfaceOp/deriveMessages/SessionEventMap/SESSION_FORMAT_VERSION) is net-new: zero matches in src/. The 3 spec motivations are partially served by the existing append-only JSONL transcript (recordTranscript → insertMessageChain → enqueueWrite with parentUuid chaining + compact_boundary markers, PR #114 pre-compact segments retained on disk) that the trajectory collector already reads ad-hoc (RawEvent {type, message, cwd}, D1 flywheel verified). The in-memory typed layer replacing mutableMessages is spec's own flagged '大改消息管理' large refactor: 16 direct mutation sites (12 QueryEngine, 2 queryHelpers, 2 print.ts) + 3 assignments. Spec's step ordering (先写事件旁路 → deriveMessages 替换 → 压缩迁移) confirms step 1 produces a foundation with no consumer; deriveMessages must exactly mirror 16 distinct site behaviors to pass the invariant = re-implementing message management = the refactor itself. No concrete failure driving; mirrors Items 5/6 resolution pattern. Recorded as explicit defer decision + gap map + spec's incremental path, not backlog. Co-Authored-By: Claude Fable 5 <[email protected]>
dahai80
added a commit
that referenced
this pull request
Aug 26, 2026
…#144) Audit P1.2 (enhance-0819.md:528) across 3 steps, defer as explicit decision: Step 3 (KV-cache prefix boundary negotiation): fusion-mlx /v1/messages ALREADY honors cache_control (anthropic_routes.py:198 _extract_prefix_cache_boundary; issues #196/#241/#289/#386 all CLOSED). memory_cache.py:721 = auto prefix match (exact+prefix+supersequence+LCP) -> KV reuse happens without explicit breakpoint. fusion-code MLX path createFusionMlxFetch translates /v1/messages -> /v1/chat/completions, dropping cache_control. Fixing = route MLX direct to /v1/messages = large adapter refactor (1500+ lines, deliberately OpenAI-compatible), no concrete failure (auto-match covers). Defer. Step 1+2 (shadow-price pruning): net-new (shadowPrice/tool-result-pruner 0 matches). hardCompact.ts:42 truncateString = fixed head/tail, not cost-model. Reference-frequency signal partially exists but binary not frequency: sessionMemoryCompact.ts:153 getToolResultIds/ adjustIndexToPreserveAPIInvariants = orphan correctness guard, not count. New cost model + live compaction path change, no failure driving. Defer. Step 4 (surfaceOp:replace): blocked by P0.2 defer (PR #143). Cross-repo boundary: fusion-mlx KV API fully delivered, no upstream issue needed. Co-authored-by: Claude Fable 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Record audit + explicit deferral decision for P0.2 (enhance-0819.md:472 — 事件溯源会话日志 + surfaceOp).
Audit findings
P0.2 is net-new infrastructure: zero matches for
SessionEvent/surfaceOp/deriveMessages/SessionEventMap/sourceEventSeqs/SESSION_FORMAT_VERSIONinsrc/.Existing informal event log (disk side)
recordTranscript→insertMessageChain→enqueueWritewithparentUuidchaining +compact_boundarymarkersEntrydiscriminated union (types/logs.ts:297) = untyped event logmutableMessagesmutation surface (spec's "大改")normalizeMessagesCache(PR feat(perf): item 5 normalizeMessages 二次规范化缓存 (CC 2.1.216/203) #112) is nearest projection-like layer but per-message transform, not log→historyDecision
The in-memory typed layer replacing
mutableMessages= spec's own flagged "大改消息管理" large refactor. Spec's step ordering (先写事件旁路 → deriveMessages 替换 → 压缩迁移) confirms step 1 produces a foundation with no consumer;deriveMessagesmust exactly mirror 16 distinct site behaviors to pass the invariant = re-implementing message management = the refactor itself.The 3 spec motivations are partially served by the existing disk log:
No concrete failure driving. Explicit defer decision + gap map + spec's incremental path, not backlog. Mirrors the resolution pattern of Items 5 (PR #141) and 6 (PR #142).
Verification
47a1e25Co-Authored-By: Claude Fable 5 [email protected]