-
Notifications
You must be signed in to change notification settings - Fork 120
fix: wait for metadata before archive cascade #577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Dante-dan
wants to merge
2
commits into
LodyAI:main
Choose a base branch
from
Dante-dan:fix/574-archive-hydration
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
.agents/notes/implemented/bug-fix/2026-09-10-archive-after-metadata-hydration.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # Archive only after metadata hydration | ||
|
|
||
| Status: implemented | ||
| Translation: pending | ||
|
|
||
| ## Abstract | ||
|
|
||
| Session Detail can render a bootstrapped root Session before the workspace metadata scan has | ||
| discovered its child Tabs. Archive now waits for that initial scan before deriving the lifecycle | ||
| subtree, preventing an early action from archiving only the root. Already-hydrated actions retain | ||
| their existing repository-read and rendered-cache fallback behavior. | ||
|
|
||
| ## Problem | ||
|
|
||
| Archive derives lifecycle descendants from `sessionMetaCacheAtom`. During cold start, bootstrap | ||
| metadata may make the requested root interactive while `docMetaCacheReadyAtom` is still false and | ||
| the cache does not yet contain a direct `parentSessionId` child. Starting writes from that partial | ||
| view leaves the child active after its root is archived. | ||
|
|
||
| ## Decision | ||
|
|
||
| `archiveSession` waits for both `docMetaCacheReadyAtom` and a ready `docMetaCacheScopeAtom` owned by | ||
| the captured workspace runtime before reading the lifecycle cache or authoring archive side effects. | ||
| Readiness is the existing signal that the workspace-wide metadata scan has merged its snapshot with | ||
| live events, so this keeps descendant discovery on the same source of truth without issuing another | ||
| full metadata query for each archive action. A runtime switch rejects the pending action and releases | ||
| its subscriptions rather than combining the old repository with a new workspace cache. | ||
|
|
||
| The individual root metadata read still prefers the repository and falls back to rendered metadata. | ||
| This preserves closing a visible Session when its own repository read lags after the initial scan. | ||
|
|
||
| ## Verification | ||
|
|
||
| The owning `use-session-actions` suite constructs a visible root with readiness false, starts an | ||
| archive, and asserts that no metadata write occurs. It then hydrates a synthetic direct child Tab, | ||
| marks the cache ready, and verifies that both root and child receive the archived idle state. A second | ||
| case switches runtimes during the wait and verifies rejection without writes. Existing coverage | ||
| continues to verify the rendered-meta fallback after initial hydration. | ||
|
|
||
| ## Limits | ||
|
|
||
| This change does not alter which relationship fields define lifecycle containment, restore or delete | ||
| semantics, or metadata scan failure handling. It only closes the pre-hydration archive window tracked | ||
| by [Lody issue #574](https://github.com/LodyAI/Lody/issues/574). |
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.