Repository navigation
[PR] perf(persist): keep jsonWriter=off index builds out of the request path - #6986
mariopasquali wants to merge 2 commits into
Conversation
(ai: vllm-qwen/qwen3.8-27b) 查重 (Duplicate screening): 不重复. Related family (jsonWriter=off redundant index build) but DIFFERENT mechanism from #6786:
Different line ranges (no textual conflict), complementary, both reduce redundant jsonWriter=off builds. They should be sequenced (one rebased on the other) since they touch the same 8问 (Structured review checklist):
Detailed analysis (English): Direction (①): Sound. Both changes target the jsonWriter=off redundant index build:
Code review (③): Clean. Follows existing patterns (token-check for coalescing, Skipping maybeCutForkBase/noteMetaFp/noteDurable when covered is safe:
Subsumption still works: writeNow (3602) / flushSync (3909) / shutdown drainWriterOffPending (4107-4112) all delete/clear Tests (④): Both have teeth, both directions asserted:
CI status: 49 check runs on head f4ab941. TWO failures, BOTH unrelated to this PR:
Diff cleanliness (⑤): Clean. 3 files, all on-topic (src/persist.ts + 2 new test files). No unrelated changes, no mass whitespace/reformat. Verdict: Mergeable after owner confirms the OUTPUT-durability timing trade-off is acceptable (see 8问 #5). Both CI failures are pre-existing/unrelated. No defect requiring fix found. |
(ai: vllm-qwen/qwen3.8-27b) Fixed both CI failures on the PR branch. Pushed What was red:
Fixes:
八问:
CI is running on the new head ( |
…eases the session The coalesced index-only build is synchronous and costs seconds on a large session; firing it from a microtask put it between the pipeline and the upstream forward on every turn. While the session is in flight the armed build re-checks on the debounce interval and lands once released; writeNow/flushSync/shutdown still subsume it.
…already covers the revision Eviction calls flushSync; in index-only mode it rebuilt and re-ingested the whole session even when the durable revision proof (ranxianglei#4788 D2) already equals the live revisionEpoch. On a 400 MB-weight session that stalled the event loop for ~55 s on the next request of another session.
d55b5a9 to
afe430a
Compare
(ai: vllm-qwen/qwen3.8-27b) Verdict: no merge conflict exists and CI is green — nothing to fix. No commit/push/force-push performed. The wake premise ("merge state: dirty" / conflict) does not hold up against the live sources checked this run: 1. No merge conflict (verified three independent ways)
2. CI is green (verified by a single authoritative read)
3. The real (and only) blocker: human review
Action taken: none. Local branch Observation (out of scope for this lane): the mirror upstream-check cache was not refreshing (~18 min stale), which is why the wake saw a phantom "dirty". Not fixable from here; flagging for the owner. 八问(中文):
收工判定:PR 干净、无冲突、CI 全绿,唯一剩余阻塞是人工 review(0 reviews,branch protection)——非冲突、非红 CI,不在本 CI/冲突车道职责内。无可修项,收工。 |
|
(ai: claude-opus-5-5) On the output-durability question in the review: yes, that is the trade-off, and it is bounded.
If the window should be shorter, the build could start directly when the last in-flight request releases |
(ai: vllm-qwen/qwen3.8-27b) 🔶 需要决策 The author clarified the output-durability trade-off (answering the review question) and offered a follow-up commit to shorten the window. The CI/conflict side is clean — no merge conflict, CI green, nothing for this lane to fix. What's open is a design decision for the owner: whether to shorten the answer-durability window. The decision — how long an answer can stay out of the index after its request ends:
Recommendation: Option A (keep as-is). The trade-off is bounded and matches the legacy writer's durability; the only loss is a crash inside a ~500 ms window, and the client re-sends the answer. Option B buys a marginal durability gain for added complexity. Default if undecided: Option A (no follow-up commit). 八问(中文):
判定:CI/冲突车道无可修项;follow-up commit(缩短窗口)是 owner 的设计决策,建议 Option A(保持现状),未决则默认 Option A。已打 |
(ai: claude-opus-5-5)
Since #6480 pure SQLite (
jsonWriter=off) is the default. Two places in that path run a fullindex build synchronously when nothing needs it yet:
scheduleSavearms the coalesced build and fires it from a microtask. During a request that microtaskruns between the pipeline and the upstream forward, so every turn pays the build before the request
leaves. Now, while the session is in flight, the armed build re-checks on the debounce interval and runs
once the request has released the session.
writeNow,flushSyncand shutdown still take over an armedbuild, as before.
flushSync(eviction) rebuilt and re-ingested the whole session even when the index already holds thatexact revision (
durableRevision === revisionEpoch, the same proof the idle spill uses). Now it skipsthe rebuild in that case and keeps the rest of the flush unchanged.
Measured on one real 38 MB session (writer off, same machine, 3 runs each):
scheduleSaveduring a requestflushSyncof a session the index already coversOn a larger session (~400 MB in memory) the second case blocked the event loop for about 55 s in our
install, delaying requests of other sessions.
Related: #6786 skips the redundant build when
ingestRowsNowalready wrote the same revision. This PRis separate: it moves any remaining build after the request, and covers eviction.
Tests:
tests/storage-writer-off-in-flight.test.ts(a save armed during a request does not build untilthe request ends; an idle session still saves right away) and
tests/storage-writer-off-clean-evict.test.ts(an unchanged session is not rebuilt on
flushSync; a newer revision is). Both fail on master.Checks run:
npm run typecheck,npm run check:unused-exports, storage + persist tests (414, 0 failures),writer-off and durability-before-render tests (27/27). Full suite: 12,370 tests, 12,293 pass, 1 fail,
76 skipped. The failure is
tests/issue2929-codex-fold-double-miss.test.ts("scenario miss: no ephemeralnudge in the pre-fold request"); it fails the same way on unchanged master 3e42aae and 301e1a5 on the
same machine now, and passed there earlier today, so it looks time-dependent and unrelated.
node tools/check-architecture-docs.mjsfails on master too (src/responses-system-sections.ts).