Repository navigation
fix(core): reserve pruned session ids with takeover identity records - #212
Merged
Merged
Conversation
Explicit log pruning now removes a session's takeover identity record only when it binds exactly the torn-down directory being removed, and only after that directory is gone. Unreadable, mismatched or linked records keep the directory, and createSession skips ids that still have a record. Closes #170
Retiring the record at prune let a delayed input call for a destroyed session rebuild its coordination storage and pass the lease check while a reused display was under human control. Prune now keeps the record, so late callers keep failing closed, and createSession skips any id that still has one.
3 tasks done
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.
Closes #170
This picks continued id reservation over retirement.
Explicit
session prunestill removes the retained session directory and keeps the sibling.<id>.takeover-identityrecord. With the directory gone, every takeover call for that id fails closed. A delayed input call for the destroyed session can't rebuild its permit storage or pass an empty lease check.createSessionnow also skips any id that still has a record, so a pruned id is never handed to a new session whose takeover could never succeed.Retiring the record at prune was tried in the first commit and dropped after review. It let a delayed
withAgentPermitcaller recreate coordination for the dead id and see no lease. That call could then deliver input to a display that a new session had reused while a human held control.Active and error sessions, held permits, legacy roots and uncertain records behave as before, because prune does not touch the record at all. The cost is one small dotfile per pruned session that ever took agent input, in an id space of 2^32 per session type.
Verification: new cases in
packages/core/test/session-retention.test.tscheck three things. After prune the record survives unchanged,withAgentPermitandreadHumanLeasefor the pruned id reject without running the action or recreating the directory, andcreateSessionskips a reserved id (this fails without thesession.tschange). All tests run under tempPICKFORGE_HOMEdirs and never touch real home data. The fullbun run test:coverage(2134 tests),lint,typecheckandbuildpass, and PickCheck reports only the preexistingparseHumanLeasefinding.