Repository navigation
fix(memory): read note access from an unlocked snapshot and defer unavailable cleanup - #9102
Merged
Merged
Conversation
…vailable cleanup - Resolve memory note access in a read-only repeatable-read transaction with no row or advisory locks; the shared Project helpers gain a snapshot mode and keep their hold behavior for every existing caller. - Resolve workspace access once per check and derive shared mutation from the effective permission. - Read the projects flag before the transaction. - Defer memory cleanup hourly without spending attempts when the worker has no cleanup endpoint or the processor lacks the key or destination, instead of dead-lettering. - Drop the credential and source-env equality checks; replay the enqueuing source env and accept rows queued with the retired fingerprint field. - Enqueue cleanup events in one bulk insert.
…defer cleanup on pre-route 401
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
[High impact] The PR appears safe to merge; no blocking issue was found. SummaryThis PR makes memory access checks use an unlocked, read-only snapshot and lets cleanup wait for missing worker routes or configuration.
No new actionable issues were found. No previous review threads were supplied. Tests were inspected but not run.
|
Collaborator
Author
Collaborator
Author
|
@cubic-dev-ai review this PR |
Contributor
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
This branch was previously deployed
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
POST /api/mothership/memories/accessand thememory_notes_accesscheckpoint control) now resolves in a read-only repeatable-read transaction with no row or advisory locks. It previously tookFOR SHAREon the user, chat, workspace, member and permission rows plus the Project and permission-group locks, so every check committed as a write transaction and blocked writers on those rows (including account deletion'suser FOR UPDATE NOWAIT). Allow/deny decisions, permission bits and error codes are unchanged.loadProjectAccess,requireCurrentCopilotProjectInvocation,requireProjectFileOwnerRoleandrequireCurrentFileSubjectgain asnapshotmode; every existing caller keeps its locking reads.requireCurrentHumanRolenow returns it) instead of a second role lookup. The projects flag is read before the transaction.Type of Change
Testing
resolve-access.integration.ts: new case resolves workspace-target access for workspace and organization chats while another transaction holds the user rowFOR UPDATEand the Project exclusively (blocks on the previous code).cleanup.integration.ts: 404 and an unconfigured destination stay pending with attempts unchanged and an hour's backoff; a row carrying the retired fingerprint field completes (both dead-lettered on the previous code).cleanup-outbox.test.ts,workspace-authorization.test.ts; Biome on changed files. Type-check, audits and integration suites run in CI.Checklist
test-auditauthoring gate)