fix(actions): singleton registration + ADR-0033 upsert + Lambda runbook - #166
Merged
Conversation
Concurrent Lambda boots could create multiple AccessControlAction nodes because register_action relied on Action.find_one (subclass-filter blind spot) and singleton guard only rejected different labels. Resolve existence via raw DB records, collapse duplicate archetypes before create, reject second labels, and drop race losers after save. Boot also dedupes singletons by archetype. Co-authored-by: Cursor <cursoragent@cursor.com>
Extract upsert_lookup_by_* into jvagent/core/upsert.py and resolve_action_for_registration into action/registration.py; refactor register_action to use them. Document JVAGENT_CONVERSATION_LOCK_REDIS_URL for multi-container bootstrap in runbook and environment-keys-reference. Co-authored-by: Cursor <cursoragent@cursor.com>
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
Closes duplicate
AccessControlAction(and other singleton) nodes under concurrent Lambda cold starts.Commit 1 — singleton enforcement (
c9a17682)register_action(bypassesAction.find_onesubclass filter)_dedupe_singleton_actions_by_archetypeCommit 2 — ADR-0033 extraction + ops (
06e8c098)jvagent/core/upsert.py—upsert_lookup_by_action_identity,upsert_lookup_by_singleton_archetypejvagent/action/registration.py—resolve_action_for_registration,reconcile_singleton_after_create.planning/runbooks/multi-container-bootstrap.mddocs/environment-keys-reference.md— distributed locking keysSupersedes #163 (same branch stack).
Ops (required for Lambda)
Set
JVAGENT_CONVERSATION_LOCK_REDIS_URL(same Redis as turn-lock) so bootstrap serializes across containers. See runbook.Test plan
pytest tests/action/test_singleton_registration.py tests/core/test_action_dedupe.py tests/core/test_upsert_identity.pyjvagent /path/to/app --updateto heal existing dupesMultiple AccessControlAction nodesafter deployMade with Cursor