Add session controller and root locks#445
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
Add two explicit ownership layers for workspace sessions:
state/runtime.lock) so two Alice backend processes cannot mutate the same workspace/session state root at the same time.PersistentSession.attach()so a session has one active controller unless another client explicitly takes over.lockedterminal state instead of reconnecting forever, with atake overaction for explicit control transfer.pnpm devwait for Alice readiness before starting Vite, so a locked/failed Alice backend does not look like an/api/auth/statusproxy/auth failure.Why
Desktop/app mode exposed a deeper ownership problem: multiple frontends, future IM bridges, or multiple backend processes can all try to control the same agent runtime. The old model silently let the latest attach kick the prior one, while two backend processes sharing the same launcher root could corrupt session state through boot fixup and registry writes.
This PR separates the layers:
Validation
pnpm vitest run src/workspaces/process-lock.spec.ts src/workspaces/persistent-session.spec.tsnpx tsc --noEmitcd ui && npx tsc -bnpx tsc -p apps/desktop/tsconfig.json --noEmitpnpm testgit diff --checkNotes
If Electron is already running on the default data/workspace root,
pnpm devis expected to fail to start Alice unless the dev run uses an isolatedOPENALICE_HOMEandAQ_LAUNCHER_ROOT. The dev guardian now surfaces that as an Alice startup/root ownership problem instead of letting Vite emit misleading auth proxy errors.