Skip to content

Torrent v2 01d: bound retained metadata and clean up cache ownership - #166

Closed
linroid wants to merge 1 commit into
torrent-v2-01-budgetsfrom
torrent-v2-01-admission
Closed

linroid wants to merge 1 commit into
torrent-v2-01-budgetsfrom
torrent-v2-01-admission

Conversation

@linroid

@linroid linroid commented Sep 12, 2026

Copy link
Copy Markdown
Owner

Retained metadata previously had a standalone byte counter and survived in the cache until its owner became unreachable. Cache entries now hold reservations in the shared budget until eviction, replacement, or shutdown. Results that cannot be admitted remain usable by the caller without being cached.

Stack: based on #165 (torrent-v2-01-budgets). This is the retained-cache admission slice of roadmap #162 step 01.

  • Account for retained arrays, file records, strings, and container overhead before admitting an entry. Keep tracker credentials out of cached values.
  • Reserve cache capacity separately from transfer buffers and metadata scratch space, preserving metadata headroom under saturated cache/transfer load.
  • Reject use after close, cancel shared fetches, await their finalizers outside the mutex, and release cache reservations on owner cancellation. Explicit close also terminates the cleanup watcher so a structured owner can finish.

Validation: cache/budget tests cover LRU eviction, replacement, over-budget results, parent pressure, repeated close, canceled shared fetches, owner teardown, and structured-scope completion. Full torrent conformance and the native runtime dependency guard pass with both pinned reference clients.

Caller-owned metadata, session indexes, platform allocations, production profiles, and total-memory/performance gates remain pending. The cache weight is a conservative accounting allowance, not a process RSS measurement.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-12T11:59:40.216107Z 55c8e16 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

  465 files  ± 0    465 suites  ±0   3m 53s ⏱️ +2s
2 302 tests +15  2 302 ✅ +15  0 💤 ±0  0 ❌ ±0 
2 898 runs  +25  2 898 ✅ +25  0 💤 ±0  0 ❌ ±0 

Results for commit f957d62. ± Comparison against base commit 04bbde6.

♻️ This comment has been updated with latest results.

@linroid

linroid commented Sep 20, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #231 (Contracts, verification infrastructure and resource limits) in the consolidated eight-PR stack for #162.

The replacement preserves this PR's code and subsequent fixes; its description links the original head and review discussions. The only additional consolidation fix is the CI-discovered listener cancellation regression, documented on the replacement. All eight replacements have passed their required CI checks.

Closing without merging. This branch and its discussions remain available for reference. Review index: #162 (comment)

@linroid linroid closed this Sep 20, 2026
@linroid
linroid deleted the torrent-v2-01-admission branch September 20, 2026 11:12
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.

1 participant