Skip to content

fix(runtime): drain result caches through resident owner - #924

Draft
Haoming9527 wants to merge 3 commits into
work/872-session-public-integrationfrom
work/872-resident-result-cleanup
Draft

Haoming9527 wants to merge 3 commits into
work/872-session-public-integrationfrom
work/872-resident-result-cleanup

Conversation

@Haoming9527

@Haoming9527 Haoming9527 commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #872. Stacked on #923.

What was wrong

Session result-cache cleanup started additional one-shot host workers during teardown. Root disposal could also withdraw the current policy lookup before pending cleanup finished. Migrating concurrent expiry directly to the resident connection exposed its unchanged 32-request limit: forty simultaneous Session expiries completed only 32 purges.

The change

Send the existing typed result/purge envelope through the owning resident client. Retain public policy and sandbox dependencies through cleanup, resolve current authority before and after grant preparation, and preserve native storage/no-follow checks. Stop ordinary admission, join pending Session cleanup, then close the connection. Sequence only each owner's existing cache cleanup section; refusal releases the next Session. Missing authority, changed grants or incomplete cleanup remain explicitly deferred without a replacement worker.

Package-root and standalone integrations use the same lifecycle. Bilingual docs and changelog describe the boundary and remaining #872 requirements.

Validation

  • Build/typecheck, diff check and file-size gate pass: 935 tracked code files, all at or below 1000 lines.
  • After normal-merging the upstream composition-boundary fix 3fd7253d, build and size checks passed; 19 checks / 3 focused suites passed (publication boundary, moved session provider, real cleanup), followed by the updated cancellation fixture 1/1 on Windows. Its POSIX resident-purge assertion will run in the new cross-platform CI.
  • Initial affected Windows run: 89 checks / 10 suites passed, 0 failed, 0 skipped.
  • After stacking on the final feat(shell): expose gated persistent sessions through Native and PTC #923 base, the combined-worker run below passed 67 checks / 7 suites, 0 failed, 0 skipped. These overlap the initial run.
  • Actual public Agent/Session, Policy, Sandbox and Subprocess checks keep one host kernel spawn through file calls and disposal, join held cleanup before exit, preserve a sibling consumer, and reject a replaced cache directory without touching its external target.
  • Meaningful negatives retained: forty expiries produced 32/40 before cleanup sequencing; removing only the retained-authority hook from a separate compiled copy failed the root check with 0/2 caches purged. The standalone and no-follow checks still passed. Removing only the duplicate client drain did not fail because dependency disposers also join cleanup; this ineffective control and fixture setup failures are recorded separately.
npm run build
build: compiled src/ to lib/ and copied 60 assets

node scripts/check-file-size.mjs
check-file-size: 935 code file(s) checked, all at or under 1000 lines

node test/run.mjs resident-result-cleanup resident-kernel result-lifecycle result-cleanup-authority result-storage-host result-storage-cache-prep resident-shell-channel
dsh-ops test: 7 suite(s) passed in 40s

Combined worker SHA-256: 9b25fceacb73ab1abe53b64b291b89d8ee8896cb9d8df6cfa7a1983f993715c0.
Latest pull-request CI: Cross-platform validation / CI required — passed all 10 jobs for 943c5bc9. The earlier run reported the upstream publication-boundary violation and a stale POSIX cancellation fixture expecting a one-shot purge. The ordinary upstream merge and test-only followup address those separately; the failed evidence is retained. This is a draft slice, not full #872 acceptance.

Environment

Windows x64, Node v26.12.1, locked development dependencies. Stacked on #923; includes upstream composition fix 3fd7253d through ordinary merge 8a2cbeb9, followed by test-only commit 943c5bc9. No dependency, version, model-facing schema or prompt changes.

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