Repository navigation
fix(store): backfill session rows stamped with an empty tenant (RIG-4167) - #1471
Merged
trunk-io[bot] merged 2 commits intoOct 2, 2026
Merged
Conversation
…167) Wakes from the delivery loop recorded agent_sessions and session_bindings rows with tenant_id '' before WakeAgent ran tenant-scoped. RLS hides those rows, and a stale '' binding beside a live one makes every ack for that session ambiguous. Migration 0002 moves each row to its agent's tenant, and drops a '' binding when that tenant already binds the agent or the session. Co-authored-by: Matt Wilkinson <matt@rigel.build>
|
😎 Merged successfully - details. |
|
Compass engineering docs preview: https://compass-server-rig-4167-back.compass-eng-docs.pages.dev Deployed from |
…(RIG-4167) Co-authored-by: Matt Wilkinson <matt@rigel.build>
rigel-mintaka
marked this pull request as ready for review
October 2, 2026 05:29
mattwilkinsonn
approved these changes
Oct 2, 2026
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.
Fixes the existing data for RIG-4167. The writer was fixed in #1466.
Problem
Before #1466, a wake from the delivery loop ran under the system role and recorded
agent_sessionsandsession_bindingswithtenant_id ''. Those rows are still in the database. On mattfw,session_bindingshas two''rows. One of them belongs to an agent that is also bound in its real tenant.SessionBindingTenanttherefore finds two tenants and refuses every ack for that session ("session bound in several tenants; refusing the runner call").Change
Migration
0002_backfill_empty_tenant.sqlruns ascompass_system, because the owner is not a superuser, so FORCE RLS would hide the rows from it.agent_sessionsandagent_placementstake the agent's tenant (agent_accounts.tenant_id).agent_session_transcript_entriesandagent_session_archive_segmentstake the tenant of their session.''row insession_bindings:Migration numbering: compass-managed's #1375 also adds a
0002. Whichever lands second renumbers to0003.Tests
TestBackfillEmptyTenantMigration(store pgtest) seeds''rows under the system role and replays the migration. It asserts that:''rows remain;''binding is gone.Mutations:
session_bindings_pkey.The store and server pgtest suites pass with
-race. Lint is clean for the touched files.