Skip to content

[PR] fix: keep restored images until the last session twin expires - #7030

Closed
Afloat16 wants to merge 2 commits into
ranxianglei:masterfrom
Afloat16:2026-11-17_gc-image-twins
Closed

Afloat16 wants to merge 2 commits into
ranxianglei:masterfrom
Afloat16:2026-11-17_gc-image-twins

Conversation

@Afloat16

Copy link
Copy Markdown
Contributor

Problem

An expired legacy or namespaced session envelope may have another fresh envelope for the same session ID. Both copies reference the same restored-image export directory. Session GC currently co-deletes that directory when it removes the first expired copy, even while the fresh copy survives, leaving image references unavailable.

Change

Check for surviving session twins through the existing indexed filename-suffix lookup before co-deleting shared image exports. The last removed twin releases the directory once. A surviving unreadable envelope is handled conservatively, and an unrelated session does not retain another session's images. The independent stale-mtime export cleanup remains unchanged.

This changes disk retention shared by the proxy and plugin store; it does not alter request rendering, compression, identity generation, or configuration.

Verification

  • Base: 301e1a5459a77d5578206927c8062a58381af642.
  • Six new isolated, disk-backed regressions: 4 failed and 2 passed on the base.
  • Final new regressions plus existing session-GC and companion suites: 42 passed, using both tests/preload-storage-baseline.mjs and tests/preload-test-env.mjs.
  • Coverage includes both namespace orderings, an unreadable surviving twin, last-twin deletion exactly once, unrelated sessions, and preservation of existing stale-export expiration.
  • Full npm run typecheck, npm run build, and git diff --check: passed.
  • Omitting the repository's storage-baseline preload causes two existing legacy-envelope GC tests to fail on both the untouched base and the patch. The final 42-test run uses the intended preload and passes.

This is separate from #2022's image cache, #4724's directory naming and #6611's suffix-index performance change. Live searches and author history found no equivalent co-deletion fix.

Fixes #7029

@ranxianglei ranxianglei changed the title fix: keep restored images until the last session twin expires [PR] fix: keep restored images until the last session twin expires Nov 17, 2026
Merge upstream master 6a641f3, including the architecture module-map and schedule-independent ranxianglei#2929 probe fixes.

Preserve the existing PR head and exact contribution patch. Validation of this refreshed head runs in upstream CI; no local test rerun is claimed.
@ranxianglei

Copy link
Copy Markdown
Owner

This fix is included verbatim (original commits and authorship preserved) in the merged batch PR #7074 — the changes are already on master. Closing to avoid a duplicate merge. 该修复已随批量 PR #7074 原样合入 master,为避免重复合并,关闭此 PR。

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Session GC removes fresh restored images while a live session twin remains

2 participants