Created At: 2026-11-18T17:23:54Z Completed At: 2026-11-18T17:23:55Z Command exited with code 0. Command output: async def get_current_tenant( user: Annotated[User, Depends(get_current_user)], db: Annotated[AsyncSession, Depends(get_db)], x_tenant_id: Annotated[Optional[str], Header()] = None, ) -> tuple[Tenant, TenantMember | None]: """ Resolves tenant context from X-Tenant-ID header. If header is omitted, auto-resolves to the user's primary workspace. Verifies that the authenticated user has access to this tenant. """ tenant_service = TenantService(db) if not x_tenant_id: # Auto-resolve user's first tenant workspace if not explicitly provided user_tenants = await tenant_service.get_user_tenants(user.id) if user_tenants: tenant = user_tenants[0] membership = None if not user.is_superuser: membership = await tenant_service.verify_member_access(tenant.id, user.id) set_current_tenant_id(tenant.id) return tenant, membership raise HTTPException( status_code=status.HTTP_400_BAD_REQUEST, detail="Header 'X-Tenant-ID' is required for tenant-scoped operations, or user has no workspace",