Skip to content

support default_tenant_id env-var#639

Closed
vijayfractl wants to merge 2 commits intomainfrom
tenant-id-bug
Closed

support default_tenant_id env-var#639
vijayfractl wants to merge 2 commits intomainfrom
tenant-id-bug

Conversation

@vijayfractl
Copy link
Copy Markdown
Contributor

@vijayfractl vijayfractl commented Mar 17, 2026

An explanation for the strange behavior in dev:

The dev database has old data. When the tenant ID was changed from 00000-* to 12345-* (commit fd599e3), existing records in the dev DB still have tenant = '00000000-...'. Every query
filters by tenant:

  WHERE __tenant__ = '12345678-1234-1234-1234-123456789abc' AND ...                                                                                                                           

So it finds zero rows — all existing dev data is invisible. Production likely got a fresh database after the change, or had a proper migration, so all its records were created with 12345-* from the start.

The "fix" of setting AGENTLANG_DEFAULT_TENANT_ID=00000-* in dev is really just a workaround to match the stale data. The real fix option would be one of:

  1. Migrate dev data: UPDATE <tables> SET __tenant__ = '12345678-1234-1234-1234-123456789abc' WHERE __tenant__ = '00000000-0000-0000-0000-000000000000'
  2. Recreate the dev database from scratch
  3. Keep the env var approach as a permanent escape hatch (what I just implemented)

@vijayfractl
Copy link
Copy Markdown
Contributor Author

the fix is redundant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant