fix(store): prevent FileStore persistence starvation during continuous writes - #2346
Merged
Merged
Conversation
Reproduce #2345 with real snapshot recovery before final Flush/Close and virtual-time continuous writes. The existing FileStore suite passes on the unchanged production base; this focused regression fails with 41 memory items and no durable items. Co-authored-by: Codex <codex@vectorcontrol.tech>
Keep the existing 50ms asynchronous coalescing window without resetting it for every mutation, so continuous writes cannot starve durable snapshots. Preserve idle, error and close semantics, with real-file virtual-time regressions and an aligned architecture description. Co-authored-by: Codex <codex@vectorcontrol.tech>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
7 tasks
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.
Summary
Closes #2345
Evidence and tests
The unchanged-source regression drove 40 subsequent writes at half the existing interval: after 20 intervals, memory had 41 items and the actual disk restore path had zero. There was no final Flush/Close before the recovery read. This concerns the supported file backend; it is not a per-token transcript-write or production-frequency claim. Earlier explicit-flush cost measurements (#2256 / #2333 / #2334) are unchanged and do not cover this timer liveness bug.
Four tests use the real constructor, public writes, actual snapshot files and the real recovery reader under
testing/synctestvirtual time:Four temporary negative controls each failed behaviorally and were restored byte-for-byte: original reset-on-every-signal loop; missing re-arm; zero-delay/no coalescing; missing close flush.
Passed locally (Go 1.26.5, from
edge-server):CGO_ENABLED=0:go test -p 2 ./internal/store ./internal/api ./cmd/agenthub-edge -count=1 -cpu=4 -timeout=10m.CGO_ENABLED=1: same package set withgo test -race -p 2 ... -count=1 -cpu=4 -timeout=10m.go vet -p 2andstaticcheckfor the same three packages; gofmt clean.verify-doc-ssot.py,verify-project-skills.py,verify-real-e2e-contract.py, OpenAPI YAML parse andgit diff --check. Existing absent-skill-root checks keep their trivial-pass/skip boundary and are not real E2E evidence.Boundaries / pending
No public API, snapshot schema, retained-data policy, SQLite/SQL/WAL change, runtime configuration, deployment, restart or production load test. No automatic persist retry policy added. Virtual-time tests demonstrate scheduling correctness, not wall-clock throughput, actual process-kill recovery or a 50 ms durability guarantee. L3 real login/model and L4 packaged Desktop are not run. All seven required checks passed on
10f40b20205633838d050b70c599bea7bf1a5a8e; workflow 34036655934 attempt 2 succeeded. The additional complete Windows Edge suite (go test ./... -short -count=1 -timeout 15m,CGO_ENABLED=0) also passed. CodeRabbit reported Review skipped, not approval.CI retry evidence
The first Windows Edge job reported all tested packages, including store and lifecycle, as passed, then Go failed while removing
lifecycle.test.exewithAccess is denied. Its exact lock owner was not identified. After inspecting that log, only the failed job and dependent jobs were requested for retry; the same source passed on attempt 2, without changing code, assertions or workflow gates. This PR does not claim to fix a lifecycle executable-lock issue.