perf: bound session startup work - #108
Merged
Merged
Conversation
chore: promote reviewed AFS hardening to development
chore: promote reviewed AFS hardening to main
promote: storage maintenance to development
promote: storage maintenance to main
chore: promote model retention audit to development
chore: promote model retention audit to main
scawful
marked this pull request as ready for review
August 5, 2026 03:23
scawful
added a commit
that referenced
this pull request
Aug 5, 2026
* perf: bound session startup work * fix: harden session pack cache validity * fix: ignore cache special files without blocking * fix: revalidate cache ownership before removal * fix: harden session cache consistency * fix: serialize context pack artifact pairs
scawful
added a commit
that referenced
this pull request
Aug 5, 2026
* perf: bound session startup work * fix: harden session pack cache validity * fix: ignore cache special files without blocking * fix: revalidate cache ownership before removal * fix: harden session cache consistency * fix: serialize context pack artifact pairs
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
session prepare-clientserve()into startup diagnostics, while keepingafs doctor's independent registry buildafs.context_packfrom the mypy grandfather baseline after cleaning its remaining type errorsWhy
Each wrapper startup could perform two broad bootstraps, two skill discovery/ranking passes, and (on a stale cache entry) two recursive mount fingerprint walks. Every stdio MCP process also rebuilt its full tool registry in background diagnostics. Expired five-minute cache entries were never pruned, so the rebuildable cache could grow indefinitely.
The changes keep output contracts intact and only reuse state after validating the context and scope. Cache pruning is best-effort, only considers 64-character lowercase-hex JSON names owned by this cache, skips symlinks, retains the just-written entry, and never touches unrelated JSON files.
Verification
make VENV=/Users/scawful/src/lab/afs/.venv lintmake VENV=/Users/scawful/src/lab/afs/.venv type-checkHOME=/tmp/afs-perf-session-startup-home AFS_CONTEXT_ROOT= make VENV=/Users/scawful/src/lab/afs/.venv test— 2525 passed, 4 skippedThe full suite used an isolated temporary HOME; no user cache files were read, pruned, or modified.